&ifdef COMMENT
# Run 'xtrans' on this file.
# Move it to 'toolvars'.
# Adapt it to your needs.
# You must at least enter values for OSSPEC and MACH.
#
# Currently known OSSPEC/MACH pairs:
#       OSSPEC        MACH
#       ======        ====
#       AIX           _IBMR2
#       DYNIX         I386
#       HPUX          HP9			# HP/UX <= 10.20 on HP/9000
#		HPUX		  PA11			# HP/UX 11.00 PA-RISC 1.1 or higher
#		HPUX		  PA20W			# HP/UX 11.00 PA-RISC 2.0 wide mode (64-Bit)
#       MI_ULT        MIPS
#       OSF1          ALPHA
#       SINIX         I386
#       SVR4          NMP           # Reliant UNIX 
#       SCO           I386
#       SUNOS         SUN
#       SVR4          SUN
#       SVR4          I386
#       WIN32         I386
#       LINUX         I386
#       LINUX         ALPHA
#
# PTS 1103527 (Punkt 6) jrg
# 64bit handling: If environment variable "BIT64" is not set to "1", the
# default is 32bit mode! 
# Exceptions: OSF1/ALPHA and LINUX/ALPHA always uses 64bit compilation
#
# BIT64 is always tested agains value "1" ! So if not defined test fails!
#
# Since some libraries used by ptoc are found in $TOOL 64bit versions of these
# libraries should be searched in $TOOL_LIB instead $TOOL/lib
#
&endif
#!/usr/bin/perl
# toolvars      *** included perl script
#
# @(#)toolvars  12-11-1997
#
# 1996-11-27: add 'mfconcom'-var 'REL' for 'cbackup'
# 1994-01-20: let "OPTIMIZE" depend on "VMAKE_VERSION"
#
# included by several shell scripts, defines system specific values
#
use Env;
&if ($OSSPEC = OSF1 || $MACH = SUN)
use CCVers;
&endif
&if $OS = UNIX
use POSIX;
&endif

if ($RELVER eq "")
{
	print "\n!!! WARNING:  RELVER not set!!!\n";
	exit 1;
}

if (! $ENV{INSTROOT})
{
	print "\n!!! WARNING:  INSTROOT not set!!!\n";
	exit 1;
}

$ADABAS_COPYRIGHT="Copyright © SAP AG 1997";
if ($RELVER eq "R61") {
	$ADABAS_VERSION="6.1";
}
elsif ($RELVER eq "R62") {
	$ADABAS_VERSION="6.2";
}
elsif ($RELVER eq "R70") {
	$ADABAS_VERSION="7.0";
}
elsif ($RELVER eq "R71") {
	$ADABAS_VERSION="7.1";
}
elsif ($RELVER eq "R72") {
	$ADABAS_VERSION="7.2";
}
elsif ($RELVER eq "R73") {
	$ADABAS_VERSION="7.3";
}


$SQLVERSION="REL30";$ENV{SQLVERSION} = $SQLVERSION; # export $SQLVERSION

&if $OSSPEC = AIX
$OSSPEC=AIX;
if ($ENV{BIT64} eq "1") {
	$ENV{OBJECT_MODE}=64;
} else {
	$ENV{OBJECT_MODE}=32;
}
&elif $OSSPEC = DYNIX
$OSSPEC=DYNIX;
&elif $OSSPEC = HPUX
$OSSPEC=HPUX;
&elif $OSSPEC = MI_ULT
$OSSPEC=MI_ULT;
&elif $OSSPEC = OSF1
$OSSPEC=OSF1;
&elif $OSSPEC = SINIX
$OSSPEC=SINIX;
&elif $OSSPEC = SCO
$OSSPEC=SCO;
&elif $OSSPEC = LINUX
$OSSPEC=LINUX;
&elif $OSSPEC = SUNOS
$OSSPEC=SUNOS;
&elif $OSSPEC = SVR4
$OSSPEC=SVR4;
&elif $OSSPEC = WIN32
$OSSPEC="WIN32";
&else
$OSSPEC=;			# supply your value here
&endif
$ENV{OSSPEC} = $OSSPEC;		# export $OSSPEC
&if $MACH = _IBMR2
$MACH = "_IBMR2";
&elif $MACH = ALPHA
$MACH = "ALPHA";
if (($OSSPEC eq "OSF1") || ($OSSPEC eq "LINUX"))
{
	$ENV{BIT64} = "1";
}
&elif $OSSPEC = HPUX
#
&ifdef COMMENT
#
# HPUX for 32bit and 64bit compilation differ in value of $MACH !
#
# 64bit compilation -> $MACH = PA20W
# 32bit compilation -> $MACH = PA10
#
# If BIT64 is set to "1", $MACH is set to PA20W 
# otherwise $MACH decides...
&endif
 if ($ENV{BIT64} eq "1") {
   $MACH = "PA20W";
 } else {
   if ( defined $ENV{MACH} ) {
     $MACH = $ENV{MACH};
     if ( $MACH eq "PA20W" ) {
       $ENV{BIT64} = "1";
	 } else {
       delete $ENV{BIT64};
	 }
   } else {
	 $MACH = "PA11";
     delete $ENV{BIT64};
   }
 }
#
# End of OSSPEC = HPUX specific MACH/BIT64 settings...
#
&elif $MACH = MIPS
$MACH = "MIPS";
&elif $MACH = I386
$MACH = "I386";
&elif $MACH = NMP
$MACH = "NMP";
&elif $MACH = SUN
$MACH = "SUN";
&elif $MACH = HP9
$MACH = HP9;
&else
$MACH = "";			# supply your value here
&endif
$ENV{MACH} = $MACH;		# export $MACH
&if $OSSPEC = WIN32
# OSBASE, CPU ist zwingend erforderlich!
# CTS 1106494 ->
if ( $ENV{BIT64} eq "1" ) 
{
	$CPU	= "i386";	$ENV{CPU}		= $CPU;			# export $CPU
	$MACHINE = "IA64";	$ENV{MACHINE}	= $MACHINE;		# export $MACHINE
}
else
{
	$CPU	= "i386";	$ENV{CPU}		= $CPU;			# export $CPU
	$MACHINE = "IX86";	$ENV{MACHINE}	= $MACHINE;		# export $MACHINE
}
# <- CTS 1106494
$OSBASE	=$ENV{OS};  $ENV{OSBASE}	= $OSBASE;		# export $OSBASE
$OS = "WIN32";
&else
$OS = "UNIX";
&endif
$ENV{OS}         = $OS;			# export $OS



&if $OS = UNIX
# CTS 1106697
unless ( $ENV{OS_VER} && $ENV{OS_REL} )
{
    local ($os_sysname, $os_nodename, $os_release, $os_version, $os_machine ) = POSIX::uname();
&if $OSSPEC in [ OSF1 ]
    $os_release = substr $os_release, 1, 1;
&endif
    $ENV{OS_VER} = $os_version;
    $ENV{OS_REL} = $os_release;
}
$OS_VER = $ENV{OS_VER};
$OS_REL = $ENV{OS_REL};
&endif UNIX


&if $OSSPEC = WIN32
$TOOL_LIB = "$TOOL/lib";
&elif (($OS = UNIX) && ($MACH = ALPHA)) 
$TOOL_LIB = "$TOOL/lib";
&else
if ($ENV{BIT64} eq "1") {
	$TOOL_LIB = "$TOOL/lib/lib64";
} else {
	$TOOL_LIB = "$TOOL/lib";
}
&endif
$ENV{TOOL_LIB} = $TOOL_LIB;

$COMP="PTOC";
if ($RELVER eq "R61") {
	#@CONCOMOPTS = ( "-REL=R61" );
	@CONCOMOPTS = ( "-$SQLVERSION=1", "-REL=R61" );
	#@CONCOMOPTS = ( "-SAG=1", "-$SQLVERSION=1", "-REL=R61" );
}
else
{
	#@CONCOMOPTS = ( );
	@CONCOMOPTS = ( "-$SQLVERSION=1" );
	#@CONCOMOPTS = ( "-SAG=1", "-$SQLVERSION=1" );
}
push @CONCOMOPTS, "-RELVER=$RELVER";
push @CONCOMOPTS, "-DIAGNOSE=1" if defined( $ENV{DIAGNOSE} );
#
# Used for all systems using 64 bit compilation!
#
if ( $ENV{BIT64} eq "1" ) 
{
	push @CONCOMOPTS, "-BIT64=1";
}
# jrg 2.9.1999
&if (($OS = UNIX) && ($MACH = ALPHA)) 
	push @CONCOMOPTS, "-BYTESWAP=1";
&endif

if ( not $CC ) 
{
&if $OSSPEC in [ SINIX ]
    $CC = "/usr/ccs/bin/cc";
&elif $OSSPEC in [ WIN32 ]
    $CC = "cl";
&else
    $CC = "cc";
&endif
}
#else take CC from the environment
&if $OS = UNIX
if ( not $CXX ) 
{
& if $OSSPEC = SVR4
	$CXX = "CC";
& elif $OSSPEC in [ HPUX ]
	$CXX = "aCC";
& elif $OSSPEC = OSF1
	$CXX = "cxx";
& elif $OSSPEC = LINUX
	$CXX = "c++";
& elif $OSSPEC = AIX
	if (($RELVER eq "R61") || ($RELVER eq "R62") || ($RELVER eq "RTOOL")) {
		$CXX = "xlC";
	} else {
		$CXX = "xlC_r";      # PTS 1001630
		$CC = "xlc_r";
	}
& endif
}
&endif

# CTS 1107045
# $LDDLL_C         - command of link c objects to shared lib
# $LDDLL_CXX       - command of link c++ shared lib
# $LDDLL_CXX_C     - command of link c++ objects to c shared lib
# to initialize $LDDLL
&if $OS = UNIX
& if $OSSPEC = AIX
$LDDLL_C = $LDDLL_CXX = $LDDLL_CXX_C="makeC++SharedLib_r";
& else
&  if $OSSPEC in [ HPUX]
if ($RELVER ge "R72")
{	$LDDLL_C = "ld"; }
else
{   $LDDLL_C = $CC; }
&  else
$LDDLL_C = $CC;
&  endif
$LDDLL_CXX = $CXX;
&  if $OSSPEC in [ SVR4, HPUX ] # HP, SUN, NMP 
$LDDLL_CXX_C = "ld";
&  else                         # DEC, LINUX
$LDDLL_CXX_C = $CXX;
&  endif
& endif
&endif  UNIX
#else take CXX from the environment PTS 1001861

&if $OSSPEC in [ WIN32 ]
$LD		= "link";
$LDDLL_C = $LD;       # PTS 1107045
&elif $MACH in [ NMP ] # PTS 1001858
if ((($RELVER eq "R62") && ($CORRECTION_LEVEL>=10)) || 
	(($RELVER gt "R62") && ($RELVER ne "RTOOL")))
{
    $LD = $CXX;
	$LDDLL = $LDDLL_CXX;
}
else
{
    $LD = $CC;
	$LDDLL = $LDDLL_C;
}
$LD_C_DLL = $CC;
&else
if (($RELVER ge "R72") && ($RELVER ne "RTOOL"))  # &gar PTS 1002110
{
	$LD = $CXX;
	$LDDLL = $LDDLL_CXX;
}
else
{
	$LD	= $CC;
	$LDDLL = $LDDLL_C;
}
&endif WIN32

# jrg 2.9.1999
# For relocatable objects (collection of object files) a different linker is used
# These definitions replace former system dependend setting in linkrel.pl!
#
&if $OS in [ UNIX ]
# WIN32 uses $AR and $ARFLAGS...
&if $OSSPEC in [ OSF1 ]
# Avoid sys5 ld script when making relocatable
$LDREL = "/usr/bin/ld";
&else
$LDREL = "ld";
&endif
&endif

&if $OSSPEC in [ HPUX ]
if ($MACH eq "HP9") 
{
	$AS		= "as";
}
elsif (($MACH eq "PA11") || ($MACH eq "PA20W")) 
{
	$AS		= $CC;
}
&elif $OSSPEC in [ WIN32 ]
$AS     = "masm386";
&else
$AS		= $CC;
&endif
&if $OSSPEC in [ SINIX ]
$AR =	"/usr/ccs/bin/ar";
&elif $OSSPEC in [ WIN32 ]
$AR     = "lib";
&else
$AR		= "ar";
&endif
&if $OSSPEC in [ WIN32 ]
$RC		= "rc";
$MC		= "mc";
$CVTRES = "cvtres";
&endif
&if $OSSPEC in [ WIN32 ]
$NULL = "nul";
&else
$NULL = "/dev/null";
&endif
# set C and CXX as environment variable
$ENV{CC}=$CC;
&if $OS in [ UNIX ]
$ENV{CXX}=$CXX;
&else
$ENV{CXX}=$CC;
&endif

#
# Additional compiler flags may be set temporary in the environment
# before calling vmake.
#

&if $OSSPEC in [ WIN32 ]
@ASFLAGS    = ( "-Mx", "-w2", "-t", "-z", "-D_X86_=1", "-D_WIN32=1" );
&elif $MACH in [ SUN ] and $OSSPEC in [ SVR4 ]
if ( $ENV{BIT64} eq "1" )
{
	@ASFLAGS = ( "-xarch=v9" );
}
 else 
{
	@ASFLAGS = ();
}
&else
@ASFLAGS = ();
&endif

# 98/06/19 &gar: for differences between C and C++-Compiling in UNIX !
# @CCFLAGS   -> FLAGS for both ( C, C++ )
# @CFLAGS    -> FLAGS for C only
# @CXXFLAGS  -> FLAGS for C++ only
&if $OS = UNIX
  @CXXFLAGS = split /\s+/, $CXXFLAGS;
  @CFLAGS = split /\s+/, $CFLAGS;
&endif
@CCFLAGS = split /\s+/, $CCFLAGS;
push @CCFLAGS, "-D$SQLVERSION",  "-D$OSSPEC", "-D$MACH", "-DSAG";
push @CCFLAGS, "-DDIAGNOSE" if defined( $ENV{DIAGNOSE} );
@CCMODEANSI = ();
@CCMODENORM = ();
@CCMODELINT = ();

# RTS 1000166
&if $OSSPEC in [ WIN32 ]
  if ( $RELVER ge "R73" ) {
#
# jrg 20.4.2000 Always use STLport directory instead of native STL
#
    push @CXXFLAGS, "-I$WRK/incl/STL";
#
# Some day this can be removed again if we can use src/SAPDB as new src...
#
    push @CXXFLAGS, "-I$WRK/incl/SAPDB";
  }
@EXCEPT_FLAG = "-GX";
&else
@EXCEPT_FLAG = ();
&endif

&if $OS = UNIX
  if (( $RELVER ge "R72") && ($RELVER ne "RTOOL")){

&   if $MACH in [ SUN ] and $OSSPEC in [ SVR4 ]
# -mt forces multithreading. This implies -D_REENTRANT
# -O forces 'correct' alignment of character arrays on local stack
#    no longer used after tests of Frank Hoffmann...
       push @CCFLAGS, "-mt", "-I$INSTROOT/incl", "-I$WRK/incl";
&   else
&if $MACH in [ NMP ]
       # CTS 1106699
       push @CCFLAGS, "-I$INSTROOT/incl", "-I$WRK/incl";
	   push @CCFLAGS, "-D_REENTRANT" if ( $ENV{OS_REL} ge "5.45" );
&else
       push @CCFLAGS, "-D_REENTRANT", "-I$INSTROOT/incl", "-I$WRK/incl";
&endif	   
&   endif

#
# 24.3.2000 Additional include directories for 73...
#
	  if ( $RELVER ge "R73" ) {
#
# Some day this can be removed again if we can use src/SAPDB as new src...
#
		push @CCFLAGS, "-I$WRK/incl/SAPDB";
&if   $MACH in [ SUN ] and $OSSPEC in [ SVR4 ]
#
# Using Standard SUN OS RogueWave STL
#
&elif $OSSPEC in [ HPUX ]
#
# Using Standard HP OS RogueWave STL
#
&elif $OSSPEC in [ OSF1 ]
#
# This is the STL_Port include directory. It replaces the systems own STL definitions and headers
#
		push @CXXFLAGS, "-std strict_ansi";
		push @CXXFLAGS, "-D__NO_USE_STD_IOSTREAM";
		push @CXXFLAGS, "-I$WRK/incl/STL";
&else
#
# This is the STL_Port include directory. It replaces the systems own STL definitions and headers
#
		push @CXXFLAGS, "-I$WRK/incl/STL";
&endif
	  }

  } else {
# 
# older versions ( < V7.2 ) do not support multithreading in any way...
#
    push @CCFLAGS, "-I$INSTROOT/incl", "-I$WRK/incl";

  }
&endif

&if $OSSPEC in [ AIX ]
if ( $ENV{BIT64} eq "1" )
{
     push @CCFLAGS, "-DBIT64";
#
# jrg 30.12.1999 This would warn about 64bit truncation of pointer due to int assignments
# but it was too noisy... i.e. complained about (int *)0 ...
#
#     push @CCFLAGS, "-qwarn64";
#
}
push @CCFLAGS, "-U__STR__", "-qchars=signed";
# push @CCFLAGS, "-D_LARGE_FILES"; # &gar: for large files 
# allow C++ comments in C Sources
push @CFLAGS, "-D_NO_PROTO", "-qcpluscmt";
@LINTFLAGS = (@CCFLAGS,@CFLAGS);
&endif
&if $OSSPEC in [ DYNIX ]
push @CCFLAGS, "-W0", "-Nn4096";
@LINTFLAGS = @CCFLAGS;
&endif
&if $OSSPEC = HPUX
if ($MACH eq "HP9") {
	@LINTFLAGS = @CCFLAGS;
#PTS 1105844
#PTS 1106628
    if (( $RELVER ge "R72") && ($RELVER ne "RTOOL")){
		push @CCFLAGS, "+DA1.0", "+DS1.0", "-Dunix", "-D_FILE_OFFSET_BITS=64";
		push @CFLAGS, "";
	} else {
		push @CCFLAGS, "+DA1.0", "+DS1.0", "-Dunix";
		push @CFLAGS, "-D_FILE_OFFSET_BITS=64";
	}
	@CCMODEANSI = ("-Ae");
	@CCMODELINT = ("-Ae");
	@CCMODENORM = ("-Ae");
	if ( $RELVER ge "R73" ) {
# force strict ansi scope rules
		push @CXXFLAGS, "-Aa";
	}
} elsif ($MACH eq "PA11") {
	push @CCFLAGS, "-DHP9";
#PTS 1105844
	push @CCFLAGS, "+DA1.1", "+DS2.0", "-Dunix", "-D_FILE_OFFSET_BITS=64";
	push @CFLAGS, "";
	@CCMODEKR = ("-Ac", "-D_HPUX_SOURCE");
} elsif ($MACH eq "PA20W") {
	push @CCFLAGS, "-DHP9";
	push @CCFLAGS, "+DA2.0W", "+DS2.0", "-Dunix", "-DBIT64";
	@CCMODEKR = ("-Ac", "-D_HPUX_SOURCE");
	push @ASFLAGS, "+DA2.0W", "+DS2.0";
}
&endif
&if $OSSPEC in [ MI_ULT ]
push @CCFLAGS, "-I/usr/include/net";
@LINTFLAGS = @CCFLAGS;
&endif

&if $OSSPEC in [ OSF1 ]
if (( $RELVER ge "R72" ) && ($RELVER ne "RTOOL")){
	push @CFLAGS, "-DPOSIX_C_SOURCE=199506L";
}
push @CCFLAGS, "-DBIT64";
push @CFLAGS, "-verbose", "-D_INTRINSICS", "-D_INLINE_INTRINSICS";
push @CCFLAGS, "-verbose";
@LINTFLAGS = @CCFLAGS;
if ( $OS_REL eq "3" ) {
    # DEC Unix V3.2C
    push @CFLAGS, "-std1";
} else {
    # DEC Unix V4.0 and above
	if ($ENV{__DECC} > 600) {
		# DTK-C-compiler
		@CCMODEANSI = ("-std1");
		@CCMODENORM = ("-std1");
		@CCMODEKR = ("-std0");
	} else {
		# standard C-compiler DU 4.0 B-E 
		@CCMODEANSI = ("-std1");
		@CCMODENORM = ("-std1");	
		@CCMODEKR = ("-std0");
	}
    # Linking with -laio requires compiling with -threads
	if (( $RELVER ge "R72" ) && ($RELVER ne "RTOOL")){
	    push @CFLAGS, "-pthread";
	} else {
		push @CFLAGS, "-threads";
	}
	if ($OS_VER eq "878") {
		push @CFLAGS, "-newc";
	}
}
&endif OSF1
&if $OSSPEC in [ SINIX ]
@LINTFLAGS = @CCFLAGS;
&endif
&if $OSSPEC in [ SCO ]
if ( $CC eq "rcc" ) {
    push @CCFLAGS, "-DSYSV", "-D_SVID", "-D_M_I386";
	push @CFLAGS, "-D_NO_PROTOTYPE", "-DNO_PROTOTYPE";
    @LINTFLAGS = (@CCFLAGS,@CFLAGS);
} else {
    push @CCFLAGS, "-DSYSV", "-D_SVID";
    @CCMODEANSI = ("-W3", "-strict");
	@CCMODELINT = ("-W3", "-strict");
    @CCMODENORM = ("-W2");
    @LINTFLAGS = @CCFLAGS;
}
&endif
&if $OSSPEC = LINUX
    push @CCFLAGS, "-DSYSV", "-D_SVID";
	push @CCFLAGS, "-I/usr/include/ncurses";
&if $MACH = ALPHA || defined BIT64
	push @CCFLAGS, "-DBIT64";
&else
	push @CCFLAGS, "-D_FILE_OFFSET_BITS=64";
&endif
    @LINTFLAGS = @CCFLAGS;
&endif
&if $OSSPEC in [ SVR4 ]
&   if $MACH = I386
    push @CCFLAGS, "-Xa", "-D_SVID";
    @LINTFLAGS = @CCFLAGS;
&   endif
&   if $MACH = NMP
    push @CCFLAGS, "-W0";
#
#   &gar NMP: define _XOPEN_SOURCE in C++ else boolean already defined 
#	push @CXXFLAGS, "-D_XOPEN_SOURCE";
#
#   &jrg NMP: define _XOPEN_SOURCE in C++ not always possible...
#
#   fixed system include file /opt/CDS++/include/C/sysincl/sys/types.h instead
#
#  replaced
# typedef enum boolean { B_FALSE, B_TRUE } boolean_t;
#  by
# typedef enum /* boolean jrg_12_3_1999 */ { B_FALSE, B_TRUE } boolean_t;
#
#   This is ugly while it must be done on all 'fresh' systems...
#
	if (( $RELVER ge "R72") && ($RELVER ne "RTOOL")) {
		push @CCFLAGS, "-D_XPG_IV";
# PTS 1105440
        push @CCFLAGS, "-FIalloca";
        push @CXXFLAGS, "-Tlocal";
        if ( $ENV{OS_REL} ge "5.45" ) {
            push @CCFLAGS, "-Kpthread";
        } else {
            push @CCFLAGS, "-K thread";
        }
	}
	# CTS 1104110
	if ( $ENV{BIT64} eq "1" )
    {
      push @CCFLAGS, "-Klp64", "-DBIT64";
	  push @ASFLAGS, "-Klp64", "-DBIT64";
    }

&   endif
&   if $MACH in [ SUN ] and $OSSPEC in [ SVR4 ]
#
# jrg 24.9.1999
# This is needed since SOLARIS7 does not support i.e. sys_errlist[] on 64Bit...
# NOTE: If you have problem on a new solaris version, modify the comparison...
#
	$OSVERSION = `uname -r`;
	chop($OSVERSION);
	if ( $OSVERSION eq "5.7" ) {
	    push @CCFLAGS, "-DSOLARIS7";
    }

    push @CFLAGS, "-Xt", "-xCC";
	if ( $ENV{BIT64} eq "1" )
	{
		push @CCFLAGS, "-xtarget=ultra", "-xarch=v9", "-DBIT64";
	}
    @LINTFLAGS = (@CCFLAGS, @CFLAGS);

&   endif
&endif
&if $OSSPEC in [ SUNOS ]
#push @CCFLAGS, "-I/usr/include/net", "-I/usr/include", "-I/usr/5include";
@LINTFLAGS = (@CCFLAGS, @CFLAGS);
&endif

&if $OSSPEC in [ WIN32 ]
$DEVELOPCCFLAGS = "-DDUMP_ENABLED";
push @CCFLAGS , $DEVELOPCCFLAGS, "-D_WIN32";
@RCFLAGS  = @CCFLAGS;
  if ( $RELVER ge "R73" ) {
#
# jrg 20.4.2000 always use exception handling code (-except no longer needed)
# must be here to prevent 'rc compiler from reporting illegal option -GX
#
    push @CXXFLAGS, @EXCEPT_FLAG;
  }

if ($RELVER eq "R61") {
	push @CCFLAGS, "-DWINDOWS";
	push @CCFLAGS, "-DREL=R61";
	push @CCFLAGS, "-DREL611";
}
push @CCFLAGS, "-G6";
& if $MACH = I386
push @CCFLAGS, "-D_X86_=1";
& endif
push @CCFLAGS, "-DCRTAPI1=_cdecl", "-DCRTAPI2=_cdecl", "-nologo", "-Gy";
@CCMODEANSI = "-W3";
@CCMODENORM = "-W2";
@CCMODELINT = "-W4";
$LINKMODE= "-MT";
&endif

# "OPTIMIZE" now depends on "VMAKE_VERSION" (needed on AIX)
if ($CURR_VERSION =~ /^f/i) { 	
    # the old value, it was used for everything
&if $OSSPEC in [ HPUX ]
    if ($MACH eq "HP9") {
        @OPTIMIZE = "+O2";
    } elsif ($MACH eq "PA11") {
		@OPTIMIZE = ("+O2", "+Olibcalls");
    } elsif ($MACH eq "PA20W") {
	    @OPTIMIZE = ("+O2", "+Olibcalls");
	}
&elif $OSSPEC in [ MI_ULT ]
	@OPTIMIZE = "-O2"
    @NO_OPTIMIZE = "-O0";
&elif $OSSPEC in [ OSF1 ]
    if ( $OS_REL eq "3" ) {
		@OPTIMIZE = ( "-O2", "-Olimit 2000");# default OSF/1 C compiler
    } elsif ($OS_VER eq "564") {
		# Digital Unix 4.0B
		@OPTIMIZE = ( "-O5", "-tune generic");
    } elsif ($OS_VER eq "878") {
		# Digital Unix 4.0D
		if ($ENV{__DECC} > 600) {
			# dtk-C-compiler
			@OPTIMIZE = ( "-O2", "-tune generic");
		} else {
			# traditional C-Compiler
			@OPTIMIZE = ( "-O4", "-tune generic");
		}
	} else {
		die "unkowen OS Version\n";
	}
    @NO_OPTIMIZE = "-O0";
&elif $MACH = SUN AND $OSSPEC = SUNOS
    @OPTIMIZE = "-O4";
&elif $MACH = NMP AND $OSSPEC = SVR4
    @OPTIMIZE = "-O";
&elif $MACH = SUN AND $OSSPEC = SVR4
    @OPTIMIZE = "-xO4";
&elif $OSSPEC in [ DYNIX ]
    @OPTIMIZE = ("-Wc", "-O3" );
&elif $OSSPEC in [ AIX ]
    # AIX - meaning of "-O" is unspecified, force the less risky
	@OPTIMIZE = "-O2";
&elif $OSSPEC in [ WIN32 ]
    if ($RELVER eq "R71") {
	   @OPTIMIZE = ("-Ogitb1","-Gs");
    } else {
	   @OPTIMIZE = "-Ox";
	}
&elif $OSSPEC = LINUX
	@OPTIMIZE = ("-O3");
&if ($MACH = I386) && (! defined BIT64)
	push @OPTIMIZE, "-march=pentium", "-mcpu=pentiumpro";
&endif
&else
	@OPTIMIZE = "-O2";
&endif
} 
&if $OSSPEC in [ HPUX ]
elsif ($CURR_VERSION =~ /^q/i) { 	@OPTIMIZE = "+O2" }
&endif
else {
    # VMAKE_VERSION is quick or slow
    # one level less than fast - not yet really tested
    # the idea is to combine range checks with less risky code
&if $OSSPEC in [ HPUX ]
    @OPTIMIZE = "+O2";
&elif $OSSPEC in [ MI_ULT, OSF1 ]
    @OPTIMIZE = "-O1";
    @NO_OPTIMIZE = "-O0";
&elif $MACH = SUN AND $OSSPEC = SUNOS
    @OPTIMIZE = "-O3";
&elif $MACH = SUN AND $OSSPEC = SVR4
    @OPTIMIZE = "-xO3";
&elif $OSSPEC in [ DYNIX ]
    @OPTIMIZE = ( "-Wc", "-O2" );
&elif $OSSPEC in [ AIX ]
    # AIX - switch off, compiler is faulty
    @OPTIMIZE = ();
&elif $OSSPEC in [ WIN32 ]
	@OPTIMIZE = ("-Od");
&elif $MACH in [ NMP ]
    @OPTIMIZE = ();
&elif $OSSPEC in [ LINUX ]
	@OPTIMIZE = "-O2";
&else
	 @OPTIMIZE = ();
&endif
    if ( $CURR_VERSION =~ /^s/ )
    {
	    push @CCFLAGS, "-DASSERTION_PROFILE=SAPDBERR_EXCEPTION_CODE";
    }
}

# CTS 1103440
&if $OSSPEC in [ WIN32 ]
@DEBUG_FLAGS = ("-Z7", "-Od");
&else WIN32
@DEBUG_FLAGS = ("-g"); 
&endif WIN32


# cba 98/07/16 : cause of differeces of C- and C++-Linker 
# we may have different linker options on some UNIX-platforms
# we use @LDFLAGS for C-linking and @LDXXFLAGS for C++-Linking
# &gar 99/06/03: for linkdll new variable DLDFLAGS and DLDXXFLAGS
# ( PTS 1103001 )
# initialize 
# CTS 1107045
# @DLD_CXX_C_FLAGS_START, DLD_CXX_C_FLAGS_END
# @DLD_CXX_C_FLAGS_START  options before objects
# @DLD_CXX_C_FLAGS_END    options after objects
&if $OSSPEC in [ HPUX ]
if ($MACH eq "HP9") 
{
	@LDFLAGS  = @LDXXFLAGS = ("+DA1.0", "+DS1.0" );
	push @LDXXFLAGS, "-ldld";
	push @LDFLAGS, "-Wl,-a,archive_shared", "-ldld";
	@KLDFLAGS = ("+DA1.0", "+DS1.0", "-Wl,-a,archive");
	@DLDFLAGS  = @DLDXXFLAGS = ("-Wl,-b");
	# not supported
	@DLD_CXX_C_FLAGS_START=();
	@DLD_CXX_C_FLAGS_END=();
} 
elsif ($MACH eq "PA11") 
{
	@LDFLAGS  = @KLDFLAGS = @LDXXFLAGS = ("+DA1.1", "+DS2.0" );
	@DLDXXFLAGS = ("+DA1.1", "+DS2.0", "-b");
	# PTS 1107045
	if ($RELVER ge "R72")
	{
		@DLDFLAGS  = ("-b");
	}
	else
	{
		@DLDFLAGS  = @DLDXXFLAGS;
	}
	@DLD_CXX_C_FLAGS_START = ("-b", "+nosmartbind", "/opt/aCC/lib/shlrt0.o");
	@DLD_CXX_C_FLAGS_END = ("-L/opt/aCC/lib", "-lCsup", "/opt/aCC/lib/cpprt0.o");

} 
elsif ($MACH eq "PA20W") 
{
	@LDFLAGS  = @KLDFLAGS = @LDXXFLAGS = ("+DA2.0W", "+DS2.0" );
	@DLDFLAGS  = @DLDXXFLAGS = ("+DA2.0W", "+DS2.0", "-b");
	# PTS 1107045
	if ($RELVER ge "R72")
	{
		@DLDFLAGS  = ("-b");
	}
	else
	{
		@DLDFLAGS  = @DLDXXFLAGS;
	}
	@DLD_CXX_C_FLAGS_START = ("-b");
	@DLD_CXX_C_FLAGS_END = ("-L/usr/lib/pa20_64", "-L/opt/langtools/lib/pa20_64", "-lCsup", "-lcl")
} 
&elif $OSSPEC in [ WIN32 ]
@LDEXEFLAGS = ( "-NODEFAULTLIB", "-RELEASE" ); # &gar , "-align:0x1000" );
# no XXFLAGS for WIN (no different linker call for c++)
@LDFLAGS = @DLDFLAGS = ( "-nologo" );
&elif $OSSPEC in [ OSF1 ]
require "hostname.pl";
@LDEXEFLAGS = @OPTIMIZE;
@LDFLAGS = @LDXXFLAGS = ("-std1");
@DLDFLAGS = @DLDXXFLAGS = ("-shared");
push @DLDFLAGS, "-Wl,-no_archive","-std1";
# cxxstd-lib only static 
push @DLDXXFLAGS, "-Wl,-so_archive", "-L/lib/cmplrs/cxx";
@DLD_CXX_C_FLAGS_START = ("-shared");
@DLD_CXX_C_FLAGS_END = ();
&elif $OSSPEC in [ SCO ]
if ( $CURR_VERSION =~ /^s/ ) { @LDFLAGS = ("-s") } 
else { @LDFLAGS = () }
&elif $OSSPEC in [ SVR4 ] and $MACH in [ SUN ]
@LDFLAGS = ("-mt");
if ($OSVERSION ne "5.7") {
	push @LDFLAGS, "-B", "static";
}
@LDXXFLAGS = ("-mt");
@DLDFLAGS = @DLDXXFLAGS = ("-mt", "-G");
if ( $ENV{BIT64} eq "1" )
{
	push @LDXXFLAGS, "-xtarget=ultra", "-xarch=v9";
	push @LDFLAGS, "-xtarget=ultra", "-xarch=v9";
	push @DLDXXFLAGS, "-xtarget=ultra", "-xarch=v9";
	push @DLDFLAGS, "-xtarget=ultra", "-xarch=v9";
	@DLD_CXX_C_FLAGS_START = ("-G", 
	                          "-R/opt/SUNWspro/lib/v9:/usr/ccs/lib/sparcv9:/usr/lib/sparcv9:/opt/SUNWspro/lib/v9", 
	                          "/opt/SUNWspro/SC5.0/lib/v9/crti.o");
	@DLD_CXX_C_FLAGS_END = ("-L/opt/SUNWspro/lib/v9", "-lc", "-lCrun", "/opt/SUNWspro/SC5.0/lib/v9/crtn.o");
}
else
{
	@DLD_CXX_C_FLAGS_START = ("-G", "-R/opt/SUNWspro/lib:/usr/ccs/lib:/usr/lib:/opt/SUNWspro/lib",
	                          "/opt/SUNWspro/SC5.0/lib/crti.o");
	@DLD_CXX_C_FLAGS_END = ("-L/opt/SUNWspro/lib","-lc", "-lCrun", "/opt/SUNWspro/SC5.0/lib/crtn.o");
}
&elif $OSSPEC in [ SVR4 ]
@LDFLAGS = ("-B", "static");
@DLDFLAGS = @DLDXXFLAGS = ("-G");
&if $MACH in [ NMP ]
# PTS 1105440
if ( $RELVER ge "R72") {
    if ( $ENV{OS_REL} ge "5.45" ) {
        @LDFLAGS = ("-Kpthread");
        @LDXXFLAGS = @LDFLAGS;
    }
}
@DLD_CXX_C_FLAGS_START = ("-G");
# CTS 1104110
if ( $ENV{BIT64} eq "1" )
{
	 push @LDXXFLAGS,"-Klp64";
	 push @DLDFLAGS, "-Klp64";
	 push @DLDXXFLAGS, "-Klp64";
	 push @DLD_CXX_C_FLAGS_START , "-B64s";
	 @DLD_CXX_C_FLAGS_END = ("-L/opt/CDS++/lib64s", "-lCrun");
}
else
{
	@DLD_CXX_C_FLAGS_END = ("-L/opt/CDS++/lib", "-lCrun");
}
&endif
&elif $OSSPEC in [ LINUX ]
@LDFLAGS = @LDXXFLAGS = ();
@DLDFLAGS = @DLDXXFLAGS = ("-shared");
@DLD_CXX_C_FLAGS_START = ("-shared");
@DLD_CXX_C_FLAGS_END = ();
&elif $OSSPEC in [ AIX ]
@LDFLAGS = @LDXXFLAGS = ("-bnoipath", "-brtl");
@DLDFLAGS = @DLDXXFLAGS = ();
@DLD_CXX_C_FLAGS_START = @DLD_CXX_C_FLAGS_END = ();
&else
@LDFLAGS = @LDXXFLAGS = "-static";
@DLDFLAGS = @DLDXXFLAGS = ();
@DLD_CXX_C_FLAGS_START = @DLD_CXX_C_FLAGS_END = ();
&endif

#
# For relocatable objects (collection of object files) a different linker is used
# These definitions replace system dependend setting in linkrel.pl!
#
&if $OS in [ UNIX ]
# WIN32 uses AR and AS_FLAGS
#
# SUN:
# There is no specific option that tells ld   to  link  64-bit
# objects;  the  class of the first object that gets processed
# by ld  determines whether it is to perform  a  32-bit  or  a
# 64-bit link edit.
# AIX:
# 32bit and 64bit relocatable object may even coexist...
#
	@LDREL_FLAGS = ( "-r", "-L$TOOL_LIB" );
&endif

# &jrg 14.9.1999
#
# C++ compilation sometimes needs to setup a path to a directory for the template
# cache. In this template cache instances of template functions with external
# linkage are stored.
# Since template instances may differ depending on VMAKE_VERSION (fast,slow...)
# for each version a seperate template cache is forced
#
&if $OSSPEC in [ OSF1 ]
#
# -ptr option works fine!
# but not with different versions (f|q|s) 
#
# -tlocal would produce static instantiations (may only be needed in relocatables
# produced by linkrel.pl.... But this means LOTs of unwanted code... See SUN below
#
# push @CXXFLAGS, "-ptr$WRK/$VMAKE_VERSION";
# push @LDXXFLAGS, "-ptr$WRK/$VMAKE_VERSION";
# push @DLDXXFLAGS, "-ptr$WRK/$VMAKE_VERSION";
push @CXXFLAGS, "-tlocal";

&elif $MACH in [ SUN ] and $OSSPEC in [ SVR4 ] 
#
# -ptr option does not work YET with the current compiler... This is a bug
# that SUN CC promised to fix... Meanwhile instantiation is done static...
#
#push @CXXFLAGS, "-ptr$WRK/$VMAKE_VERSION";
#push @LDXXFLAGS, "-ptr$WRK/$VMAKE_VERSION";
#push @DLDXXFLAGS, "-ptr$WRK/$VMAKE_VERSION";
#
push @CXXFLAGS, "-instances=static";
&elif $OSSPEC in [ HPUX ] 
#
# nothing needed... +inst_all is default. Linker seems intelligent enough to 
# eliminate doubled template definitions or produces LOTs of code...
#
&elif $OSSPEC in [ LINUX ] 
#
# gcc...nothing needed. If REALLY wanted smaller code is producable with
# -fexternal-templates and #pragma implementation / #pragma interface...
# I would not recomment this even whit producing LOTs of code now...
#
&elif $MACH in [ NMP ] and $OSSPEC in [ SVR4 ] 
#
# nothing needed... -T auto is default and seems to work fine
#
&elif $OSSPEC in [ AIX ]
#
# jrg 3.3.2000 Problem with imf dcom...
#
#push @CXXFLAGS, "-qtempinc=$WRK/$VMAKE_VERSION";
#push @LDXXFLAGS, "-qtempinc=$WRK/$VMAKE_VERSION";
#push @DLDXXFLAGS, "-qtempinc=$WRK/$VMAKE_VERSION";
push @CXXFLAGS, "-qnotempinc";
push @LDXXFLAGS, "-qnotempinc";
push @DLDXXFLAGS, "-qnotempinc";
&endif

# &gar PTS 1001828
&if $OSSPEC in [ AIX, LINUX ]
@PRF_FLAGS = "-pg";
&elif $OSSPEC in [ WIN32 ]
@PRF_FLAGS = "-Gh";
&elif $MACH = SUN
@PRF_FLAGS = "-xpg";
&else
@PRF_FLAGS = ();
&endif

# &gar OFLAGS for call options
# used in link... and comp... 
# always initialize here with ()
@OFLAGS=();

&if $OS in [ UNIX ]
$SR_ID = "static char ident_sr[] =";
$MF_ID = "static char ident_mf[] =";
$PC_ID = "static char ident_pc[] =";
$CC_ID = "static char ident_cc[] =";
$ID_END= ";";
&else
$SR_ID  = "#ident";
$MF_ID  = "#ident";
$PC_ID  = "#ident";
$CC_ID  = "#ident";
$ID_END = "";
&endif

&if $OSSPEC = HPUX
if (($MACH eq "HP9") || ($MACH eq "PA11")) {
	@PCFLAGS= ( "-qn", "-e" );
} elsif ($MACH eq "PA20W") {
	@PCFLAGS= ( "-qn", "-e" , "-64" );
}
&else
@PCFLAGS= ( "-qn", "-e" );
&endif
&if $OSSPEC in [ WIN32 ]
@ARFLAGS = ( "-nologo", "-MACHINE:$MACHINE" );
&else
@ARFLAGS = ( "rcs" );
&endif
&if $OSSPEC in [ WIN32 ]
$RANLIB = "lib -list";
&else
$RANLIB = "ar ts";
&endif

&if $OSSPEC in [ WIN32 ]
@LIBPC      = ( "$TOOL_LIB/ptocnts.lib" );
@LIBPC_PROF = ( "$TOOL_LIB/ptocnts.lib" );
&else
& if $OSSPEC in [ HPUX ]
@LIBPC = ( "$TOOL_LIB/libsqlptc.a" );	# static, not dynamic lib
@LIBPC_PROF = ( "$TOOL_LIB/libsqlptc.a");	# static, not dynamic lib
& else
@LIBPC = ( "$TOOL_LIB/libsqlptc.a" );	# static, not dynamic lib
@LIBPC_PROF = ( "$TOOL_LIB/libsqlptc_p.a" );	# static, not dynamic lib
& endif
&endif
&if $OSSPEC in [ MI_ULT ]
@LIBSCR = "-lcursesX";
&elif $OSSPEC in [ SINIX ]
@LIBSCR = "/opt/xms/lib/scrlib.a";
&elif $OSSPEC in [ SUNOS_UCB ]
@LIBSCR = "/usr/5lib/libcurses.a";
&elif $OSSPEC in [ WIN32 ]
@LIBSCR = ( "user32.lib" );
&elif $OSSPEC in [ LINUX ]
@LIBSCR = "-lncurses";
&elif $OSSPEC in [ HPUX ]
if ($MACH eq "HP9") {
	@LIBSCR = "-lHcurses";
} else {
	@LIBSCR = "-lcurses";
}
&else
@LIBSCR = "-lcurses";
&endif
&if $OSSPEC in [ WIN32 ]
@LIBMATH = ();
&else
@LIBMATH = "-lm";
&endif
&if $OSSPEC = SVR4
&if $MACH in [ SUN ]
@DYNAMIC_LIB = ("-Bdynamic");  # &gar PTS 1002144
&else
@DYNAMIC_LIB = ("-B", "dynamic");
&endif
&else
@DYNAMIC_LIB = ();
&endif
&if $OSSPEC in [ AIX ]
@LIBNET  = "-lbsd";
&elif $OSSPEC in [ DYNIX ]
@LIBNET = ( "-lsocket", "-linet", "-lnsl", "-lseq" );
&elif $OSSPEC in [ SCO ]
@LIBNET = "-lsocket";
&elif $OSSPEC in [ SINIX ]
@LIBNET = "-lsocket -lnsl";
&elif $OSSPEC in [ SVR4 ]
@LIBNET = ( "-lsocket", "-lnsl" );
&elif $OSSPEC in [ WIN32 ]
@LIBNET = ( "wsock32.lib" );
&else
@LIBNET = ();
&endif
@LIBCSCI    = ();

#
# PTS 1002837 jrg 26.5.1999 
&if $OSSPEC in [ SVR4 ] && $MACH in [ I386 , SUN ]
@LIBMPROC = ();
&elif $OSSPEC in [ SVR4 ] 
@LIBMPROC = ( "-lmproc", "-lext" );
&elif $OSSPEC in [ SINIX ]
@LIBMPROC = ( "-lmproc", "-lext" );
&elif $OSSPEC in [ SUNOS ]
@LIBMPROC="-llwp"
&elif $OSSPEC in [ WIN32 ]
@LIBMPROC   = ( "libcmt.lib", "oldnames.lib", "kernel32.lib", "advapi32.lib", "gdi32.lib" );
&elif $OSSPEC in [ HPUX ]  && $VMAKE_VERSION in [ slow ]
@LIBMPROC = ( "/opt/langtools/lib/end.o" );
&else
@LIBMPROC = ();
&endif
&if $OSSPEC in [ LINUX ]
#
# obsolete License Management Library...
#
# @LIBCLMGR = "-lclmgr";
&endif

# CTS 1106257
@LIBLD=();  

&if $OSSPEC in [ OSF1 ]
# DEC Unix V4.0 and above
# -laio works with kernel's set-user-ID bit
# -threads must be the very last option on the command line
if (( $RELVER ge "R72") && ($RELVER ne "RTOOL")){
    @LIBAIO = ( "-laio", "-pthread" );
	@LIBLD=("-lmld");  # CTS 1106257
} else {
	@LIBAIO = ( "-laio", "-threads" );
}
&elif $OSSPEC in [ SVR4 ]
&if not $MACH in [ NMP ]
if (( $RELVER ge "R72") && ($RELVER ne "RTOOL")) {
	@LIBAIO = ("-lpthread");
} else {
	@LIBAIO = ("-lthread");
}
&endif
&elif $OSSPEC in [ LINUX ]
if (( $RELVER ge "R72") && ($RELVER ne "RTOOL")){
	@LIBAIO = ("-lpthread");
} else {
	@LIBAIO = ();
}
&elif $OSSPEC in [ HPUX ]
if (( $RELVER ge "R72") && ($RELVER ne "RTOOL")) {
	@LIBAIO = ("-lpthread");
} else {
	@LIBAIO = ();
}
&else
@LIBAIO = ();
&endif

# &gar PTS 1106517
@LDSHMFLAGS=();
&if $OSSPEC in [ AIX ]
if (( $RELVER ge "R72") && ($RELVER ne "RTOOL"))
{		
    # heapsize = 1GB if Version < 7.2.2.5 else 2 GB (PTS 1106620) 
    if (($RELVER eq "R72") && 
       (($ENV{CORRECTION_LEVEL} < 2) || (($ENV{CORRECTION_LEVEL} == 2 ) && ($ENV{BUILDPRAEFIX} < 5))))
    { push @LDSHMFLAGS, "-Wl,-bD:0x40000000"; }
    else
    { push @LDSHMFLAGS, "-Wl,-bD:0x80000000"; }
}
&endif


if ( $SQLVERSION eq "REL30" )  { $TRACETYPE = "tsp_trace" }
	else { $TRACETYPE = "tracetext" }

&if $OSSPEC in [ AIX ]
$SHELL = "/bin/sh"; $ENV{SHELL} = $SHELL;    # force Bourne shell even for C shell users
&endif

#################################################
# vmake environment variables must be set by hand 
#################################################

if ( ! $DEVENV ) {
& if $OSSPEC in [ SCO ]
    $DEVENV = "YES";		# Pascal vsp-modules
#   $DEVENV = "NO";		# Assembler or C vsp-modules
& else
#   $DEVENV = "YES";		# Pascal vsp-modules
    $DEVENV = "NO";			# Assembler or C vsp-modules
& endif
}
$ENV{DEVENV} = $DEVENV; # export $DEVENV

&if $MACH in [ HP9, PA11, PA20W, SUN, ALPHA, MIPS, _IBMR2, LINUX ]
undef($CCOMP);
$CCOMP = "GENC";
$ENV{CCOMP} = $CCOMP;
undef($CPPCOMP);
undef($COBCOMP);
undef($FORCOMP);
undef($PASCOMP);
&endif


# ================================================================

&if $OSSPEC in [ AIX ]
$DLL_TYPE = "so";
&elif $OSSPEC in [ HPUX ]
$DLL_TYPE = "sl";
if (($MACH eq "HP9") ||($MACH eq "PA11")) {
	push @CCFLAGS, "+Z";		# "position independent code" required
}
&elif $OSSPEC in [ SVR4 ]
$DLL_TYPE = "so";
push @CCFLAGS, "-KPIC";		# "position independent code" required
&if not $MACH in [ SUN, NMP ]
push @CCFLAGS, "-K", "thread";	
&endif
&elif $OSSPEC in [ OSF1 ]
$DLL_TYPE = "so";
&elif $OSSPEC in [ WIN32 ]
$DLL_TYPE = "dll";
&elif $OSSPEC in [ LINUX ]
$DLL_TYPE = "so";
&else
$DLL_TYPE = "x";		# default (dll) generates too long file names on SCO
&endif
$ENV{DLL_TYPE} = $DLL_TYPE;		# can be exported even if not set

&if $OS = UNIX
$ARCH_TYPE = ".a";
&else
$ARCH_TYPE = ".lib";
&endif
$ENV{ARCH_TYPE} = $ARCH_TYPE;		# can be exported even if not set

&if $OS = UNIX
# PTS 1103820 jrg
# since it can be expected to have python and/or perl already installed
# on the machine, the location of includes and libraries needed can be 
# overwritten by environment.
#
if (! $ENV{PYTHON_INCLUDE})
{
	$PYTHON_INCLUDE = $ENV{TOOL} . "/Python/include";
    $ENV{PYTHON_INCLUDE} = $PYTHON_INCLUDE;
}
if (! $ENV{ACTIVEPERL_INCLUDE})
{
	$ACTIVEPERL_INCLUDE = "";
	$ENV{ACTIVEPERL_INCLUDE} = $ACTIVEPERL_INCLUDE;
}
if (! $ENV{ACTIVEPERL_LIB})
{
	$ACTIVEPERL_LIB = "";
	$ENV{ACTIVEPERL_LIB} = $ACTIVEPERL_LIB;
}
if (! $ENV{COREPERL_INCLUDE})
{
	$COREPERL_INCLUDE = $ENV{TOOL} . "/Perl/lib/CORE";
	$ENV{COREPERL_INCLUDE} = $COREPERL_INCLUDE;
}
if (! $ENV{COREPERL_LIB})
{
	$COREPERL_LIB = $ENV{TOOL} . "/Perl/lib/CORE";
	$ENV{COREPERL_LIB} = $COREPERL_LIB;
}
&else
$PYTHON_INCLUDE = $ENV{TOOL} . "/Python/include";
$ENV{PYTHON_INCLUDE} = $PYTHON_INCLUDE;
$ACTIVEPERL_INCLUDE = $ENV{TOOL} . "/Perl/lib/CORE";
$ENV{ACTIVEPERL_INCLUDE} = $ACTIVEPERL_INCLUDE;
$ACTIVEPERL_LIB = $ENV{TOOL} . "/Perl/lib/CORE";
$ENV{ACTIVEPERL_LIB} = $ACTIVEPERL_LIB;
$COREPERL_INCLUDE = $ENV{TOOL} . "/PerlCore/lib/CORE";
$ENV{COREPERL_INCLUDE} = $COREPERL_INCLUDE;
$COREPERL_LIB = $ENV{TOOL} . "/PerlCore/lib/CORE";
$ENV{COREPERL_LIB} = $COREPERL_LIB;
&endif

# set installation directory for libraries and scripting interfaces
&if $OSSPEC = WIN32
$ENV{INSTLIB} = $INSTROOT."\\lib";
$ENV{INSTMISC} = $INSTROOT."\\misc";
&elif $MACH = ALPHA && $OS = UNIX
$ENV{INSTLIB} = $INSTROOT."/lib";
$ENV{INSTMISC} = $INSTROOT."/misc";
&else
if ($ENV{BIT64} eq "1")
{
	#all 64-bit-platforms should use lib/lib64
	$ENV{INSTLIB} = $INSTROOT."/lib/lib64";
    $ENV{INSTMISC} = $INSTROOT."/misc/lib64";
} else {
    $ENV{INSTLIB} = $INSTROOT."/lib";
    $ENV{INSTMISC} = $INSTROOT."/misc";
}
&endif

$TraceFile = "$WRK/$VMAKE_VERSION/prot/trace.prot";
sub ToolTrace { 
	# usage ToolTrace($string, \@daten)
	if ( $ENV{TOOLTRACE}) {
		local( $string, $r_daten ) = @_;
		open( TOOLTRACE, ">>$TraceFile") || die "Can't open $TraceFile (append): $!\n";
		print TOOLTRACE sprintf($string, @$r_daten);
		close(TOOLTRACE);
	}
}


# initializing flush of output buffer
$|=1; print "";
