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