OOO330
[LibreOffice.git] / set_soenv.in
blob94fab67f15c9d9aefa4456052c34242b111d1ebd
1 #!@PERL@ -w
3 # Program:     set_soenv.in
4 # Version:     $Revision: 1.201 $
5 # Date:        $Date: 2008-09-05 14:14:29 $
6 # Author:      Willem van Dorp, Ross Nicholson, Oisin Boydell - Sun Microsystems, Ireland.
8 #---------------------------------------------------------------------------
9 #---------------------------------------------------------------------------
10 # Description:
11 # set_soenv generates a file that contains all necessary 
12 # environment variables for the build proces of OpenOffice
13 # on Linux, NetBSD, Solaris, Windows NT and Mac OS X/Darwin.
15 # Program steps.
17 # I.    Checking the command-line arguments.
18 # IIa.  Declaring variables for the system commands, etc.
19 # IIb.  Declaring the environment variables.
20 # III.  Initialising the variables for the system commands, etc.
21 # IV.   Print out some important messages etc.
22 # V.    Initialising the environment variables.
23 # VI.   Open the output file.
24 # VII.  Writing the data to the output file.
25 # VIII. Closing output file.
26 # IX.   Sourcing the output file.
27 # X.    Set up the build environment.
28 # XI.   Moving the output file to the build home directory.
30 #---------------------------------------------------------------------------
32 use strict;                        # pragma
33 use File::Basename;
37 #--------------------------------------------------------
38 # IIa. Declaring variables for the system commands, etc.
39 #--------------------------------------------------------
41 my ( $outfile, $outfile_sh, $bootfile, $newline, $comment,
42      $compiler, $unsetenv, $setenv, $unset, $set, $ds, $ps,
43      $wps, $cur_dir, $par_dir, $I, $L, $D, $buildenv, $answer, $tmp, $MINGW,
44      $USE_MINGW, $platform,
45      $cygwinver, $empty, $no_ant, $no_stl, $no_gcc_include, 
46      $no_gxx_include, $warnfile, $Warning, $result, $unsetvars, $unsetvarssh, $unsetvarsbat, $exportvars, $win_format_var, $perl_os, @mingw_lib_include_paths, $mingw_lib_include_path);
48 #-------------------------------------------------
49 # IIb. Declaring environment values (constants).
50 #-------------------------------------------------
52 # Platform independent constant values.
53 my @DICTIONARIES = ("DADK", "DEDE", "ENGB", "ENUS", "HUHU", "ITIT", "RURU", "THTH", "SWTZ" );
54 my ( $CALL_CDECL, $COMMON_OUTDIR, $BMP_WRITES_FLAG, 
55      $common_build, $NO_REC_RES, $SO3, $SOLAR_JAVA, 
56      $SOLAR_PLUGIN, $UPDATER, $BUILD_DELIVER, $VCL, 
57      $CC, $CXX,
58      $BUILD_SOSL, $ENABLEUNICODE, $NEW_JAR_PACK, $NO_BSYMBOLIC, 
59      $BUILD_SOSL_RELEASE, $RSC_ONCE );
61 # Platform dependent constant values.
62 my ( $BIG_SVX, $COM, $ARCH, $CPU, $CPUNAME, $CVER, $GLIBC, $GUI, $GUIBASE,
63       $GVER, $OS, $OSVERSION, $OUTPATH, $INPATH, $PATH_SEPERATOR,
64       $DYNAMIC_CRT, $SET_EXCEPTIONS, $use_shl_versions, $CDPATHx, $JRELIBDIR,
65       $JRETOOLKITDIR, $JRETHREADDIR,
66       $FLIPCMD );
68 #-------------------------------------------
69 # IIc. Declaring the environment variables.
70 #-------------------------------------------
72 # Help variables.
73 my ( $USR, $ETC, $BIN, $LIB, $LIB64, $INC, $INCLUDE, $DEV, $OPT, $LOCAL, $SOLENV, $SOLVER, $CONFIG, 
74      $USR_BIN, $USR_LIB, $USR_LOCAL, $USR_CCS, $JAVA_BIN, $JAVA_LIB, $JAVA_INCLUDE,
75      $SOLARENVINC, $USR_DT, $USR_OPENWIN, $XLIB, $XINC,
76      $CYGWIN_PATH, $language, $dict, $ASM_PATH, $NSIS_PATH, $ps_STLPORT_LIB, $L_STLPORT_LIB,
77      $STLPORT_stlport, $STLPORT_inc_stlport, $PERL_PATH );
79 # Environment variables.
80 my ( $oldPATH, $SRC_ROOT, $SO_HOME, $JAVA_HOME, $JDK, $JAVAFLAGS, $OOO_SHELL,
81      $UPD, $WORK_STAMP, $SOURCE_ROOT_DIR ,
82      $SOLARSRC, $DEVROOT, $SOLARVER, $SOLARVERSION, $SOLARENV, 
83      $STAR_INIROOT, $STAR_INIROOTOLD, $STAR_STANDLST, $STAR_SSCOMMON, $STAR_SSOLARINI, 
84      $DMAKEROOT, $CLASSPATH, $XCLASSPATH, $COMPATH,
85      $MSPDB_PATH, $MIDL_PATH, $CSC_PATH,
86      $PATH, $SOLAREXTRAINC, $SOLAREXTRALIB, $SOLARLIB, 
87      $SOLARINC, $LOCALINI, $FRAMEWORKSHOME, $COMEX, $PERL, 
88      $COMP_ENV, $ILIB, $JAVAHOME, $PSDK_HOME, $DIRECTXSDK_LIB, $USE_NEW_SDK, $FRAME_HOME, 
89      $USE_DIRECTX5, $ATL_LIB, $ATL_INCLUDE, $MFC_LIB, $MFC_INCLUDE, $NO_HIDS, $TMPDIR,
90      $COMMON_BUILD_TOOLS, $WIN_GREP, $WIN_FIND, $WIN_LS,
91      $WIN_GNUCOPY, $WIN_TOUCH, $STLPORT4, $MOZILLA_VERSION, $MOZILLA_TOOLKIT, $PREBUILD_MOZAB, $MOZILLABUILD,
92          $PROEXT, $TARFILE_LOCATION,
93      $SYSTEM_PYTHON, $SYSTEM_MOZILLA, $EPM_FLAGS);
95 #-------------------------------------------
96 # IId. Declaring the aliases.
97 #-------------------------------------------
99 my ( $dmake, $build, $build_client, $nmake, $mkout, $deliver, $zipdep );
102 #-------------------------------------------------------------
103 # IIIa. Initialising constants.
104 #-------------------------------------------------------------
106 # $platform is needed for PathFormat()
108 $platform          = `./config.guess`;
109 chomp( $platform );
111 $UPD            = '@UPD@';          # the project's UPD
112 $newline        = "\n";             # Perl newline character
113 $unsetenv       = "unsetenv";       # c-shell command
114 $setenv         = "setenv";         # c-shell command
115 $unset          = "unset";          # msdos batch file command
116 $set            = "set";            # msdos batch file command
117 $ds             = "/";              # directory separator
118 $ps             = ":";              # path separator
119 $wps            = ":";              # path separator, will be set to ';' for windows later.
120 $cur_dir        = ".";              # current directory
121 $par_dir        = "..";             # parrent directory
122 $I              = " -I";            # include search path
123 $L              = " -L";            # library search path
124 $D              = " -D";            # define search path
125 $empty          = "";               # used as argument
126 $no_stl         = "NO_STLPORT4";    # possible argument
127 $warnfile       = "warn";           # logfile configure warnings.
128 $Warning        = "";               # container for warning messages
129 $STLPORT4       = '@STLPORT4@';     # Location of STLport4
130 $SYSTEM_PYTHON  = '@SYSTEM_PYTHON@';
131 $SYSTEM_MOZILLA = '@SYSTEM_MOZILLA@';
132 $JDK            = '@JDK@';
133 $JAVAFLAGS              = '@JAVAFLAGS@';
134 $MINGW          = '@WITH_MINGWIN@'; # use MinGW for Windows build
135 $USE_MINGW      = '@USE_MINGW@';     # use MinGW in cygwin or pure-mingw
136 if ( $MINGW eq "yes" )
137 { $CC             = '@CC@';           # C compiler
138   $CXX            = '@CXX@'; }        # C++ compiler
139 else
140 { $CC             = PathFormat('@CC@');           # C compiler
141   $CXX            = PathFormat('@CXX@'); }        # C++ compiler
142 $MOZILLA_VERSION        = '@MOZILLA_VERSION@'; # mozilla version to use to build mozilla
143 $MOZILLA_TOOLKIT        = '@MOZILLA_TOOLKIT@'; # GUI toolkit to use to build mozilla
144 $FLIPCMD        = "";               # Flip '/' to '\' wrapper (only for winnt)
145 $GLIBC          = "";               # Whether the platform uses glibc
146 $PROEXT         = "@PROEXT@";
147 $EPM_FLAGS      = "";
150 #--------------------------------------------------------------------
151 # IV. Initialise the warning container and print a note to the user.
152 #--------------------------------------------------------------------
154 # Add the configure (pre-requisite) warnings to the warning container
155 # , $Warning.
156 AddWarning( "configure", "" );
158 print ("Setting up the environment for building OpenOffice.org $newline");
160 #--------------------------------------------------
161 # V. Setting the environment variables/values.
162 #--------------------------------------------------
164 # A. Checking the platform first.
166 # get perls idea for OS
167 # needed to differentiate cygwin/native perl on windows
168 $perl_os = $^O;
171 # B. Gathering information from the system.
173 # 1. Path
174 $oldPATH = $ENV{"PATH"};
175 chomp( $oldPATH );                  # cut off new line
177 # C. Setting the constant values.
179 # Setting platform independent constant values.
180 print "Setting platform independent values... ";
181 # NB: Language options now set at 'ToFile' stage. 
182 $BMP_WRITES_FLAG      = "TRUE";
183 $BUILD_SOSL_RELEASE   = "TRUE";
184 $RSC_ONCE             = "TRUE";
185 $CALL_CDECL           = "TRUE";
186 $COMMON_OUTDIR        = "";
187 $common_build         = "";
188 $NO_REC_RES           = "TRUE";
189 $SO3                  = "TRUE";
190 $SOLAR_JAVA           = "@SOLAR_JAVA@";
191 $SOLAR_PLUGIN         = "TRUE";
192 $UPDATER              = "YES";
193 $BUILD_DELIVER        = "true";
194 $VCL                  = "TRUE";
195 $BUILD_SOSL           = "true";
196 $ENABLEUNICODE        = "TRUE";
197 $NEW_JAR_PACK         = "TRUE";
198 $NO_BSYMBOLIC         = "TRUE";
199 $comment              = "#";           # UNIX script comment character
200 $TARFILE_LOCATION = "@TARFILE_LOCATION@"; # where to find tarballs with external sources
202 # Setting platform dependent constant values.
203 if ( $platform =~ m/solaris/ ) 
204 {     print "Setting Solaris specific values... ";
205    if ($platform =~ m/^i[3456]86/)
206    {  
207       if ( $CC =~ "gcc") {
208          $outfile        = "SolarisX86GccEnv.Set";
209          $OUTPATH        = "unxsogi";
210       } else {
211          $outfile        = "SolarisX86Env.Set";
212          $OUTPATH        = "unxsoli4";
213       }
214       $CPU            = "I";
215       $CPUNAME        = "INTEL";
216           $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
217           $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."motif21";
218           $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
220    }
221    else
222    {
223       if ( $CC =~ "gcc") {
224          $outfile        = "SolarisSparcGccEnv.Set"; 
225          $OUTPATH        = "unxsogs";
226       } else {
227          $outfile        = "SolarisSparcEnv.Set"; 
228          $OUTPATH        = "unxsols4";
229       }
230       $CPU            = "S";
231       $CPUNAME        = "SPARC";
232           $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc";
233           $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."motif21";
234           $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."native_threads";
235    }
237    if ( $CC =~ "gcc") {
238        $COM            = "GCC";
239        $CVER           = "C300";
240    } else {
241        $COM            = "C52";
242        $CVER           = "C52";
243        $COMEX          = 4;
244    }
245    $BIG_SVX        = "TRUE";
246    $COMPATH        = '@COMPATH@'; 
247    $GUI            = "UNX";
248    $GUIBASE        = "unx";
249    $GVER           = "VCL";
250    $INPATH         = $OUTPATH.$PROEXT;
251    $OS             = "SOLARIS";
252    $PATH_SEPERATOR = $ps;
254 elsif ( $platform =~ m/netbsd/ ) 
256 #Set platform specific values: 
257    if ($platform =~ m/^i[3456]86/)
258    {  print "Setting NetBSD x86 specific values... ";
259       $outfile        = "NetBSDX86Env.Set"; 
260       $CPU            = "I";
261       $CPUNAME        = "INTEL";
262       $OUTPATH        = "unxbsdi";
263       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
264       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
265       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
266    }
267    elsif ($platform =~ m/^sparc/)
268    {  print "Setting NetBSD Sparc specific values... ";
269       $outfile        = "NetBSDSparcEnv.Set"; 
270       $CPU            = "S";
271       $CPUNAME        = "SPARC";
272       $OUTPATH        = "unxbsds";
273       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc";
274       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."client";
275       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."native_threads";
276    }
277    elsif ($platform =~ m/powerpc/)
278    {  print "Setting NetBSD PPC specific values... ";
279       $outfile        = "NetBSDPPCEnv.Set"; 
280       $CPU            = "P";
281       $CPUNAME        = "POWERPC";
282       $OUTPATH        = "unxbsdppc";
283       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
284       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."classic";
285       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads";
286    }
287    else
288    { print "Unsupported NetBSD architecture: $platform \n";
289      exit 1;
290    }
291    #Conditional setting depending on gcc3:
292       $CVER           = "C300";
293       $OUTPATH        = $OUTPATH."2";
294    # General NetBSD settings:
295       $BIG_SVX        = "TRUE";
296       $COM            = "GCC";
297       $COMPATH        = '@COMPATH@'; 
298       $GUI            = "UNX";
299       $GUIBASE        = "unx";
300       $GVER           = "VCL";
301       $INPATH         = $OUTPATH.$PROEXT;
302       $OS             = "NETBSD";
303       $PATH_SEPERATOR = $ps;
305 elsif ( $platform =~ m/kfreebsd/ ) 
307 # General GNU/kFreeBSD settings:
308       $CVER           = "C341";
309       $BIG_SVX        = "TRUE";
310       $COM            = "GCC";
311       $COMPATH        = '@COMPATH@'; 
312       $GLIBC          = "2REDHAT60";
313       $GUI            = "UNX";
314       $GUIBASE        = "unx";
315       $GVER           = "VCL";
316       $OS             = "LINUX";
317       $PATH_SEPERATOR = $ps;
319 #Set platform specific values: 
320    if ($platform =~ m/^i[3456]86/)
321    {  print "Setting GNU/kFreeBSD x86 specific values... ";
322       $outfile        = "GNUkFreeBSDX86Env.Set"; 
323       $CPU            = "I";
324       $CPUNAME        = "INTEL";
325       $OUTPATH        = "unxkfgi6";
326       
327       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
328       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
329       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
331    }
332    elsif ($platform =~ m/^x86_64/)
333    {  print "Setting GNU/kFreeBSD x86-64 specific values... ";
334       $outfile        = "GNUkFreeBSDX86-64Env.Set";
335       $CPU            = "X";
336       $CPUNAME        = "X86_64";
337       $OUTPATH        = "unxkfgx6";
339       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64";
340       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."server";
341       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."native_threads";
342    }
344    $INPATH         = $OUTPATH.$PROEXT;
346 elsif ( $platform =~ m/freebsd/ ) 
347 {     $BIG_SVX        = "TRUE";
348       $COM            = "GCC";
349       $COMPATH        = '@COMPATH@'; 
350       $CVER           = "C300";
351       $GUI            = "UNX";
352       $GUIBASE        = "unx";
353       $GVER           = "VCL";
354       $OS             = "FREEBSD";
355       $PATH_SEPERATOR = $ps;
356       $OSVERSION      = '@OSVERSION@';
357    if ($platform =~ m/^amd64/)
358    {  my ( $JAVA_OS );
359       print "Setting FreeBSD AMD64 specific values... ";
360       $outfile        = "FreeBSDAMDEnv.Set";
361       $CPU            = "X";
362       $CPUNAME        = "X86_64";
363       $OUTPATH        = "unxfbsdx";
364       $JAVA_OS        = '@JAVA_HOME@';
365       $JAVA_OS        =~ s/.*\///;
366       if ($JAVA_OS =~ m/^linux/)
367       {  $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
368          $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
369          $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
370       }
371       else
372       {  $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64";
373          $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."server";
374          $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."native_threads";
375       }
376    }
377    elsif ($platform =~ m/^i386/)
378    {  print "Setting FreeBSD x86 specific values... ";
379       $outfile        = "FreeBSDX86Env.Set";
380       $CPU            = "I";
381       $CPUNAME        = "INTEL";
382       $OUTPATH        = "unxfbsdi";
383       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
384       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
385       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
386    }
387    else
388    {  print "Unsupported FreeBSD architecture: $platform \n";
389          exit 1;
390    }
391    if( @GCCVER@ >= 30401 ) {
392       $CVER        = "C341";
393    }
394       $INPATH         = $OUTPATH.$PROEXT;
396 elsif ( $platform =~ m/linux/ ) 
398 # General Linux settings:
399       $CVER           = "C341";
400       $BIG_SVX        = "TRUE";
401       $COM            = "GCC";
402       $COMPATH        = '@COMPATH@'; 
403       $GLIBC          = "2REDHAT60";
404       $GUI            = "UNX";
405       $GUIBASE        = "unx";
406       $GVER           = "VCL";
407       $OS             = "LINUX";
408       $PATH_SEPERATOR = $ps;
410 #Set platform specific values: 
411    if ($platform =~ m/^i[3456]86/)
412    {  print "Setting Linux x86 specific values... ";
413       $outfile        = "LinuxX86Env.Set"; 
414       $CPU            = "I";
415       $CPUNAME        = "INTEL";
416       
417       if ($JDK =~ m/^[Ii][Bb][Mm]/)
418       { $JRELIBDIR     = '$JAVA_HOME'.$ds."jre".$ds."bin";
419         $JRETOOLKITDIR = '$JAVA_HOME'.$ds."jre".$ds."bin".$ds."classic";
420         $JRETHREADDIR  = '$JAVA_HOME'.$ds."jre".$ds."bin"; }
422       elsif ($JDK =~ m/^[Bb][Ee][Aa]/)
423       { $JRELIBDIR     = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
424         $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."jrockit";
425         $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads"; }
427       else {      
428       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
429       # has both server and client
430       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
431       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
432       }
434       $OUTPATH     = "unxlngi6";
435    }
436    elsif ($platform =~ m/^x86_64/)
437    {  print "Setting Linux x86-64 specific values... ";
438       $outfile        = "LinuxX86-64Env.Set";
439       $CPU            = "X";
440       $CPUNAME        = "X86_64";
441       $OUTPATH        = "unxlngx6";
442       # Blackdown.org JDK porting project uses `amd64' and `server' in JDK 1.4.2 RC1
443       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64";
444       # has both server and client
445       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."server";
446       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."native_threads";
447    }
448    elsif ($platform =~ m/^ia64/)
449    {  print "Setting Linux ia64 specific values... ";
450       $outfile        = "LinuxIA64Env.Set";
451       $CPU            = "A";
452       $CPUNAME        = "IA64";
453       $OUTPATH        = "unxlnga";
454       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ia64";
455       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ia64".$ds."server";
456       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ia64".$ds."native_threads";
457    }
458    elsif ($platform =~ m/^sparc/)
460    {  print "Setting Linux Sparc specific values... ";
461       $outfile        = "LinuxSparcEnv.Set"; 
462       $CPU            = "S";
463       $CPUNAME        = "SPARC";
464       $OUTPATH        = "unxlngs";
465       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc";
466       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."server";
467       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."native_threads";
468    }
469    elsif ($platform =~ m/^powerpc/)
470    {
471       if (($platform =~ m/^powerpc64/) && ('@SIZEOF_LONG@' eq '8')) {
472          print "Setting Linux PPC64 specific values... ";
473          $outfile = "LinuxPPC64Env.Set"; 
474          $OUTPATH = "unxlngppc64";
475          $CPUNAME = "POWERPC64";
477          if ( $JDK eq "gcj" ) {
478             $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc64";
479             $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc64".$ds."client";
480             $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc64".$ds."native_threads";
481          }
482       }
483       else {
484          print "Setting Linux PPC specific values... ";
485          $outfile = "LinuxPPCEnv.Set"; 
486          $OUTPATH = "unxlngppc";
487          $CPUNAME = "POWERPC";
489          if ( $JDK eq "gcj" ) {
490             $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
491             $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."client";
492             $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads"; }
493          elsif ($JDK =~ m/^[Ii][Bb][Mm]/)
494          {  $JRELIBDIR     = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
495             $JRETOOLKITDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."classic";
496             $JRETHREADDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
497          }
498          # OpenJDK
499          elsif ($JDK =~ m/sun/) {
500             $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
501             $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."server";
502             $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads";
503          }
504       }
506       $CPU            = "P";
508    }
509    elsif ($platform =~ m/^s390/)
510    {
511       if (($platform =~ m/^s390x/) && ('@SIZEOF_LONG@' eq '8')) {
512          print "Setting Linux zSeries specific values... ";
513          $outfile        = "LinuxS390XEnv.Set";
514          $CPUNAME        = "S390X";
515          $ARCH           = "s390x";
516          $OUTPATH        = "unxlngs390x";
517       }
518       else {
519          print "Setting Linux S/390 specific values... ";
520          $outfile        = "LinuxS390Env.Set";
521          $CPUNAME        = "S390";
522          $ARCH           = "s390";
523          $OUTPATH        = "unxlngs390";
524       }
525       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH;
526       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH.$ds."server";
527       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH.$ds."native_threads";
528       $CPU            = "3";
529    }
530    elsif ($platform =~ m/^m68k/)
531    {  print "Setting Linux m68k specific values... ";
532       $outfile        = "LinuxM68KEnv.Set";
533       $CPU            = "6";
534       $CPUNAME        = "M68K";
535       $OUTPATH        = "unxlngm68k";
536       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."m68k";
537       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."m68k".$ds."server";
538       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."m68k".$ds."native_threads";
539    }
540    elsif ($platform =~ m/^hppa/)
541    {  print "Setting Linux hppa specific values... ";
542       $outfile        = "LinuxHPPAEnv.Set";
543       $CPU            = "H";
544       $CPUNAME        = "HPPA";
545       $OUTPATH        = "unxlnghppa";
546       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."hppa";
547       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."hppa".$ds."server";
548       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."hppa".$ds."native_threads";
549       $EPM_FLAGS      = "-a hppa";
550    }
551    elsif ($platform =~ m/^alpha/) 
552    {  print "Setting Linux Alpha specific values... ";
553       $outfile        = "LinuxAlphaEnv.Set"; 
554       $CPU            = "L";
555       $CPUNAME        = "AXP";
556       $OUTPATH        = "unxlngaxp";
557       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha";
558       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha".$ds."server";
559       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha".$ds."native_threads";
560    }
561    elsif ($platform =~ m/^arm.*?l-/)
562    {  print "Setting Linux ARM specific values... ";
563       $outfile        = "LinuxARMEnv.Set"; 
564       $CPU            = "R";
565       $CPUNAME        = "ARM";
566       $OUTPATH        = "unxlngr";
567       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm";
568       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm".$ds."server";
569       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm".$ds."native_threads";
570       $EPM_FLAGS      = "-a arm";
571    }
572    elsif ($platform =~ m/^mips/)
573    {  print "Setting Linux MIPS specific values... ";
574       $outfile        = "LinuxMIPSEnv.Set"; 
575       $CPU            = "M";
576       $CPUNAME        = "GODSON";
577       $OUTPATH        = "unxlngmips";
579       if ('@SIZEOF_LONG@' eq '8') {
580         if ('@WORDS_BIGENDIAN@' ne 'yes') {
581           $EPM_FLAGS = "-a mips64el";
582           if ( $JDK eq "gcj" ) {
583             $ARCH = "mips64el";
584           }
585         }
586         else {
587           $ARCH = "mips64";
588         }
589       }
590       else {
591         if ('@WORDS_BIGENDIAN@' ne 'yes') {
592           $EPM_FLAGS = "-a mipsel";
593           if ( $JDK =~ m/sun/ && -d "@JAVA_HOME@".$ds."jre".$ds."lib".$ds."mips32" ) {
594            $ARCH = "mips32"; # Lemote
595           } else {
596            $ARCH = "mipsel";
597           }
598         }
599         else {
600           $ARCH = "mips";
601         }
602       }
604       $JRELIBDIR      = '$JAVA_HOME'.$ds."lib".$ds.$ARCH;
605       if ( $JDK =~ m/sun/ && -d "@JAVA_HOME@".$ds."jre".$ds."lib".$ds."mips32" ) {
606         $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."lib".$ds.$ARCH.$ds."client"; # Lemote
607       } else {
608         $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."lib".$ds.$ARCH.$ds."server";
609       }  
610       $JRETHREADDIR   = '$JAVA_HOME'.$ds."lib".$ds.$ARCH.$ds."native_threads";
611    }
614    $INPATH         = $OUTPATH.$PROEXT;
616 elsif ( $platform =~ m/osf1/ ) 
617 {     print "Setting Tru64 specific values... ";
618       $outfile        = "Tru64AlphaEnv.Set"; 
619       $BIG_SVX        = "TRUE";
620       $COM            = "CXX";
621       $COMPATH        = '@COMPATH@'; 
622       $CPU            = "A";
623       $CPUNAME        = "ALPHA_";
624       $CVER           = "C62";
625       $GUI            = "UNX";
626       $GUIBASE        = "unx";
627       $GVER           = "VCL";
628       $OUTPATH        = "unxt64";
629       $INPATH         = $OUTPATH.$PROEXT;
630       $OS             = "TRU64";
631       $PATH_SEPERATOR = $ps;
632       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha";
633       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha".$ds."client";
634       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha".$ds."native_threads";
636 elsif ( $platform =~ m/cygwin/ ) 
638       $MSPDB_PATH     = PathFormat('@MSPDB_PATH@');
639       $MIDL_PATH      = PathFormat('@MIDL_PATH@');
640       $CSC_PATH       = PathFormat('@CSC_PATH@');
641       $PSDK_HOME      = PathFormat('@PSDK_HOME@');
642       $DIRECTXSDK_LIB = PathFormat('@DIRECTXSDK_LIB@');
643       $USE_DIRECTX5   = "";
644       $FRAME_HOME     = PathFormat('@FRAME_HOME@');
645       $USE_NEW_SDK    = "TRUE";
646       $CPUNAME        = "INTEL";
647       $CPU            = "I";
648       $GUI            = "WNT";
649       $GUIBASE        = "WIN";
650       $GVER           = "NT351";
651       $OS             = "WNT";
652       $DYNAMIC_CRT    = "TRUE";
653       $SET_EXCEPTIONS = "TRUE";
654       $use_shl_versions = "TRUE";
655       $wps = ';'; # Windows style path seperator
656   if ( $MINGW eq "yes" )
657   {   # At the moment this implies the use of tcsh
658       print "Setting Windows NT cygwin MinGW specific values... ";
659       $FLIPCMD        = "slfl.pl";
660       $PATH_SEPERATOR = ';';
661       $outfile        = "winmingw.set"; 
662       $COMPATH        = PathFormat('@COMPATH@/bin');
663       $COMPATH        =~ s/\/bin$//i;
664       $COM            = "GCC";
665       $CVER           = "C341";
666       $OUTPATH        = "wntgcci";
667       $INPATH         = $OUTPATH.$PROEXT;
668       $ATL_INCLUDE = '$SOLARVER'.$ds.'$INPATH'.$ds."inc".$ds."external".$ds."mingw".$ds."include".$ds."atl". " ".'$PSDK_HOME'.$ds."include".$ds."atl";
669   }
670   else # The MSVC section starts here
671   {   $outfile        = "winenv.set";
672       $COMPATH        = PathFormat('@COMPATH@');
673       $COM            = "MSC";
674       $OUTPATH        = "wntmsci@COMEX@";
675       $INPATH         = $OUTPATH.$PROEXT;
676       $COMEX          = '@COMEX@';
677       if ( "@COMEX@" eq "10" ) { # .NET 2003 needs M1310
678           $CVER        = "M1310";
679           $ATL_LIB     = $COMPATH.$ds."atlmfc".$ds."lib";
680           $ATL_INCLUDE = $COMPATH.$ds."atlmfc".$ds."include";
681           $MFC_LIB     = "";
682           $MFC_INCLUDE = "";
683       } elsif ( "@COMEX@" ge "11" ) { # .NET 2005 needs M1400
684           if ( "@COMEX@" eq "11" ) {
685               $CVER        = "M1400";
686           } elsif ( "@COMEX@" eq "12" ) {
687               $CVER        = "M1500";
688           } else {                   # Unsupported
689               die "Unsupported value for COMEX variable.\n";
690           }
691           if ( "@DISABLE_ACTIVEX@" ) {
692               $ATL_LIB     = $PSDK_HOME.$ds."lib"; # Doesn't exist for VSE
693               $ATL_INCLUDE = $PSDK_HOME.$ds."include".$ds."atl";
694               $MFC_LIB     = $PSDK_HOME.$ds."lib"; # Doesn't exist for VSE
695               $MFC_INCLUDE = $PSDK_HOME.$ds."include".$ds."mfc";
696           } else {
697               $ATL_LIB     = $COMPATH.$ds."atlmfc".$ds."lib";
698               $ATL_INCLUDE = $COMPATH.$ds."atlmfc".$ds."include";
699               $MFC_LIB     = $COMPATH.$ds."atlmfc".$ds."lib";
700               $MFC_INCLUDE = $PSDK_HOME.$ds."include".$ds."mfc";
701           }
702       }
703           print "Setting W32 build with bash shell specific values... ";
704           # No speacial treatment for CC an CXX anymore.
705           $FLIPCMD        = "slfl.pl";
706           $PATH_SEPERATOR = ';';
707   }
709 elsif ( $platform =~ m/os2/ ) 
711       $COMPATH        = PathFormat('@COMPATH@');
712       $MSPDB_PATH     = PathFormat('@MSPDB_PATH@');
713       $MIDL_PATH      = PathFormat('@MIDL_PATH@');
714       $CSC_PATH       = PathFormat('@CSC_PATH@');
715       $PSDK_HOME      = PathFormat('@PSDK_HOME@');
716       $FRAME_HOME     = PathFormat('@FRAME_HOME@');
717       $USE_NEW_SDK    = "TRUE";
718       $CPUNAME        = "INTEL";
719       $CPU            = "I";
720       $GUI            = "OS2";
721       $GUIBASE        = "os2";
722       $GVER           = "VCL";
723       $OS             = "OS2";
724       $DYNAMIC_CRT    = "TRUE";
725       $SET_EXCEPTIONS = "TRUE";
726       $use_shl_versions = "TRUE";
727   {
728       print "Setting OS/2 gcc 3.3.5 specific values... \n";
729       $outfile        = "os2env.set";
730       $COM            = "GCC";
731       $CVER           = "C300";
732       $OUTPATH        = "os2gcci";
733       $INPATH         = $OUTPATH.$PROEXT;
734       $COMEX          = '@COMEX@';
736   {   print "Setting OS/2 with 4OS2 specific values... ";
737       # Change path to lower case.
738       $COMPATH        = lc $COMPATH;
739       $PATH_SEPERATOR = ';';
740       $ps = ';';
741       $wps = ';'; # Windows style path seperator
742   }
744   }
746 elsif ( $platform =~ m/darwin/ ) 
747 {     print "Setting Mac OS X/Darwin specific values... ";
748       $BIG_SVX        = "TRUE";
749       $COM            = "GCC";
750       $COMPATH        = '@COMPATH@'; 
751       if ($platform =~ m/^i[3456]86/)
752       {
753           print "Setting values for Mac OS X/Darwin on x86... ";
754           $outfile        = "MacOSXX86Env.Set"; 
755           $CPU            = "I";
756           $CPUNAME        = "INTEL";
757           $OUTPATH        = "unxmacxi";
758       }
759       elsif ($platform =~ m/^powerpc/)
760       {
761           print "Setting values for Mac OS X/Darwin on PowerPC... ";
762           $outfile        = "MacOSXPPCEnv.Set"; 
763           $CPU            = "P";
764           $CPUNAME        = "POWERPC";
765           $OUTPATH        = "unxmacxp";
766       }
767       if (@GCCVER@ >= 30401) {
768           $CVER           = "C341";
769       } else {
770           $CVER           = "C300";
771       }
772       $GUI            = "UNX";
773       $GVER           = "VCL";
774       $INPATH         = $OUTPATH.$PROEXT;
775       $OS             = "MACOSX";
776       $PATH_SEPERATOR = $ps;
777       # GUIBASE is set below; may be "aqua" or "unx".
779 elsif ( $platform =~ m/aix/ )
781    if( $platform !~ m/^powerpc/ )
782    {
783         print "\nAIX has only been ported and tested on powerpc\n";
784         AddWarning( "set_soenv", "Platform $platform has not been tested");
785    }
786    print "Setting AIX PPC specific values... ";
787    $outfile        = "aixPPCEnv.Set"; 
788    $CPU            = "P";
789    $CPUNAME        = "POWERPC";
790    $OUTPATH        = "unxlngppc";
791    $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
792    $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."classic";
793    $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads";
794    $BIG_SVX        = "TRUE";
795    $COM            = "GCC";
796    $CVER           = "C300";
797    $COMPATH        = '@COMPATH@'; 
798    $GUI            = "UNX";
799    $GUIBASE        = "unx";
800    $GVER           = "VCL";
801    $INPATH         = $OUTPATH.$PROEXT;
802    $OS             = "AIX";
803    $PATH_SEPERATOR = $ps;
805 else {
806         print "\nset_soenv:  Cannot figure out what platform you are running\n";
807         print "For $platform.\n";
808         exit 1;
810 print "done\n";
813 # D. Gathering directory information from the user.
815 # If the directory does not exist something is strange.
816 # 1. OpenOffice.org build home directory.
817 chomp($SRC_ROOT  = `pwd`);
818 $SRC_ROOT =~ s/\/config_office//;
819 $SRC_ROOT = PathFormat($SRC_ROOT);
820 CheckPathExist( $SRC_ROOT );
823 #-----------------------------------------------------------------------------------------------------
824 # Copy top level makefile from config_office/ to $SRC_ROOT
825 #-----------------------------------------------------------------------------------------------------
826 if (! -e "makefile.rc")
827 {  AddWarning( "set_soenv", "makefile.rc not found in config_office/. Could not copy to SRC_ROOT." );
829 else
830 {  `cp -f makefile.rc $SRC_ROOT/makefile.mk`;
833 # 2. Java home directory.
834 # JAVA_HOME as argument from autoconf.
835 $JAVA_HOME = PathFormat('@JAVA_HOME@') ;
837 if ( $platform =~ m/cygwin|os2/ ) {
838    $JAVA_HOME =~ s/[\s\/]+$//;  # remove trailing \n or \/ if there is any.
840 # 3. shell path.
841 $OOO_SHELL = '@SHELLPATH@'."\/bash";
843 if ( '@STLPORT4@' eq $no_stl )
845    $STLPORT4 = "$no_stl";
848 # ml.exe assembler path for Windows users.
849 if ($platform =~ m/cygwin/)
850 {  $ASM_PATH = PathFormat('@ASM_HOME@');
853 # Check for prebuild mozab libraries if we don't build them # ourselves
854 # and we're also not using the external system mozilla installation.
856 # FIXME! This check should be done in configure and not here, but
857 # the $OS, $COM, $CPU variables are not yet present there.
859 if ( "@WITH_MOZILLA@" eq "YES" and "@BUILD_MOZAB@" ne "TRUE" and "@SYSTEM_MOZILLA@" ne "YES" )
860 {  print("\nChecking for prebuilt Mozilla libraries ...");
861    my $mozbinfile = $SRC_ROOT."/moz/zipped/";
862    if ( $^O eq 'MSWin32' ) {
863        chomp( $mozbinfile = qx{cygpath -d "$mozbinfile"} );
864    }
865    $mozbinfile .= $OS.$COM.$CPU;
866    if ( -e $mozbinfile."inc.zip"
867         and -e $mozbinfile."lib.zip"
868         and -e $mozbinfile."runtime.zip" )
869    {   print " found.\n";
870        $PREBUILD_MOZAB = "YES";
871    }
872    else
873    {   print " not found!\n\n";
874        print "If you don\'t use the system mozilla and also not build the needed\n";
875        print "mozilla libraries yourself you have to provide the needed files\n";
876        print "$OS$COM$CPU\{inc,lib,runtime\}.zip in moz/zipped/ .\n";
877        print "These files can be found here:\n";
878        print "  <http://tools.openoffice.org/moz_prebuild/680/>.\n\n";
879        die;
880    }
882 else
884    $PREBUILD_MOZAB = "";
888 # E. Determining the envionment values based on the information
889 #    that was gathered earlier on.
891 print "Setting the environment variables... ";
892 $USR                  = $ds."usr";
893 $ETC                  = $ds."etc";
894 $BIN                  = $ds."bin";
895 $LIB                  = $ds."lib";
896 $LIB64                = $ds."lib";
897 $LIB64               .= "64"
898 if ($platform =~ m/x86_64-.*-linux/);
899 $LIB64               .= "64" 
900 if (($platform =~ m/powerpc64-.*-linux/) && ('@SIZEOF_LONG@' eq '8'));
901 $LIB64               .= "64" 
902 if (($platform =~ m/s390x-.*-linux/) && ('@SIZEOF_LONG@' eq '8'));
903 $INC                  = $ds."inc";
904 $INCLUDE              = $ds."include";
905 $DEV                  = $ds."dev";
906 $OPT                  = $ds."opt";
907 $LOCAL                = $ds."local";
908 $SOLENV               = $ds."solenv";
909 $SOLVER               = $ds."solver";
910 $CONFIG               = $ds."config";
911 $USR_BIN              = $USR.$BIN;
912 $USR_LIB              = $USR.$LIB64;
913 $USR_LOCAL            = $USR.$ds."local";
914 $USR_CCS              = $USR.$ds."ccs";
915 $USR_OPENWIN          = $USR.$ds."openwin";
916 $USR_DT               = $USR.$ds."dt";
917 $COMMON_BUILD_TOOLS   = '$SRC_ROOT'.$ds."external".$ds."common";
919 # Generate alternate output file for sh?
920 $outfile_sh = $outfile.".sh";
922 if ($STLPORT4 ne $no_stl) {
923         $ps_STLPORT_LIB         = $ps.'$STLPORT4'.$LIB64;
924         $L_STLPORT_LIB          = $L.'$STLPORT4'.$LIB64;
925         $STLPORT_stlport        = $I.'$STLPORT4'.$ds.'stlport';
926         $STLPORT_inc_stlport    = $I.'$STLPORT4'.$ds.'include'.$ds.'stlport';
927 } else {
928         $ps_STLPORT_LIB         = "";
929         $L_STLPORT_LIB          = "";
930         $STLPORT_stlport        = $I.$SRC_ROOT.$SOLVER.$ds.$UPD.$ds.$INPATH.$INC.$ds."stl";
931         $STLPORT_inc_stlport    = "";
935 # Windows NT only variables
936 if ($platform =~ m/cygwin/)
937 {  
938    if ( $JAVA_HOME ne "" )
939    {
940       $JAVA_LIB             = $JAVA_HOME.$LIB;
941    }
942    # Import SystemDrive enviroment variable
943    use Env qw(SYSTEMDRIVE);
944    # Change $SYSTEMDRIVE to lower case.
945    $SYSTEMDRIVE          = lc $SYSTEMDRIVE;
946    use Env qw(SYSTEMROOT);
947    $CYGWIN_PATH          = PathFormat('@CYGWIN_PATH@'); # Windows bash path
948    $WIN_GREP             = '$CYGWIN_PATH'.$ds."grep.exe";
949    $WIN_FIND             = '$CYGWIN_PATH'.$ds."find.exe";
950    $WIN_LS               = '$CYGWIN_PATH'.$ds."ls.exe";
951    $WIN_GNUCOPY          = '$CYGWIN_PATH'.$ds."cp.exe";
952    $WIN_TOUCH            = '$CYGWIN_PATH'.$ds."touch.exe";
955 if ( $JAVA_HOME ne "" )
957    $JAVA_BIN             = $JAVA_HOME.$BIN;
958    $JAVA_INCLUDE         = $JAVA_HOME.$ds."include";
962 $PERL                 = PathFormat('@PERL@'); # Perl program
963 $PERL_PATH            = dirname('@PERL@'); # Perl Path 
964 $XLIB                 = PathFormat('@XLIB@'); # X11 libraries
965 $XINC                 = PathFormat('@XINC@'); # X11 includes
968 # Mac OS X/Darwin only variables.
969 if ( $platform =~ m/darwin/ )
970 {  $FRAMEWORKSHOME       = $ds."System".$ds."Library".$ds."Frameworks";
971    if ( $XLIB eq "no_x_libraries" ) {
972       $GUIBASE  = "aqua";
973    } else {
974       $GUIBASE  = "unx";
975    }
978 # The project's workstamp.
979 $WORK_STAMP            = "@SOURCEVERSION@";
980 # Location of the source.
981 $SOLARSRC             = '$SRC_ROOT';
982 # Location of the repository.
983 my @splitlist = split( /\//, $SRC_ROOT );
984 pop @splitlist;
985 $SOURCE_ROOT_DIR      = join("/", @splitlist);
987 # default TARFILE_LOCATION
988 if ('@TARFILE_LOCATION@' eq "DEFAULT")
989 {       $TARFILE_LOCATION="$SOURCE_ROOT_DIR/ext_sources";
993 $DEVROOT              = '$SRC_ROOT';
994 # Set solenv and solver to given or default values. 
995 # Location of the solenv tree.
996 if ('@LOCAL_SOLENV@' eq "DEFAULT")
997 {  $SOLARENV          = $SRC_ROOT.$SOLENV;
999 else
1000 {  $SOLARENV          =  PathFormat('@LOCAL_SOLENV@');
1002 # Location of the solver tree.
1003 if ('@LOCAL_SOLVER@' eq "DEFAULT")
1004 {  $SOLARVER          = $SRC_ROOT.$SOLVER.$ds.$UPD;
1006 else
1007 {  $SOLARVER          = PathFormat('@LOCAL_SOLVER@').$ds.$UPD;
1009 #Location of Solar version.
1010 $SOLARVERSION         = '$SOLARVER';
1012 $SOLARENVINC          = '$SOLARENV'.$INC;
1013 # Location of 
1014 $LOCALINI             = '$SOLARENV'.$CONFIG;
1015 # Location of 
1016 $STAR_INIROOT         = '$SOLARENV'.$CONFIG;
1017 # Location of 
1018 $STAR_INIROOTOLD      = '$SOLARENV'.$CONFIG;
1019 # Location of 
1020 $STAR_STANDLST        = '$SOLARENV'.$CONFIG.$ds."stand.lst";
1021 # Location of 
1022 $STAR_SSCOMMON        = '$SOLARENV'.$CONFIG.$ds."ssolar.cmn";
1023 # Location of 
1024 $STAR_SSOLARINI       = '$SOLARENV'.$CONFIG.$ds."ssolar.ini";
1025 # Location of dmake resource. 
1026 $DMAKEROOT            = '$SOLARENVINC'.$ds."startup";
1027 # Location of JDK classes .zip file.
1028 # but in jdk 1.2 it is called rt.jar and it lives in jre/lib
1029 $CLASSPATH            = '$JAVA_HOME'.$ds.'jre'.$LIB.$ds."rt.jar".$wps.'.';
1030 # Location of the JDK supported standard classes.zip file.
1031 # see above for why the change
1032 $XCLASSPATH           = '$JAVA_HOME'.$ds.'jre'.$LIB.$ds."rt.jar".$wps.'.';
1034 # Location used by the linker to create libraries.
1035 if ($platform =~ m/solaris/) 
1036 {  $SOLAREXTRALIB     = $L.$par_dir.$LIB.
1037                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$ds."lib.solaris.2.6".
1038                         $L.$LIB.
1039                         $L.$USR.$LIB.
1040                         $L.$USR.$LOCAL.$LIB.
1041                         $L.$USR_DT.$LIB.
1042                         $L.$USR_OPENWIN.$LIB;
1044 elsif ($platform =~ m/linux|netbsd|osf1|freebsd|aix/)
1046    $SOLAREXTRALIB     = $L.$par_dir.$LIB64;
1048 elsif ($platform =~ m/darwin/) 
1049 {  $SOLAREXTRALIB     = $L.$LIB.
1050                         $L.$USR.$LIB;
1052 elsif ($platform !~ m/cygwin|os2/ )
1053 {  AddWarning( "set_soenv", "$platform not configured for linkage create libraries" );
1056 # Windows NT only variables
1057 if ($platform =~ m/cygwin|os2/)
1058 {  $COMP_ENV          = $OUTPATH;
1060    $JAVAHOME          = '$JAVA_HOME';
1062    $ILIB             = $cur_dir;
1064    if ($STLPORT4 ne $no_stl) {
1065        $ILIB      .=   $wps.$STLPORT4.$LIB64;
1066    }
1068    # Mingw is different
1069    if ( $COM eq "MSC" )
1070    {  $ILIB       .=    $wps.$SOLARVER.$ds.$INPATH.$LIB.
1071                         $wps.$JAVA_HOME.$LIB.
1072                         $wps.$PSDK_HOME.$LIB.
1073                         $wps.$FRAME_HOME.$LIB.
1074                         $wps.$COMPATH.$LIB;
1075       if ( '@ENABLE_DIRECTX@' ne "" ) {
1076           $ILIB   .= $wps.$DIRECTXSDK_LIB;
1077           if ( '@COMEX@' eq "10" ) {
1078               # .NET2003 provides and compiles against DirectX 5 libraries and is
1079               # hereby still Win9x compatible.
1080               $ILIB .= $wps.'$COMPATH'.$ds.'PlatformSDK'.$LIB;
1081               $USE_DIRECTX5 = "YES";
1082           }
1083       }
1084       # ILIB needs to use '\' directory seperators;
1085       $ILIB = WinPath( $ILIB, ";" );
1086    }
1087    elsif ( $COM eq "GCC" )
1088    {  $ILIB       .=    $wps.$SOLARVER.$ds.$INPATH.$LIB.
1089                         $wps.$SOLARVER.$ds.$INPATH.$BIN.
1090                         $wps.$JAVA_HOME.$LIB;
1091       if ( $USE_MINGW eq "cygwin" )
1092       {  $ILIB    .= $wps.PathFormat($USR.$LIB.$ds."mingw").
1093                      $wps.PathFormat($USR.$LIB.$ds."w32api");
1094       }
1095       else
1096       {  $ILIB       .= $wps.$COMPATH.$LIB;
1097       }
1098       $ILIB       .= $wps.PathFormat("@MINGW_CLIB_DIR@").
1099                      $wps.$PSDK_HOME.$LIB;
1100       if ( '@ENABLE_DIRETX@' )
1101       {   $ILIB   .= $wps.PathFormat("@DIRECTXSDK_LIB@");
1102       }
1103    }
1105    $JAVAHOME          = '$JAVA_HOME';
1108      
1109 # The general environment path.
1110 if ($platform =~ m/linux|netbsd|odf1|freebsd|aix|solaris/)
1111 {  $PATH              = $cur_dir.
1112 #                        $ps.'$SOLARVER'.$ds.'$INPATH'.$BIN.
1113                         $ps.'$SOLARENV'.$ds.'$OUTPATH'.$BIN.
1114                         $ps.'$SOLARENV'.$BIN;
1116    if ($platform =~ m/solaris/) {
1117         $PATH .= $ps.$USR_CCS.$BIN;
1118    }
1120    $PATH             .= $ps.$oldPATH;
1122    my @javaBits;
1123    if (( $JAVA_HOME ne "" ) && ( $JDK ne "gcj" )) {
1124       @javaBits = ( '$JAVA_HOME'.$BIN, 'javac' );
1125    } else {
1126       @javaBits = (); 
1127    }
1128    $PATH              = GetCorrectPath ($PATH,
1129                                         $COMPATH, $CC,
1130                                         $PERL_PATH, 'perl',
1131                                         @javaBits);
1134 elsif ($platform =~ m/cygwin/)
1135 {  # The PATH variable is completely created from scratch. Elements
1136    # from oldPATH that are not yet included are appended to PATH at
1137    # the end.
1139    my ( $tmppath );
1141    $PATH              = $cur_dir.
1142 #                        $ps.CygFormat($SOLARVER).$ds.$INPATH.$BIN.
1143                         $ps.CygFormat($SOLARENV).$ds."bin".
1144                         $ps.CygFormat($SOLARENV).$ds.$OUTPATH.$BIN;
1146    if ( $JAVA_HOME ne "" )
1147    {
1148       # hack either "hotspot" or "client" should be used, depending on the jdk version:
1149       # 1.2.x   -   no such directory, unsupported 
1150       # 1.3.x   -   hotspot, client missing
1151       # 1.4.x   -   client, hotspot missing
1152       
1153       $PATH .= $ps.CygFormat($JAVA_HOME).$BIN;
1154           if ( -d $JAVA_HOME.$ds."jre".$ds."bin".$ds."hotspot" ) {
1155                   $PATH .= $ps.CygFormat($JAVA_HOME).$ds."jre".$ds."bin".$ds."hotspot";
1156           }
1157           if ( -d $JAVA_HOME.$ds."jre".$ds."bin".$ds."client" ) {
1158                   $PATH .= $ps.CygFormat($JAVA_HOME).$ds."jre".$ds."bin".$ds."client";
1159           }
1160    }
1162    # Add path to compiler
1163    $tmppath = CygFormat($COMPATH).$BIN;
1164    $tmppath =~ s/^\/\//\//;
1165    $PATH .= $ps.$tmppath;
1167    if ( $COM eq "MSC" ) {
1168        $tmppath = CygFormat($MSPDB_PATH);
1169            # for .NET to find mspdb71.dll (needed by CL.EXE C/C++ Compiler)
1170            if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1171                    $PATH .= $ps.$tmppath;
1172            }
1173            if ( ( $COMEX ge "10" ) ) {
1174                    # .NET needs midl.exe
1175                $tmppath = CygFormat($MIDL_PATH);
1176                    if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1177                            $PATH .= $ps.$tmppath;
1178                    }
1179                    # .NET needs csc.exe
1180                $tmppath = CygFormat($CSC_PATH);
1181                    if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1182                            $PATH .= $ps.$tmppath;
1183                    }
1184                    # Native installer needs some files if the Windows Installer SDK
1185                $tmppath = CygFormat($PSDK_HOME);
1186                    if ( $PATH !~ /(?:[:]|\A)(?:$tmppath\/bin)(?:[:]|\Z)/i ) {
1187                            $PATH .= $ps.$tmppath.$BIN;
1188                    }
1189            }
1190    } else { # Mingw is different
1191            # Native installer needs some files if the Windows Installer SDK
1192                $tmppath = CygFormat($PSDK_HOME);
1193            if ( $PATH !~ /(?:[:]|\A)(?:$tmppath\/bin)(?:[:]|\Z)/i ) {
1194                    $PATH .= $ps.$tmppath.$BIN;
1195            }
1196    }
1198    if ( $ASM_PATH ne "ASM_IN_PATH" )
1199    {   $PATH          .= $ps.CygFormat($ASM_PATH);
1200    } 
1201    # zip.exe / unzip.exe path for Windows users.
1202    my $zip_home_path = PathFormat('@ZIP_HOME@');
1203    $tmppath = CygFormat($zip_home_path);
1204    if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1205        $PATH          .= $ps.$tmppath;
1206    }
1208    # Possible cygwin paths must follow behind the OOo and MS paths
1210    # Check if $PERL_PATH is already set in PATH
1211    $tmppath = CygFormat($PERL_PATH);
1212    if ( ! ( $PATH =~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) )
1213    {
1214       $PATH          .= $ps.$tmppath;
1215    }
1216    # Check if $CYGWIN_PATH is already set in PATH
1217    $tmppath = CygFormat($CYGWIN_PATH);
1218    if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1219       $PATH           .= $ps.$tmppath;
1220    }
1221    $PATH              .= $ps_STLPORT_LIB;
1222    # nsis path for Windows users.
1223    $NSIS_PATH = PathFormat('@NSIS_PATH@');
1224    $tmppath = CygFormat($NSIS_PATH);
1225    if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1226        $PATH          .= $ps.$tmppath;
1227    }
1228    # path to sn.exe (signing) for Windows users.
1229    my $sn_path = PathFormat('@FRAME_HOME@/bin');
1230    $tmppath = CygFormat($sn_path);
1231    if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1232        $PATH          .= $ps.$tmppath;
1233    }
1236    # Add the rest of the original path if it is still missing.
1237    if (($^O eq "cygwin")) { # Not for ActiveState perl
1238        my $expandedPATH = $PATH;
1239        $expandedPATH =~ s/(\$\w+)/$1/eeg;
1241        # fix situations where PATH may look like /bin:"C:\blah\bleh":/ugh
1242        my $fixedPATH = $oldPATH;
1243        if ( $oldPATH =~ /"/ ) {
1244            $fixedPATH = "";
1245            foreach my $pathentry ( split( '"',$oldPATH ) ) {
1246                if ( ( $pathentry =~ /^$ps/ ) || ( $pathentry =~ /$ps$/ ) ) {
1247                    $fixedPATH .= $pathentry;
1248                } else {
1249                    chomp( $pathentry = qx{cygpath -d "$pathentry"} ) ;
1250                    chomp( $pathentry = qx{cygpath -u "$pathentry"} ) ;
1251                    $fixedPATH .= $pathentry;
1252                }
1253            }
1254        }
1256        foreach my $pathentry (split($ps,$fixedPATH)) {
1257            if ( ! ( $expandedPATH =~ /(?:$ps|\A)(?:$pathentry)(?:$ps|\Z)/ ) ) {
1258                $PATH .= $ps.$pathentry;
1259                $expandedPATH .= $ps.$pathentry;
1260            }
1261        }
1262    } else {
1263        $PATH          .= $ps.$oldPATH;
1264    }
1266    # The path now is in cygwin posix format
1270 elsif ($platform =~ m/os2/)
1271 {  # The PATH variable is completely created from scratch. Everything that is not
1272    # needed is appended to the end.
1274    $PATH              = $cur_dir.
1275 #                        $ps.'$SOLARVER'.$ds.'$INPATH'.$BIN.
1276                         $ps.'$SOLARENV'.$ds."bin".
1277                         $ps.'$SOLARENV'.$ds.'$OUTPATH'.$BIN;
1279    if ( $JAVA_HOME ne "" )
1280    {
1281       # hack either "hotspot" or "client" should be used, depending on the jdk version:
1282       # 1.2.x   -   no such directory, unsupported 
1283       # 1.3.x   -   hotspot, client missing
1284       # 1.4.x   -   client, hotspot missing
1285       
1286       $PATH .= $ps.$JAVA_HOME.$BIN;
1287           if ( -d $JAVA_HOME.$ds."jre".$ds."bin".$ds."hotspot" ) {
1288                   $PATH .= $ps.$JAVA_HOME.$ds."jre".$ds."bin".$ds."hotspot";
1289           }
1290           if ( -d $JAVA_HOME.$ds."jre".$ds."bin".$ds."client" ) {
1291                   $PATH .= $ps.$JAVA_HOME.$ds."jre".$ds."bin".$ds."client";
1292           }
1293    }
1295   # Append old PATH
1296   my $temp = $oldPATH;
1297   $temp =~ s/\\/\//g ;
1298   $PATH             .= $ps.$temp;
1301 elsif ($platform =~ m/darwin/)
1302 {  $PATH              = $cur_dir.
1303 #                        $ps.'$SOLARVER'.$ds.'$INPATH'.$BIN.
1304                         $ps.'$SOLARENV'.$ds.'$OUTPATH'.$BIN.
1305                         $ps.'$SOLARENV'.$BIN;
1307   # Append old PATH
1308   $PATH             .= $ps.$oldPATH;
1310 else
1311 {  AddWarning( "set_soenv", "$platform not configured for general environment paths" );
1314 # Linker library search directory paths. 
1315 if ($platform =~ m/solaris/) 
1316 {  $SOLARLIB          = $L.$par_dir.$LIB.
1317                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB.
1318                         $L.'$SOLARVER'.$ds.'$INPATH'.$LIB.
1319                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB.
1320                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB."solaris.2.6".
1321                         $L.$LIB.
1322                         $L.$USR_LIB;
1323    if ( $CC =~ "gcc" ) {
1324       $SOLARLIB      .= $L.$COMPATH.$LIB;
1325    }
1326    $SOLARLIB         .= $L.$USR_LOCAL.$LIB.
1327                         $L.$USR_DT.$LIB.
1328                         $L.$USR_OPENWIN.$LIB.
1329                         $L.'$JAVA_HOME'.$LIB.
1330                         $L.$JRELIBDIR.
1331                         $L.$JRETOOLKITDIR.
1332                         $L.$JRETHREADDIR.
1333                         $L_STLPORT_LIB.
1334                         $L.$XLIB;
1336 elsif ($platform =~ m/linux|netbasd|osf1|aix|freebsd/)
1337 {  $SOLARLIB          = $L.$par_dir.$LIB.
1338                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB.
1339                         $L.'$SOLARVER'.$ds.'$INPATH'.$LIB.
1340                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB.
1341                         $L.'$JAVA_HOME'.$LIB64.
1342                         $L.$JRELIBDIR.
1343                         $L.$JRETOOLKITDIR.
1344                         $L.$JRETHREADDIR.
1345                         $L_STLPORT_LIB.
1346                         $L.$XLIB;
1348 elsif ($platform =~ m/cygwin|os2/)
1349 {  $SOLARLIB          = $L.'$SOLARVER'.$ds.'$INPATH'.$LIB.
1350                         $L.$par_dir.$LIB.
1351                         $L_STLPORT_LIB.
1352                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB;
1354 elsif ($platform =~ m/darwin/) 
1355 {  $SOLARLIB          = $L.'$SOLARVER'.$ds.'$INPATH'.$LIB.
1356                         $L_STLPORT_LIB.
1357                         $L.$USR_LIB;
1358     # [ed] 6/15/02 Add in X11 libraries onto the library path
1359     if ($GUIBASE eq "unx") {
1360        $SOLARLIB      .= $L.$XLIB;
1361     }
1365 if ($SYSTEM_MOZILLA eq "YES")
1367        $SOLARLIB .= $L."@MOZ_LIB@"
1370 # Location of the compiler include search directory paths.
1371 $SOLARINC             = $I.$cur_dir.
1372                         $I.'$SOLARVER'.$ds.'$INPATH'.$INC.$ds."stl".
1373                         $I.'$SOLARVER'.$ds.'$INPATH'.$INC.$ds."external".
1374                         $I.'$SOLARVER'.$ds.'$INPATH'.$INC.
1375                         $I.'$SOLARENV'.$ds.'$OUTPATH'.$INC.
1376                         $I.'$SOLARENV'.$INC.
1377                         $I.'$SRC_ROOT'.$ds."res";
1379 if ($platform =~ m/solaris|linux|osf1|freebsd|netbsd/)
1381 $SOLARINC            .= $STLPORT_stlport;
1382 if ($platform =~ m/linux|freebsd|netbsd/)
1384 # This simply adds an include path, so even cases that break the FHS work
1385 $SOLARINC            .= $STLPORT_inc_stlport;
1387 if ($platform =~ m/solaris/ && ! $CC =~ "gcc")
1389 $SOLARINC            .= '/SC5 ';
1391 # Platform dependent include path at the top of this list of include paths
1392 if ($platform =~ m/solaris/)
1393 {   
1394     $SOLARINC         .= $I.$COMPATH.$ds."include";
1396 if ($platform =~ m/linux/)
1398 # This simply adds an include path, so even cases that break the FHS work
1399    $SOLARINC         .= $STLPORT_inc_stlport;
1403         $SOLARINC      .= $I.'$SOLARENV'.$INC.$ds."Xp31".
1404                      $I.'$JAVA_HOME'.$INCLUDE;
1406         #include system dependent Java include directory
1407         if (!($JDK eq "gcj"))
1408         {
1409                 if ($platform =~ m/solaris/)
1410                 {  $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."solaris";
1411                 }
1412                 elsif  ($platform =~ m/linux|osf1/)
1413                 {  $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."linux";
1414                 }
1415                 elsif ($platform =~ m/freebsd/)
1416                 {
1417                 $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."freebsd";
1418                 $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."bsd";
1419                 $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."linux";
1420                 }
1421                 elsif ($platform =~ m/netbsd/)
1422                 {  $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."netbsd";
1423                 }
1425                 #java threads include path
1427                 $SOLARINC .=$I.'$JAVA_HOME'.$INCLUDE.$ds."native_threads".$ds."include";
1428         }
1429     #The tail, if needed
1430     if ($platform =~ m/linux|freebsd|netbsd/)
1431     {  $SOLARINC  .= $I.$XINC;
1432     }
1433     elsif ($platform =~ m/osf1/)
1434     {  $SOLARINC  .= $I.$XINC.
1435                      $I.$USR.$INCLUDE;
1436     }
1438 elsif ($platform =~ m/cygwin/)
1439 {  $SOLARINC         .= $STLPORT_stlport.
1440                         $I.'$JAVA_HOME'.$ds."include".$ds."win32".
1441                         $I.'$JAVA_HOME'.$ds."include";
1442    # Mingw is different
1443    if ( $COM eq "MSC" )
1444    {  $SOLARINC       .= $I.'$PSDK_HOME'.$INCLUDE.
1445                          $I.'$COMPATH'.$ds."include";
1446       if ( '@ENABLE_DIRECTX@' ne "" ) {
1447           $SOLARINC   .= $I.PathFormat('@DIRECTXSDK_HOME@').$INCLUDE;
1448           if ( '@COMEX@' eq "10" ) {
1449               # .NET2003 provides and compiles against DirectX 5 libraries and is
1450               # hereby still Win9x compatible.
1451               $SOLARINC .= $I.'$COMPATH'.$ds.'PlatformSDK'.$ds."include";
1452           }
1453       }
1454    }
1455    elsif ( $COM eq "GCC" )
1456    {  $SOLARINC       .= $I.'$SOLARVER'.$ds.'$INPATH'.$INC.$ds."external".$ds."mingw".$ds."include";
1457      if ( $USE_MINGW eq "cygwin" )
1458      {  $SOLARINC    .= $I.PathFormat($USR.$ds."include".$ds."mingw").
1459                         $I.PathFormat($USR.$ds."include".$ds."w32api").
1460                         $I.PathFormat($USR.$ds."include"); }
1461      else
1462      {  $SOLARINC    .= $I.'$COMPATH'.$ds."include"; }
1463      @mingw_lib_include_paths = split( / /, "@MINGW_LIB_INCLUDE_PATH@" );
1464      $SOLARINC .= $I.PathFormat("@MINGW_BACKWARD_INCLUDE_PATH@");
1465      foreach $mingw_lib_include_path (@mingw_lib_include_paths)
1466        {   chomp $mingw_lib_include_path;
1467            if ( $mingw_lib_include_path ne $COMPATH.$ds."include" && $mingw_lib_include_path ne "" )
1468            {
1469               $SOLARINC   .= $I.PathFormat($mingw_lib_include_path);
1470            }
1471        }
1472      $SOLARINC .= $I.PathFormat("@GXX_INCLUDE_PATH@").$I.PathFormat("@GXX_INCLUDE_PATH@".$ds."mingw32").
1473                   $I.'$PSDK_HOME'.$INCLUDE;
1474    }
1475    if ( '@ENABLE_DIRECTX@' ne "" ) {
1476        $SOLARINC   .= $I.PathFormat('@DIRECTXSDK_HOME@').$INCLUDE;
1477    }
1479 elsif ($platform =~ m/darwin/)
1480 {  $SOLARINC         .= $STLPORT_stlport.
1481                                                 $I.$FRAMEWORKSHOME.$ds."JavaVM.framework".$ds."Versions".$ds."Current".$ds."Headers".
1482                         $I.$FRAMEWORKSHOME.$ds."JavaVM.framework".$ds."Headers";
1483    # [ed] 6/15/02 Add in X11 headers as appropriate for the build
1484    if ($GUIBASE eq "unx") {
1485       $SOLARINC      .= $I.$XINC.
1486                         $I.$XINC.$ds."freetype2";
1487    }
1489 else
1490 {  AddWarning( "set_soenv", "$platform not configured for system dependant include dir" );
1494 print "done\n";
1497 # F. Setting the different aliases.
1499 print "Setting the aliases... ";
1500 # 1. alias for a full product make. 
1501         $mkout           = '"perl $SOLARENV/bin/mkout.pl"';
1502         $deliver         = '"perl $SOLARENV/bin/deliver.pl"';
1503         $build           = '"perl $SOLARENV/bin/build.pl"';
1504         $build_client    = '"perl $SOLARENV/bin/build_client.pl"';
1505         $zipdep          = '"perl $SOLARENV/bin/zipdep.pl"';
1506 # 3. alias for a full product make
1507 $nmake           = '"dmake"';
1508 print "done\n";
1510 #--------------------------
1511 # VI. Open the output file.
1512 #--------------------------
1514 open( OUT, ">$outfile" ) ||
1515    die "Cannot open $outfile: $!\n";
1517 # Create sh environment file
1518 open( OUT_SH, ">$outfile_sh" ) ||
1519   die "Cannot open $outfile_sh: $!\n";
1522 #------------------------------------------
1523 # VII. Writing the data to the output file.
1524 #------------------------------------------
1526 # Write file header.
1527 CreateFileHeader( *OUT, $UPD, $platform, "(t)csh", "#" );
1528 CreateFileHeader( *OUT_SH, $UPD, $platform, "sh/bash/ksh", "#" );
1530 ToFile( "SRC_ROOT",          $SRC_ROOT,          "e" );
1531 ToFile( "OOO_SHELL",         $OOO_SHELL,         "e" );
1532 ToFile( "JAVA_HOME",         $JAVA_HOME,         "e" );
1533 ToFile( "ANT_HOME",          PathFormat("@ANT_HOME@"), "e" );
1534 ToFile( "ANT_LIB",           PathFormat("@ANT_LIB@"), "e" );
1535 ToFile( "ANT",               PathFormat("@ANT@"), "e" );
1536 ToFile( "JDKLIB",            $JAVA_LIB,          "e" );
1537 ToFile( "STLPORT4",          $STLPORT4,          "e" );
1538 ToFile( "STLPORT_VER",       "@STLPORT_VER@",    "e" );
1539 ToFile( "ASM_PATH",          $ASM_PATH,          "e" );
1540 ToFile( "BUILD_SOSL",        $BUILD_SOSL,        "e" );
1541 ToFile( "FRAMEWORKSHOME",    $FRAMEWORKSHOME,    "e" );
1542 ToFile( "Empty",             $empty,             "n" );
1545 # Writing the platform independent constant values to file.
1546 # (c = comment, e = environment variable, a = alias )
1547 ToFile( "Platform independent constant values.", $empty, "c" );
1548 # dictionaries
1549 if ('@WITH_DICT@' =~ m/ALL,/s)
1551    foreach $dict (@DICTIONARIES)
1552    {
1553       ToFile( "DIC_$dict",     "TRUE",          "e" );
1554    }
1555    ToFile( "DIC_ALL",          "TRUE",          "e" );
1557 else
1558 {       
1559    foreach $dict (@DICTIONARIES)
1560    {   if ('@WITH_DICT@' =~ m/$dict,/s)
1561        {   my $val="TRUE";
1562            ToFile( "DIC_$dict",     $val,          "e" );
1563        }
1564        else
1565        {   my $val;
1566            undef $val;
1567            ToFile( "DIC_$dict",     $val,          "e" );
1568        }
1569    }
1571 # Languages
1572 ToFile( "WITH_LANG",         "@WITH_LANG@",      "e" );
1573 ToFile( "INTRO_BITMAPS",     "@INTRO_BITMAPS@",  "e" );
1574 ToFile( "ABOUT_BITMAPS",     "@ABOUT_BITMAPS@",  "e" );
1575 ToFile( "OOO_VENDOR",        "@OOO_VENDOR@",     "e" );
1576 ToFile( "OOODMAKEMODE",      "YES",              "e" );
1577 ToFile( "WITH_POOR_HELP_LOCALIZATIONS", "@WITH_POOR_HELP_LOCALIZATIONS@", "e" );
1579 ToFile( "CALL_CDECL",        $CALL_CDECL,        "e" );
1580 ToFile( "COMMON_OUTDIR",     $COMMON_OUTDIR,     "e" );
1581 ToFile( "common_build",      $common_build,      "e" );
1582 ToFile( "BMP_WRITES_FLAG",   $BMP_WRITES_FLAG,   "e" );
1583 ToFile( "BUILD_SOSL_RELEASE", $BUILD_SOSL_RELEASE, "e" );
1584 ToFile( "NO_REC_RES",        $NO_REC_RES,        "e" );
1585 ToFile( "SO3",               $SO3,               "e" );
1586 ToFile( "SOLAR_PLUGIN",      $SOLAR_PLUGIN,      "e" );
1587 ToFile( "UPDATER",           $UPDATER,           "e" );
1588 ToFile( "build_deliver",     $BUILD_DELIVER,     "e" );
1589 ToFile( "VCL",               $VCL,               "e" );
1590 ToFile( "ENABLEUNICODE",     $ENABLEUNICODE,     "e" );
1591 ToFile( "NEW_JAR_PACK",      $NEW_JAR_PACK,      "e" );
1592 ToFile( "NO_BSYMBOLIC",      $NO_BSYMBOLIC,      "e" );
1593 ToFile( "TF_FILTER",         "TRUE",             "e" );
1594 if ("@ENABLE_DEBUG@" eq "TRUE") {
1595 ToFile( "debug",             "true",             "e" );
1597 if ("@ENABLE_WERROR@" eq "FALSE") {
1598 ToFile( "EXTERNAL_WARNINGS_NOT_ERRORS", "TRUE",  "e" );
1600 ToFile( "PRODUCT",           "@PRODUCT@",        "e" );
1601 ToFile( "PROFULLSWITCH",     "@PROFULLSWITCH@",  "e" );
1602 ToFile( "PROEXT",            $PROEXT,            "e" );
1603 ToFile( "UNIXWRAPPERNAME",   "@UNIXWRAPPERNAME@","e" );
1604 ToFile( "BUILD_MOZAB",       "@BUILD_MOZAB@",    "e" );
1605 ToFile( "PREBUILD_MOZAB",    $PREBUILD_MOZAB,    "e" );
1606 ToFile( "MOZILLA_VERSION",   $MOZILLA_VERSION,   "e" );
1607 ToFile( "DEFAULT_MOZILLA_TOOLKIT", $MOZILLA_TOOLKIT, "e" );
1608 ToFile( "ENABLE_NSS_MODULE",  "@ENABLE_NSS_MODULE@", "e" );
1609 ToFile( "MOZILLABUILD",  "@MOZILLABUILD@", "e" );
1610 ToFile( "BUILD_VER_STRING",  "@BUILD_VER_STRING@", "e" );
1611 ToFile( "ENABLE_VBA",  "@ENABLE_VBA@", "e" );
1612 ToFile( "VBA_EXTENSION",  "@VBA_EXTENSION@", "e" );
1613 if ($platform =~ m/linux/ && $platform =~ m/powerpc/) {
1614 ToFile( "JITC_PROCESSOR_TYPE","6",                 "e" );
1616 ToFile( "DEFAULT_TO_ENGLISH_FOR_PACKING",  "yes", "e" );
1617 ToFile( "ENABLE_GTK",        "@ENABLE_GTK@",       "e" );
1618 ToFile( "GTK_CFLAGS",        "@GTK_CFLAGS@",       "e" );
1619 ToFile( "GTK_LIBS",          "@GTK_LIBS@",         "e" );
1620 ToFile( "ENABLE_SYSTRAY_GTK", "@ENABLE_SYSTRAY_GTK@", "e" );
1621 ToFile( "ENABLE_STATIC_GTK", "@ENABLE_STATIC_GTK@", "e" );
1622 ToFile( "ENABLE_CAIRO",      "@ENABLE_CAIRO@",     "e" );
1623 ToFile( "ENABLE_OPENGL",     "@ENABLE_OPENGL@",    "e" );
1624 ToFile( "ENABLE_PDFIMPORT",  "@ENABLE_PDFIMPORT@", "e" );
1625 ToFile( "ENABLE_PRESENTER_EXTRA_UI","@ENABLE_PRESENTER_EXTRA_UI@","e" );
1626 ToFile( "ENABLE_MINIMIZER",   "@ENABLE_MINIMIZER@","e" );
1627 ToFile( "ENABLE_PRESENTER_SCREEN","@ENABLE_PRESENTER_SCREEN@","e" );
1628 ToFile( "ENABLE_REPORTBUILDER","@ENABLE_REPORTBUILDER@","e" );
1629 ToFile( "SYSTEM_JFREEREPORT","@SYSTEM_JFREEREPORT@","e" );
1630 ToFile( "OOO_JUNIT_JAR",     "@OOO_JUNIT_JAR@",    "e" );
1631 ToFile( "SAC_JAR",           "@SAC_JAR@",          "e" );
1632 ToFile( "LIBXML_JAR",        "@LIBXML_JAR@",       "e" );
1633 ToFile( "FLUTE_JAR",         "@FLUTE_JAR@",        "e" );
1634 ToFile( "JFREEREPORT_JAR",   "@JFREEREPORT_JAR@",  "e" );
1635 ToFile( "LIBLAYOUT_JAR",     "@LIBLAYOUT_JAR@",    "e" );
1636 ToFile( "LIBLOADER_JAR",     "@LIBLOADER_JAR@",    "e" );
1637 ToFile( "LIBFORMULA_JAR",    "@LIBFORMULA_JAR@",   "e" );
1638 ToFile( "LIBREPOSITORY_JAR", "@LIBREPOSITORY_JAR@","e" );
1639 ToFile( "LIBBASE_JAR",       "@LIBBASE_JAR@",      "e" );
1640 ToFile( "LIBFONTS_JAR",      "@LIBFONTS_JAR@",     "e" );
1641 ToFile( "LIBSERIALIZER_JAR", "@LIBSERIALIZER_JAR@","e" );
1642 ToFile( "ENABLE_MEDIAWIKI",  "@ENABLE_MEDIAWIKI@", "e" );
1643 ToFile( "SYSTEM_APACHE_COMMONS","@SYSTEM_APACHE_COMMONS@","e" );
1644 ToFile( "COMMONS_CODEC_JAR", "@COMMONS_CODEC_JAR@","e" );
1645 ToFile( "COMMONS_LANG_JAR",  "@COMMONS_LANG_JAR@", "e" );
1646 ToFile( "COMMONS_HTTPCLIENT_JAR","@COMMONS_HTTPCLIENT_JAR@","e" );
1647 ToFile( "COMMONS_LOGGING_JAR","@COMMONS_LOGGING_JAR@","e" );
1648 ToFile( "SYSTEM_SERVLETAPI", "@SYSTEM_SERVLETAPI@", "e" );
1649 ToFile( "SERVLETAPI_JAR",    "@SERVLETAPI_JAR@",   "e" );
1650 ToFile( "ENABLE_DBUS",       "@ENABLE_DBUS@",      "e" );
1651 ToFile( "ENABLE_GCONF",      "@ENABLE_GCONF@",     "e" );
1652 ToFile( "ENABLE_GNOMEVFS",   "@ENABLE_GNOMEVFS@",  "e" );
1653 ToFile( "ENABLE_GIO",        "@ENABLE_GIO@",       "e" );
1654 ToFile( "ENABLE_KDE",        "@ENABLE_KDE@",       "e" );
1655 ToFile( "KDE_CFLAGS",        "@KDE_CFLAGS@",       "e" );
1656 ToFile( "KDE_LIBS",          "@KDE_LIBS@",         "e" );
1657 ToFile( "MOC",               "@MOC@",              "e" );
1658 ToFile( "ENABLE_KDE4",       "@ENABLE_KDE4@",      "e" );
1659 ToFile( "KDE4_CFLAGS",       "@KDE4_CFLAGS@",      "e" );
1660 ToFile( "KDE4_LIBS",         "@KDE4_LIBS@",        "e" );
1661 ToFile( "MOC4",              "@MOC4@",             "e" );
1662 ToFile( "ENABLE_KAB",        "@ENABLE_KAB@",       "e" );
1663 ToFile( "PSPRINT",           "TRUE",             "e" );
1664 ToFile( "MKDEPENDSOLVER",    "TRUE",             "e" );
1665 ToFile( "nodep",             "@nodep@",          "e" );
1666 ToFile( "TARFILE_LOCATION",  $TARFILE_LOCATION,  "e" );
1667 ToFile( "DO_FETCH_TARBALLS", "@DO_FETCH_TARBALLS@",  "e" );
1669 # Writing the platform dependent constant values to file.
1670 # (c = comment, e = environment variable, a = alias )
1671 ToFile( "Platform dependent constant values.", $empty, "c" );
1672 ToFile( "SOLAR_JAVA",        $SOLAR_JAVA,        "e" );
1673 ToFile( "BIG_SVX",           $BIG_SVX,           "e" );
1674 ToFile( "COM",               $COM,               "e" );
1675 ToFile( "COMPATH",           $COMPATH,           "e" );
1676 ToFile( "CPU",               $CPU,               "e" );
1677 ToFile( "CPUNAME",           $CPUNAME,           "e" );
1678 ToFile( "CVER",              $CVER,              "e" );
1679 ToFile( "GUI",               $GUI,               "e" );
1680 ToFile( "GLIBC",             $GLIBC,             "e" );
1681 ToFile( "GUIBASE",           $GUIBASE,           "e" );
1682 ToFile( "GVER",              $GVER,              "e" );
1683 ToFile( "OS",                $OS,                "e" );
1684 ToFile( "OSVERSION",         $OSVERSION,         "e" );
1685 ToFile( "PTHREAD_CFLAGS",    "@PTHREAD_CFLAGS@", "e" );
1686 ToFile( "PTHREAD_LIBS",      "@PTHREAD_LIBS@",   "e" );
1687 ToFile( "OUTPATH",           $OUTPATH,           "e" );
1688 ToFile( "INPATH",            $INPATH,            "e" );
1689 ToFile( "PATH_SEPERATOR",    $PATH_SEPERATOR,    "e" );
1690 ToFile( "COMEX",             $COMEX,             "e" );
1691 ToFile( "CDPATHx",           $CDPATHx,           "e" );
1692 ToFile( "DYNAMIC_CRT",       $DYNAMIC_CRT,       "e" );
1693 ToFile( "SET_EXCEPTIONS",    $SET_EXCEPTIONS,    "e" );
1694 ToFile( "use_shl_versions",  $use_shl_versions,  "e" );
1695 ToFile( "FLIPCMD",           $FLIPCMD,           "e" );
1697 # Writing the variables to file.
1698 # (c = comment, e = environment variable, a = alias, n = newline )
1699 ToFile( "Variable values.",  $empty,             "c" );
1700 if ( $platform =~ m/cygwin/ )
1701 {  ToFile( "CYGWIN_PATH",       $CYGWIN_PATH,       "e" );
1702    ToFile( "PSDK_HOME",         $PSDK_HOME,         "e" );
1703    ToFile( "WINDOWS_VISTA_PSDK","@WINDOWS_VISTA_PSDK@","e" );
1704    ToFile( "DIRECTXSDK_LIB",    $DIRECTXSDK_LIB,    "e" );
1705    ToFile( "USE_DIRECTX5",      $USE_DIRECTX5,      "e" );
1706    ToFile( "ATL_LIB",           $ATL_LIB,         "e" );
1707    if ( $MINGW ne "yes" )
1708    {  ToFile( "ATL_INCLUDE",       $ATL_INCLUDE,       "e" );
1709    }
1710    ToFile( "MFC_LIB",           $MFC_LIB,         "e" );
1711    ToFile( "MFC_INCLUDE",       $MFC_INCLUDE,       "e" );
1712    ToFile( "NSIS_PATH",         $NSIS_PATH,         "e" );
1713    ToFile( "DISABLE_ACTIVEX",   "@DISABLE_ACTIVEX@","e" );
1714    ToFile( "DISABLE_ATL",   "@DISABLE_ATL@","e" );
1715    ToFile( "USE_NEW_SDK",       $USE_NEW_SDK,       "e" );
1717    # Hack around dmake's mktmp not generating DOS paths.
1718    my $tmpdir = qx{cygpath -m "/tmp"};
1719    chomp($tmpdir);
1720    ToFile( "TMPDIR",     $tmpdir,            "e" );
1722 ToFile( "PERL",              $PERL,              "e" );
1723 ToFile( "RPM",               "@RPM@",            "e" );
1724 ToFile( "DPKG",              "@DPKG@",           "e" );
1725 ToFile( "PKGMK",             "@PKGMK@",          "e" );
1726 ToFile( "GNUMAKE",           "@GNUMAKE@",        "e" );
1727 ToFile( "GNUTAR",            "@GNUTAR@",         "e" );
1728 ToFile( "UPD",               $UPD,               "e" );
1729 ToFile( "WORK_STAMP",        $WORK_STAMP,        "e" );
1730 ToFile( "SOLARVER",          $SOLARVER,          "e" );
1731 ToFile( "SOLARVERSION",      $SOLARVERSION,      "e" );
1732 ToFile( "SOLARENV",          $SOLARENV,          "e" );
1733 ToFile( "SOLARENVINC",       $SOLARENVINC,       "e" );
1734 ToFile( "LOCALINI",          $LOCALINI,          "e" );
1735 ToFile( "STAR_INIROOT",      $STAR_INIROOT,      "e" );
1736 ToFile( "STAR_INIROOTOLD",   $STAR_INIROOTOLD,   "e" );
1737 ToFile( "STAR_STANDLST",     $STAR_STANDLST,     "e" );
1738 ToFile( "STAR_SSCOMMON",     $STAR_SSCOMMON,     "e" );
1739 ToFile( "STAR_SSOLARINI",    $STAR_SSOLARINI,    "e" );
1740 ToFile( "DMAKEROOT",         $DMAKEROOT,         "e" );
1741 if ( $JDK ne "gcj" ) {
1742    ToFile( "CLASSPATH",         $CLASSPATH,         "e" );
1743    ToFile( "XCLASSPATH",        $XCLASSPATH,        "e" );
1745 else {
1746    ToFile( "JAVACISGCJ",       '@JAVACISGCJ@',      "e" );
1748 if ( $GUI eq "UNX" ) {
1749    ToFile( "AWTLIB",           '@AWTLIB@',          "e" );
1751 if ( '@JDK@' ne '' )
1753    ToFile( "JDK",             "@JDK@",           "e" );
1754    ToFile( "JAVAFLAGS",             "@JAVAFLAGS@",           "e" );
1755    ToFile( "JAVAINTERPRETER", PathFormat("@JAVAINTERPRETER@"), "e" );
1756    ToFile( "JAVAIFLAGS",      "@JAVAIFLAGS@",    "e" );
1757    ToFile( "JAVACOMPILER",    PathFormat("@JAVACOMPILER@"), "e" );
1758    ToFile( "JAVAAOTCOMPILER", PathFormat("@JAVAAOTCOMPILER@"), "e" );
1759    ToFile( "JAVADOC",         PathFormat("@JAVADOC@"), "e" );
1761 ToFile( "SCPDEFS",           '@SCPDEFS@',        "e" );
1762 ToFile( "SOLAREXTRAINC",     $SOLAREXTRAINC,     "e" );
1763 ToFile( "SOLAREXTRALIB",     $SOLAREXTRALIB,     "e" );
1764 ToFile( "PATH",              $PATH,              "e" );
1765 ToFile( "SOLARLIB",          $SOLARLIB,          "e" );
1766 ToFile( "SOLARINC",          $SOLARINC,          "e" );
1767 ToFile( "COMP_ENV",          $COMP_ENV,          "e" );
1768 ToFile( "JAVAHOME",          $JAVAHOME,          "e" );
1769 ToFile( "CC",                $CC,                "e" );
1770 ToFile( "HAVE_GCC_VISIBILITY_FEATURE",
1771                 "@HAVE_GCC_VISIBILITY_FEATURE@", "e" );
1772 ToFile( "HAVE_LD_HASH_STYLE","@HAVE_LD_HASH_STYLE@","e" );
1773 ToFile( "HAVE_LD_BSYMBOLIC_FUNCTIONS",
1774                 "@HAVE_LD_BSYMBOLIC_FUNCTIONS@","e" );
1775 ToFile( "CXX",               $CXX,               "e" );
1776 ToFile( "USE_CCACHE",        "@USE_CCACHE@",     "e" );
1777 ToFile( "MINGWCXX",          "@MINGWCXX@",       "e" );
1778 ToFile( "MINGWSTRIP",        "@MINGWSTRIP@",     "e" );
1779 ToFile( "USE_SYSTEM_STL",    "@USE_SYSTEM_STL@", "e" );
1780 ToFile( "ALLOC",             "@ALLOC@",          "e" );
1781 ToFile( "ENABLE_SYMBOLS",    "@ENABLE_SYMBOLS@",    "e" );
1782 ToFile( "DISABLE_STRIP",     "@DISABLE_STRIP@",     "e" );
1783 ToFile( "LFS_CFLAGS",        "@LFS_CFLAGS@",     "e" );
1784 ToFile( "ENABLE_CRASHDUMP",  "@ENABLE_CRASHDUMP@",  "e" );
1785 ToFile( "ENABLE_CUPS",       "@ENABLE_CUPS@",       "e" );
1786 ToFile( "ENABLE_RANDR",      "@ENABLE_RANDR@",      "e" );
1787 ToFile( "ENABLE_FONTCONFIG", "@ENABLE_FONTCONFIG@", "e" );
1788 ToFile( "ENABLE_DIRECTX",    "@ENABLE_DIRECTX@",    "e" );
1789 ToFile( "ENABLE_LAYOUT",     "@ENABLE_LAYOUT@",     "e" );
1790 ToFile( "ENABLE_PCH",        "@ENABLE_PCH@",       "e" );
1791 ToFile( "NO_HIDS",           "@NO_HIDS@",       "e" );
1792 ToFile( "ENABLE_GRAPHITE",   "@ENABLE_GRAPHITE@",   "e");
1793 ToFile( "SYSTEM_GRAPHITE",   "@SYSTEM_GRAPHITE@",   "e");
1794 ToFile( "GRAPHITE_LIBS",     "@GRAPHITE_LIBS@",     "e");
1795 ToFile( "GRAPHITE_CFLAGS",   "@GRAPHITE_CFLAGS@",   "e");
1796 ToFile( "VC_STANDARD",       "@VC_STANDARD@",      "e" );
1797 ToFile( "WITH_MYSPELL_DICTS","@WITH_MYSPELL_DICTS@","e");
1798 ToFile( "SYSTEM_DICTS",      "@SYSTEM_DICTS@",     "e");
1799 ToFile( "DICT_SYSTEM_DIR",   "@DICT_SYSTEM_DIR@",  "e");
1800 ToFile( "HYPH_SYSTEM_DIR",   "@HYPH_SYSTEM_DIR@",  "e");
1801 ToFile( "THES_SYSTEM_DIR",   "@THES_SYSTEM_DIR@",  "e");
1802 ToFile( "ENABLE_LOCKDOWN",   "@ENABLE_LOCKDOWN@",  "e" );
1803 ToFile( "WITH_LDAP",         "@WITH_LDAP@",        "e" );
1804 ToFile( "WITH_OPENLDAP",     "@WITH_OPENLDAP@",    "e" );
1805 ToFile( "WITH_MOZILLA",      "@WITH_MOZILLA@",     "e" );
1806 ToFile( "SYSTEM_MOZILLA",    "@SYSTEM_MOZILLA@",   "e" );
1807 ToFile( "MOZ_FLAVOUR",       "@MOZ_FLAVOUR@",      "e" );
1808 ToFile( "NSPR_LIB",          "@NSPR_LIB@",         "e" );
1809 ToFile( "NSS_LIB",           "@NSS_LIB@",          "e" );
1810 ToFile( "MOZ_INC",           "@MOZ_INC@",          "e" );
1811 ToFile( "MOZ_LIB",           "@MOZ_LIB@",          "e" );
1812 ToFile( "MOZ_LIB_XPCOM",     "@MOZ_LIB_XPCOM@",    "e" );
1813 ToFile( "MOZ_NSPR_CFLAGS",   "@MOZ_NSPR_CFLAGS@",  "e" );
1814 ToFile( "MOZ_NSS_CFLAGS",    "@MOZ_NSS_CFLAGS@",   "e" );
1815 ToFile( "MOZ_LDAP_CFLAGS",   "@MOZ_LDAP_CFLAGS@",  "e" );
1816 ToFile( "WITH_FONTS",        "@WITH_FONTS@",       "e" );
1817 ToFile( "WITHOUT_AFMS",      "@WITHOUT_AFMS@",     "e" );
1818 ToFile( "WITHOUT_PPDS",      "@WITHOUT_PPDS@",     "e" );
1819 ToFile( "WITH_BINFILTER",    "@WITH_BINFILTER@",   "e" );
1820 ToFile( "BUILD_TYPE",        "@BUILD_TYPE@",       "e" );
1821 ToFile( "VERBOSE",           "@VERBOSE@",          "e" );
1822 ToFile( "ENABLE_EVOAB2",     "@ENABLE_EVOAB2@",    "e" );
1823 ToFile( "GOBJECT_CFLAGS",    "@GOBJECT_CFLAGS@",   "e" );
1824 ToFile( "GOBJECT_LIBS",      "@GOBJECT_LIBS@",     "e" );
1825 if ( '@ENABLE_RPATH@' eq "no" ) {
1826   ToFile( "LINKFLAGSRUNPATH",'',                   "e" );
1828 ToFile( "EPM",               "@EPM@",              "e" );
1829 ToFile( "EPM_FLAGS",         $EPM_FLAGS,           "e" );
1830 ToFile( "BUILD_EPM",         "@BUILD_EPM@",        "e" );
1831 ToFile( "PKGFORMAT",         "@PKGFORMAT@",        "e" );
1832 ToFile( "SYSTEM_STDLIBS",    "@SYSTEM_STDLIBS@",   "e" );
1833 ToFile( "SYSTEM_ZLIB",       "@SYSTEM_ZLIB@",      "e" );
1834 ToFile( "SYSTEM_OPENSSL",    "@SYSTEM_OPENSSL@",   "e" );
1835 ToFile( "OPENSSL_CFLAGS",    "@OPENSSL_CFLAGS@",   "e" );
1836 ToFile( "OPENSSL_LIBS",      "@OPENSSL_LIBS@",     "e" );
1837 ToFile( "SYSTEM_PYTHON",     "@SYSTEM_PYTHON@",    "e" );
1838 ToFile( "PYTHON_CFLAGS",     "@PYTHON_CFLAGS@",    "e" );
1839 ToFile( "PYTHON_LIBS",       "@PYTHON_LIBS@",      "e" );
1840 if ($SYSTEM_PYTHON eq "NO") {
1841 ToFile( "HOME",              "@HOME@",             "e" );
1843 ToFile( "SYSTEM_ICU",        "@SYSTEM_ICU@",       "e" );
1844 ToFile( "SYSTEM_GENBRK",     "@SYSTEM_GENBRK@",    "e" );
1845 ToFile( "SYSTEM_GENCCODE",   "@SYSTEM_GENCCODE@",  "e" );
1846 ToFile( "SYSTEM_GENCMN",     "@SYSTEM_GENCMN@",    "e" );
1847 ToFile( "SYSTEM_JPEG",       "@SYSTEM_JPEG@",      "e" );
1848 ToFile( "FREETYPE_CFLAGS",   "@FREETYPE_CFLAGS@",  "e" );
1849 ToFile( "FREETYPE_LIBS",     "@FREETYPE_LIBS@",    "e" );
1850 ToFile( "SYSTEM_POPPLER",    "@SYSTEM_POPPLER@",   "e" );
1851 ToFile( "POPPLER_CFLAGS",    "@POPPLER_CFLAGS@",   "e" );
1852 ToFile( "POPPLER_LIBS",      "@POPPLER_LIBS@",     "e" );
1853 ToFile( "SYSTEM_CAIRO",      "@SYSTEM_CAIRO@",     "e" );
1854 ToFile( "BUILD_PIXMAN",      "@BUILD_PIXMAN@",     "e" );
1855 ToFile( "CAIRO_CFLAGS",      "@CAIRO_CFLAGS@",     "e" );
1856 ToFile( "CAIRO_LIBS",        "@CAIRO_LIBS@",       "e" );
1857 ToFile( "XRANDR_CFLAGS",     "@XRANDR_CFLAGS@",    "e" );
1858 ToFile( "XRANDR_LIBS",       "@XRANDR_LIBS@",      "e" );
1859 ToFile( "XRANDR_DLOPEN",     "@XRANDR_DLOPEN@",    "e" );
1860 ToFile( "SYSTEM_LIBWPD",     "@SYSTEM_LIBWPD@",    "e" );
1861 ToFile( "LIBWPD_CFLAGS",     "@LIBWPD_CFLAGS@",    "e" );
1862 ToFile( "LIBWPD_LIBS",       "@LIBWPD_LIBS@",      "e" );
1863 ToFile( "SYSTEM_CPPUNIT",    "@SYSTEM_CPPUNIT@",   "e" );
1864 ToFile( "CPPUNIT_CFLAGS",    "@CPPUNIT_CFLAGS@",   "e" );
1865 ToFile( "CPPUNIT_LIBS",      "@CPPUNIT_LIBS@",     "e" );
1866 ToFile( "SYSTEM_LIBXML",     "@SYSTEM_LIBXML@",    "e" );
1867 ToFile( "USE_FT_EMBOLDEN",   "@USE_FT_EMBOLDEN@",  "e" );
1868 ToFile( "LIBXML_CFLAGS",     "@LIBXML_CFLAGS@",    "e" );
1869 ToFile( "LIBXML_LIBS",       "@LIBXML_LIBS@",      "e" );
1870 ToFile( "SYSTEM_EXPAT",      "@SYSTEM_EXPAT@",     "e" );
1871 ToFile( "SYSTEM_DB",         "@SYSTEM_DB@",        "e" );
1872 ToFile( "DB_VERSION",        "@DB_VERSION@",       "e" );
1873 ToFile( "DB_INCLUDES",       "@DB_INCLUDES@",      "e" );
1874 ToFile( "ENABLE_MYSQLC",     "@ENABLE_MYSQLC@",    "e" );
1875 ToFile( "SYSTEM_MYSQL",      "@SYSTEM_MYSQL@",     "e" );
1876 ToFile( "SYSTEM_MYSQL_CPPCONN","@SYSTEM_MYSQL_CPPCONN@","e" );
1877 ToFile( "MYSQL_INC",         "@MYSQL_INC@",        "e" );
1878 ToFile( "MYSQL_LIB",         "@MYSQL_LIB@",        "e" );
1879 ToFile( "MYSQL_DEFINES",     "@MYSQL_DEFINES@",    "e" );
1880 ToFile( "LIBMYSQL_PATH",     "@LIBMYSQL_PATH@",    "e" );
1881 ToFile( "SYSTEM_HSQLDB",     "@SYSTEM_HSQLDB@",    "e" );
1882 ToFile( "HSQLDB_JAR",        "@HSQLDB_JAR@",       "e" );
1883 ToFile( "SYSTEM_LUCENE",     "@SYSTEM_LUCENE@",    "e" );
1884 ToFile( "LUCENE_CORE_JAR",   "@LUCENE_CORE_JAR@",  "e" );
1885 ToFile( "LUCENE_ANALYZERS_JAR",   "@LUCENE_ANALYZERS_JAR@",  "e" );
1886 ToFile( "SYSTEM_BSH",        "@SYSTEM_BSH@",       "e" );
1887 ToFile( "BSH_JAR",           "@BSH_JAR@",          "e" );
1888 ToFile( "SYSTEM_SAXON",      "@SYSTEM_SAXON@",     "e" );
1889 ToFile( "SAXON_JAR",         "@SAXON_JAR@",        "e" );
1890 ToFile( "SYSTEM_ODBC_HEADERS","@SYSTEM_ODBC_HEADERS@","e" );
1891 ToFile( "SYSTEM_LIBXSLT",    "@SYSTEM_LIBXSLT@",   "e" );
1892 ToFile( "LIBXSLT_CFLAGS",    "@LIBXSLT_CFLAGS@",   "e" );
1893 ToFile( "LIBXSLT_LIBS",      "@LIBXSLT_LIBS@",     "e" );
1894 ToFile( "SYSTEM_SANE_HEADER","@SYSTEM_SANE_HEADER@","e" );
1895 ToFile( "SYSTEM_XRENDER_HEADERS","@SYSTEM_XRENDER_HEADERS@","e" );
1896 ToFile( "SYSTEM_CURL",       "@SYSTEM_CURL@",      "e" );
1897 ToFile( "CURL_CFLAGS",       "@CURL_CFLAGS@",      "e" );
1898 ToFile( "CURL_LIBS",         "@CURL_LIBS@",        "e" );
1899 ToFile( "SYSTEM_BOOST",      "@SYSTEM_BOOST@",     "e" );
1900 ToFile( "SYSTEM_MDDS",       "@SYSTEM_MDDS@",      "e" );
1901 ToFile( "SYSTEM_VIGRA",      "@SYSTEM_VIGRA@",     "e" );
1902 ToFile( "SYSTEM_NEON",       "@SYSTEM_NEON@",      "e" );
1903 ToFile( "NEON_VERSION",      "@NEON_VERSION@",     "e" );
1904 ToFile( "NEON_LIBS",         "@NEON_LIBS@",        "e" );
1905 ToFile( "NEON_CFLAGS",       "@NEON_CFLAGS@",      "e" );
1906 ToFile( "DISABLE_NEON",      "@DISABLE_NEON@",     "e" );
1907 ToFile( "DISABLE_XAW",       "@DISABLE_XAW@",      "e" );
1908 ToFile( "ENABLE_AGG",        "@ENABLE_AGG@",       "e" );
1909 ToFile( "SYSTEM_AGG",        "@SYSTEM_AGG@",       "e" );
1910 ToFile( "AGG_VERSION",       "@AGG_VERSION@",      "e" );
1911 ToFile( "BUILD_DMAKE",       "@BUILD_DMAKE@",      "e" );
1912 ToFile( "BUILD_STAX",        "@BUILD_STAX@",       "e" );
1913 ToFile( "BUILD_UNOWINREG",   "@BUILD_UNOWINREG@",  "e" );
1914 ToFile( "USE_XINERAMA",      "@USE_XINERAMA@",     "e" );
1915 ToFile( "XINERAMA_LINK",     "@XINERAMA_LINK@",    "e" );
1916 ToFile( "SYSTEM_REDLAND",    "@SYSTEM_REDLAND@",   "e" );
1917 ToFile( "REDLAND_LIBS",      "@REDLAND_LIBS@",     "e" );
1918 ToFile( "SYSTEM_HUNSPELL",   "@SYSTEM_HUNSPELL@",  "e" );
1919 ToFile( "HUNSPELL_CFLAGS",   "@HUNSPELL_CFLAGS@",  "e" );
1920 ToFile( "HUNSPELL_LIBS",     "@HUNSPELL_LIBS@",    "e" );
1921 ToFile( "SYSTEM_LPSOLVE",    "@SYSTEM_LPSOLVE@",   "e" );
1922 ToFile( "HAVE_GETOPT",       "@HAVE_GETOPT@",      "e" );
1923 ToFile( "HAVE_READDIR_R",    "@HAVE_READDIR_R@",   "e" );
1924 ToFile( "SYSTEM_LIBC",       "@SYSTEM_LIBC@",      "e" );
1925 ToFile( "SYSTEM_HYPH",       "@SYSTEM_HYPH@",      "e" );
1926 ToFile( "HYPHEN_LIB",        "@HYPHEN_LIB@",       "e" );
1927 ToFile( "SYSTEM_MYTHES",     "@SYSTEM_MYTHES@",    "e" );
1928 ToFile( "MYTHES_CFLAGS",     "@MYTHES_CFLAGS@",    "e" );
1929 ToFile( "MYTHES_LIBS",       "@MYTHES_LIBS@",      "e" );
1930 ToFile( "PAM",               "@PAM@",              "e" );
1931 ToFile( "NEW_SHADOW_API",    "@NEW_SHADOW_API@",   "e" );
1932 ToFile( "PAM_LINK",          "@PAM_LINK@",         "e" );
1933 ToFile( "CRYPT_LINK",        "@CRYPT_LINK@",       "e" );
1934 ToFile( "XAU_LIBS",          "@XAU_LIBS@",         "e" );
1935 ToFile( "GXX_INCLUDE_PATH",  PathFormat("@GXX_INCLUDE_PATH@"), "e" );
1936 ToFile( "COMMON_BUILD_TOOLS",$COMMON_BUILD_TOOLS,  "e" );
1937 if ($platform !~ m/cygwin|os2/) {
1938    if ( $ENV{"TMPDIR"} eq "" ) {
1939       ToFile( "TMPDIR",      "/tmp",               "e" );
1940    } else {
1941       ToFile( "TMPDIR",      "$ENV{'TMPDIR'}",     "e" );
1942    }
1944 ToFile( "SOLARSRC",           $SOLARSRC,           "e" );
1945 ToFile( "SOURCE_ROOT_DIR",    $SOURCE_ROOT_DIR,    "e" );
1946 if ( $platform =~ m/cygwin/ )
1948    ToFile( "ILIB",              $ILIB,              "e" );
1949    if ( $MINGW eq "yes" )
1950    {  ToFile( "ATL_INCLUDE",       $ATL_INCLUDE,       "e" );
1951       ToFile( "EXCEPTIONS",        "@EXCEPTIONS@",        "e" );
1952       ToFile( "DIRECTXSDK_HOME",    PathFormat("@DIRECTXSDK_HOME@"),    "e" );
1953       ToFile( "USE_MINGW",         $USE_MINGW,              "e" );
1954       ToFile( "MINGW_CLIB_DIR",         PathFormat("@MINGW_CLIB_DIR@"),              "e" );
1955       ToFile( "MINGW_SHARED_GCCLIB",         "@MINGW_SHARED_GCCLIB@",              "e" );
1956       ToFile( "MINGW_GCCLIB_EH",      "@MINGW_GCCLIB_EH@",              "e" );
1957       ToFile( "MINGW_SHARED_GXXLIB",         "@MINGW_SHARED_GXXLIB@",              "e" );
1958       ToFile( "MINGW_GCCDLL",         "@MINGW_GCCDLL@",              "e" );
1959       ToFile( "MINGW_GXXDLL",         "@MINGW_GXXDLL@",              "e" );
1960    }
1961    ToFile( "GREP",              $WIN_GREP,          "e" );
1962    ToFile( "FIND",              $WIN_FIND,          "e" );
1963    ToFile( "LS",                $WIN_LS,            "e" );
1964    ToFile( "GNUCOPY",           $WIN_GNUCOPY,       "e" );
1965    ToFile( "TOUCH",             $WIN_TOUCH,         "e" );
1967 if ( $platform =~ m/os2/ )
1969    #ToFile( "ILIB",              $ILIB,              "e" );
1970    
1971    ToFile( "GREP",              "grep.exe",         "e" );
1972    ToFile( "FIND",              "find.exe",         "e" );
1973    ToFile( "LS",                "ls.exe",           "e" );
1974    ToFile( "GNUCOPY",           "cp.exe",           "e" );
1975    ToFile( "TOUCH",             "touch",            "e" );
1978 # $perlpre is only used for the following three variables
1979 # and only set for OS2.
1980 my $perlpre = "";
1981 if (( $platform =~ m/os2/ )) {
1982    $perlpre = "perl ".${SOLARENV}.${BIN}.${ds};
1984 ToFile( "DELIVER",       $perlpre."deliver.pl",     "e" );
1985 ToFile( "MKOUT",         $perlpre."mkout.pl",       "e" );
1986 ToFile( "ZIPDEP",        $perlpre."zipdep.pl",      "e" );
1989 # Writing the aliases to file.
1990 ToFile( "Aliases.",          $empty,             "c" );
1991 ToFile( "Don't set aliases when bootstrapping", $empty, "c" );
1992 ToFile( 'if ( ! ${?_ISBOOTSTRAP_} ) then', $empty, "y");
1993 ToFile( "if test -z \"\$_ISBOOTSTRAP_\"; then", $empty, "z");
1995 ToFile( "alias mkout",       $mkout,             "a" );
1996 ToFile( "alias deliver",     $deliver,           "a" );
1997 ToFile( "alias build",       $build,             "a" );
1998 ToFile( "alias build_client",$build_client,      "a" );
1999 ToFile( "alias zipdep",      $zipdep,            "a" );
2000 if ( $platform !~ m/cygwin/ )
2001 {  ToFile( "alias nmake",       $nmake,             "a" );
2003 if ( $platform =~ m/os2/ )
2004 {  ToFile( "alias gunzip",       "gzip -d",         "a" );
2007 ToFile( "endif",             $empty, "y");
2008 ToFile( "fi",                $empty, "z");
2010 # Check if the right dmake version is used. (W32 only)
2011 if ( $platform =~ m/cygwin/ ) {
2012     ToFile( "Check if the right dmake version is used.", $empty, "c" );
2013     # Invalidate build environment.
2014     ToFile( "WORK_STAMP", "_invalid_", "e" );
2015     # Don't test the dmake version if this file is sourced by bootstrap
2016     ToFile( "bash -c 'if test -n \"\$_ISBOOTSTRAP_\" || (dmake.exe -V | grep -e \"-cygwin\\|OS := cygwin\" > /dev/null ); then true; else echo -e \"\\n\\nERROR: Not a cygwin build dmake or dmake missing, please check!\\n\\n\" ; sleep 5; false ; fi' || exit 1", $empty, "y");
2017     # Restore valid environment if test was successful.
2018     ToFile( "WORK_STAMP",        $WORK_STAMP,        "e" );
2019     ToFile( "", $empty, "n");
2022 # on Solaris, MacOSX and FreeBSD, set GNUCOPY and GNUPATCH
2023 if ($platform =~ m/solaris|darwin|freebsd/)
2025   ToFile( "GNUPATCH",   "@GNUPATCH@",   "e");
2026   ToFile( "GNUCOPY",    "@GNUCP@",      "e");
2028 # OS/2 define .pl as executable for 4os2
2029 # use - as switch char for dmake (os2/switchar.c)
2030 if ($platform =~ m/os2/)
2032   ToFile( ".pl",        "perl", "e");
2033   ToFile( "SWITCHAR",   "-",    "e");
2035 ToFile( "SAL_ENABLE_FILE_LOCKING",      "1",    "e");
2036 ToFile( "DBGSV_INIT", "$SOLARENV/bin/dbgsv.ini", "e");
2038 # Writing unset variables you might not need to file.
2040 print OUT $unsetvars;
2042 print OUT_SH "export $exportvars$newline";
2043 print OUT_SH "unset $unsetvarssh$newline";
2047 #---------------------------
2048 # VIII. Closing output file.
2049 #---------------------------
2051 close( OUT ) || print "Can't close $outfile: $!";
2053 close( OUT_SH ) || print "Can't close $outfile_sh: $!";
2056 #------------------------------
2057 # IX. Sourcing the output file.
2058 #------------------------------
2060 #---------------------------------
2061 # X. Set up the build environment.
2062 #---------------------------------
2064 #--------------------------------------------------------
2065 # XI. Moving the output file to the build home directory.
2066 #--------------------------------------------------------
2068 $tmp = $SRC_ROOT.$ds.$outfile;
2069 if (rename( $outfile, $tmp ) ne 1)
2070 {  `mv -f $outfile $tmp`;
2073 $tmp = $SRC_ROOT.$ds.$outfile_sh;
2074 if (rename( $outfile_sh, $tmp ) ne 1)
2075 {  `mv -f $outfile_sh $tmp`;
2079 #--------------------------------------------------------
2080 # XII. Message at the end.
2081 #--------------------------------------------------------
2084 print "*********************************************************".
2085       "******************* $newline"."*"."$newline";
2086 print "* OpenOffice.org $UPD configuration. $newline";
2087 for ( $tmp = 0; $tmp < 2; $tmp++ ) 
2088 {  print "* $newline";
2090 print "* Configuration part of OpenOffice.org $UPD build is finished. $newline* $newline";
2091 print "* NB! Be aware that you might not be able to build OpenOffice.org if you $newline".
2092       "* ignore any warning message that were generated during this configuration $newline".
2093       "* process. $newline* $newline";
2095 if ( $Warning ne "" ) 
2096 {  print "$Warning*"; 
2097    print "$newline";
2100 print "*$newline* USAGE: $newline";
2101 print "* Source $outfile (in tcsh)";
2102 print " or $outfile.sh (in sh)";
2103 print "$newline";
2104 print "* in order to set up the build-environment variables.$newline";
2105 for ( $tmp = 0; $tmp < 2; $tmp++ ) 
2106 {  print "* $newline";
2108 print "*********************************************************".
2109       "******************* $newline";
2111 $bootfile = "bootstrap";
2112 open( OUT, ">$bootfile" ) ||
2113 die "Cannot open $bootfile: $!\n";
2114 print OUT "#!/bin/sh\n";
2115 print OUT "_ISBOOTSTRAP_=TRUE ; export _ISBOOTSTRAP_ ; . $SRC_ROOT/$outfile.sh\n"; 
2116 print OUT "unset _ISBOOTSTRAP_; export _ISBOOTSTRAP_\n"; 
2117 if ( $MINGW eq "yes" )
2118 {  print OUT 'PATH="/usr/bin:$PATH" : export PATH'."\n"; }
2119 close( OUT ) || print "Can't close $bootfile: $!";
2120 system(`cat bootstrap.1 >> bootstrap`);
2121 system(`chmod +x bootstrap`);
2123 #--------------------------------------------------------
2124 # Moving the bootstrap file to the build home directory.
2125 #--------------------------------------------------------
2127 $tmp = $SRC_ROOT.$ds.$bootfile;
2128 if (rename( $bootfile, $tmp ) ne 1)
2129 {  `mv -f $bootfile $tmp`;
2132 print "Configure completed\n";
2133 print "You may now run ./bootstrap in $SRC_ROOT\n";
2134 if ( $Warning ne "" ) {
2135         print "***** WARNINGS ISSUED *****\n";
2139 #-----------------
2140 # XII. Functions.
2141 #-----------------
2143 #-------------------------------------------------------------
2144 # Function name: CheckPathName 
2145 # Description:   chops off the '/' character if it's the last
2146 #                character in a pathname. also adds the '/'
2147 #                character if it's not the first character
2148 #                in a path.
2149 # Arguments:     1. Path (string)
2150 # Return value:  Path (string)
2151 #-------------------------------------------------------------
2152 sub CheckPathName 
2153 {  my $retrn = $_[ 0 ];
2154    if ($platform =~ m/cygwin/)
2155    {  # Check if the first character is not a '/'.
2156       if ( !( $_[ 0 ] =~ /^\// ) ) 
2157       {  $retrn = $ds.$_[ 0 ];
2158       }
2159    }
2160    # kill the last '/','\','\n' if they exists.
2161    $retrn =~ s![\s/\\]+$!!;
2162    # Done!
2163    return( $retrn );
2165 #-------------------------------------------------------------
2166 # Function name: CheckPathExist 
2167 # Description:   Checks whether the directory that is given
2168 #                as an argument exists. If not abort.
2169 # Arguments:     1. Path (string)
2170 # Return value:  void
2171 #-------------------------------------------------------------
2172 sub CheckPathExist 
2173 {  my $dir = $_[ 0 ];
2174    if ( !( -d $dir ) and $^O ne 'MSWin32' )
2175    {  print ( "The directory $_[ 0 ] does not exist. Please create first.\n" );
2176       exit 1;
2177    }
2178    else
2179    {  # Don't check under ActiveState Perl (Windows). The path is possibly
2180       # posix and it cannot handle it.
2181       return "true";
2182    }
2184 #------------------------------------------------------------
2185 # Function name: CreateFileHeader 
2186 # Description:   Creates a header for the outfile.
2187 # Arguments:     1. File to write to
2188 #                2. UPD (string)
2189 #                3. Platform (string)
2190 #                4. name of shell for this file
2191 #                5. comment to use for this file
2192 # Return value:  void
2193 #------------------------------------------------------------
2194 sub CreateFileHeader 
2195 {  my $timestamp = `date`;
2196    chomp( $timestamp );
2197    my $filehandle = $_[0];
2198    my $comment = $_[4];
2199    print { $filehandle } "$comment #################################################################"; 
2200    print { $filehandle } $newline;
2201    print { $filehandle } "$comment OpenOffice.org $_[ 1 ] build environment file for: $_[ 2 ]. $newline"; 
2202    print { $filehandle } "$comment Generated on: $timestamp $newline"; 
2203    print { $filehandle } "$comment Source this file to set up the build environment. $newline"; 
2204    print { $filehandle } "$comment 1. exec $_[3] $newline"; 
2205    print { $filehandle } "$comment 2. source $outfile $newline"; 
2206    print { $filehandle } "$comment #################################################################"; 
2207    print { $filehandle } $newline;
2209 #---------------------------------------------------------
2210 # Function name: ToFile
2211 # Description:   Writes the environment variable in the
2212 #                output file.
2213 # Arguments:     1. Name of environment variable (string)
2214 #                2. Value of environment variable (string)
2215 #                3. e - env. var
2216 #                   a - alias
2217 #                   c - comment
2218 #                   n - newline
2219 #                   x - raw, write as is to OUT_BAT
2220 #                   y - raw, write as is to OUT
2221 #                   z - raw, write as is to OUT_SH
2222 # Return value:  void
2223 #---------------------------------------------------------
2224 sub ToFile {
2225    if ( $_[ 2 ] eq "e" ) {
2226       # Write an environment variable to file.
2227       if (defined $_[ 1 ] && $_[ 1 ] ne "" ) {
2228          my $envvar = $_[ 1 ];
2229          my $envvarbash = $envvar;
2231          # Tcsh/bash needs backslashes quoted
2232          $envvar =~ s/\\/\\\\/g;
2233          $envvarbash = $envvar;
2235          printf("%-12s %-17s %-10s %s\n", "The variable", $_[ 0 ], "is set to:", $envvar);
2236          print OUT "$setenv $_[ 0 ] \"$envvar\"$newline";  # to tcsh file
2237          print OUT_SH "$_[ 0 ]=\"$envvarbash\"$newline";   # to sh file
2238          $exportvars .= " $_[ 0 ]";                        # add to export list for sh file
2240       } else {
2241          printf("%-12s %-17s %-10s %s\n", "The variable", $_[ 0 ], "is set to:", "unset") ; # to stdout
2242          $unsetvars .= "$unsetenv $_[ 0 ] >& /dev/null$newline"; # for tcsh file
2243          $unsetvarssh .= " $_[ 0 ]";                             # for sh file
2244       }
2245    }
2246    elsif ( $_[ 2 ] eq "a" ) 
2247    {  # Write an alias to file.
2248       print "The $_[ 0 ] is set to: $_[ 1 ]\n";    # to stdout
2249       print OUT "$_[ 0 ] $_[ 1 ]$newline";         # to tcsh file
2250       print OUT_SH "$_[ 0 ]=$_[ 1 ]$newline";      # to sh file
2251    }
2252    elsif ( $_[ 2 ] eq "c" ) 
2253    {  # Write a comment to file.
2254       print "$newline";
2255       print "$comment$newline";
2256       print "$comment $_[ 0 ]$newline";
2257       print "$comment$newline";
2258       print OUT "$newline";
2259       print OUT "$comment$newline";
2260       print OUT "$comment $_[ 0 ]$newline";
2261       print OUT "$comment$newline";
2262       print OUT_SH "$newline";
2263       print OUT_SH "$comment$newline";
2264       print OUT_SH "$comment $_[ 0 ]$newline";
2265       print OUT_SH "$comment$newline";
2266    }
2267    elsif ( $_[ 2 ] eq "n" )
2268    {  #Write a newline to a file
2269       print OUT "$newline";
2270       print OUT_SH "$newline";
2271    }
2272    elsif ( $_[ 2 ] eq "y" )
2273    {
2274       #Write first argument as is, and nothing else
2275       print OUT "$_[ 0 ]$newline";
2276    }
2277    elsif ( $_[ 2 ] eq "z" )
2278    {
2279       #Write first argument as is, and nothing else
2280       print OUT_SH "$_[ 0 ]$newline";
2281    }
2282    else
2283    {  print "Unknown type!$newline";
2284    }
2286 #----------------------------------------------------------
2287 # Function name: PathFormat
2288 # Description:   Reformat path to either POSIX or mixed mode style.
2289 # Arguments:     1. Variable (string)
2290 # Return value:  Reformatted String
2291 #----------------------------------------------------------
2292 sub PathFormat
2293 {  my ( $variable, $d1, $d2 );
2294    $variable = $_[ 0 ];
2296    if ( $platform =~ m/cygwin/ )
2297    {   $variable =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables
2298        $variable =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables twice!
2300        # Complain if PosixPath is used on a PATH-like string
2301        if ( $variable =~ m/;/ ) {
2302            die( "Do not use on PATH lists (i.e., 'c:\\foo;d:\\bar')");
2303        }
2305        # Replace path with space with short dos path
2306        if ( $variable =~ / / ) {
2307            chomp( $variable = qx{cygpath -d "$variable"} ) ;
2308        }
2310        # Replace absolute paths or DOS paths with ...
2311        if ( ( $variable =~ m/^\// ) or ( $variable =~ m/:/ ) ) {
2312            # mixed mode paths
2313            chomp( $variable = qx{cygpath -m "$variable"} );
2314        }
2315    }
2316    return $variable;
2318 #----------------------------------------------------------
2319 # Function name: CygFormat
2320 # Description:   Format variables to cygwin posix style path
2321 #                unless .
2322 # Arguments:     1. Variable (string)
2323 # Return value:  Reformatted String
2324 #----------------------------------------------------------
2325 sub CygFormat
2326 {  my ( $variable, $d1, $d2 );
2327    $variable = $_[ 0 ];
2328    # ToDo: Do the replacement only if Windows and var contains "\" and ":"
2329    if ( $platform =~ m/cygwin|os2/ )
2330    {
2331        # Complain if PosixPath is used on a PATH-like string
2332        if ( $variable =~ m/;/ ) {
2333            die( "Do not use on PATH lists (i.e., 'c:\\foo;d:\\bar')");
2334        }
2336        # Replace DOS paths with posix paths
2337        if ( ( $variable =~ m/\\/ ) or ( $variable =~ m/:/ ) ) {
2338            chomp( $variable = qx{cygpath -u "$variable"} );
2339        }
2340    }
2341    return $variable;
2343 #----------------------------------------------------------
2344 # Function name: WinFormat
2345 # Description:   Format variables to Windows Format.
2346 # Arguments:     1. Variable (string)
2347 # Return value:  Reformatted String
2348 #----------------------------------------------------------
2349 sub WinFormat
2350 {  my ( $variable, $d1 );
2351    $variable = $_[ 0 ];
2352    $variable =~ s/^\s+//g ; #remove leading spaces
2353    $variable =~ s/\s+$//g ; #remove trailing spaces
2354    $variable =~ s/(\$\{?\w+\}?)/$1/eeg ;   # expand the variables
2355    $variable =~ s/(\$\{?\w+\}?)/$1/eeg ;   # expand the variables twice!
2356    $variable =~ s/:+/:/g ;                 # remove multiple ;
2358    # Some variables are already in DOS path format, return early.
2359    if ( $variable =~ /\\/ ) {
2360        return $variable;
2361    }
2362    if ( $variable eq ";" ) {
2363        # Ignore single ';'
2364        return $variable;
2365    }
2366    if ( $variable =~ /;/ and $variable =~ /\// ) {
2367        # Mixed mode path-style entry, separated with ;, like CLASSPATH
2368        return $variable;
2369    }
2371    # Search for posix path entry and replace with cygpath -w entry
2372    # ( -d if filename contains space )
2374    # Normal paths
2376    # One special case is if "perl " is prepended.
2377    $variable =~ /^(perl\s+)?(.*)$/;
2378    my $perlpre = $1;
2379    if ( !defined($perlpre) ) {
2380        $perlpre = "";
2381    }
2382    $variable = $2;
2384    if ( $variable =~ /^\/[\w\.~ ]+/ ) {
2385        if ( $variable =~ / / ) {
2386            # Use DOS 8.3 style to avoid quoting
2387            chomp( $variable = qx{cygpath -d "$variable"} );
2388        } else {
2389            # Use "normal" filenames
2390            chomp( $variable = qx{cygpath -w "$variable"} );
2391        }
2392    } else {
2393        # relative or absolute DOS paths here
2394        $variable =~ s#/#\\#g;
2395    }
2397    $variable = $perlpre.$variable;
2398    if ( ($perlpre ne "") && ($^O eq "cygwin")) {
2399        # Cygwin's perl needs quoted backslashes
2400        $variable =~ s#\\#\\\\#g;
2401    }
2403    return $variable;
2406 #----------------------------------------------------------
2407 # Function name: WinPath
2408 # Description:   Reformat a $sep seperated path using DOS paths.
2409 # Arguments:     1. Variable (string)
2410 #                2. Separaror (string)
2411 # Return value:  Reformatted String
2412 #----------------------------------------------------------
2413 sub WinPath
2415     my ( $variable, $d1, $sep, @split_var );
2417     if ( $platform =~ m/cygwin/ ) {
2418         $variable = $_[ 0 ];
2419         $sep = $_[ 1 ];
2420         $variable =~ s/^\s+//g ; #remove leading spaces
2421         $variable =~ s/\s+$//g ; #remove trailing spaces
2422         $variable =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables
2423         $variable =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables twice!
2425         @split_var = split(/$sep/,$variable);
2426         foreach $d1 ( @split_var ) {
2427             if ( $d1 =~ /(?:^\/[\w\.~ ]+)+/ ) {
2428                 if ( $d1 =~ / / ) {
2429                     # Use DOS 8.3 style to avoid quoting
2430                     chomp( $d1 = qx{cygpath -d "$d1"} );
2431                 } else {
2432                     # Use "normal" filenames
2433                     chomp( $d1 = qx{cygpath -w "$d1"} );
2434                 }
2435             }
2436         }
2437         $variable = join(';',@split_var);
2439         $variable =~ s/\//\\/g; # Remaining \ come from e.g.: ../foo/baa
2440     }
2442     return $variable;
2445 #--------------------------------------------------------
2446 # Function name: GetCorrectPath
2447 # Description:   Creates the build environment. 
2448 # Arguments:     1.   existing / original path
2449 #                2... pairs of <path, executable>
2450 # Return value:  String - Correct Path
2451 #--------------------------------------------------------
2452 sub GetCorrectPath
2454         sub PathLookup
2455         {
2456             my $cmd = shift;
2457             while (@_) {
2458                 my $elem = shift;
2459                 
2460                 -x "$elem/$cmd" && return $elem;
2461             }
2462             return '';
2463         }
2465         sub SaneGrep
2466         {
2467             # Perl grep is unbelievably strange.
2468             my $needle = shift;
2469             while (@_) {
2470                 my $haystack = shift;
2471                 if ($needle eq $haystack) {
2472                     return 1;
2473                 } 
2474             }
2475             return 0;
2476         }       
2478         sub CleanupPath
2479         {
2480             my @elements = @_;
2481             my @cleanName = ();
2483             while (@elements) {
2484                 my $elem = shift @elements;
2485                 if (!SaneGrep ($elem, @cleanName)) {
2486                         push @cleanName, $elem;
2487                 }
2488             }
2490             return @cleanName;
2491         }
2493         my $oldPath = shift;
2494         my @originalPairs = @_;
2495         my @pairs = @originalPairs;
2496         my @Path = split /$ps/, $oldPath;
2498         while (@pairs) {
2499             my $path = shift @pairs;
2500             my $cmd = shift @pairs;
2501             my $to_append = 1;
2502             my $elem;
2504             if (! -x "$path/$cmd") {
2505                 AddWarning ("Missing executable $path/$cmd\n");
2506             }
2508             for $elem (@Path) {
2509                 if ($elem eq $path) {
2510 #                   print "Hit duplicate path in path; break\n";
2511                     $to_append = 0;
2512                     last;
2513                 }
2514                 if (-f "$elem/$cmd") {
2515 #                   print "Element already in path ...\n";
2516                     unshift @Path, $path;
2517                     $to_append = 0;
2518                     last;
2519                 } else {
2520 #                   print "No file $elem/$cmd\n";
2521                 }
2522             }
2523             if ($to_append) {
2524                 push @Path, $path;
2525             }
2526         }
2528         @pairs = @originalPairs;
2529         while (@pairs) {
2530             my $path = shift @pairs;
2531             my $cmd = shift @pairs;
2532             my $realpath;
2534             $realpath = PathLookup ($cmd, @Path);
2535             if (!($realpath eq $path)) {
2536                 AddWarning ("Path conflict for executables " .
2537                             "$path/$cmd against $realpath");
2538             }
2539         }
2541         return join $ps, CleanupPath (@Path);
2544 #------------------------------------------------------------
2545 # Function name: AddWarning 
2546 # Description:   Adds any kind of warning for the user.
2547 #                The warning will be shown at the end
2548 #                of this script.
2549 # Arguments:     1. Add the configure warnings or the set_soenv
2550 #                   warning (string).
2551 #                2. Warning (string).
2552 # Return value:  void
2553 #------------------------------------------------------------
2554 sub AddWarning 
2555 {  if ( $_[ 0 ] eq "configure" ) 
2556    {  open( IN, $warnfile );
2557       while ( <IN> ) 
2558       {  $Warning = $Warning."* - ".$_;
2559       }
2560       close( IN );
2561       # Remove the temporary warning file.
2562       # unlink ( $warnfile );
2563    }
2564    elsif ( $_[ 0 ] eq "set_soenv" ) 
2565    {  my ( $arg1 );
2566       $arg1 = $_[ 1 ];
2567       chomp( $arg1 );                            # cut off new line      
2568       $Warning = $Warning."* - set_soenv: warning: $arg1 $newline";  # add the warning  
2569    }
2571 #-------------------
2572 # That's all folks!
2573 #-------------------