sync master with lastest vba changes
[ooovba.git] / set_soenv.in
blob9bc71be040ee3cdeff9917b540f41f1a92df0df6
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, $outfile_bat, $bootfile, $newline, $comment,
42      $comment4nt, $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       $JREEXTRALIBDIR, $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, $SHELL_PATH, $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, $SHELL,
81      $UPD, $WORK_STAMP, 
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      $LD_LIBRARY_PATH, $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, $TEMP,
90      $COMMON_BUILD_TOOLS, $WIN_GREP, $WIN_FIND, $WIN_LS,
91      $WIN_GNUCOPY, $WIN_TOUCH, $STLPORT4, $MOZILLA_VERSION, $MOZILLA_TOOLKIT, $PREBUILD_MOZAB,
92          $PROEXT,
93      $SYSTEM_PYTHON, $PYTHONPATH, $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 $NO_HIDS              = "TRUE";
190 $SO3                  = "TRUE";
191 $SOLAR_JAVA           = "@SOLAR_JAVA@";
192 $SOLAR_PLUGIN         = "TRUE";
193 $UPDATER              = "YES";
194 $BUILD_DELIVER        = "true";
195 $VCL                  = "TRUE";
196 $BUILD_SOSL           = "true";
197 $ENABLEUNICODE        = "TRUE";
198 $NEW_JAR_PACK         = "TRUE";
199 $NO_BSYMBOLIC         = "TRUE";
200 $comment              = "#";           # UNIX script comment character
201 $comment4nt           = "rem";         # Windows 4nt script comment character
203 # Some JREs do not need the following variable.
204 $JREEXTRALIBDIR = "";
206 # Setting platform dependent constant values.
207 if ( $platform =~ m/solaris/ ) 
208 {     print "Setting Solaris specific values... ";
209    if ($platform =~ m/^i[3456]86/)
210    {  
211       if ( $CC =~ "gcc") {
212          $outfile        = "SolarisX86GccEnv.Set";
213          $OUTPATH        = "unxsogi";
214       } else {
215          $outfile        = "SolarisX86Env.Set";
216          $OUTPATH        = "unxsoli4";
217       }
218       $CPU            = "I";
219       $CPUNAME        = "INTEL";
220           $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
221           $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."motif21";
222           $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
224    }
225    else
226    {
227       if ( $CC =~ "gcc") {
228          $outfile        = "SolarisSparcGccEnv.Set"; 
229          $OUTPATH        = "unxsogs";
230       } else {
231          $outfile        = "SolarisSparcEnv.Set"; 
232          $OUTPATH        = "unxsols4";
233       }
234       $CPU            = "S";
235       $CPUNAME        = "SPARC";
236           $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc";
237           $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."motif21";
238           $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."native_threads";
239    }
241    if ( $CC =~ "gcc") {
242        $COM            = "GCC";
243        $CVER           = "C300";
244    } else {
245        $COM            = "C52";
246        $CVER           = "C52";
247        $COMEX          = 4;
248    }
249    $BIG_SVX        = "TRUE";
250    $COMPATH        = '@COMPATH@'; 
251    $GUI            = "UNX";
252    $GUIBASE        = "unx";
253    $GVER           = "VCL";
254    $INPATH         = $OUTPATH.$PROEXT;
255    $OS             = "SOLARIS";
256    $PATH_SEPERATOR = $ps;
258 elsif ( $platform =~ m/netbsd/ ) 
260 #Set platform specific values: 
261    if ($platform =~ m/^i[3456]86/)
262    {  print "Setting NetBSD x86 specific values... ";
263       $outfile        = "NetBSDX86Env.Set"; 
264       $CPU            = "I";
265       $CPUNAME        = "INTEL";
266       $OUTPATH        = "unxbsdi";
267       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
268       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
269       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
270    }
271    elsif ($platform =~ m/^sparc/)
272    {  print "Setting NetBSD Sparc specific values... ";
273       $outfile        = "NetBSDSparcEnv.Set"; 
274       $CPU            = "S";
275       $CPUNAME        = "SPARC";
276       $OUTPATH        = "unxbsds";
277       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc";
278       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."client";
279       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."native_threads";
280    }
281    elsif ($platform =~ m/powerpc/)
282    {  print "Setting NetBSD PPC specific values... ";
283       $outfile        = "NetBSDPPCEnv.Set"; 
284       $CPU            = "P";
285       $CPUNAME        = "POWERPC";
286       $OUTPATH        = "unxbsdppc";
287       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
288       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."classic";
289       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads";
290    }
291    else
292    { print "Unsupported NetBSD architecture: $platform \n";
293      exit 1;
294    }
295    #Conditional setting depending on gcc3:
296       $CVER           = "C300";
297       $OUTPATH        = $OUTPATH."2";
298    # General NetBSD settings:
299       $BIG_SVX        = "TRUE";
300       $COM            = "GCC";
301       $COMPATH        = '@COMPATH@'; 
302       $GUI            = "UNX";
303       $GUIBASE        = "unx";
304       $GVER           = "VCL";
305       $INPATH         = $OUTPATH.$PROEXT;
306       $OS             = "NETBSD";
307       $PATH_SEPERATOR = $ps;
309 elsif ( $platform =~ m/freebsd/ ) 
310 {     $BIG_SVX        = "TRUE";
311       $COM            = "GCC";
312       $COMPATH        = '@COMPATH@'; 
313       $CVER           = "C300";
314       $GUI            = "UNX";
315       $GUIBASE        = "unx";
316       $GVER           = "VCL";
317       $OS             = "FREEBSD";
318       $PATH_SEPERATOR = $ps;
319       $OSVERSION      = '@OSVERSION@';
320    if ($platform =~ m/^amd64/)
321    {  my ( $JAVA_OS );
322       print "Setting FreeBSD AMD64 specific values... ";
323       $outfile        = "FreeBSDAMDEnv.Set";
324       $CPU            = "X";
325       $CPUNAME        = "X86_64";
326       $OUTPATH        = "unxfbsdx";
327       $JAVA_OS        = '@JAVA_HOME@';
328       $JAVA_OS        =~ s/.*\///;
329       if ($JAVA_OS =~ m/^linux/)
330       {  $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
331          $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
332          $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
333          $JREEXTRALIBDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."xawt";
334       }
335       else
336       {  $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64";
337          $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."server";
338          $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."native_threads";
339          $JREEXTRALIBDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."xawt";
340       }
341    }
342    elsif ($platform =~ m/^i386/)
343    {  print "Setting FreeBSD x86 specific values... ";
344       $outfile        = "FreeBSDX86Env.Set";
345       $CPU            = "I";
346       $CPUNAME        = "INTEL";
347       $OUTPATH        = "unxfbsdi";
348       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
349       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
350       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
351       $JREEXTRALIBDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."xawt";
352    }
353    else
354    {  print "Unsupported FreeBSD architecture: $platform \n";
355          exit 1;
356    }
357    if( @GCCVER@ >= 30401 ) {
358       $CVER        = "C341";
359    }
360       $INPATH         = $OUTPATH.$PROEXT;
362 elsif ( $platform =~ m/linux/ ) 
364 # General Linux settings:
365       $CVER           = "C300";
366       $BIG_SVX        = "TRUE";
367       $COM            = "GCC";
368       $COMPATH        = '@COMPATH@'; 
369       $GLIBC          = "2REDHAT60";
370       $GUI            = "UNX";
371       $GUIBASE        = "unx";
372       $GVER           = "VCL";
373       $OS             = "LINUX";
374       $PATH_SEPERATOR = $ps;
376 #Set platform specific values: 
377    if ($platform =~ m/^i[3456]86/)
378    {  print "Setting Linux x86 specific values... ";
379       $outfile        = "LinuxX86Env.Set"; 
380       $CPU            = "I";
381       $CPUNAME        = "INTEL";
382       
383       if ($JDK =~ m/^[Ii][Bb][Mm]/)
384       { $JRELIBDIR     = '$JAVA_HOME'.$ds."jre".$ds."bin";
385         $JRETOOLKITDIR = '$JAVA_HOME'.$ds."jre".$ds."bin".$ds."classic";
386         $JRETHREADDIR  = '$JAVA_HOME'.$ds."jre".$ds."bin"; }
388       elsif ($JDK =~ m/^[Bb][Ee][Aa]/)
389       { $JRELIBDIR     = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
390         $JREEXTRALIBDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."xawt";
391         $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."jrockit";
392         $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads"; }
394       else {      
395       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
396        $JREEXTRALIBDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."xawt";
397       # has both server and client
398       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
399       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
400       }
402       if( @GCCVER@ >= 30401 ) {
403          $OUTPATH     = "unxlngi6";
404          $CVER        = "C341";
405       }
406       else {
407          $OUTPATH     = "unxlngi4";
408       }
409    }
410    elsif ($platform =~ m/^x86_64/)
411    {  print "Setting Linux x86-64 specific values... ";
412       $outfile        = "LinuxX86-64Env.Set";
413       $CPU            = "X";
414       $CPUNAME        = "X86_64";
415       $CVER           = "C341";
416       $OUTPATH        = "unxlngx6";
417       # Blackdown.org JDK porting project uses `amd64' and `server' in JDK 1.4.2 RC1
418       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64";
419       # has both server and client
420       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."server";
421       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."native_threads";
422       $JREEXTRALIBDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."xawt";
423    }
424    elsif ($platform =~ m/^ia64/)
425    {  print "Setting Linux ia64 specific values... ";
426       $outfile        = "LinuxIA64Env.Set";
427       $CPU            = "A";
428       $CPUNAME        = "IA64";
429       $CVER           = "C341";
430       $OUTPATH        = "unxlnga";
431       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ia64";
432       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ia64".$ds."server";
433       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ia64".$ds."native_threads";
434       $JREEXTRALIBDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ia64".$ds."xawt";
435    }
436    elsif ($platform =~ m/^sparc/)
438    {  print "Setting Linux Sparc specific values... ";
439       $outfile        = "LinuxSparcEnv.Set"; 
440       $CPU            = "S";
441       $CPUNAME        = "SPARC";
442       $OUTPATH        = "unxlngs";
443       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc";
444       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."server";
445       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."native_threads";
446       $JREEXTRALIBDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."xawt";
447    }
448    elsif ($platform =~ m/^powerpc/)
449    {
450       if (($platform =~ m/^powerpc64/) && ('@SIZEOF_LONG@' eq '8')) {
451          print "Setting Linux PPC64 specific values... ";
452          $outfile = "LinuxPPC64Env.Set"; 
453          $OUTPATH = "unxlngppc64";
454          $CPUNAME = "POWERPC64";
456          if ( $JDK eq "gcj" ) {
457             $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc64";
458             $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc64".$ds."client";
459             $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc64".$ds."native_threads";
460          }
461       }
462       else {
463          print "Setting Linux PPC specific values... ";
464          $outfile = "LinuxPPCEnv.Set"; 
465          $OUTPATH = "unxlngppc";
466          $CPUNAME = "POWERPC";
468          if ( $JDK eq "gcj" ) {
469             $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
470             $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."client";
471             $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads"; }
472          elsif ($JDK =~ m/^[Ii][Bb][Mm]/)
473          {  $JRELIBDIR     = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
474             $JRETOOLKITDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."classic";
475             $JRETHREADDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
476             $JREEXTRALIBDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."xawt";
477          }
478          # OpenJDK
479          elsif ($JDK =~ m/sun/) {
480             $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
481             $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."server";
482             $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads";
483             $JREEXTRALIBDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."xawt";
484          }
485       }
487       $CPU            = "P";
489    }
490    elsif ($platform =~ m/^s390/)
491    {
492       if (($platform =~ m/^s390x/) && ('@SIZEOF_LONG@' eq '8')) {
493          print "Setting Linux zSeries specific values... ";
494          $outfile        = "LinuxS390XEnv.Set";
495          $CPUNAME        = "S390X";
496          $ARCH           = "s390x";
497          $OUTPATH        = "unxlngs390x";
498       }
499       else {
500          print "Setting Linux S/390 specific values... ";
501          $outfile        = "LinuxS390Env.Set";
502          $CPUNAME        = "S390";
503          $ARCH           = "s390";
504          $OUTPATH        = "unxlngs390";
505       }
506       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH;
507       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH.$ds."server";
508       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH.$ds."native_threads";
509       $JREEXTRALIBDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH.$ds."xawt";
510       $CPU            = "3";
511    }
512    elsif ($platform =~ m/^m68k/)
513    {  print "Setting Linux m68k specific values... ";
514       $outfile        = "LinuxM68KEnv.Set";
515       $CPU            = "6";
516       $CPUNAME        = "M68K";
517       $CVER           = "C341";
518       $OUTPATH        = "unxlngm68k";
519       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."m68k";
520       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."m68k".$ds."server";
521       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."m68k".$ds."native_threads";
522       $JREEXTRALIBDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."m68k".$ds."xawt";
523    }
524    elsif ($platform =~ m/^alpha/) 
525    {  print "Setting Linux Alpha specific values... ";
526       $outfile        = "LinuxAlphaEnv.Set"; 
527       $CPU            = "A";
528       $CPUNAME        = "ALPHA_";
529       $OUTPATH        = "unxlnga";
530       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha";
531       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha".$ds."server";
532       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha".$ds."native_threads";
533    }
534    elsif ($platform =~ m/^arm.*?l-/)
535    {  print "Setting Linux ARM specific values... ";
536       $outfile        = "LinuxARMEnv.Set"; 
537       $CPU            = "R";
538       $CPUNAME        = "ARM";
539       $OUTPATH        = "unxlngr";
540       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm";
541       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm".$ds."server";
542       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm".$ds."native_threads";
543       $JREEXTRALIBDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm".$ds."xawt";
544       $EPM_FLAGS      = "-a arm";
545    }
546    elsif ($platform =~ m/^mips/)
547    {  print "Setting Linux MIPS specific values... ";
548       $outfile        = "LinuxMIPSEnv.Set"; 
549       $CPU            = "M";
550       $CPUNAME        = "GODSON";
551       $OUTPATH        = "unxlngmips";
553       if ('@SIZEOF_LONG@' eq '8') {
554         if ('@WORDS_BIGENDIAN@' ne 'yes') {
555           $EPM_FLAGS = "-a mips64el";
556           if ( $JDK eq "gcj" ) {
557             $ARCH = "mips64el";
558           }
559         }
560         else {
561           $ARCH = "mips64";
562         }
563       }
564       else {
565         if ('@WORDS_BIGENDIAN@' ne 'yes') {
566           $EPM_FLAGS = "-a mipsel";
567           if ( $JDK =~ m/sun/ && -d "@JAVA_HOME@".$ds."jre".$ds."lib".$ds."mips32" ) {
568            $ARCH = "mips32"; # Lemote
569           } else {
570            $ARCH = "mipsel";
571           }
572         }
573         else {
574           $ARCH = "mips";
575         }
576       }
578       $JRELIBDIR      = '$JAVA_HOME'.$ds."lib".$ds.$ARCH;
579       if ( $JDK =~ m/sun/ && -d "@JAVA_HOME@".$ds."jre".$ds."lib".$ds."mips32" ) {
580         $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."lib".$ds.$ARCH.$ds."client"; # Lemote
581       } else {
582         $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."lib".$ds.$ARCH.$ds."server";
583       }  
584       $JRETHREADDIR   = '$JAVA_HOME'.$ds."lib".$ds.$ARCH.$ds."native_threads";
585       $JREEXTRALIBDIR = '$JAVA_HOME'.$ds."lib".$ds.$ARCH.$ds."xawt";
586    }
589    $INPATH         = $OUTPATH.$PROEXT;
591 elsif ( $platform =~ m/osf1/ ) 
592 {     print "Setting Tru64 specific values... ";
593       $outfile        = "Tru64AlphaEnv.Set"; 
594       $BIG_SVX        = "TRUE";
595       $COM            = "CXX";
596       $COMPATH        = '@COMPATH@'; 
597       $CPU            = "A";
598       $CPUNAME        = "ALPHA_";
599       $CVER           = "C62";
600       $GUI            = "UNX";
601       $GUIBASE        = "unx";
602       $GVER           = "VCL";
603       $OUTPATH        = "unxt64";
604       $INPATH         = $OUTPATH.$PROEXT;
605       $OS             = "TRU64";
606       $PATH_SEPERATOR = $ps;
607       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha";
608       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha".$ds."client";
609       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha".$ds."native_threads";
611 elsif ( $platform =~ m/irix/ )
612 {     print "Setting Irix specific values... ";
613       $outfile        = "IrixMipsEnv.Set";
614       $BIG_SVX        = "TRUE";
615       if ($CC =~ "gcc" ) {
616             $COM          = "GCC";
617             $OUTPATH        = "unxirgm";
618             $CVER           = "C300";
619       }
620           else {
621                 $COM            = "C730";
622         $CVER           = "C730";
623         $OUTPATH        = "unxirxm3";
624       }
625       $COMPATH        = '@COMPATH@';
626       $CPU            = "M";
627       $CPUNAME        = "MIPS";
628       $GUI            = "UNX";
629       $GUIBASE        = "unx";
630       $GVER           = "VCL";
631       $INPATH         = $OUTPATH.$PROEXT;
632       $OS             = "IRIX";
633       $PATH_SEPERATOR = $ps;
634       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."mips";
635       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."mips".$ds."client";
636       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."mips".$ds."native_threads";
638 elsif ( $platform =~ m/cygwin/ ) 
640       $COMPATH        = PathFormat('@COMPATH@');
641       $MSPDB_PATH     = PathFormat('@MSPDB_PATH@');
642       $MIDL_PATH      = PathFormat('@MIDL_PATH@');
643       $CSC_PATH       = PathFormat('@CSC_PATH@');
644       $PSDK_HOME      = PathFormat('@PSDK_HOME@');
645       $DIRECTXSDK_LIB = PathFormat('@DIRECTXSDK_LIB@');
646       $USE_DIRECTX5   = "";
647       $FRAME_HOME     = PathFormat('@FRAME_HOME@');
648       $USE_NEW_SDK    = "TRUE";
649       $CPUNAME        = "INTEL";
650       $CPU            = "I";
651       $GUI            = "WNT";
652       $GUIBASE        = "WIN";
653       $GVER           = "NT351";
654       $OS             = "WNT";
655       $DYNAMIC_CRT    = "TRUE";
656       $SET_EXCEPTIONS = "TRUE";
657       $use_shl_versions = "TRUE";
658       $wps = ';'; # Windows style path seperator
659   if ( $MINGW eq "yes" )
660   {   # At the moment this implies the use of tcsh
661       print "Setting Windows NT cygwin MinGW specific values... ";
662       $FLIPCMD        = "slfl.pl";
663       $PATH_SEPERATOR = ';';
664       $outfile        = "winmingw.set"; 
665       $COM            = "GCC";
666       $COMPATH        =~ s/\/bin$//i;
667       $CVER           = "C341";
668       $OUTPATH        = "wntgcci";
669       $INPATH         = $OUTPATH.$PROEXT;
670       $ATL_INCLUDE = '$SOLARVER'.$ds.'$INPATH'.$ds."inc".$ds."external".$ds."mingw".$ds."include".$ds."atl". " ".'$PSDK_HOME'.$ds."include".$ds."atl";
671   }
672   else # The MSVC section starts here
673   {   $outfile        = "winenv.set";
674       $COM            = "MSC";
675       # COMPATH for MSC is differently used
676       $COMPATH        =~ s/\/bin$//i;
677       $OUTPATH        = "wntmsci@COMEX@";
678       $INPATH         = $OUTPATH.$PROEXT;
679       $COMEX          = '@COMEX@';
680       if ( "@COMEX@" eq "10" ) { # .NET 2003 needs M1310
681           $CVER        = "M1310";
682           $ATL_LIB     = $COMPATH.$ds."atlmfc".$ds."lib";
683           $ATL_INCLUDE = $COMPATH.$ds."atlmfc".$ds."include";
684           $MFC_LIB     = "";
685           $MFC_INCLUDE = "";
686       } elsif ( "@COMEX@" ge "11" ) { # .NET 2005 needs M1400
687           if ( "@COMEX@" eq "11" ) {
688               $CVER        = "M1400";
689           } elsif ( "@COMEX@" eq "12" ) {
690               $CVER        = "M1500";
691           } else {                   # Unsupported
692               die "Unsupported value for COMEX variable.\n";
693           }
694           if ( "@DISABLE_ACTIVEX@" ) {
695               $ATL_LIB     = $PSDK_HOME.$ds."lib"; # Doesn't exist for VSE
696               $ATL_INCLUDE = $PSDK_HOME.$ds."include".$ds."atl";
697               $MFC_LIB     = $PSDK_HOME.$ds."lib"; # Doesn't exist for VSE
698               $MFC_INCLUDE = $PSDK_HOME.$ds."include".$ds."mfc";
699           } else {
700               $ATL_LIB     = $COMPATH.$ds."atlmfc".$ds."lib";
701               $ATL_INCLUDE = $COMPATH.$ds."atlmfc".$ds."include";
702               $MFC_LIB     = $COMPATH.$ds."atlmfc".$ds."lib";
703               $MFC_INCLUDE = $PSDK_HOME.$ds."include".$ds."mfc";
704           }
705       }
706       if ( "@USE_SHELL@" ne "4nt" ) {
707           print "Setting W32 build with bash shell specific values... ";
708           # No speacial treatment for CC an CXX anymore.
709           $FLIPCMD        = "slfl.pl";
710           $PATH_SEPERATOR = ';';
711       } else                    # "@USE_SHELL@" ne "4nt"
712       {   print "Setting W32 build with 4NT shell specific values... ";
713           # Change path to lower case.
714           $COMPATH        = lc $COMPATH;
715           $PATH_SEPERATOR = ';';
716       }
717   }
719 elsif ( $platform =~ m/os2/ ) 
721       $COMPATH        = PathFormat('@COMPATH@');
722       $MSPDB_PATH     = PathFormat('@MSPDB_PATH@');
723       $MIDL_PATH      = PathFormat('@MIDL_PATH@');
724       $CSC_PATH       = PathFormat('@CSC_PATH@');
725       $PSDK_HOME      = PathFormat('@PSDK_HOME@');
726       $FRAME_HOME     = PathFormat('@FRAME_HOME@');
727       $USE_NEW_SDK    = "TRUE";
728       $CPUNAME        = "INTEL";
729       $CPU            = "I";
730       $GUI            = "OS2";
731       $GUIBASE        = "os2";
732       $GVER           = "VCL";
733       $OS             = "OS2";
734       $DYNAMIC_CRT    = "TRUE";
735       $SET_EXCEPTIONS = "TRUE";
736       $use_shl_versions = "TRUE";
737   {
738       print "Setting OS/2 gcc 3.3.5 specific values... \n";
739       $outfile        = "os2env.set";
740       $COM            = "GCC";
741       $CVER           = "C300";
742       $OUTPATH        = "os2gcci";
743       $INPATH         = $OUTPATH.$PROEXT;
744       $COMEX          = '@COMEX@';
746   {   print "Setting OS/2 with 4OS2 specific values... ";
747       # Change path to lower case.
748       $COMPATH        = lc $COMPATH;
749       $PATH_SEPERATOR = ';';
750       $ps = ';';
751       $wps = ';'; # Windows style path seperator
752   }
754   }
756 elsif ( $platform =~ m/darwin/ ) 
757 {     print "Setting Mac OS X/Darwin specific values... ";
758       $BIG_SVX        = "TRUE";
759       $COM            = "GCC";
760       $COMPATH        = '@COMPATH@'; 
761       if ($platform =~ m/^i[3456]86/)
762       {
763           print "Setting values for Mac OS X/Darwin on x86... ";
764           $outfile        = "MacOSXX86Env.Set"; 
765           $CPU            = "I";
766           $CPUNAME        = "INTEL";
767           $OUTPATH        = "unxmacxi";
768       }
769       elsif ($platform =~ m/^powerpc/)
770       {
771           print "Setting values for Mac OS X/Darwin on PowerPC... ";
772           $outfile        = "MacOSXPPCEnv.Set"; 
773           $CPU            = "P";
774           $CPUNAME        = "POWERPC";
775           $OUTPATH        = "unxmacxp";
776       }
777       if (@GCCVER@ >= 30401) {
778           $CVER           = "C341";
779       } else {
780           $CVER           = "C300";
781       }
782       $GUI            = "UNX";
783       $GVER           = "VCL";
784       $INPATH         = $OUTPATH.$PROEXT;
785       $OS             = "MACOSX";
786       $PATH_SEPERATOR = $ps;
787       # GUIBASE is set below; may be "aqua" or "unx".
789 elsif ( $platform =~ m/aix/ )
791    if( $platform !~ m/^powerpc/ )
792    {
793         print "\nAIX has only been ported and tested on powerpc\n";
794         AddWarning( "set_soenv", "Platform $platform has not been tested");
795    }
796    print "Setting AIX PPC specific values... ";
797    $outfile        = "aixPPCEnv.Set"; 
798    $CPU            = "P";
799    $CPUNAME        = "POWERPC";
800    $OUTPATH        = "unxlngppc";
801    $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
802    $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."classic";
803    $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads";
804    $BIG_SVX        = "TRUE";
805    $COM            = "GCC";
806    $CVER           = "C300";
807    $COMPATH        = '@COMPATH@'; 
808    $GUI            = "UNX";
809    $GUIBASE        = "unx";
810    $GVER           = "VCL";
811    $INPATH         = $OUTPATH.$PROEXT;
812    $OS             = "AIX";
813    $PATH_SEPERATOR = $ps;
815 else {
816         print "\nset_soenv:  Cannot figure out what platform you are running\n";
817         print "For $platform.\n";
818         exit 1;
820 print "done\n";
823 # D. Gathering directory information from the user.
825 # If the directory does not exist something is strange.
826 # 1. OpenOffice.org build home directory.
827 chomp($SRC_ROOT  = `pwd`);
828 $SRC_ROOT =~ s/\/config_office//;
829 $SRC_ROOT = PathFormat($SRC_ROOT);
830 CheckPathExist( $SRC_ROOT );
832 #-----------------------------------------------------------------------------------------------------
833 # Copy top level makefile from config_office/ to $SRC_ROOT
834 #-----------------------------------------------------------------------------------------------------
835 if (! -e "makefile.rc")
836 {  AddWarning( "set_soenv", "makefile.rc not found in config_office/. Could not copy to SRC_ROOT." );
838 else
839 {  `cp -f makefile.rc $SRC_ROOT/makefile.mk`;
842 # 2. Java home directory.
843 # JAVA_HOME as argument from autoconf.
844 $JAVA_HOME = PathFormat('@JAVA_HOME@') ;
846 if ( $platform =~ m/cygwin|os2/ ) {
847    $JAVA_HOME =~ s/[\s\/]+$//;  # remove trailing \n or \/ if there is any.
849 # 3. shell path.
850 # Check whether autoconf found a valid shell path.
851 if ("@USE_SHELL@" eq "tcsh")
852 {  # SHELL as argument from autoconf.
853    $SHELL_PATH = '@SHELLPATH@';
854    $SHELL = '@SHELLPATH@'."\/tcsh";
856 elsif ("@USE_SHELL@" eq "bash")
858    $SHELL_PATH = '@SHELLPATH@';
859    $SHELL = '@SHELLPATH@'."\/bash";
861 elsif ("@USE_SHELL@" eq "4nt")
862 {  # @SHELLPATH@ is NO_SHELLPATH_NEEDED for 4nt - 
863    $SHELL_PATH = '';
865 else {
866    die "Not a recognized shell: @USE_SHELL@ !";
870 if ( '@STLPORT4@' eq $no_stl )
872    $STLPORT4 = "$no_stl";
875 # ml.exe assembler path for Windows users.
876 if ($platform =~ m/cygwin/)
877 {  $ASM_PATH = PathFormat('@ASM_HOME@');
880 # Check for prebuild mozab libraries if we don't build them # ourselves
881 # and we're also not using the external system mozilla installation.
883 # FIXME! This check should be done in configure and not here, but
884 # the $OS, $COM, $CPU variables are not yet present there.
886 if ( "@WITH_MOZILLA@" eq "YES" and "@BUILD_MOZAB@" ne "TRUE" and "@SYSTEM_MOZILLA@" ne "YES" )
887 {  print("\nChecking for prebuilt Mozilla libraries ...");
888    my $mozbinfile = $SRC_ROOT."/moz/zipped/";
889    if ( $^O eq 'MSWin32' ) {
890        chomp( $mozbinfile = qx{cygpath -d "$mozbinfile"} );
891    }
892    $mozbinfile .= $OS.$COM.$CPU;
893    if ( -e $mozbinfile."inc.zip"
894         and -e $mozbinfile."lib.zip"
895         and -e $mozbinfile."runtime.zip" )
896    {   print " found.\n";
897        $PREBUILD_MOZAB = "YES";
898    }
899    else
900    {   print " not found!\n\n";
901        print "If you don\'t use the system mozilla and also not build the needed\n";
902        print "mozilla libraries yourself you have to provide the needed files\n";
903        print "$OS$COM$CPU\{inc,lib,runtime\}.zip in moz/zipped/ .\n";
904        print "These files can be found here:\n";
905        print "  <http://tools.openoffice.org/moz_prebuild/680/>.\n\n";
906        die;
907    }
909 else
911    $PREBUILD_MOZAB = "";
915 # E. Determining the envionment values based on the information
916 #    that was gathered earlier on.
918 print "Setting the environment variables... ";
919 $USR                  = $ds."usr";
920 $ETC                  = $ds."etc";
921 $BIN                  = $ds."bin";
922 $LIB                  = $ds."lib";
923 $LIB64                = $ds."lib";
924 $LIB64               .= "64"
925 if ($platform =~ m/x86_64-.*-linux/);
926 $LIB64               .= "64" 
927 if (($platform =~ m/powerpc64-.*-linux/) && ('@SIZEOF_LONG@' eq '8'));
928 $LIB64               .= "64" 
929 if (($platform =~ m/s390x-.*-linux/) && ('@SIZEOF_LONG@' eq '8'));
930 $INC                  = $ds."inc";
931 $INCLUDE              = $ds."include";
932 $DEV                  = $ds."dev";
933 $OPT                  = $ds."opt";
934 $LOCAL                = $ds."local";
935 $SOLENV               = $ds."solenv";
936 $SOLVER               = $ds."solver";
937 $CONFIG               = $ds."config";
938 $USR_BIN              = $USR.$BIN;
939 $USR_LIB              = $USR.$LIB64;
940 $USR_LOCAL            = $USR.$ds."local";
941 $USR_CCS              = $USR.$ds."ccs";
942 $USR_OPENWIN          = $USR.$ds."openwin";
943 $USR_DT               = $USR.$ds."dt";
944 $COMMON_BUILD_TOOLS   = '$SRC_ROOT'.$ds."external".$ds."common";
946 # Generate alternate output file for sh?
947 $outfile_sh = $outfile.".sh";
948 if ($GUI eq "OS2")
950    # Generate output file for 4os2?
951    $outfile_bat = $outfile;
952    $outfile_bat =~ s/set$/cmd/i;
954 elsif ("@USE_SHELL@" eq "4nt")
956     # Generate output file for 4nt?
957     $outfile_bat = $outfile;
958     $outfile_bat =~ s/set$/bat/i;
959 } else {
960     undef $outfile_bat;
963 if ($STLPORT4 ne $no_stl) {
964         $ps_STLPORT_LIB         = $ps.'$STLPORT4'.$LIB64;
965         $L_STLPORT_LIB          = $L.'$STLPORT4'.$LIB64;
966         $STLPORT_stlport        = $I.'$STLPORT4'.$ds.'stlport';
967         $STLPORT_inc_stlport    = $I.'$STLPORT4'.$ds.'include'.$ds.'stlport';
968 } else {
969         $ps_STLPORT_LIB         = "";
970         $L_STLPORT_LIB          = "";
971         $STLPORT_stlport        = $I.$SRC_ROOT.$SOLVER.$ds.$UPD.$ds.$INPATH.$INC.$ds."stl";
972         $STLPORT_inc_stlport    = "";
976 # Windows NT only variables
977 if ($platform =~ m/cygwin/)
978 {  
979    if ( $JAVA_HOME ne "" )
980    {
981       $JAVA_LIB             = $JAVA_HOME.$LIB;
982    }
983    # Import SystemDrive enviroment variable
984    use Env qw(SYSTEMDRIVE);
985    # Change $SYSTEMDRIVE to lower case.
986    $SYSTEMDRIVE          = lc $SYSTEMDRIVE;
987    use Env qw(SYSTEMROOT);
988    $CYGWIN_PATH          = PathFormat('@CYGWIN_PATH@'); # Windows bash path
989    $WIN_GREP             = '$CYGWIN_PATH'.$ds."grep.exe";
990    $WIN_FIND             = '$CYGWIN_PATH'.$ds."find.exe";
991    $WIN_LS               = '$CYGWIN_PATH'.$ds."ls.exe";
992    $WIN_GNUCOPY          = '$CYGWIN_PATH'.$ds."cp.exe";
993    $WIN_TOUCH            = '$CYGWIN_PATH'.$ds."touch.exe";
996 if ( $JAVA_HOME ne "" )
998    $JAVA_BIN             = $JAVA_HOME.$BIN;
999    $JAVA_INCLUDE         = $JAVA_HOME.$ds."include";
1003 $PERL                 = PathFormat('@PERL@'); # Perl program
1004 $PERL_PATH            = dirname('@PERL@'); # Perl Path 
1005 $XLIB                 = PathFormat('@XLIB@'); # X11 libraries
1006 $XINC                 = PathFormat('@XINC@'); # X11 includes
1009 # Mac OS X/Darwin only variables.
1010 if ( $platform =~ m/darwin/ )
1011 {  $FRAMEWORKSHOME       = $ds."System".$ds."Library".$ds."Frameworks";
1012    if ( $XLIB eq "no_x_libraries" ) {
1013       $GUIBASE  = "aqua";
1014    } else {
1015       $GUIBASE  = "unx";
1016    }
1019 # The project's workstamp.
1020 $WORK_STAMP            = "@SOURCEVERSION@";
1021 # Location of the source.
1022 $SOLARSRC             = '$SRC_ROOT';
1024 $DEVROOT              = '$SRC_ROOT';
1025 # Set solenv and solver to given or default values. 
1026 # Location of the solenv tree.
1027 if ('@LOCAL_SOLENV@' eq "DEFAULT")
1028 {  $SOLARENV          = $SRC_ROOT.$SOLENV;
1030 else
1031 {  $SOLARENV          =  PathFormat('@LOCAL_SOLENV@');
1033 # Location of the solver tree.
1034 if ('@LOCAL_SOLVER@' eq "DEFAULT")
1035 {  $SOLARVER          = $SRC_ROOT.$SOLVER.$ds.$UPD;
1037 else
1038 {  $SOLARVER          = PathFormat('@LOCAL_SOLVER@').$ds.$UPD;
1040 #Location of Solar version.
1041 $SOLARVERSION         = '$SOLARVER';
1043 $SOLARENVINC          = '$SOLARENV'.$INC;
1044 # Location of 
1045 $LOCALINI             = '$SOLARENV'.$CONFIG;
1046 # Location of 
1047 $STAR_INIROOT         = '$SOLARENV'.$CONFIG;
1048 # Location of 
1049 $STAR_INIROOTOLD      = '$SOLARENV'.$CONFIG;
1050 # Location of 
1051 $STAR_STANDLST        = '$SOLARENV'.$CONFIG.$ds."stand.lst";
1052 # Location of 
1053 $STAR_SSCOMMON        = '$SOLARENV'.$CONFIG.$ds."ssolar.cmn";
1054 # Location of 
1055 $STAR_SSOLARINI       = '$SOLARENV'.$CONFIG.$ds."ssolar.ini";
1056 # Location of dmake resource. 
1057 $DMAKEROOT            = '$SOLARENVINC'.$ds."startup";
1058 # Location of JDK classes .zip file.
1059 # but in jdk 1.2 it is called rt.jar and it lives in jre/lib
1060 $CLASSPATH            = '$JAVA_HOME'.$ds.'jre'.$LIB.$ds."rt.jar".$wps.'.';
1061 # Location of the JDK supported standard classes.zip file.
1062 # see above for why the change
1063 $XCLASSPATH           = '$JAVA_HOME'.$ds.'jre'.$LIB.$ds."rt.jar".$wps.'.';
1065 # Paths to run time shared libraries.
1066 if ($platform =~ m/solaris/) 
1067 {  $LD_LIBRARY_PATH   = $cur_dir.
1068                         $ps.$USR_DT.$LIB.
1069                         $ps.$USR_OPENWIN.$LIB.
1070                         $ps.$USR_LOCAL.$LIB.
1071                         $ps.$par_dir.$LIB.
1072                         $ps_STLPORT_LIB.
1073                         $ps.$JRELIBDIR.
1074                         $ps.$JREEXTRALIBDIR.
1075                         $ps.$JRETOOLKITDIR.
1076                         $ps.$JRETHREADDIR.
1077                         $ps.'$SOLARVER'.$ds.'$INPATH'.$LIB;
1079 elsif ($platform =~ m/linux|netbsd|osf1|freebsd|aix/)
1080 {  $LD_LIBRARY_PATH   = $cur_dir.
1081                         $ps.'$SOLARENV'.$ds.'$INPATH'.$LIB.
1082                         $ps.$JRELIBDIR.
1083                         $ps.$JREEXTRALIBDIR.
1084                         $ps.$JRETOOLKITDIR.
1085                         $ps.$JRETHREADDIR.
1086                         $ps.$par_dir.$LIB64.
1087                         $ps_STLPORT_LIB.
1088                         $ps.'$SOLARVER'.$ds.'$INPATH'.$LIB.
1089                        $ps.$ENV{'LD_LIBRARY_PATH'};
1091 elsif ($platform =~ m/irix/)
1092 {  $LD_LIBRARY_PATH   = $cur_dir.
1093                         $ps.'$SOLARENV'.$ds.'$INPATH'.$LIB.
1094                         $ps.$JRELIBDIR.
1095                         $ps.$JREEXTRALIBDIR.
1096                         $ps.$JRETOOLKITDIR.
1097                         $ps.$JRETHREADDIR.
1098                         $ps.$USR_LOCAL.$LIB.
1099                         $ps.$par_dir.$LIB.
1100                         $ps.'$SOLARVER'.$ds.'$INPATH'.$LIB;
1102 elsif ($platform =~ m/darwin/)
1103 {  $LD_LIBRARY_PATH   = $cur_dir.
1104                         $ps.'$SOLARVER'.$ds.'$INPATH'.$LIB.
1105                         $ps_STLPORT_LIB;
1107 elsif ($platform !~ m/cygwin|os2/)
1108 {  AddWarning( "set_soenv", "$platform not configured for runtime shared libraries" );
1110         
1111 # Location used by the linker to create libraries.
1112 if ($platform =~ m/solaris/) 
1113 {  $SOLAREXTRALIB     = $L.$par_dir.$LIB.
1114                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$ds."lib.solaris.2.6".
1115                         $L.$LIB.
1116                         $L.$USR.$LIB.
1117                         $L.$USR.$LOCAL.$LIB.
1118                         $L.$USR_DT.$LIB.
1119                         $L.$USR_OPENWIN.$LIB;
1121 elsif ($platform =~ m/linux|netbsd|osf1|irix|freebsd|aix/)
1123    $SOLAREXTRALIB     = $L.$par_dir.$LIB64;
1125 elsif ($platform =~ m/darwin/) 
1126 {  $SOLAREXTRALIB     = $L.$LIB.
1127                         $L.$USR.$LIB;
1129 elsif ($platform !~ m/cygwin|os2/ )
1130 {  AddWarning( "set_soenv", "$platform not configured for linkage create libraries" );
1133 # Windows NT only variables
1134 if ($platform =~ m/cygwin|os2/)
1135 {  $COMP_ENV          = $OUTPATH;
1137    $JAVAHOME          = '$JAVA_HOME';
1139    $ILIB             = $cur_dir;
1141    if ($STLPORT4 ne $no_stl) {
1142        $ILIB      .=   $wps.$STLPORT4.$LIB64;
1143    }
1145    # Mingw is different
1146    if ( $COM eq "MSC" )
1147    {  $ILIB       .=    $wps.$SOLARVER.$ds.$INPATH.$LIB.
1148                         $wps.$JAVA_HOME.$LIB.
1149                         $wps.$PSDK_HOME.$LIB.
1150                         $wps.$FRAME_HOME.$LIB.
1151                         $wps.$COMPATH.$LIB;
1152       if ( '@ENABLE_DIRECTX@' ne "" ) {
1153           $ILIB   .= $wps.$DIRECTXSDK_LIB;
1154           if ( '@COMEX@' eq "10" ) {
1155               # .NET2003 provides and compiles against DirectX 5 libraries and is
1156               # hereby still Win9x compatible.
1157               $ILIB .= $wps.'$COMPATH'.$ds.'PlatformSDK'.$LIB;
1158               $USE_DIRECTX5 = "YES";
1159           }
1160       }
1161       # ILIB needs to use '\' directory seperators;
1162       $ILIB = WinPath( $ILIB, ";" );
1163    }
1164    elsif ( $COM eq "GCC" )
1165    {  $ILIB       .=    $wps.$SOLARVER.$ds.$INPATH.$LIB.
1166                         $wps.$SOLARVER.$ds.$INPATH.$BIN.
1167                         $wps.$JAVA_HOME.$LIB;
1168       if ( $USE_MINGW eq "cygwin" )
1169       {  $ILIB    .= $wps.PathFormat($USR.$LIB.$ds."mingw").
1170                      $wps.PathFormat($USR.$LIB.$ds."w32api");
1171       }
1172       else
1173       {  $ILIB       .= $wps.$COMPATH.$LIB;
1174       }
1175       $ILIB       .= $wps.$PSDK_HOME.$LIB;
1176       if ( '@ENABLE_DIRETX@' )
1177       {   $ILIB   .= $wps.PathFormat("@DIRECTXSDK_LIB@");
1178       }
1179    }
1181    $JAVAHOME          = '$JAVA_HOME';
1184      
1185 # The general environment path.
1186 if ($platform =~ m/linux|netbsd|odf1|irix|freebsd|aix|solaris/)
1187 {  $PATH              = $cur_dir.
1188                         $ps.'$SOLARVER'.$ds.'$INPATH'.$BIN.
1189                         $ps.'$SOLARENV'.$ds.'$OUTPATH'.$BIN.
1190                         $ps.'$SOLARENV'.$BIN;
1192    if ($platform =~ m/solaris/) {
1193         $PATH .= $ps.$USR_CCS.$BIN;
1194    }
1196    $PATH             .= $ps.$oldPATH;
1198    my @javaBits;
1199    if (( $JAVA_HOME ne "" ) && ( $JDK ne "gcj" )) {
1200       @javaBits = ( '$JAVA_HOME'.$BIN, 'javac' );
1201    } else {
1202       @javaBits = (); 
1203    }
1204    $PATH              = GetCorrectPath ($PATH,
1205                                         $COMPATH, $CC,
1206                                         $PERL_PATH, 'perl',
1207                                         $SHELL_PATH, '@USE_SHELL@',
1208                                         @javaBits);
1211 elsif ($platform =~ m/cygwin/)
1212 {  # The PATH variable is completely created from scratch. Elements
1213    # from oldPATH that are not yet included are appended to PATH at
1214    # the end.
1216    my ( $tmppath );
1218    $PATH              = $cur_dir.
1219                         $ps.CygFormat($SOLARVER).$ds.$INPATH.$BIN.
1220                         $ps.CygFormat($SOLARENV).$ds."bin".
1221                         $ps.CygFormat($SOLARENV).$ds.$OUTPATH.$BIN;
1223    if ( $JAVA_HOME ne "" )
1224    {
1225       # hack either "hotspot" or "client" should be used, depending on the jdk version:
1226       # 1.2.x   -   no such directory, unsupported 
1227       # 1.3.x   -   hotspot, client missing
1228       # 1.4.x   -   client, hotspot missing
1229       
1230       $PATH .= $ps.CygFormat($JAVA_HOME).$BIN;
1231           if ( -d $JAVA_HOME.$ds."jre".$ds."bin".$ds."hotspot" ) {
1232                   $PATH .= $ps.CygFormat($JAVA_HOME).$ds."jre".$ds."bin".$ds."hotspot";
1233           }
1234           if ( -d $JAVA_HOME.$ds."jre".$ds."bin".$ds."client" ) {
1235                   $PATH .= $ps.CygFormat($JAVA_HOME).$ds."jre".$ds."bin".$ds."client";
1236           }
1237    }
1239    # Add path to compiler
1240    $tmppath = CygFormat($COMPATH).$BIN;
1241    $tmppath =~ s/^\/\//\//;
1242    $PATH .= $ps.$tmppath;
1244    if ( $COM eq "MSC" ) {
1245        $tmppath = CygFormat($MSPDB_PATH);
1246            # for .NET to find mspdb71.dll (needed by CL.EXE C/C++ Compiler)
1247            if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1248                    $PATH .= $ps.$tmppath;
1249            }
1250            if ( ( $COMEX ge "10" ) ) {
1251                    # .NET needs midl.exe
1252                $tmppath = CygFormat($MIDL_PATH);
1253                    if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1254                            $PATH .= $ps.$tmppath;
1255                    }
1256                    # .NET needs csc.exe
1257                $tmppath = CygFormat($CSC_PATH);
1258                    if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1259                            $PATH .= $ps.$tmppath;
1260                    }
1261                    # Native installer needs some files if the Windows Installer SDK
1262                $tmppath = CygFormat($PSDK_HOME);
1263                    if ( $PATH !~ /(?:[:]|\A)(?:$tmppath\/bin)(?:[:]|\Z)/i ) {
1264                            $PATH .= $ps.$tmppath.$BIN;
1265                    }
1266            }
1267    } else { # Mingw is different
1268            # Native installer needs some files if the Windows Installer SDK
1269                $tmppath = CygFormat($PSDK_HOME);
1270            if ( $PATH !~ /(?:[:]|\A)(?:$tmppath\/bin)(?:[:]|\Z)/i ) {
1271                    $PATH .= $ps.$tmppath.$BIN;
1272            }
1273    }
1275    if ( $ASM_PATH ne "ASM_IN_PATH" )
1276    {   $PATH          .= $ps.CygFormat($ASM_PATH);
1277    } 
1278    # zip.exe / unzip.exe path for Windows users.
1279    my $zip_home_path = PathFormat('@ZIP_HOME@');
1280    $tmppath = CygFormat($zip_home_path);
1281    if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1282        $PATH          .= $ps.$tmppath;
1283    }
1285    # Possible cygwin paths must follow behind the OOo and MS paths
1287    # Check if $PERL_PATH is already set in PATH
1288    $tmppath = CygFormat($PERL_PATH);
1289    if ( ! ( $PATH =~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) )
1290    {
1291       $PATH          .= $ps.$tmppath;
1292    }
1293    # Check if $SHELL_PATH is already set in PATH
1294    $tmppath = CygFormat($SHELL_PATH);
1295    if ( ( "@USE_SHELL@" ne "4nt" ) && ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) )
1296    {   $PATH          .= $ps.$tmppath;
1297    }
1298    # Check if $CYGWIN_PATH is already set in PATH
1299    $tmppath = CygFormat($CYGWIN_PATH);
1300    if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1301       $PATH           .= $ps.$tmppath;
1302    }
1303    $PATH              .= $ps_STLPORT_LIB;
1304    # nsis path for Windows users.
1305    $NSIS_PATH = PathFormat('@NSIS_PATH@');
1306    $tmppath = CygFormat($NSIS_PATH);
1307    if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1308        $PATH          .= $ps.$tmppath;
1309    }
1310    # path to sn.exe (signing) for Windows users.
1311    my $sn_path = PathFormat('@FRAME_HOME@/bin');
1312    $tmppath = CygFormat($sn_path);
1313    if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1314        $PATH          .= $ps.$tmppath;
1315    }
1318    # Add the rest of the original path if it is still missing.
1319    if (($^O eq "cygwin")) { # Not for ActiveState perl
1320        my $expandedPATH = $PATH;
1321        $expandedPATH =~ s/(\$\w+)/$1/eeg;
1323        # fix situations where PATH may look like /bin:"C:\blah\bleh":/ugh
1324        my $fixedPATH = $oldPATH;
1325        if ( $oldPATH =~ /"/ ) {
1326            $fixedPATH = "";
1327            foreach my $pathentry ( split( '"',$oldPATH ) ) {
1328                if ( ( $pathentry =~ /^$ps/ ) || ( $pathentry =~ /$ps$/ ) ) {
1329                    $fixedPATH .= $pathentry;
1330                } else {
1331                    chomp( $pathentry = qx{cygpath -d "$pathentry"} ) ;
1332                    chomp( $pathentry = qx{cygpath -u "$pathentry"} ) ;
1333                    $fixedPATH .= $pathentry;
1334                }
1335            }
1336        }
1338        foreach my $pathentry (split($ps,$fixedPATH)) {
1339            if ( ! ( $expandedPATH =~ /(?:$ps|\A)(?:$pathentry)(?:$ps|\Z)/ ) ) {
1340                $PATH .= $ps.$pathentry;
1341                $expandedPATH .= $ps.$pathentry;
1342            }
1343        }
1344    } else {
1345        $PATH          .= $ps.$oldPATH;
1346    }
1348    # The path now is in cygwin posix format
1352 elsif ($platform =~ m/os2/)
1353 {  # The PATH variable is completely created from scratch. Everything that is not
1354    # needed is appended to the end.
1356    $PATH              = $cur_dir.
1357                         $ps.'$SOLARVER'.$ds.'$INPATH'.$BIN.
1358                         $ps.'$SOLARENV'.$ds."bin".
1359                         $ps.'$SOLARENV'.$ds.'$OUTPATH'.$BIN;
1361    if ( $JAVA_HOME ne "" )
1362    {
1363       # hack either "hotspot" or "client" should be used, depending on the jdk version:
1364       # 1.2.x   -   no such directory, unsupported 
1365       # 1.3.x   -   hotspot, client missing
1366       # 1.4.x   -   client, hotspot missing
1367       
1368       $PATH .= $ps.$JAVA_HOME.$BIN;
1369           if ( -d $JAVA_HOME.$ds."jre".$ds."bin".$ds."hotspot" ) {
1370                   $PATH .= $ps.$JAVA_HOME.$ds."jre".$ds."bin".$ds."hotspot";
1371           }
1372           if ( -d $JAVA_HOME.$ds."jre".$ds."bin".$ds."client" ) {
1373                   $PATH .= $ps.$JAVA_HOME.$ds."jre".$ds."bin".$ds."client";
1374           }
1375    }
1377   # Append old PATH
1378   my $temp = $oldPATH;
1379   $temp =~ s/\\/\//g ;
1380   $PATH             .= $ps.$temp;
1383 elsif ($platform =~ m/darwin/)
1384 {  $PATH              = $cur_dir.
1385                         $ps.'$SOLARVER'.$ds.'$INPATH'.$BIN.
1386                         $ps.'$SOLARENV'.$ds.'$OUTPATH'.$BIN.
1387                         $ps.'$SOLARENV'.$BIN;
1389   # Append old PATH
1390   $PATH             .= $ps.$oldPATH;
1392 else
1393 {  AddWarning( "set_soenv", "$platform not configured for general environment paths" );
1396 # Linker library search directory paths. 
1397 if ($platform =~ m/solaris/) 
1398 {  $SOLARLIB          = $L.$par_dir.$LIB.
1399                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB.
1400                         $L.'$SOLARVER'.$ds.'$INPATH'.$LIB.
1401                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB.
1402                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB."solaris.2.6".
1403                         $L.$LIB.
1404                         $L.$USR_LIB;
1405    if ( $CC =~ "gcc" ) {
1406       my $temp = $COMPATH;
1407       $temp =~ s:/bin$::;
1408       $SOLARLIB      .= $L.$temp.$LIB;
1409    }
1410    $SOLARLIB         .= $L.$USR_LOCAL.$LIB.
1411                         $L.$USR_DT.$LIB.
1412                         $L.$USR_OPENWIN.$LIB.
1413                         $L.'$JAVA_HOME'.$LIB.
1414                         $L.$JRELIBDIR.
1415                         $L.$JRETOOLKITDIR.
1416                         $L.$JRETHREADDIR.
1417                         $L_STLPORT_LIB.
1418                         $L.$XLIB;
1420 elsif ($platform =~ m/linux|netbasd|osf1|irix|aix|freebsd/)
1421 {  $SOLARLIB          = $L.$par_dir.$LIB.
1422                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB.
1423                         $L.'$SOLARVER'.$ds.'$INPATH'.$LIB.
1424                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB.
1425                         $L.'$JAVA_HOME'.$LIB64.
1426                         $L.$JRELIBDIR.
1427                         $L.$JRETOOLKITDIR.
1428                         $L.$JRETHREADDIR.
1429                         $L_STLPORT_LIB.
1430                         $L.$XLIB;
1432 elsif ($platform =~ m/cygwin|os2/)
1433 {  $SOLARLIB          = $L.'$SOLARVER'.$ds.'$INPATH'.$LIB.
1434                         $L.$par_dir.$LIB.
1435                         $L_STLPORT_LIB.
1436                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB;
1438 elsif ($platform =~ m/darwin/) 
1439 {  $SOLARLIB          = $L.'$SOLARVER'.$ds.'$INPATH'.$LIB.
1440                         $L_STLPORT_LIB.
1441                         $L.$USR_LIB;
1442     # [ed] 6/15/02 Add in X11 libraries onto the library path
1443     if ($GUIBASE eq "unx") {
1444        $SOLARLIB      .= $L.$XLIB;
1445     }
1449 if ($SYSTEM_MOZILLA eq "YES")
1451        $SOLARLIB .= $L."@MOZ_LIB@"
1454 # Location of the compiler include search directory paths.
1455 $SOLARINC             = $I.$cur_dir.
1456                         $I.'$SOLARVER'.$ds.'$INPATH'.$INC.$ds."stl".
1457                         $I.'$SOLARVER'.$ds.'$INPATH'.$INC.$ds."external".
1458                         $I.'$SOLARVER'.$ds.'$INPATH'.$INC.
1459                         $I.'$SOLARENV'.$ds.'$OUTPATH'.$INC.
1460                         $I.'$SOLARENV'.$INC.
1461                         $I.'$SRC_ROOT'.$ds."res";
1463 if ($platform =~ m/solaris|linux|osf1|freebsd|netbsd|irix/)
1465 $SOLARINC            .= $STLPORT_stlport;
1466 if ($platform =~ m/linux|freebsd|netbsd/)
1468 # This simply adds an include path, so even cases that break the FHS work
1469 $SOLARINC            .= $STLPORT_inc_stlport;
1471 if ($platform =~ m/solaris/ && $CC !=~ "gcc")
1473 $SOLARINC            .= '/SC5 ';
1475 # Platform dependent include path at the top of this list of include paths
1476 if ($platform =~ m/solaris/)
1477 {   my $temp;
1478     $temp =~ s:$COMPATH:/bin\$:;
1479     $SOLARINC         .= $I.$temp.$ds."include";
1481 if ($platform =~ m/linux/)
1483 # This simply adds an include path, so even cases that break the FHS work
1484    $SOLARINC         .= $STLPORT_inc_stlport;
1488         $SOLARINC      .= $I.'$SOLARENV'.$INC.$ds."Xp31".
1489                      $I.'$JAVA_HOME'.$INCLUDE;
1491         #include system dependent Java include directory
1492         if (!($JDK eq "gcj"))
1493         {
1494                 if ($platform =~ m/solaris/)
1495                 {  $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."solaris";
1496                 }
1497                 elsif  ($platform =~ m/linux|osf1/)
1498                 {  $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."linux";
1499                 }
1500                 elsif ($platform =~ m/freebsd/)
1501                 {
1502                 $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."freebsd";
1503                 $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."bsd";
1504                 $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."linux";
1505                 }
1506                 elsif ($platform =~ m/netbsd/)
1507                 {  $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."netbsd";
1508                 }
1509                 elsif ($platform =~ m/irix/)
1510                 {  $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."irix";
1511                 }
1513                 #java threads include path
1515                 $SOLARINC .=$I.'$JAVA_HOME'.$INCLUDE.$ds."native_threads".$ds."include";
1516         }
1517     #The tail, if needed
1518     if ($platform =~ m/linux|freebsd|netbsd/)
1519     {  $SOLARINC  .= $I.$XINC;
1520     }
1521     elsif ($platform =~ m/osf1/)
1522     {  $SOLARINC  .= $I.$XINC.
1523                      $I.$USR.$INCLUDE;
1524     }
1526 elsif ($platform =~ m/cygwin/)
1527 {  $SOLARINC         .= $STLPORT_stlport.
1528                         $I.'$JAVA_HOME'.$ds."include".$ds."win32".
1529                         $I.'$JAVA_HOME'.$ds."include";
1530    # Mingw is different
1531    if ( $COM eq "MSC" )
1532    {  $SOLARINC       .= $I.'$PSDK_HOME'.$INCLUDE.
1533                          $I.'$COMPATH'.$ds."include";
1534       if ( '@ENABLE_DIRECTX@' ne "" ) {
1535           $SOLARINC   .= $I.PathFormat('@DIRECTXSDK_HOME@').$INCLUDE;
1536           if ( '@COMEX@' eq "10" ) {
1537               # .NET2003 provides and compiles against DirectX 5 libraries and is
1538               # hereby still Win9x compatible.
1539               $SOLARINC .= $I.'$COMPATH'.$ds.'PlatformSDK'.$ds."include";
1540           }
1541       }
1542    }
1543    elsif ( $COM eq "GCC" )
1544    {  $SOLARINC       .= $I.'$SOLARVER'.$ds.'$INPATH'.$INC.$ds."external".$ds."mingw".$ds."include";
1545      if ( $USE_MINGW eq "cygwin" )
1546      {  $SOLARINC    .= $I.PathFormat($USR.$ds."include".$ds."mingw".$ds."include").
1547                         $I.PathFormat($USR.$ds."include".$ds."mingw").
1548                         $I.PathFormat($USR.$ds."include".$ds."w32api").
1549                         $I.PathFormat($USR.$ds."include"); }
1550      else
1551      {  $SOLARINC    .= $I.'$COMPATH'.$ds."include"; }
1552      @mingw_lib_include_paths = split( / /, "@MINGW_LIB_INCLUDE_PATH@" );
1553      foreach $mingw_lib_include_path (@mingw_lib_include_paths)
1554        {   chomp $mingw_lib_include_path;
1555            if ( $mingw_lib_include_path ne $COMPATH.$ds."include" && $mingw_lib_include_path ne "" )
1556            {
1557               $SOLARINC   .= $I.PathFormat($mingw_lib_include_path);
1558            }
1559        }
1560      $SOLARINC .= $I.PathFormat("@GXX_INCLUDE_PATH@").$I.PathFormat("@GXX_INCLUDE_PATH@".$ds."mingw32").
1561                   $I.'$PSDK_HOME'.$INCLUDE;
1562    }
1563    if ( '@ENABLE_DIRECTX@' ne "" ) {
1564        $SOLARINC   .= $I.PathFormat('@DIRECTXSDK_HOME@').$INCLUDE;
1565    }
1567 elsif ($platform =~ m/darwin/)
1568 {  $SOLARINC         .= $STLPORT_stlport.
1569                                                 $I.$FRAMEWORKSHOME.$ds."JavaVM.framework".$ds."Versions".$ds."Current".$ds."Headers".
1570                         $I.$FRAMEWORKSHOME.$ds."JavaVM.framework".$ds."Headers";
1571    # [ed] 6/15/02 Add in X11 headers as appropriate for the build
1572    if ($GUIBASE eq "unx") {
1573       $SOLARINC      .= $I.$XINC.
1574                         $I.$XINC.$ds."freetype2";
1575    }
1577 else
1578 {  AddWarning( "set_soenv", "$platform not configured for system dependant include dir" );
1581 if ($SYSTEM_PYTHON eq "NO") {
1582     $PYTHONPATH           = '.'.$wps.$SOLARVER.$ds.$INPATH.$ds.'lib'.$wps.$SOLARVER.$ds.$INPATH.$ds.'lib'.$ds.'python'.$wps.$SOLARVER.$ds.$INPATH.$ds.'lib'.$ds.'python'.$ds.'lib-dynload'.$wps.$SOLARVER.$ds.$INPATH.$ds.'lib'.$ds.'pyuno'.$wps.$SOLARVER.$ds.$INPATH.$ds.'bin'.$ds.'pyuno';
1583     if ($GUIBASE eq "WIN") {
1584         # PYTHONPATH need to use '\' directory seperators;
1585         $PYTHONPATH = WinPath( $PYTHONPATH, ";" );
1586     }
1590 print "done\n";
1593 # F. Setting the different aliases.
1595 print "Setting the aliases... ";
1596 # 1. alias for a full product make. 
1597 # ToFile will take care for the right 4nt format
1598         $mkout           = '"perl $SOLARENV/bin/mkout.pl"';
1599         $deliver         = '"perl $SOLARENV/bin/deliver.pl"';
1600         $build           = '"perl $SOLARENV/bin/build.pl"';
1601         $build_client    = '"perl $SOLARENV/bin/build_client.pl"';
1602         $zipdep          = '"perl $SOLARENV/bin/zipdep.pl"';
1603 # 3. alias for a full product make
1604 $nmake           = '"dmake"';
1605 print "done\n";
1607 #--------------------------
1608 # VI. Open the output file.
1609 #--------------------------
1611 open( OUT, ">$outfile" ) ||
1612    die "Cannot open $outfile: $!\n";
1614 # Create sh environment file
1615 open( OUT_SH, ">$outfile_sh" ) ||
1616   die "Cannot open $outfile_sh: $!\n";
1618 if(defined($outfile_bat))
1619 {  # Create bat environment file
1620    open( OUT_BAT, ">$outfile_bat" ) ||
1621    die "Cannot open $outfile_bat: $!\n";
1625 #------------------------------------------
1626 # VII. Writing the data to the output file.
1627 #------------------------------------------
1629 # Write file header.
1630 CreateFileHeader( *OUT, $UPD, $platform, "(t)csh", "#" );
1631 CreateFileHeader( *OUT_SH, $UPD, $platform, "sh/bash/ksh", "#" );
1632 CreateFileHeader( *OUT_BAT, $UPD, $platform, "4nt", "rem" ) if defined($outfile_bat);
1634 ToFile( "SRC_ROOT",          $SRC_ROOT,          "e" );
1635 ToFile( "SHELL",             $SHELL,             "e" );
1636 ToFile( "JAVA_HOME",         $JAVA_HOME,         "e" );
1637 ToFile( "ANT_HOME",          PathFormat("@ANT_HOME@"), "e" );
1638 ToFile( "ANT_LIB",           PathFormat("@ANT_LIB@"), "e" );
1639 ToFile( "ANT",               PathFormat("@ANT@"), "e" );
1640 ToFile( "JDKLIB",            $JAVA_LIB,          "e" );
1641 ToFile( "STLPORT4",          $STLPORT4,          "e" );
1642 ToFile( "STLPORT_VER",       "@STLPORT_VER@",    "e" );
1643 ToFile( "ASM_PATH",          $ASM_PATH,          "e" );
1644 ToFile( "BUILD_SOSL",        $BUILD_SOSL,        "e" );
1645 ToFile( "FRAMEWORKSHOME",    $FRAMEWORKSHOME,    "e" );
1646 ToFile( "Empty",             $empty,             "n" );
1649 # Writing the platform independent constant values to file.
1650 # (c = comment, e = environment variable, a = alias )
1651 ToFile( "Platform independent constant values.", $empty, "c" );
1652 # dictionaries
1653 if ('@WITH_DICT@' =~ m/ALL,/s)
1655    foreach $dict (@DICTIONARIES)
1656    {
1657       ToFile( "DIC_$dict",     "TRUE",          "e" );
1658    }
1659    ToFile( "DIC_ALL",          "TRUE",          "e" );
1661 else
1662 {       
1663    foreach $dict (@DICTIONARIES)
1664    {   if ('@WITH_DICT@' =~ m/$dict,/s)
1665        {   my $val="TRUE";
1666            ToFile( "DIC_$dict",     $val,          "e" );
1667        }
1668        else
1669        {   my $val;
1670            undef $val;
1671            ToFile( "DIC_$dict",     $val,          "e" );
1672        }
1673    }
1675 # Languages
1676 ToFile( "WITH_LANG",         "@WITH_LANG@",      "e" );
1677 ToFile( "INTRO_BITMAPS",     "@INTRO_BITMAPS@",  "e" );
1678 ToFile( "ABOUT_BITMAPS",     "@ABOUT_BITMAPS@",  "e" );
1679 ToFile( "OOO_VENDOR",        "@OOO_VENDOR@",     "e" );
1680 ToFile( "OOODMAKEMODE",      "YES",              "e" );
1681 ToFile( "WITH_POOR_HELP_LOCALIZATIONS", "@WITH_POOR_HELP_LOCALIZATIONS@", "e" );
1683 ToFile( "CALL_CDECL",        $CALL_CDECL,        "e" );
1684 ToFile( "COMMON_OUTDIR",     $COMMON_OUTDIR,     "e" );
1685 ToFile( "common_build",      $common_build,      "e" );
1686 ToFile( "BMP_WRITES_FLAG",   $BMP_WRITES_FLAG,   "e" );
1687 ToFile( "BUILD_SOSL_RELEASE", $BUILD_SOSL_RELEASE, "e" );
1688 ToFile( "NO_REC_RES",        $NO_REC_RES,        "e" );
1689 ToFile( "NO_HIDS",           $NO_HIDS,           "e" );
1690 ToFile( "SO3",               $SO3,               "e" );
1691 ToFile( "SOLAR_PLUGIN",      $SOLAR_PLUGIN,      "e" );
1692 ToFile( "UPDATER",           $UPDATER,           "e" );
1693 ToFile( "build_deliver",     $BUILD_DELIVER,     "e" );
1694 ToFile( "VCL",               $VCL,               "e" );
1695 ToFile( "ENABLEUNICODE",     $ENABLEUNICODE,     "e" );
1696 ToFile( "NEW_JAR_PACK",      $NEW_JAR_PACK,      "e" );
1697 ToFile( "NO_BSYMBOLIC",      $NO_BSYMBOLIC,      "e" );
1698 ToFile( "TF_FILTER",         "TRUE",             "e" );
1699 if ("@ENABLE_DEBUG@" eq "TRUE") {
1700 ToFile( "debug",             "true",             "e" );
1702 if ("@ENABLE_WERROR@" eq "FALSE") {
1703 ToFile( "EXTERNAL_WARNINGS_NOT_ERRORS", "TRUE",  "e" );
1705 ToFile( "PRODUCT",           "@PRODUCT@",        "e" );
1706 ToFile( "PROFULLSWITCH",     "@PROFULLSWITCH@",  "e" );
1707 ToFile( "PROEXT",            $PROEXT,            "e" );
1708 ToFile( "UNIXWRAPPERNAME",   "@UNIXWRAPPERNAME@","e" );
1709 ToFile( "BUILD_MOZAB",       "@BUILD_MOZAB@",    "e" );
1710 ToFile( "PREBUILD_MOZAB",    $PREBUILD_MOZAB,    "e" );
1711 ToFile( "MOZILLA_VERSION",   $MOZILLA_VERSION,   "e" );
1712 ToFile( "DEFAULT_MOZILLA_TOOLKIT", $MOZILLA_TOOLKIT, "e" );
1713 ToFile( "BUILD_VER_STRING",  "@BUILD_VER_STRING@", "e" );
1714 ToFile( "ENABLE_VBA",  "@ENABLE_VBA@", "e" );
1715 ToFile( "VBA_EXTENSION",  "@VBA_EXTENSION@", "e" );
1716 if ($platform =~ m/linux/ && $platform =~ m/powerpc/) {
1717 ToFile( "JITC_PROCESSOR_TYPE","6",                 "e" );
1719 ToFile( "DEFAULT_TO_ENGLISH_FOR_PACKING",  "yes", "e" );
1720 ToFile( "ENABLE_GTK",        "@ENABLE_GTK@",       "e" );
1721 ToFile( "GTK_CFLAGS",        "@GTK_CFLAGS@",       "e" );
1722 ToFile( "GTK_LIBS",          "@GTK_LIBS@",         "e" );
1723 ToFile( "ENABLE_SYSTRAY_GTK", "@ENABLE_SYSTRAY_GTK@", "e" );
1724 ToFile( "ENABLE_STATIC_GTK", "@ENABLE_STATIC_GTK@", "e" );
1725 ToFile( "ENABLE_CAIRO",      "@ENABLE_CAIRO@",     "e" );
1726 ToFile( "ENABLE_OPENGL",     "@ENABLE_OPENGL@",    "e" );
1727 ToFile( "ENABLE_PDFIMPORT",  "@ENABLE_PDFIMPORT@", "e" );
1728 ToFile( "ENABLE_MINIMIZER",   "@ENABLE_MINIMIZER@","e" );
1729 ToFile( "ENABLE_PRESENTER_SCREEN","@ENABLE_PRESENTER_SCREEN@","e" );
1730 ToFile( "ENABLE_REPORTBUILDER","@ENABLE_REPORTBUILDER@","e" );
1731 ToFile( "SYSTEM_JFREEREPORT","@SYSTEM_JFREEREPORT@","e" );
1732 ToFile( "SAC_JAR",           "@SAC_JAR@",          "e" );
1733 ToFile( "LIBXML_JAR",        "@LIBXML_JAR@",       "e" );
1734 ToFile( "FLUTE_JAR",         "@FLUTE_JAR@",        "e" );
1735 ToFile( "JFREEREPORT_JAR",   "@JFREEREPORT_JAR@",  "e" );
1736 ToFile( "LIBLAYOUT_JAR",     "@LIBLAYOUT_JAR@",    "e" );
1737 ToFile( "LIBLOADER_JAR",     "@LIBLOADER_JAR@",    "e" );
1738 ToFile( "LIBFORMULA_JAR",    "@LIBFORMULA_JAR@",   "e" );
1739 ToFile( "LIBREPOSITORY_JAR", "@LIBREPOSITORY_JAR@","e" );
1740 ToFile( "LIBBASE_JAR",       "@LIBBASE_JAR@",      "e" );
1741 ToFile( "LIBFONTS_JAR",      "@LIBFONTS_JAR@",     "e" );
1742 ToFile( "LIBSERIALIZER_JAR", "@LIBSERIALIZER_JAR@","e" );
1743 ToFile( "ENABLE_MEDIAWIKI",  "@ENABLE_MEDIAWIKI@", "e" );
1744 ToFile( "SYSTEM_APACHE_COMMONS","@SYSTEM_APACHE_COMMONS@","e" );
1745 ToFile( "COMMONS_CODEC_JAR", "@COMMONS_CODEC_JAR@","e" );
1746 ToFile( "COMMONS_LANG_JAR",  "@COMMONS_LANG_JAR@", "e" );
1747 ToFile( "COMMONS_HTTPCLIENT_JAR","@COMMONS_HTTPCLIENT_JAR@","e" );
1748 ToFile( "COMMONS_LOGGING_JAR","@COMMONS_LOGGING_JAR@","e" );
1749 ToFile( "SYSTEM_SERVLETAPI", "@SYSTEM_SERVLETAPI@", "e" );
1750 ToFile( "SERVLETAPI_JAR",    "@SERVLETAPI_JAR@",   "e" );
1751 ToFile( "ENABLE_DBUS",       "@ENABLE_DBUS@",      "e" );
1752 ToFile( "ENABLE_GCONF",      "@ENABLE_GCONF@",     "e" );
1753 ToFile( "ENABLE_GNOMEVFS",   "@ENABLE_GNOMEVFS@",  "e" );
1754 ToFile( "GNOMEVFS_HAS_LOCKING","@GNOMEVFS_HAS_LOCKING@",  "e" );
1755 ToFile( "ENABLE_GSTREAMER",  "@ENABLE_GSTREAMER@", "e" );
1756 ToFile( "ENABLE_GIO",        "@ENABLE_GIO@",       "e" );
1757 ToFile( "ENABLE_KDE",        "@ENABLE_KDE@",       "e" );
1758 ToFile( "KDE_CFLAGS",        "@KDE_CFLAGS@",       "e" );
1759 ToFile( "KDE_LIBS",          "@KDE_LIBS@",         "e" );
1760 ToFile( "ENABLE_KAB",        "@ENABLE_KAB@",       "e" );
1761 ToFile( "MOC",               "@MOC@",              "e" );
1762 ToFile( "PSPRINT",           "TRUE",             "e" );
1763 ToFile( "MKDEPENDSOLVER",    "TRUE",             "e" );
1765 # Writing the platform dependent constant values to file.
1766 # (c = comment, e = environment variable, a = alias )
1767 ToFile( "Platform dependent constant values.", $empty, "c" );
1768 ToFile( "SOLAR_JAVA",        $SOLAR_JAVA,        "e" );
1769 ToFile( "ENABLE_MONO",       "@ENABLE_MONO@",    "e" );
1770 ToFile( "ENABLE_MONO_CLIMAKER",       "@ENABLE_MONO_CLIMAKER@",    "e" );
1771 ToFile( "CSC",               "@CSC@",            "e" );
1772 ToFile( "AL",                "@AL@",             "e" );
1773 ToFile( "CSC_PATH",          "@CSC_PATH@",       "e" );
1774 ToFile( "MONO_CFLAGS",       "@MONO_CFLAGS@",    "e" );
1775 ToFile( "MONO_LIBS",         "@MONO_LIBS@",      "e" );
1776 ToFile( "BIG_SVX",           $BIG_SVX,           "e" );
1777 ToFile( "COM",               $COM,               "e" );
1778 ToFile( "COMPATH",           $COMPATH,           "e" );
1779 ToFile( "CPU",               $CPU,               "e" );
1780 ToFile( "CPUNAME",           $CPUNAME,           "e" );
1781 ToFile( "CVER",              $CVER,              "e" );
1782 ToFile( "GUI",               $GUI,               "e" );
1783 ToFile( "GLIBC",             $GLIBC,             "e" );
1784 ToFile( "GUIBASE",           $GUIBASE,           "e" );
1785 ToFile( "GVER",              $GVER,              "e" );
1786 ToFile( "OS",                $OS,                "e" );
1787 ToFile( "OSVERSION",         $OSVERSION,         "e" );
1788 ToFile( "PTHREAD_CFLAGS",    "@PTHREAD_CFLAGS@", "e" );
1789 ToFile( "PTHREAD_LIBS",      "@PTHREAD_LIBS@",   "e" );
1790 ToFile( "OUTPATH",           $OUTPATH,           "e" );
1791 ToFile( "INPATH",            $INPATH,            "e" );
1792 ToFile( "PATH_SEPERATOR",    $PATH_SEPERATOR,    "e" );
1793 ToFile( "COMEX",             $COMEX,             "e" );
1794 ToFile( "CDPATHx",           $CDPATHx,           "e" );
1795 ToFile( "DYNAMIC_CRT",       $DYNAMIC_CRT,       "e" );
1796 ToFile( "SET_EXCEPTIONS",    $SET_EXCEPTIONS,    "e" );
1797 ToFile( "use_shl_versions",  $use_shl_versions,  "e" );
1798 ToFile( "FLIPCMD",           $FLIPCMD,           "e" );
1800 # Writing the variables to file.
1801 # (c = comment, e = environment variable, a = alias, n = newline )
1802 ToFile( "Variable values.",  $empty,             "c" );
1803 if ( $platform =~ m/cygwin/ )
1804 {  ToFile( "CYGWIN_PATH",       $CYGWIN_PATH,       "e" );
1805    ToFile( "PSDK_HOME",         $PSDK_HOME,         "e" );
1806    ToFile( "WINDOWS_VISTA_PSDK","@WINDOWS_VISTA_PSDK@","e" );
1807    ToFile( "DIRECTXSDK_LIB",    $DIRECTXSDK_LIB,    "e" );
1808    ToFile( "USE_DIRECTX5",      $USE_DIRECTX5,      "e" );
1809    ToFile( "ATL_LIB",           $ATL_LIB,         "e" );
1810    if ( $MINGW ne "yes" )
1811    {  ToFile( "ATL_INCLUDE",       $ATL_INCLUDE,       "e" );
1812    }
1813    ToFile( "MFC_LIB",           $MFC_LIB,         "e" );
1814    ToFile( "MFC_INCLUDE",       $MFC_INCLUDE,       "e" );
1815    ToFile( "NSIS_PATH",         $NSIS_PATH,         "e" );
1816    ToFile( "DISABLE_ACTIVEX",   "@DISABLE_ACTIVEX@","e" );
1817    ToFile( "DISABLE_ATL",   "@DISABLE_ATL@","e" );
1818    ToFile( "USE_NEW_SDK",       $USE_NEW_SDK,       "e" );
1820    # Hack around dmake's mktmp not generating DOS paths.
1821    my $tmpdir = qx{cygpath -m "/tmp"};
1822    chomp($tmpdir);
1823    ToFile( "TMPDIR",     $tmpdir,            "e" );
1825 ToFile( "PERL",              $PERL,              "e" );
1826 ToFile( "RPM",               "@RPM@",            "e" );
1827 ToFile( "DPKG",              "@DPKG@",           "e" );
1828 ToFile( "PKGMK",             "@PKGMK@",          "e" );
1829 ToFile( "GNUMAKE",           "@GNUMAKE@",        "e" );
1830 ToFile( "UPD",               $UPD,               "e" );
1831 ToFile( "WORK_STAMP",        $WORK_STAMP,        "e" );
1832 ToFile( "SOLARVER",          $SOLARVER,          "e" );
1833 ToFile( "SOLARVERSION",      $SOLARVERSION,      "e" );
1834 ToFile( "SOLARENV",          $SOLARENV,          "e" );
1835 ToFile( "SOLARENVINC",       $SOLARENVINC,       "e" );
1836 ToFile( "LOCALINI",          $LOCALINI,          "e" );
1837 ToFile( "STAR_INIROOT",      $STAR_INIROOT,      "e" );
1838 ToFile( "STAR_INIROOTOLD",   $STAR_INIROOTOLD,   "e" );
1839 ToFile( "STAR_STANDLST",     $STAR_STANDLST,     "e" );
1840 ToFile( "STAR_SSCOMMON",     $STAR_SSCOMMON,     "e" );
1841 ToFile( "STAR_SSOLARINI",    $STAR_SSOLARINI,    "e" );
1842 ToFile( "DMAKEROOT",         $DMAKEROOT,         "e" );
1843 if ( $JDK ne "gcj" ) {
1844    ToFile( "CLASSPATH",         $CLASSPATH,         "e" );
1845    ToFile( "XCLASSPATH",        $XCLASSPATH,        "e" );
1846    ToFile( "JAVACISKAFFE",     '@JAVACISKAFFE@',    "e" );
1848 else {
1849    ToFile( "JAVACISGCJ",       '@JAVACISGCJ@',      "e" );
1851 if ( $GUI eq "UNX" ) {
1852    ToFile( "AWTLIB",           '@AWTLIB@',          "e" );
1854 if ( '@JDK@' ne '' )
1856    ToFile( "JDK",             "@JDK@",           "e" );
1857    ToFile( "JAVAFLAGS",             "@JAVAFLAGS@",           "e" );
1858    ToFile( "JAVA_SOURCE_VER", "@JAVA_SOURCE_VER@","e" );
1859    ToFile( "JAVA_TARGET_VER", "@JAVA_TARGET_VER@","e" );
1860    ToFile( "JAVAINTERPRETER", PathFormat("@JAVAINTERPRETER@"), "e" );
1861    ToFile( "JAVACOMPILER",    PathFormat("@JAVACOMPILER@"), "e" );
1862    ToFile( "JAVAAOTCOMPILER", PathFormat("@JAVAAOTCOMPILER@"), "e" );
1863    ToFile( "JAVADOC",         PathFormat("@JAVADOC@"), "e" );
1865 if ( $platform =~ m/darwin/ )
1866 {  ToFile( "DYLD_LIBRARY_PATH", $LD_LIBRARY_PATH,   "e" );
1868 else {
1869   if ( $platform =~ m/irix/ ) {
1870     ToFile( "LD_LIBRARYN32_PATH",   $LD_LIBRARY_PATH,   "e" );
1871   }
1872   else {
1873     ToFile( "LD_LIBRARY_PATH",   $LD_LIBRARY_PATH,   "e" );
1874   }
1876 ToFile( "SCPDEFS",           '@SCPDEFS@',        "e" );
1877 ToFile( "SOLAREXTRAINC",     $SOLAREXTRAINC,     "e" );
1878 ToFile( "SOLAREXTRALIB",     $SOLAREXTRALIB,     "e" );
1879 ToFile( "PATH",              $PATH,              "e" );
1880 ToFile( "SOLARLIB",          $SOLARLIB,          "e" );
1881 ToFile( "SOLARINC",          $SOLARINC,          "e" );
1882 ToFile( "COMP_ENV",          $COMP_ENV,          "e" );
1883 ToFile( "JAVAHOME",          $JAVAHOME,          "e" );
1884 ToFile( "CC",                $CC,                "e" );
1885 ToFile( "HAVE_GCC_VISIBILITY_FEATURE",
1886                 "@HAVE_GCC_VISIBILITY_FEATURE@", "e" );
1887 ToFile( "HAVE_GCC_VISIBILITY_BROKEN",
1888                 "@HAVE_GCC_VISIBILITY_BROKEN@", "e" );
1889 ToFile( "HAVE_LD_HASH_STYLE","@HAVE_LD_HASH_STYLE@","e" );
1890 ToFile( "WITH_LINKER_HASH_STYLE","@WITH_LINKER_HASH_STYLE@","e" );
1891 ToFile( "HAVE_LD_BSYMBOLIC_FUNCTIONS",
1892                 "@HAVE_LD_BSYMBOLIC_FUNCTIONS@","e" );
1893 ToFile( "CXX",               $CXX,               "e" );
1894 ToFile( "MINGWCXX",          "@MINGWCXX@",       "e" );
1895 ToFile( "MINGWSTRIP",        "@MINGWSTRIP@",     "e" );
1896 ToFile( "USE_SYSTEM_STL",    "@USE_SYSTEM_STL@", "e" );
1897 ToFile( "ALLOC",             "@ALLOC@",          "e" );
1898 ToFile( "ENABLE_SYMBOLS",    "@ENABLE_SYMBOLS@",    "e" );
1899 ToFile( "DISABLE_STRIP",     "@DISABLE_STRIP@",     "e" );
1900 ToFile( "LFS_CFLAGS",        "@LFS_CFLAGS@",     "e" );
1901 ToFile( "ENABLE_CRASHDUMP",  "@ENABLE_CRASHDUMP@",  "e" );
1902 ToFile( "ENABLE_CUPS",       "@ENABLE_CUPS@",       "e" );
1903 ToFile( "ENABLE_RANDR",      "@ENABLE_RANDR@",      "e" );
1904 ToFile( "ENABLE_FONTCONFIG", "@ENABLE_FONTCONFIG@", "e" );
1905 ToFile( "ENABLE_DIRECTX",    "@ENABLE_DIRECTX@",    "e" );
1906 ToFile( "ENABLE_LAYOUT",     "@ENABLE_LAYOUT@",     "e" );
1907 ToFile( "ENABLE_LAYOUT_EXPERIMENTAL", "@ENABLE_LAYOUT_EXPERIMENTAL@", "e" );
1908 ToFile( "ENABLE_PCH",        "@ENABLE_PCH@",       "e" );
1909 ToFile( "VC_STANDARD",       "@VC_STANDARD@",      "e" );
1910 ToFile( "WITH_GPC",          "@WITH_GPC@",         "e" );
1911 ToFile( "WITH_MYSPELL_DICTS","@WITH_MYSPELL_DICTS@","e");
1912 ToFile( "SYSTEM_DICTS",      "@SYSTEM_DICTS@",     "e");
1913 ToFile( "DICT_SYSTEM_DIR",   "@DICT_SYSTEM_DIR@",  "e");
1914 ToFile( "HYPH_SYSTEM_DIR",   "@HYPH_SYSTEM_DIR@",  "e");
1915 ToFile( "THES_SYSTEM_DIR",   "@THES_SYSTEM_DIR@",  "e");
1916 ToFile( "ENABLE_LOCKDOWN",   "@ENABLE_LOCKDOWN@",  "e" );
1917 ToFile( "WITH_LDAP",         "@WITH_LDAP@",        "e" );
1918 ToFile( "WITH_OPENLDAP",     "@WITH_OPENLDAP@",    "e" );
1919 ToFile( "WITH_MOZILLA",      "@WITH_MOZILLA@",     "e" );
1920 ToFile( "SYSTEM_MOZILLA",    "@SYSTEM_MOZILLA@",   "e" );
1921 ToFile( "MOZ_FLAVOUR",       "@MOZ_FLAVOUR@",      "e" );
1922 ToFile( "NSPR_LIB",          "@NSPR_LIB@",         "e" );
1923 ToFile( "NSS_LIB",           "@NSS_LIB@",          "e" );
1924 ToFile( "MOZ_INC",           "@MOZ_INC@",          "e" );
1925 ToFile( "MOZ_LIB",           "@MOZ_LIB@",          "e" );
1926 ToFile( "MOZ_LIB_XPCOM",     "@MOZ_LIB_XPCOM@",    "e" );
1927 ToFile( "MOZ_NSPR_CFLAGS",   "@MOZ_NSPR_CFLAGS@",  "e" );
1928 ToFile( "MOZ_NSS_CFLAGS",    "@MOZ_NSS_CFLAGS@",   "e" );
1929 ToFile( "MOZ_LDAP_CFLAGS",   "@MOZ_LDAP_CFLAGS@",  "e" );
1930 ToFile( "WITH_FONTS",        "@WITH_FONTS@",       "e" );
1931 ToFile( "WITHOUT_AFMS",      "@WITHOUT_AFMS@",     "e" );
1932 ToFile( "WITHOUT_PPDS",      "@WITHOUT_PPDS@",     "e" );
1933 ToFile( "WITH_BINFILTER",    "@WITH_BINFILTER@",   "e" );
1934 ToFile( "BUILD_TYPE",        "@BUILD_TYPE@",       "e" );
1935 ToFile( "VERBOSE",           "@VERBOSE@",          "e" );
1936 ToFile( "WITH_FONTOOO",      "@WITH_FONTOOO@",     "e" );
1937 ToFile( "ENABLE_EVOAB2",     "@ENABLE_EVOAB2@",    "e" );
1938 ToFile( "GOBJECT_CFLAGS",    "@GOBJECT_CFLAGS@",   "e" );
1939 ToFile( "GOBJECT_LIBS",      "@GOBJECT_LIBS@",     "e" );
1940 ToFile( "SYSTEM_MSPACK",     "@SYSTEM_MSPACK@",    "e" );
1941 if ( '@ENABLE_RPATH@' eq "no" ) {
1942   ToFile( "LINKFLAGSRUNPATH",'',                   "e" );
1944 ToFile( "EPM",               "@EPM@",              "e" );
1945 ToFile( "EPM_FLAGS",         $EPM_FLAGS,           "e" );
1946 ToFile( "BUILD_EPM",         "@BUILD_EPM@",        "e" );
1947 ToFile( "PKGFORMAT",         "@PKGFORMAT@",        "e" );
1948 ToFile( "SYSTEM_STDLIBS",    "@SYSTEM_STDLIBS@",   "e" );
1949 ToFile( "SYSTEM_ZLIB",       "@SYSTEM_ZLIB@",      "e" );
1950 ToFile( "SYSTEM_OPENSSL",    "@SYSTEM_OPENSSL@",   "e" );
1951 ToFile( "OPENSSL_CFLAGS",    "@OPENSSL_CFLAGS@",   "e" );
1952 ToFile( "OPENSSL_LIBS",      "@OPENSSL_LIBS@",     "e" );
1953 ToFile( "SYSTEM_PYTHON",     "@SYSTEM_PYTHON@",    "e" );
1954 ToFile( "PYTHON_CFLAGS",     "@PYTHON_CFLAGS@",    "e" );
1955 ToFile( "PYTHON_LIBS",       "@PYTHON_LIBS@",      "e" );
1956 if ($SYSTEM_PYTHON eq "NO") {
1957 ToFile( "HOME",              "@HOME@",             "e" );
1959 ToFile( "SYSTEM_ICU",        "@SYSTEM_ICU@",       "e" );
1960 ToFile( "SYSTEM_GENBRK",     "@SYSTEM_GENBRK@",    "e" );
1961 ToFile( "SYSTEM_GENCCODE",   "@SYSTEM_GENCCODE@",  "e" );
1962 ToFile( "SYSTEM_GENCMN",     "@SYSTEM_GENCMN@",    "e" );
1963 ToFile( "SYSTEM_JPEG",       "@SYSTEM_JPEG@",      "e" );
1964 ToFile( "FREETYPE_CFLAGS",   "@FREETYPE_CFLAGS@",  "e" );
1965 ToFile( "FREETYPE_LIBS",     "@FREETYPE_LIBS@",    "e" );
1966 ToFile( "SYSTEM_POPPLER",    "@SYSTEM_POPPLER@",   "e" );
1967 ToFile( "POPPLER_CFLAGS",    "@POPPLER_CFLAGS@",   "e" );
1968 ToFile( "POPPLER_LIBS",      "@POPPLER_LIBS@",     "e" );
1969 ToFile( "SYSTEM_CAIRO",      "@SYSTEM_CAIRO@",     "e" );
1970 ToFile( "BUILD_PIXMAN",      "@BUILD_PIXMAN@",     "e" );
1971 ToFile( "CAIRO_CFLAGS",      "@CAIRO_CFLAGS@",     "e" );
1972 ToFile( "CAIRO_LIBS",        "@CAIRO_LIBS@",       "e" );
1973 ToFile( "XRANDR_CFLAGS",     "@XRANDR_CFLAGS@",    "e" );
1974 ToFile( "XRANDR_LIBS",       "@XRANDR_LIBS@",      "e" );
1975 ToFile( "XRANDR_DLOPEN",     "@XRANDR_DLOPEN@",    "e" );
1976 ToFile( "SYSTEM_LIBWPD",     "@SYSTEM_LIBWPD@",    "e" );
1977 ToFile( "LIBWPD_CFLAGS",     "@LIBWPD_CFLAGS@",    "e" );
1978 ToFile( "LIBWPD_LIBS",       "@LIBWPD_LIBS@",      "e" );
1979 ToFile( "SYSTEM_LIBWPS",     "@SYSTEM_LIBWPS@",    "e" );
1980 ToFile( "LIBWPS_CFLAGS",     "@LIBWPS_CFLAGS@",    "e" );
1981 ToFile( "LIBWPS_LIBS",       "@LIBWPS_LIBS@",      "e" );
1982 ToFile( "SYSTEM_LIBWPG",     "@SYSTEM_LIBWPG@",    "e" );
1983 ToFile( "LIBWPG_CFLAGS",     "@LIBWPG_CFLAGS@",    "e" );
1984 ToFile( "LIBWPG_LIBS",       "@LIBWPG_LIBS@",      "e" );
1985 ToFile( "SYSTEM_LIBXML",     "@SYSTEM_LIBXML@",    "e" );
1986 ToFile( "USE_FT_EMBOLDEN",   "@USE_FT_EMBOLDEN@",  "e" );
1987 ToFile( "LIBXML_CFLAGS",     "@LIBXML_CFLAGS@",    "e" );
1988 ToFile( "LIBXML_LIBS",       "@LIBXML_LIBS@",      "e" );
1989 ToFile( "SYSTEM_EXPAT",      "@SYSTEM_EXPAT@",     "e" );
1990 ToFile( "SYSTEM_DB",         "@SYSTEM_DB@",        "e" );
1991 ToFile( "DB_VERSION",        "@DB_VERSION@",       "e" );
1992 ToFile( "DB_INCLUDES",       "@DB_INCLUDES@",      "e" );
1993 ToFile( "SYSTEM_HSQLDB",     "@SYSTEM_HSQLDB@",    "e" );
1994 ToFile( "HSQLDB_JAR",        "@HSQLDB_JAR@",       "e" );
1995 ToFile( "SYSTEM_LUCENE",     "@SYSTEM_LUCENE@",    "e" );
1996 ToFile( "LUCENE_CORE_JAR",   "@LUCENE_CORE_JAR@",  "e" );
1997 ToFile( "LUCENE_ANALYZERS_JAR",   "@LUCENE_ANALYZERS_JAR@",  "e" );
1998 ToFile( "SYSTEM_BSH",        "@SYSTEM_BSH@",       "e" );
1999 ToFile( "BSH_JAR",           "@BSH_JAR@",          "e" );
2000 ToFile( "SYSTEM_SAXON",      "@SYSTEM_SAXON@",     "e" );
2001 ToFile( "SAXON_JAR",         "@SAXON_JAR@",        "e" );
2002 ToFile( "SYSTEM_ODBC_HEADERS","@SYSTEM_ODBC_HEADERS@","e" );
2003 ToFile( "SYSTEM_LIBXSLT",    "@SYSTEM_LIBXSLT@",   "e" );
2004 ToFile( "LIBXSLT_CFLAGS",    "@LIBXSLT_CFLAGS@",   "e" );
2005 ToFile( "LIBXSLT_LIBS",      "@LIBXSLT_LIBS@",     "e" );
2006 ToFile( "SYSTEM_SANE_HEADER","@SYSTEM_SANE_HEADER@","e" );
2007 ToFile( "SYSTEM_XRENDER_HEADERS","@SYSTEM_XRENDER_HEADERS@","e" );
2008 ToFile( "SYSTEM_MESA_HEADERS","@SYSTEM_MESA_HEADERS@","e" );
2009 ToFile( "SYSTEM_CURL",       "@SYSTEM_CURL@",      "e" );
2010 ToFile( "CURL_CFLAGS",       "@CURL_CFLAGS@",      "e" );
2011 ToFile( "CURL_LIBS",         "@CURL_LIBS@",        "e" );
2012 ToFile( "SYSTEM_BOOST",      "@SYSTEM_BOOST@",     "e" );
2013 ToFile( "SYSTEM_VIGRA",      "@SYSTEM_VIGRA@",     "e" );
2014 ToFile( "SYSTEM_NEON",       "@SYSTEM_NEON@",      "e" );
2015 ToFile( "NEON_VERSION",      "@NEON_VERSION@",     "e" );
2016 ToFile( "NEON_LIBS",         "@NEON_LIBS@",        "e" );
2017 ToFile( "NEON_CFLAGS",       "@NEON_CFLAGS@",      "e" );
2018 ToFile( "DISABLE_NEON",      "@DISABLE_NEON@",     "e" );
2019 ToFile( "DISABLE_XAW",       "@DISABLE_XAW@",      "e" );
2020 ToFile( "ENABLE_AGG",        "@ENABLE_AGG@",       "e" );
2021 ToFile( "SYSTEM_AGG",        "@SYSTEM_AGG@",       "e" );
2022 ToFile( "AGG_VERSION",       "@AGG_VERSION@",      "e" );
2023 ToFile( "BUILD_DMAKE",       "@BUILD_DMAKE@",      "e" );
2024 ToFile( "BUILD_STAX",        "@BUILD_STAX@",       "e" );
2025 ToFile( "BUILD_UNOWINREG",   "@BUILD_UNOWINREG@",  "e" );
2026 ToFile( "USE_XINERAMA",      "@USE_XINERAMA@",     "e" );
2027 ToFile( "XINERAMA_LINK",     "@XINERAMA_LINK@",    "e" );
2028 ToFile( "SYSTEM_REDLAND",    "@SYSTEM_REDLAND@",   "e" );
2029 ToFile( "REDLAND_LIBS",      "@REDLAND_LIBS@",     "e" );
2030 ToFile( "SYSTEM_POSTGRESQL",  "@SYSTEM_POSTGRESQL@", "e" );
2031 ToFile( "SYSTEM_HUNSPELL",   "@SYSTEM_HUNSPELL@",  "e" );
2032 ToFile( "HUNSPELL_CFLAGS",   "@HUNSPELL_CFLAGS@",  "e" );
2033 ToFile( "HUNSPELL_LIBS",     "@HUNSPELL_LIBS@",    "e" );
2034 ToFile( "SYSTEM_LPSOLVE",    "@SYSTEM_LPSOLVE@",   "e" );
2035 ToFile( "SYSTEM_HYPH",       "@SYSTEM_HYPH@",      "e" );
2036 ToFile( "HYPHEN_LIB",        "@HYPHEN_LIB@",       "e" );
2037 ToFile( "SYSTEM_MYTHES",     "@SYSTEM_MYTHES@",    "e" );
2038 ToFile( "PAM",               "@PAM@",              "e" );
2039 ToFile( "NEW_SHADOW_API",    "@NEW_SHADOW_API@",   "e" );
2040 ToFile( "PAM_LINK",          "@PAM_LINK@",         "e" );
2041 ToFile( "CRYPT_LINK",        "@CRYPT_LINK@",       "e" );
2042 ToFile( "XAU_LIBS",          "@XAU_LIBS@",         "e" );
2043 ToFile( "GXX_INCLUDE_PATH",  PathFormat("@GXX_INCLUDE_PATH@"), "e" );
2044 ToFile( "COMMON_BUILD_TOOLS",$COMMON_BUILD_TOOLS,  "e" );
2045 if ($platform !~ m/cygwin|os2/)
2046 {  ToFile( "TEMP",              $TEMP,              "e" );
2047    ToFile( "TMP",               $TEMP,              "e" );
2049 ToFile( "SOLARSRC",           $SOLARSRC,           "e" );
2050 if ( $platform =~ m/cygwin/ )
2052    ToFile( "ILIB",              $ILIB,              "e" );
2053    if ( $MINGW eq "yes" )
2054    {  ToFile( "ATL_INCLUDE",       $ATL_INCLUDE,       "e" );
2055       ToFile( "DIRECTXSDK_HOME",    PathFormat("@DIRECTXSDK_HOME@"),    "e" );
2056       ToFile( "USE_MINGW",         $USE_MINGW,              "e" );
2057    }
2058    ToFile( "GREP",              $WIN_GREP,          "e" );
2059    ToFile( "FIND",              $WIN_FIND,          "e" );
2060    ToFile( "LS",                $WIN_LS,            "e" );
2061    ToFile( "GNUCOPY",           $WIN_GNUCOPY,       "e" );
2062    ToFile( "TOUCH",             $WIN_TOUCH,         "e" );
2064 if ( $platform =~ m/os2/ )
2066    #ToFile( "ILIB",              $ILIB,              "e" );
2067    
2068    ToFile( "GREP",              "grep.exe",         "e" );
2069    ToFile( "FIND",              "find.exe",         "e" );
2070    ToFile( "LS",                "ls.exe",           "e" );
2071    ToFile( "GNUCOPY",           "cp.exe",           "e" );
2072    ToFile( "TOUCH",             "touch",            "e" );
2075 # $perlpre is only used for the following three variables
2076 # and only set for 4nt.
2077 my $perlpre = "";
2078 if (( $platform =~ m/cygwin/ ) and ( '@USE_SHELL@' eq "4nt" )) {
2079    ToFile( "HOME",              "   ",          "e" );
2080    $perlpre = "perl ".${SOLARENV}.${BIN}.${ds};
2082 if (( $platform =~ m/os2/ )) {
2083    $perlpre = "perl ".${SOLARENV}.${BIN}.${ds};
2085 ToFile( "DELIVER",       $perlpre."deliver.pl",     "e" );
2086 ToFile( "MKOUT",         $perlpre."mkout.pl",       "e" );
2087 ToFile( "ZIPDEP",        $perlpre."zipdep.pl",      "e" );
2089 ToFile( "USE_SHELL",             '@USE_SHELL@',     "e" );
2090 if ($SYSTEM_PYTHON eq "NO") {
2091     ToFile( "PYTHONPATH",        $PYTHONPATH,        "e" );
2095 # Writing the aliases to file.
2096 ToFile( "Aliases.",          $empty,             "c" );
2097 ToFile( "Don't set aliases when bootstrapping", $empty, "c" );
2098 ToFile( 'if ( ! ${?_ISBOOTSTRAP_} ) then', $empty, "y");
2099 ToFile( "if test -z \"\$_ISBOOTSTRAP_\"; then", $empty, "z");
2101 ToFile( "alias mkout",       $mkout,             "a" );
2102 ToFile( "alias deliver",     $deliver,           "a" );
2103 ToFile( "alias build",       $build,             "a" );
2104 ToFile( "alias build_client",$build_client,      "a" );
2105 ToFile( "alias zipdep",      $zipdep,            "a" );
2106 if ( $platform !~ m/cygwin/ )
2107 {  ToFile( "alias nmake",       $nmake,             "a" );
2109 if ( $platform =~ m/os2/ )
2110 {  ToFile( "alias gunzip",       "gzip -d",         "a" );
2113 ToFile( "endif",             $empty, "y");
2114 ToFile( "fi",                $empty, "z");
2116 # write make command for dmake for W32-4nt
2117 if ( $platform =~ m/cygwin/ and '@USE_SHELL@' eq "4nt" )
2119   ToFile( "build the dmake executable.", $empty, "c");
2120   ToFile( "if not exist \%SOLARENV\\\%OUTPATH\\bin\\dmake.exe (cd \%SRC_ROOT\\dmake \^ set INCLUDE=\%COMPATH\\include;\%PSDK_HOME\\include \^ set LIB=\%COMPATH\\lib;\%PSDK_HOME\\lib \^ call make.bat win95-vpp40 \^ cd \%SRC_ROOT)", $empty, "x");
2121   ToFile( "if not exist \%SOLARENV\\\%OUTPATH\\bin\\dmake.exe ( mkdir /S \%SOLARENV\\\%OUTPATH\\bin \^ copy dmake\\dmake.exe \%SOLARENV\\\%OUTPATH\\bin\\dmake.exe )", $empty, "x");
2122   ToFile( "\@echo Warning! LIB and INCLUDE will be cleared!", $empty, "x");
2123   ToFile( "\@unset INCLUDE LIB", $empty, "x");
2124   ToFile( "check for correct dmake.", $empty, "c");
2125   ToFile( '@if "%@SEARCH[dmake]" == "" ( @echo dmake not build or missing! Invalid build environment! ^ unset SOLARENV ^ cancel )', $empty, "x");
2126   ToFile( '@dmake -V > dmakecheck.out', $empty, "x");
2127   ToFile( '@ffind /Tcygwin /C /B dmakecheck.out && ( @echo Found cygwin build dmake! Invalid! ^ unset SOLARENV ^ cancel )', $empty, "x");
2128   ToFile( "  ", $empty, "x");
2131 # Check if the right dmake version is used. (W32-tcsh only)
2132 if ( $platform =~ m/cygwin/ and '@USE_SHELL@' ne "4nt" ) {
2133     ToFile( "Check if the right dmake version is used.", $empty, "c" );
2134     # Invalidate build environment.
2135     ToFile( "WORK_STAMP", "_invalid_", "e" );
2136     # Don't test the dmake version if this file is sourced by bootstrap
2137     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");
2138     # Restore valid environment if test was successful.
2139     ToFile( "WORK_STAMP",        $WORK_STAMP,        "e" );
2140     ToFile( "", $empty, "n");
2143 # on Solaris, MacOSX and FreeBSD, set GNUCOPY and GNUPATCH
2144 if ($platform =~ m/solaris|darwin|freebsd/)
2146   ToFile( "GNUPATCH",   "@GNUPATCH@",   "e");
2147   ToFile( "GNUCOPY",    "@GNUCP@",      "e");
2149 # OS/2 define .pl as executable for 4os2
2150 # use - as switch char for dmake (os2/switchar.c)
2151 if ($platform =~ m/os2/)
2153   ToFile( ".pl",        "perl", "e");
2154   ToFile( "SWITCHAR",   "-",    "e");
2156 ToFile( "SAL_ENABLE_FILE_LOCKING",      "1",    "e");
2158 # Writing unset variables you might not need to file.
2160 print OUT $unsetvars;
2162 print OUT_SH "export $exportvars$newline";
2163 print OUT_SH "unset $unsetvarssh$newline";
2165 if(defined($outfile_bat))
2166 {  print OUT_BAT $unsetvarsbat;
2170 #---------------------------
2171 # VIII. Closing output file.
2172 #---------------------------
2174 close( OUT ) || print "Can't close $outfile: $!";
2176 close( OUT_SH ) || print "Can't close $outfile_sh: $!";
2178 if( defined($outfile_bat))
2179 {  close( OUT_BAT ) || print "Can't close $outfile_bat: $!";
2183 #------------------------------
2184 # IX. Sourcing the output file.
2185 #------------------------------
2187 #---------------------------------
2188 # X. Set up the build environment.
2189 #---------------------------------
2191 #--------------------------------------------------------
2192 # XI. Moving the output file to the build home directory.
2193 #--------------------------------------------------------
2195 $tmp = $SRC_ROOT.$ds.$outfile;
2196 if (rename( $outfile, $tmp ) ne 1)
2197 {  `mv -f $outfile $tmp`;
2200 $tmp = $SRC_ROOT.$ds.$outfile_sh;
2201 if (rename( $outfile_sh, $tmp ) ne 1)
2202 {  `mv -f $outfile_sh $tmp`;
2205 if(defined($outfile_bat))
2207     $tmp = $SRC_ROOT.$ds.$outfile_bat;
2208     if (rename( $outfile_bat, $tmp ) ne 1)
2209     {  `mv -f $outfile_bat $tmp`;
2210     }
2214 #--------------------------------------------------------
2215 # XII. Message at the end.
2216 #--------------------------------------------------------
2219 print "*********************************************************".
2220       "******************* $newline"."*"."$newline";
2221 print "* OpenOffice.org $UPD configuration. $newline";
2222 for ( $tmp = 0; $tmp < 2; $tmp++ ) 
2223 {  print "* $newline";
2225 print "* Configuration part of OpenOffice.org $UPD build is finished. $newline* $newline";
2226 print "* NB! Be aware that you might not be able to build OpenOffice.org if you $newline".
2227       "* ignore any warning message that were generated during this configuration $newline".
2228       "* process. $newline* $newline";
2230 if ( $Warning ne "" ) 
2231 {  print "$Warning*"; 
2232    print "$newline";
2235 print "*$newline* USAGE: $newline";
2236 print "* Source $outfile (in tcsh)";
2237 print " or $outfile.sh (in sh)";
2238 print "$newline";
2239 print "* in order to set up the build-environment variables.$newline";
2240 for ( $tmp = 0; $tmp < 2; $tmp++ ) 
2241 {  print "* $newline";
2243 print "*********************************************************".
2244       "******************* $newline";
2246 $bootfile = "bootstrap";
2247 open( OUT, ">$bootfile" ) ||
2248 die "Cannot open $bootfile: $!\n";
2249 print OUT "#!/bin/sh\n";
2250 print OUT "_ISBOOTSTRAP_=TRUE ; export _ISBOOTSTRAP_ ; . $SRC_ROOT/$outfile.sh\n"; 
2251 print OUT "unset _ISBOOTSTRAP_; export _ISBOOTSTRAP_\n"; 
2252 if ( $MINGW eq "yes" )
2253 {  print OUT 'PATH="/usr/bin:$PATH" : export PATH'."\n"; }
2254 close( OUT ) || print "Can't close $bootfile: $!";
2255 system(`cat bootstrap.1 >> bootstrap`);
2256 system(`chmod +x bootstrap`);
2258 #--------------------------------------------------------
2259 # Moving the bootstrap file to the build home directory.
2260 #--------------------------------------------------------
2262 $tmp = $SRC_ROOT.$ds.$bootfile;
2263 if (rename( $bootfile, $tmp ) ne 1)
2264 {  `mv -f $bootfile $tmp`;
2267 print "Configure completed\n";
2268 if ( "@USE_SHELL@" ne "4nt" ) {
2269         print "You may now run ./bootstrap in $SRC_ROOT\n";
2271 if ( $Warning ne "" ) {
2272         print "***** WARNINGS ISSUED *****\n";
2276 #-----------------
2277 # XII. Functions.
2278 #-----------------
2280 #-------------------------------------------------------------
2281 # Function name: CheckPathName 
2282 # Description:   chops off the '/' character if it's the last
2283 #                character in a pathname. also adds the '/'
2284 #                character if it's not the first character
2285 #                in a path.
2286 # Arguments:     1. Path (string)
2287 # Return value:  Path (string)
2288 #-------------------------------------------------------------
2289 sub CheckPathName 
2290 {  my $retrn = $_[ 0 ];
2291    if (($platform =~ m/cygwin/) or ( '@USE_SHELL@' ne "4nt" ))
2292    {  # Check if the first character is not a '/'.
2293       if ( !( $_[ 0 ] =~ /^\// ) ) 
2294       {  $retrn = $ds.$_[ 0 ];
2295       }
2296    }
2297    # kill the last '/','\','\n' if they exists.
2298    $retrn =~ s![\s/\\]+$!!;
2299    # Done!
2300    return( $retrn );
2302 #-------------------------------------------------------------
2303 # Function name: CheckPathExist 
2304 # Description:   Checks whether the directory that is given
2305 #                as an argument exists. If not abort.
2306 # Arguments:     1. Path (string)
2307 # Return value:  void
2308 #-------------------------------------------------------------
2309 sub CheckPathExist 
2310 {  my $dir = $_[ 0 ];
2311    if ( !( -d $dir ) and $^O ne 'MSWin32' )
2312    {  print ( "The directory $_[ 0 ] does not exist. Please create first.\n" );
2313       exit 1;
2314    }
2315    else
2316    {  # Don't check under ActiveState Perl (Windows). The path is possibly
2317       # posix and it cannot handle it.
2318       return "true";
2319    }
2321 #------------------------------------------------------------
2322 # Function name: CreateFileHeader 
2323 # Description:   Creates a header for the outfile.
2324 # Arguments:     1. File to write to
2325 #                2. UPD (string)
2326 #                3. Platform (string)
2327 #                4. name of shell for this file
2328 #                5. comment to use for this file
2329 # Return value:  void
2330 #------------------------------------------------------------
2331 sub CreateFileHeader 
2332 {  my $timestamp = `date`;
2333    chomp( $timestamp );
2334    my $filehandle = $_[0];
2335    my $comment = $_[4];
2336    print { $filehandle } "$comment #################################################################"; 
2337    print { $filehandle } $newline;
2338    print { $filehandle } "$comment OpenOffice.org $_[ 1 ] build environment file for: $_[ 2 ]. $newline"; 
2339    print { $filehandle } "$comment Generated on: $timestamp $newline"; 
2340    print { $filehandle } "$comment Source this file to set up the build environment. $newline"; 
2341    print { $filehandle } "$comment 1. exec $_[3] $newline"; 
2342    print { $filehandle } "$comment 2. source $outfile $newline"; 
2343    print { $filehandle } "$comment #################################################################"; 
2344    print { $filehandle } $newline;
2346 #---------------------------------------------------------
2347 # Function name: ToFile
2348 # Description:   Writes the environment variable in the
2349 #                output file.
2350 # Arguments:     1. Name of environment variable (string)
2351 #                2. Value of environment variable (string)
2352 #                3. e - env. var
2353 #                   a - alias
2354 #                   c - comment
2355 #                   n - newline
2356 #                   x - raw, write as is to OUT_BAT
2357 #                   y - raw, write as is to OUT
2358 #                   z - raw, write as is to OUT_SH
2359 # Return value:  void
2360 #---------------------------------------------------------
2361 sub ToFile {
2362    if ( $_[ 2 ] eq "e" ) {
2363       # Write an environment variable to file.
2364       if (defined $_[ 1 ] && $_[ 1 ] ne "" ) {
2365          my $envvar = $_[ 1 ];
2366          my $envvarbash = $envvar;
2367          if ("@USE_SHELL@" eq "4nt" ) {
2368              # expand the variables
2369              $envvar =~ s/(\$\{?\w+\}?)/$1/eeg ;
2370              # Some variables need to be translated
2371              if ( ($_[ 0 ] =~ /^PATH$/) and ($platform !~ m/os2/) ) {
2372                  # PATH is in cygwin format, but for 4nt it needs to be DOS.
2373                  $win_format_var = WinPath( $envvar, ":" );
2374              } else {
2375                  $win_format_var = WinFormat( $envvar );
2376              }
2377              # The excluded variables are translated by cygwin
2378              if ( $_[ 0 ] !~ /^PATH$|^TMP$|^TEMP$|^TMPDIR$|^HOME$/i ) {
2379                  $envvar = $win_format_var;
2380              }
2381          }
2383          # Tcsh/bash needs backslashes quoted
2384          $envvar =~ s/\\/\\\\/g;
2385          $envvarbash = $envvar;
2387          printf("%-12s %-17s %-10s %s\n", "The variable", $_[ 0 ], "is set to:", $envvar);
2388          print OUT "$setenv $_[ 0 ] \"$envvar\"$newline";  # to tcsh file
2389          print OUT_SH "$_[ 0 ]=\"$envvarbash\"$newline";   # to sh file
2390          $exportvars .= " $_[ 0 ]";                        # add to export list for sh file
2392          if(defined($outfile_bat)) {
2393              print OUT_BAT "IF DEFINED $_[ 0 ] $unset $_[ 0 ]$newline";
2394              print OUT_BAT "$set $_[ 0 ]=$win_format_var$newline";
2395          }
2396       } else {
2397          printf("%-12s %-17s %-10s %s\n", "The variable", $_[ 0 ], "is set to:", "unset") ; # to stdout
2398          $unsetvars .= "$unsetenv $_[ 0 ] >& /dev/null$newline"; # for tcsh file
2399          $unsetvarssh .= " $_[ 0 ]";                             # for sh file
2400          if(defined($outfile_bat)) {
2401              $unsetvarsbat .= "$unset $_[ 0 ] >& NUL$newline";
2402          }
2403       }
2404    }
2405    elsif ( $_[ 2 ] eq "a" ) 
2406    {  # Write an alias to file.
2407       print "The $_[ 0 ] is set to: $_[ 1 ]\n";    # to stdout
2408       print OUT "$_[ 0 ] $_[ 1 ]$newline";         # to tcsh file
2409       print OUT_SH "$_[ 0 ]=$_[ 1 ]$newline";      # to sh file
2410       if(defined($outfile_bat)) # create the correct 4nt alias format
2411       {  my $aliastmp = $_[ 1 ];
2412          $aliastmp =~ s/\$/\%/g;
2413          $aliastmp =~ s!/!\\!g;
2414          $aliastmp =~ s!"!!g;
2415          print OUT_BAT "$_[ 0 ]=".'`'.$aliastmp.'`'.$newline;
2416       }
2417    }
2418    elsif ( $_[ 2 ] eq "c" ) 
2419    {  # Write a comment to file.
2420       print "$newline";
2421       print "$comment$newline";
2422       print "$comment $_[ 0 ]$newline";
2423       print "$comment$newline";
2424       print OUT "$newline";
2425       print OUT "$comment$newline";
2426       print OUT "$comment $_[ 0 ]$newline";
2427       print OUT "$comment$newline";
2428       print OUT_SH "$newline";
2429       print OUT_SH "$comment$newline";
2430       print OUT_SH "$comment $_[ 0 ]$newline";
2431       print OUT_SH "$comment$newline";
2432       if(defined($outfile_bat)) {
2433           print OUT_BAT "$newline";
2434           print OUT_BAT "$comment4nt$newline";
2435           print OUT_BAT "$comment4nt $_[ 0 ]$newline";
2436           print OUT_BAT "$comment4nt$newline";
2437       }
2438    }
2439    elsif ( $_[ 2 ] eq "n" )
2440    {  #Write a newline to a file
2441       print OUT "$newline";
2442       print OUT_SH "$newline";
2443       print OUT_BAT "$newline" if defined($outfile_bat);
2444    }
2445    elsif ( $_[ 2 ] eq "x" )
2446    {
2447       #Write first argument as is, and nothing else
2448       print OUT_BAT "$_[ 0 ]$newline" if defined($outfile_bat);
2449    }
2450    elsif ( $_[ 2 ] eq "y" )
2451    {
2452       #Write first argument as is, and nothing else
2453       print OUT "$_[ 0 ]$newline";
2454    }
2455    elsif ( $_[ 2 ] eq "z" )
2456    {
2457       #Write first argument as is, and nothing else
2458       print OUT_SH "$_[ 0 ]$newline";
2459    }
2460    else
2461    {  print "Unknown type!$newline";
2462    }
2464 #----------------------------------------------------------
2465 # Function name: PathFormat
2466 # Description:   Reformat path to either POSIX or mixed mode style.
2467 # Arguments:     1. Variable (string)
2468 # Return value:  Reformatted String
2469 #----------------------------------------------------------
2470 sub PathFormat
2471 {  my ( $variable, $d1, $d2 );
2472    $variable = $_[ 0 ];
2474    if ( $platform =~ m/cygwin/ )
2475    {   $variable =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables
2476        $variable =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables twice!
2478        # Complain if PosixPath is used on a PATH-like string
2479        if ( $variable =~ m/;/ ) {
2480            die( "Do not use on PATH lists (i.e., 'c:\\foo;d:\\bar')");
2481        }
2483        # Replace path with space with short dos path
2484        if ( $variable =~ / / ) {
2485            chomp( $variable = qx{cygpath -d "$variable"} ) ;
2486        }
2488        # Replace absolute paths or DOS paths with ...
2489        if ( ( $variable =~ m/^\// ) or ( $variable =~ m/:/ ) ) {
2490            # mixed mode paths
2491            chomp( $variable = qx{cygpath -m "$variable"} );
2492        }
2493    }
2494    return $variable;
2496 #----------------------------------------------------------
2497 # Function name: CygFormat
2498 # Description:   Format variables to cygwin posix style path
2499 #                unless .
2500 # Arguments:     1. Variable (string)
2501 # Return value:  Reformatted String
2502 #----------------------------------------------------------
2503 sub CygFormat
2504 {  my ( $variable, $d1, $d2 );
2505    $variable = $_[ 0 ];
2506    # ToDo: Do the replacement only if Windows and var contains "\" and ":"
2507    if ( $platform =~ m/cygwin|os2/ )
2508    {
2509        # Complain if PosixPath is used on a PATH-like string
2510        if ( $variable =~ m/;/ ) {
2511            die( "Do not use on PATH lists (i.e., 'c:\\foo;d:\\bar')");
2512        }
2514        # Replace DOS paths with posix paths
2515        if ( ( $variable =~ m/\\/ ) or ( $variable =~ m/:/ ) ) {
2516            chomp( $variable = qx{cygpath -u "$variable"} );
2517        }
2518    }
2519    return $variable;
2521 #----------------------------------------------------------
2522 # Function name: WinFormat
2523 # Description:   Format variables to Windows Format.
2524 # Arguments:     1. Variable (string)
2525 # Return value:  Reformatted String
2526 #----------------------------------------------------------
2527 sub WinFormat
2528 {  my ( $variable, $d1 );
2529    $variable = $_[ 0 ];
2530    $variable =~ s/^\s+//g ; #remove leading spaces
2531    $variable =~ s/\s+$//g ; #remove trailing spaces
2532    $variable =~ s/(\$\{?\w+\}?)/$1/eeg ;   # expand the variables
2533    $variable =~ s/(\$\{?\w+\}?)/$1/eeg ;   # expand the variables twice!
2534    $variable =~ s/:+/:/g ;                 # remove multiple ;
2536    # Some variables are already in DOS path format, return early.
2537    if ( $variable =~ /\\/ ) {
2538        return $variable;
2539    }
2540    if ( $variable eq ";" ) {
2541        # Ignore single ';'
2542        return $variable;
2543    }
2544    if ( $variable =~ /;/ and $variable =~ /\// ) {
2545        # Mixed mode path-style entry, separated with ;, like CLASSPATH
2546        return $variable;
2547    }
2549    # Search for posix path entry and replace with cygpath -w entry
2550    # ( -d if filename contains space )
2552    # Normal paths
2554    # One special case is if "perl " is prepended.
2555    $variable =~ /^(perl\s+)?(.*)$/;
2556    my $perlpre = $1;
2557    if ( !defined($perlpre) ) {
2558        $perlpre = "";
2559    }
2560    $variable = $2;
2562    if ( $variable =~ /^\/[\w\.~ ]+/ ) {
2563        if ( $variable =~ / / ) {
2564            # Use DOS 8.3 style to avoid quoting
2565            chomp( $variable = qx{cygpath -d "$variable"} );
2566        } else {
2567            # Use "normal" filenames
2568            chomp( $variable = qx{cygpath -w "$variable"} );
2569        }
2570    } else {
2571        # relative or absolute DOS paths here
2572        $variable =~ s#/#\\#g;
2573    }
2575    $variable = $perlpre.$variable;
2576    if ( ($perlpre ne "") && ($^O eq "cygwin")) {
2577        # Cygwin's perl needs quoted backslashes
2578        $variable =~ s#\\#\\\\#g;
2579    }
2581    return $variable;
2584 #----------------------------------------------------------
2585 # Function name: WinPath
2586 # Description:   Reformat a $sep seperated path using DOS paths.
2587 # Arguments:     1. Variable (string)
2588 #                2. Separaror (string)
2589 # Return value:  Reformatted String
2590 #----------------------------------------------------------
2591 sub WinPath
2593     my ( $variable, $d1, $sep, @split_var );
2595     if ( $platform =~ m/cygwin/ ) {
2596         $variable = $_[ 0 ];
2597         $sep = $_[ 1 ];
2598         $variable =~ s/^\s+//g ; #remove leading spaces
2599         $variable =~ s/\s+$//g ; #remove trailing spaces
2600         $variable =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables
2601         $variable =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables twice!
2603         @split_var = split(/$sep/,$variable);
2604         foreach $d1 ( @split_var ) {
2605             if ( $d1 =~ /(?:^\/[\w\.~ ]+)+/ ) {
2606                 if ( $d1 =~ / / ) {
2607                     # Use DOS 8.3 style to avoid quoting
2608                     chomp( $d1 = qx{cygpath -d "$d1"} );
2609                 } else {
2610                     # Use "normal" filenames
2611                     chomp( $d1 = qx{cygpath -w "$d1"} );
2612                 }
2613             }
2614         }
2615         $variable = join(';',@split_var);
2617         $variable =~ s/\//\\/g; # Remaining \ come from e.g.: ../foo/baa
2618     }
2620     return $variable;
2623 #--------------------------------------------------------
2624 # Function name: GetCorrectPath
2625 # Description:   Creates the build environment. 
2626 # Arguments:     1.   existing / original path
2627 #                2... pairs of <path, executable>
2628 # Return value:  String - Correct Path
2629 #--------------------------------------------------------
2630 sub GetCorrectPath
2632         sub PathLookup
2633         {
2634             my $cmd = shift;
2635             while (@_) {
2636                 my $elem = shift;
2637                 
2638                 -x "$elem/$cmd" && return $elem;
2639             }
2640             return '';
2641         }
2643         sub SaneGrep
2644         {
2645             # Perl grep is unbelievably strange.
2646             my $needle = shift;
2647             while (@_) {
2648                 my $haystack = shift;
2649                 if ($needle eq $haystack) {
2650                     return 1;
2651                 } 
2652             }
2653             return 0;
2654         }       
2656         sub CleanupPath
2657         {
2658             my @elements = @_;
2659             my @cleanName = ();
2661             while (@elements) {
2662                 my $elem = shift @elements;
2663                 if (!SaneGrep ($elem, @cleanName)) {
2664                         push @cleanName, $elem;
2665                 }
2666             }
2668             return @cleanName;
2669         }
2671         my $oldPath = shift;
2672         my @originalPairs = @_;
2673         my @pairs = @originalPairs;
2674         my @Path = split /$ps/, $oldPath;
2676         while (@pairs) {
2677             my $path = shift @pairs;
2678             my $cmd = shift @pairs;
2679             my $to_append = 1;
2680             my $elem;
2682             if (! -x "$path/$cmd") {
2683                 AddWarning ("Missing executable $path/$cmd\n");
2684             }
2686             for $elem (@Path) {
2687                 if ($elem eq $path) {
2688 #                   print "Hit duplicate path in path; break\n";
2689                     $to_append = 0;
2690                     last;
2691                 }
2692                 if (-f "$elem/$cmd") {
2693 #                   print "Element already in path ...\n";
2694                     unshift @Path, $path;
2695                     $to_append = 0;
2696                     last;
2697                 } else {
2698 #                   print "No file $elem/$cmd\n";
2699                 }
2700             }
2701             if ($to_append) {
2702                 push @Path, $path;
2703             }
2704         }
2706         @pairs = @originalPairs;
2707         while (@pairs) {
2708             my $path = shift @pairs;
2709             my $cmd = shift @pairs;
2710             my $realpath;
2712             $realpath = PathLookup ($cmd, @Path);
2713             if (!($realpath eq $path)) {
2714                 AddWarning ("Path conflict for executables " .
2715                             "$path/$cmd against $realpath");
2716             }
2717         }
2719         return join $ps, CleanupPath (@Path);
2722 #------------------------------------------------------------
2723 # Function name: AddWarning 
2724 # Description:   Adds any kind of warning for the user.
2725 #                The warning will be shown at the end
2726 #                of this script.
2727 # Arguments:     1. Add the configure warnings or the set_soenv
2728 #                   warning (string).
2729 #                2. Warning (string).
2730 # Return value:  void
2731 #------------------------------------------------------------
2732 sub AddWarning 
2733 {  if ( $_[ 0 ] eq "configure" ) 
2734    {  open( IN, $warnfile );
2735       while ( <IN> ) 
2736       {  $Warning = $Warning."* - ".$_;
2737       }
2738       close( IN );
2739       # Remove the temporary warning file.
2740       # unlink ( $warnfile );
2741    }
2742    elsif ( $_[ 0 ] eq "set_soenv" ) 
2743    {  my ( $arg1 );
2744       $arg1 = $_[ 1 ];
2745       chomp( $arg1 );                            # cut off new line      
2746       $Warning = $Warning."* - set_soenv: warning: $arg1 $newline";  # add the warning  
2747    }
2749 #-------------------
2750 # That's all folks!
2751 #-------------------