BuildingFromSvn: acdefaults.pl

File acdefaults.pl, 11.6 kB (added by dshipton, 3 years ago)

Patrick's Perl module for default arguments

Line 
1 package acdefaults;
2
3 sub load();
4 sub addAllArgs($@);
5 sub hasArg($$);
6
7 # Tell the package that loaded us what function to run.
8 my $caller_pkg = caller();
9 ${"${caller_pkg}::CFG_LOAD_FUNC"} = \&load;
10
11 my @all_platforms = qw(
12 --with-java-orb=JDK
13 --with-junit=/home/vr/Juggler/java/junit.jar
14 );
15
16 #--with-java-orb-jar=/home/vr/Juggler/java/openorb-1.3.0.jar:/home/vr/Juggler/java/avalon-framework.jar:/home/vr/Juggler/java/logkit.jar
17 #--with-java-orb-jar=/home/vr/Juggler/java/openorb-1.2.0.jar
18
19 my @irix_mipspro = qw(
20 --with-jdkhome=/usr/java2
21 --with-cxx-orb=omniORB4
22 --with-cxx-orb-root=/home/vr/Juggler/irix/mipspro
23 --with-gmtl=/home/vr/Juggler/irix/mipspro
24 --with-audiere=/home/vr/Juggler/irix/mipspro
25 --with-openal=/home/vr/Juggler/irix/mipspro
26 --with-cppunit=/home/vr/Juggler/irix/mipspro
27 --with-cppdom=/home/vr/Juggler/irix/mipspro
28 --with-boost=/home/vr/Juggler/irix/mipspro
29 --with-boost-includes=/home/vr/Juggler/irix/mipspro/include/boost-1_32
30 --with-vrpn=/home/vr/Juggler/irix/mipspro/vrpn
31 );
32
33 my @irix_mipspro64 = qw(
34 --with-abi=64_M4
35 --with-jdkhome=/usr/java2
36 --with-cxx-orb=omniORB4
37 --with-cxx-orb-root=/home/vr/Juggler/irix64/mipspro
38 --with-gmtl=/home/vr/Juggler/irix64/mipspro
39 --with-audiere=/home/vr/Juggler/irix64/mipspro
40 --with-openal=/home/vr/Juggler/irix64/mipspro
41 --with-cppunit=/home/vr/Juggler/irix64/mipspro
42 --with-cppdom=/home/vr/Juggler/irix64/mipspro
43 --with-boost=/home/vr/Juggler/irix64/mipspro
44 --with-boost-includes=/home/vr/Juggler/irix64/mipspro/include/boost-1_32
45 --with-vrpn=/home/vr/Juggler/irix64/mipspro/vrpn
46 );
47
48 my @irix_gcc30 = qw(
49 --with-jdkhome=/usr/java2
50 --disable-pf-api
51 --with-gcc
52 --with-gmtl=/home/vr/Juggler/irix/gcc30
53 --with-audiere=/home/vr/Juggler/irix/gcc30
54 --with-openal=/home/vr/Juggler/irix/gcc30
55 --with-cppunit=/home/vr/Juggler/irix/gcc30
56 --with-cppdom=/home/vr/Juggler/irix/gcc30
57 --with-boost=/home/vr/Juggler/irix/gcc30
58 --with-boost-includes=/home/vr/Juggler/irix/gcc30/include/boost-1_32
59 );
60
61 my @irix_gcc31 = @irix_gcc30;
62 my @irix_gcc32 = @irix_gcc31;
63 my @irix_gcc33 = @irix_gcc32;
64
65 # Red Hat Linux 7.x with GCC 3.0.
66 my @linux_gcc30 = qw(
67 --with-jdkhome=/usr/java/j2sdk1.4.2_03
68 --with-cxx-orb=omniORB3
69 --with-cxx-orb-root=/home/vr/Juggler/linux/gcc30
70 --with-cxx-orb-bin=/home/vr/Juggler/linux/gcc30/bin/i586_linux_2.0_glibc2.1
71 --with-cxx-orb-lib=/home/vr/Juggler/linux/gcc30/lib/i586_linux_2.0_glibc2.1
72 --with-audiere=/home/vr/Juggler/linux/gcc30
73 --with-openal=/home/vr/Juggler/linux/gcc30
74 --with-cppunit=/home/vr/Juggler/linux/gcc30
75 );
76
77 # Red Hat Linux 7.x with GCC 3.1.
78 my @linux_gcc31 = qw(
79 --with-jdkhome=/usr/java/j2sdk1.4.2_03
80 --with-cxx-orb=omniORB3
81 --with-cxx-orb-root=/home/vr/Juggler/linux/gcc31
82 --with-cxx-orb-bin=/home/vr/Juggler/linux/gcc31/bin/i586_linux_2.0_glibc2.1
83 --with-cxx-orb-lib=/home/vr/Juggler/linux/gcc31/lib/i586_linux_2.0_glibc2.1
84 --with-audiere=/home/vr/Juggler/linux/gcc31
85 --with-openal=/home/vr/Juggler/linux/gcc31
86 );
87
88 # This is really RedHat 8.0.
89 my @linux_gcc32 = qw(
90 --with-jdkhome=/usr/java/j2sdk1.4.2_03
91 --with-cxx-orb=omniORB4
92 --with-cxx-orb-root=/home/vr/Juggler/linux-rh80
93 --with-gmtl=/home/vr/Juggler/linux-rh80
94 --with-audiere=/home/vr/Juggler/linux-rh80
95 --with-openal=/home/vr/Juggler/linux-rh80
96 --with-cppunit=/home/vr/Juggler/linux-rh80
97 --with-cppdom=/home/vr/Juggler/linux-rh80
98 --with-boost=/home/vr/Juggler/linux-rh80
99 --with-boost-includes=/home/vr/Juggler/linux-rh80/include/boost-1_32
100 --with-vrpn=/home/vr/Juggler/linux-rh80/vrpn
101 );
102
103 # This is really Fedora Core 1.
104 my @linux_gcc33 = qw(
105 --with-jdkhome=/usr/java/j2sdk1.4.2_03
106 --with-cxx-orb=omniORB4
107 --with-cxx-orb-root=/home/vr/Juggler/linux-fc1
108 --with-gmtl=/home/vr/Juggler/linux-fc1
109 --with-audiere=/home/vr/Juggler/linux-fc1
110 --with-openal=/home/vr/Juggler/linux-fc1
111 --with-cppunit=/home/vr/Juggler/linux-fc1
112 --with-cppdom=/home/vr/Juggler/linux-fc1
113 --with-boost=/home/vr/Juggler/linux-fc1
114 --with-boost-includes=/home/vr/Juggler/linux-fc1/include/boost-1_32
115 --with-vrpn=/home/vr/Juggler/linux-fc1/vrpn
116 );
117
118 my @linux = @linux_gcc33;
119
120 my @solaris_sparc = qw(
121 --with-nspr=/home/vr/Juggler/solaris-sparc/wspro6
122 --with-cxx-orb=omniORB3
123 --with-cxx-orb-root=/home/vr/Juggler/solaris-sparc/wspro6
124 --with-cxx-orb-bin=/home/vr/Juggler/solaris-sparc/wspro6/bin/sun4_sosV_5.8
125 --with-cxx-orb-lib=/home/vr/Juggler/solaris-sparc/wspro6/lib/sun4_sosV_5.8
126 --with-cppunit=/home/vr/Juggler/solaris-sparc/wspro6
127 --with-cppdom=/home/vr/Juggler/solaris-sparc/wspro6
128 --with-gmtl=/home/vr/Juggler/solaris-sparc/wspro6
129 --with-boost=/home/vr/Juggler/solaris-sparc/wspro6
130 --with-boost-includes=/home/vr/Juggler/solaris-sparc/wspro6/include/boost-1_32
131 );
132
133 my @solaris_sparc_gcc31 = qw(
134 --with-nspr=/home/vr/Juggler/solaris-sparc/gcc31
135 --with-gcc
136 --with-cxx-orb=omniORB3
137 --with-cxx-orb-root=/home/vr/Juggler/solaris-sparc/gcc31
138 --with-cxx-orb-bin=/home/vr/Juggler/solaris-sparc/gcc31/bin/sun4_sosV_5.8
139 --with-cxx-orb-lib=/home/vr/Juggler/solaris-sparc/gcc31/lib/sun4_sosV_5.8
140 --with-cppunit=/home/vr/Juggler/solaris-sparc/gcc31
141 --with-cppdom=/home/vr/Juggler/solaris-sparc/gcc31
142 --with-gmtl=/home/vr/Juggler/solaris-sparc/gcc31
143 --with-boost=/home/vr/Juggler/solaris-sparc/gcc31
144 --with-boost-includes=/home/vr/Juggler/solaris-sparc/gcc31/include/boost-1_32
145 );
146
147 my @solaris_sparc_gcc32 = qw(
148 --with-nspr=/home/vr/Juggler/solaris-sparc/gcc32
149 --with-gcc
150 --with-cxx-orb=omniORB3
151 --with-cxx-orb-root=/home/vr/Juggler/solaris-sparc/gcc32
152 --with-cxx-orb-bin=/home/vr/Juggler/solaris-sparc/gcc32/bin/sun4_sosV_5.8
153 --with-cxx-orb-lib=/home/vr/Juggler/solaris-sparc/gcc32/lib/sun4_sosV_5.8
154 --with-cppunit=/home/vr/Juggler/solaris-sparc/gcc32
155 --with-cppdom=/home/vr/Juggler/solaris-sparc/gcc32
156 --with-gmtl=/home/vr/Juggler/solaris-sparc/gcc32
157 --with-boost=/home/vr/Juggler/solaris-sparc/gcc32
158 --with-boost-includes=/home/vr/Juggler/solaris-sparc/gcc32/include/boost-1_32
159 );
160
161 my @solaris_x86 = qw(
162 --with-nspr=/home/vr/Juggler/solaris-x86/wspro6
163 --with-cxx-orb=omniORB3
164 --with-cxx-orb-root=/home/vr/Juggler/solaris-sparc/wspro6
165 --with-cxx-orb-bin=/home/vr/Juggler/solaris-sparc/wspro6/bin/sun4_sosV_5.8
166 --with-cxx-orb-lib=/home/vr/Juggler/solaris-sparc/wspro6/lib/sun4_sosV_5.8
167 --with-cppunit=/home/vr/Juggler/solaris-sparc/wspro6
168 --with-cppdom=/home/vr/Juggler/solaris-sparc/wspro6
169 --with-gmtl=/home/vr/Juggler/solaris-sparc/wspro6
170 --with-boost=/home/vr/Juggler/solaris-sparc/wspro6
171 --with-boost-includes=/home/vr/Juggler/solaris-sparc/wspro6/include/boost-1_32
172 );
173
174 my @solaris_x86_gcc31 = qw(
175 --with-nspr=/home/vr/Juggler/solaris-x86/gcc31
176 --with-gcc
177 --with-cxx-orb=omniORB3
178 --with-cxx-orb-root=/home/vr/Juggler/solaris-x86/gcc31
179 --with-cxx-orb-bin=/home/vr/Juggler/solaris-x86/gcc31/bin/sun4_sosV_5.8
180 --with-cxx-orb-lib=/home/vr/Juggler/solaris-x86/gcc31/lib/sun4_sosV_5.8
181 --with-cppunit=/home/vr/Juggler/solaris-x86/gcc31
182 --with-cppdom=/home/vr/Juggler/solaris-x86/gcc31
183 --with-gmtl=/home/vr/Juggler/solaris-x86/gcc31
184 --with-boost=/home/vr/Juggler/solaris-x86/gcc31
185 --with-boost-includes=/home/vr/Juggler/solaris-x86/gcc31/include/boost-1_32
186 );
187
188 my @solaris_x86_gcc32 = qw(
189 --with-nspr=/home/vr/Juggler/solaris-x86/gcc32
190 --with-gcc
191 --with-cxx-orb=omniORB3
192 --with-cxx-orb-root=/home/vr/Juggler/solaris-x86/gcc32
193 --with-cxx-orb-bin=/home/vr/Juggler/solaris-x86/gcc32/bin/sun4_sosV_5.8
194 --with-cxx-orb-lib=/home/vr/Juggler/solaris-x86/gcc32/lib/sun4_sosV_5.8
195 --with-cppunit=/home/vr/Juggler/solaris-x86/gcc32
196 --with-cppdom=/home/vr/Juggler/solaris-x86/gcc32
197 --with-gmtl=/home/vr/Juggler/solaris-x86/gcc32
198 --with-boost=/home/vr/Juggler/solaris-x86/gcc32
199 --with-boost-includes=/home/vr/Juggler/solaris-x86/gcc32/include/boost-1_32
200 );
201
202 my @solaris_x86_gcc33 = @solaris_x86_gcc32;
203
204 my @darwin7 = qw(
205 --with-boost=/Users/patrick/boost-1.32
206 --with-boost-includes=/Users/patrick/boost-1.32/include/boost-1_32
207 --with-cppdom=/Users/patrick
208 --with-cxx-orb=omniORB4
209 --with-cxx-orb-root=/Users/patrick
210 --with-gmtl=/Users/patrick
211 --with-cppunit=/Users/patrick
212 --with-junit=/Users/patrick/src/Juggler/junit.jar
213 --with-vrpn=/Users/patrick/vrpn
214 --with-openal=/Library/Frameworks
215 );
216
217 # This is the function that will be run by configure.pl.  It must take one
218 # scalar argument that is a reference to an array.  The array that is passed
219 # in may or may not have values in it, so no assumptions should be made about
220 # its contents.
221 sub load ()
222 {
223    my @new_argv = ();
224
225    # This queries the platform type.  This may be a standard platform name
226    # (IRIX, linux, etc.) or a user-defined name (Linux.gcc31, IRIX-mipspro,
227    # whatever).
228    my $platform = main::getPlatform();
229
230    print "PLATFORM: $platform\n";
231
232    addAllArgs(\@new_argv, @all_platforms);
233
234    # We're on IRIX.
235    if ( $platform =~ /irix/i )
236    {
237       # We're using GCC 3.0.
238       if ( $platform =~ /gcc3$/i )
239       {
240          addAllArgs(\@new_argv, @irix_gcc30);
241       }
242       # We're using GCC 3.1.
243       elsif ( $platform =~ /gcc31$/i )
244       {
245          addAllArgs(\@new_argv, @irix_gcc31);
246       }
247       # We're using GCC 3.2.
248       elsif ( $platform =~ /gcc32$/i )
249       {
250          addAllArgs(\@new_argv, @irix_gcc32);
251       }
252       # We're using GCC 3.3.
253       elsif ( $platform =~ /gcc33$/i )
254       {
255          addAllArgs(\@new_argv, @irix_gcc33);
256       }
257       # We're using 64-bit MIPSpro.
258       elsif ( $platform =~ /mipspro64$/i )
259       {
260          addAllArgs(\@new_argv, @irix_mipspro64);
261       }
262       # We're using MIPSpro.
263       else
264       {
265          addAllArgs(\@new_argv, @irix_mipspro);
266       }
267    }
268    # We're on Linux.
269    elsif ( $platform =~ /linux/i )
270    {
271       # We're using GCC 3.0.
272       if ( $platform =~ /gcc3$/i )
273       {
274          addAllArgs(\@new_argv, @linux_gcc30);
275       }
276       # We're using GCC 3.1.
277       elsif ( $platform =~ /gcc31$/i )
278       {
279          addAllArgs(\@new_argv, @linux_gcc31);
280       }
281       # We're using GCC 3.2.
282       elsif ( $platform =~ /gcc32$/i )
283       {
284          addAllArgs(\@new_argv, @linux_gcc32);
285       }
286       # We're using GCC 3.3.
287       elsif ( $platform =~ /gcc33$/i )
288       {
289          addAllArgs(\@new_argv, @linux_gcc33);
290       }
291       # Use the default Linux settings.
292       else
293       {
294          addAllArgs(\@new_argv, @linux);
295       }
296    }
297    # We're on Solaris.
298    elsif ( $platform =~ /solaris/i )
299    {
300       # We're using GCC 3.1.
301       if ( $platform =~ /gcc31$/i )
302       {
303          if ( $platform =~ /sparc/i )
304          {
305             addAllArgs(\@new_argv, @solaris_sparc_gcc31);
306          }
307          else
308          {
309             addAllArgs(\@new_argv, @solaris_x86_gcc31);
310          }
311       }
312       elsif ( $platform =~ /gcc32$/i )
313       {
314          if ( $platform =~ /sparc/i )
315          {
316             addAllArgs(\@new_argv, @solaris_sparc_gcc32);
317          }
318          else
319          {
320             addAllArgs(\@new_argv, @solaris_x86_gcc32);
321          }
322       }
323       elsif ( $platform =~ /gcc33$/i )
324       {
325          if ( $platform =~ /sparc/i )
326          {
327             addAllArgs(\@new_argv, @solaris_sparc_gcc33);
328          }
329          else
330          {
331             addAllArgs(\@new_argv, @solaris_x86_gcc33);
332          }
333       }
334       else
335       {
336          if ( $platform =~ /sparc/i )
337          {
338             addAllArgs(\@new_argv, @solaris_sparc);
339          }
340          else
341          {
342             addAllArgs(\@new_argv, @solaris_x86);
343          }
344       }
345    }
346    # We're on Mac OS X (Darwin).
347    elsif ( $platform =~ /darwin/i )
348    {
349       addAllArgs(\@new_argv, @darwin7);
350    }
351
352    return @new_argv;
353 }
354
355 # Adds the array of arguments (all the arguments except the first) to the
356 # given array reference (the first argument).
357 sub addAllArgs ($@)
358 {
359    my $argv_ref = shift;
360    
361    my $arg;
362    foreach $arg ( @_ )
363    {
364       push(@$argv_ref, $arg) unless hasArg($argv_ref, $arg);
365    }
366 }
367
368 # Determines if the array reference (first arg) contains the given argument
369 # (the second arg).
370 sub hasArg ($$)
371 {
372    my $argv_ref = shift;
373    my $arg      = shift;
374
375    $arg =~ /^(--[^=]+)/;
376    return grep(/$1/, @$argv_ref);
377 }
378
379 1;