Commit | Line | Data |
1dc48e02 |
1 | #!/usr/bin/sh |
8e07c86e |
2 | |
1dc48e02 |
3 | ### SYSTEM ARCHITECTURE |
8e07c86e |
4 | |
1dc48e02 |
5 | # Determine the architecture type of this system. |
6 | # Keep leading tab below -- Configure Black Magic -- RAM, 03/02/97 |
7 | xxOsRevMajor=`uname -r | sed -e 's/^[^0-9]*//' | cut -d. -f1`; |
bf5ca8fd |
8 | xxOsRevMinor=`uname -r | sed -e 's/^[^0-9]*//' | cut -d. -f2`; |
9 | xxOsRev=`expr 100 \* $xxOsRevMajor + $xxOsRevMinor` |
1dc48e02 |
10 | if [ "$xxOsRevMajor" -ge 10 ]; then |
11 | # This system is running >= 10.x |
12 | |
13 | # Tested on 10.01 PA1.x and 10.20 PA[12].x. |
14 | # Idea: Scan /usr/include/sys/unistd.h for matches with |
15 | # "#define CPU_* `getconf # CPU_VERSION`" to determine CPU type. |
16 | # Note the text following "CPU_" is used, *NOT* the comment. |
17 | # |
18 | # ASSUMPTIONS: Numbers will continue to be defined in hex -- and in |
19 | # /usr/include/sys/unistd.h -- and the CPU_* #defines will be kept |
20 | # up to date with new CPU/OS releases. |
21 | xxcpu=`getconf CPU_VERSION`; # Get the number. |
22 | xxcpu=`printf '0x%x' $xxcpu`; # convert to hex |
94c7f405 |
23 | archname=`sed -n -e "s/^#[[:space:]]*define[[:space:]]*CPU_//p" /usr/include/sys/unistd.h | |
24 | sed -n -e "s/[[:space:]]*$xxcpu[[:space:]].*//p" | |
38dbb4c5 |
25 | sed -e s/_RISC/-RISC/ -e s/HP_// -e s/_/./ -e "s/[[:space:]]*//g"`; |
1dc48e02 |
26 | else |
27 | # This system is running <= 9.x |
28 | # Tested on 9.0[57] PA and [78].0 MC680[23]0. Idea: After removing |
29 | # MC6888[12] from context string, use first CPU identifier. |
30 | # |
31 | # ASSUMPTION: Only CPU identifiers contain no lowercase letters. |
32 | archname=`getcontext | tr ' ' '\012' | grep -v '[a-z]' | grep -v MC688 | |
33 | sed -e 's/HP-//' -e 1q`; |
34 | selecttype='int *' |
8e07c86e |
35 | fi |
1717e83e |
36 | |
37 | # For some strange reason, the u32align test from Configure hangs in |
38 | # HP-UX 10.20 since the December 2001 patches. So hint it to avoid |
39 | # the test. |
40 | if [ "$xxOsRevMajor" -le 10 ]; then |
41 | d_u32align=$define |
2da79f33 |
42 | fi |
8e07c86e |
43 | |
1dc48e02 |
44 | echo "Archname is $archname" |
45 | |
90e831dc |
46 | # Fix XSlib (CPAN) confusion when re-using a prefix but changing from ILP32 |
47 | # to LP64 builds. They're NOT binary compatible, so quit claiming they are. |
48 | archname64=LP64 |
49 | |
1dc48e02 |
50 | |
51 | ### HP-UX OS specific behaviour |
5e4c82f0 |
52 | |
e08bfeb2 |
53 | # -ldbm is obsolete and should not be used |
54 | # -lBSD contains BSD-style duplicates of SVR4 routines that cause confusion |
55 | # -lPW is obsolete and should not be used |
56 | # The libraries crypt, malloc, ndir, and net are empty. |
c723583c |
57 | set `echo "X $libswanted " | sed -e 's/ ld / /' -e 's/ dbm / /' -e 's/ BSD / /' -e 's/ PW / /'` |
58 | shift |
e08bfeb2 |
59 | libswanted="$*" |
60 | |
1dc48e02 |
61 | cc=${cc:-cc} |
c723583c |
62 | ar=/usr/bin/ar # Yes, truly override. We do not want the GNU ar. |
63 | full_ar=$ar # I repeat, no GNU ar. arrr. |
167d2fcb |
64 | |
c723583c |
65 | set `echo "X $ccflags " | sed -e 's/ -A[ea] / /' -e 's/ -D_HPUX_SOURCE / /'` |
66 | shift |
67 | cc_cppflags="$* -D_HPUX_SOURCE" |
68 | cppflags="-Aa -D__STDC_EXT__ $cc_cppflags" |
69 | |
70 | case "$prefix" in |
71 | "") prefix='/opt/perl5' ;; |
72 | esac |
0f3ba31f |
73 | |
dcd01700 |
74 | gnu_as=no |
75 | gnu_ld=no |
b36fec95 |
76 | case `$cc -v 2>&1`"" in |
c723583c |
77 | *gcc*) ccisgcc="$define" |
dcd01700 |
78 | ccflags="$cc_cppflags" |
16c1da12 |
79 | if [ "X$gccversion" = "X" ]; then |
80 | # Done too late in Configure if hinted |
0baa0948 |
81 | gccversion=`$cc -dumpversion` |
16c1da12 |
82 | fi |
1717e83e |
83 | case "$gccversion" in |
84 | [012]*) # HP-UX and gcc-2.* break UINT32_MAX :-( |
85 | ccflags="$ccflags -DUINT32_MAX_BROKEN" |
86 | ;; |
b951dd56 |
87 | [34]*) # GCC (both 32bit and 64bit) will define __STDC_EXT__ |
51d2fe06 |
88 | # by default when using GCC 3.0 and newer versions of |
89 | # the compiler. |
90 | cppflags="$cc_cppflags" |
91 | ;; |
1717e83e |
92 | esac |
0f3ba31f |
93 | case "`getconf KERNEL_BITS 2>/dev/null`" in |
dcd01700 |
94 | *64*) |
eb9ee3dc |
95 | echo "main(){}">try.c |
16c1da12 |
96 | case "$gccversion" in |
b951dd56 |
97 | [34]*) |
90e831dc |
98 | case "$archname" in |
87a010a9 |
99 | PA-RISC*) |
100 | case "$ccflags" in |
101 | *-mpa-risc*) ;; |
102 | *) ccflags="$ccflags -mpa-risc-2-0" ;; |
103 | esac |
104 | ;; |
90e831dc |
105 | esac |
dcd01700 |
106 | ;; |
eb9ee3dc |
107 | *) # gcc with gas will not accept +DA2.0 |
16c1da12 |
108 | case "`$cc -c -Wa,+DA2.0 try.c 2>&1`" in |
109 | *"+DA2.0"*) # gas |
110 | gnu_as=yes |
111 | ;; |
112 | *) # HPas |
113 | ccflags="$ccflags -Wa,+DA2.0" |
114 | ;; |
115 | esac |
dcd01700 |
116 | ;; |
117 | esac |
118 | # gcc with gld will not accept +vnocompatwarnings |
119 | case "`$cc -o try -Wl,+vnocompatwarnings try.c 2>&1`" in |
120 | *"+vnocompat"*) # gld |
121 | gnu_ld=yes |
122 | ;; |
123 | *) # HPld |
1717e83e |
124 | case "$gccversion" in |
125 | [12]*) |
90e831dc |
126 | # Why not 3 as well here? |
127 | # Since not relevant to IA64, not changed. |
1717e83e |
128 | ldflags="$ldflags -Wl,+vnocompatwarnings" |
129 | ccflags="$ccflags -Wl,+vnocompatwarnings" |
130 | ;; |
131 | esac |
dcd01700 |
132 | ;; |
133 | esac |
eb9ee3dc |
134 | rm -f try.c |
dcd01700 |
135 | ;; |
0f3ba31f |
136 | esac |
c723583c |
137 | ;; |
138 | *) ccisgcc='' |
bd7dcc15 |
139 | # What cannot be use in combination with ccache links :( |
140 | cc_found="" |
141 | for p in `echo $PATH | tr : ' ''` ; do |
142 | x="$p/cc" |
143 | if [ -f $x ] && [ -x $x ]; then |
144 | if [ -h $x ]; then |
145 | l=`ls -l $x | sed 's,.*-> ,,'` |
146 | case $l in |
147 | /*) x=$l ;; |
148 | *) x="$p/$l" ;; |
149 | esac |
150 | fi |
151 | x=`echo $x | sed 's,/\./,/,g'` |
152 | case $x in |
153 | *ccache*) ;; |
154 | *) [ -z "$cc_found" ] && cc_found=$x ;; |
155 | esac |
156 | fi |
157 | done |
158 | [ -z "$cc_found" ] && cc_found=`which cc` |
159 | what $cc_found >&4 |
4aa4159a |
160 | ccversion=`what $cc_found | awk '/Compiler/{print $2}/Itanium/{print $6,$7}/for Integrity/{print $6}'` |
0fb2d8c6 |
161 | case "$ccflags" in |
51d2fe06 |
162 | "-Ae "*) ;; |
bf5ca8fd |
163 | *) ccflags="-Ae $cc_cppflags" |
164 | # +vnocompatwarnings not known in 10.10 and older |
165 | if [ $xxOsRev -ge 1020 ]; then |
17ad866a |
166 | ccflags="$ccflags -Wl,+vnocompatwarnings" |
bf5ca8fd |
167 | fi |
168 | ;; |
51d2fe06 |
169 | esac |
5e2807cc |
170 | # Needed because cpp does only support -Aa (not -Ae) |
171 | cpplast='-' |
172 | cppminus='-' |
173 | cppstdin='cc -E -Aa -D__STDC_EXT__' |
174 | cpprun=$cppstdin |
0b93aee7 |
175 | # case "$d_casti32" in |
176 | # "") d_casti32='undef' ;; |
177 | # esac |
0f3ba31f |
178 | ;; |
1dc48e02 |
179 | esac |
180 | |
e08bfeb2 |
181 | # When HP-UX runs a script with "#!", it sets argv[0] to the script name. |
182 | toke_cflags='ccflags="$ccflags -DARG_ZERO_IS_SCRIPT"' |
1dc48e02 |
183 | |
1dc48e02 |
184 | ### 64 BITNESS |
b36fec95 |
185 | |
8cb447e0 |
186 | # Some gcc versions do native 64 bit long (e.g. 2.9-hppa-000310 and gcc-3.0) |
dcd01700 |
187 | # We have to force 64bitness to go search the right libraries |
188 | gcc_64native=no |
189 | case "$ccisgcc" in |
190 | $define|true|[Yy]) |
33773f1a |
191 | echo '#include <stdio.h>\nint main(){long l;printf("%d\\n",sizeof(l));}'>try.c |
dcd01700 |
192 | $cc -o try $ccflags $ldflags try.c |
193 | if [ "`try`" = "8" ]; then |
0215cc28 |
194 | case "$use64bitall" in |
195 | $define|true|[Yy]) ;; |
196 | *) cat <<EOM >&4 |
dcd01700 |
197 | |
198 | *** This version of gcc uses 64 bit longs. -Duse64bitall is |
199 | *** implicitly set to enable continuation |
200 | EOM |
0215cc28 |
201 | esac |
dcd01700 |
202 | use64bitall=$define |
203 | gcc_64native=yes |
204 | fi |
205 | ;; |
206 | esac |
207 | |
ec7b9793 |
208 | case "$use64bitall" in |
1dc48e02 |
209 | $define|true|[yY]*) use64bitint="$define" ;; |
210 | esac |
211 | |
6d5d7abf |
212 | case "$usemorebits" in |
1dc48e02 |
213 | $define|true|[yY]*) use64bitint="$define"; uselongdouble="$define" ;; |
214 | esac |
bf0c440f |
215 | |
38dbb4c5 |
216 | case "$archname" in |
217 | IA64*) |
218 | # While here, override so=sl auto-detection |
219 | so='so' |
220 | ;; |
1dc48e02 |
221 | esac |
bf0c440f |
222 | |
1dc48e02 |
223 | case "$use64bitint" in |
224 | $define|true|[Yy]) |
bf0c440f |
225 | |
1dc48e02 |
226 | if [ "$xxOsRevMajor" -lt 11 ]; then |
227 | cat <<EOM >&4 |
228 | |
229 | *** 64-bit compilation is not supported on HP-UX $xxOsRevMajor. |
230 | *** You need at least HP-UX 11.0. |
ec7b9793 |
231 | *** Cannot continue, aborting. |
bf0c440f |
232 | EOM |
1dc48e02 |
233 | exit 1 |
234 | fi |
bf0c440f |
235 | |
1dc48e02 |
236 | # Set libc and the library paths |
237 | case "$archname" in |
238 | PA-RISC*) |
239 | loclibpth="$loclibpth /lib/pa20_64" |
240 | libc='/lib/pa20_64/libc.sl' ;; |
e5a5d6fc |
241 | IA64*) |
1dc48e02 |
242 | loclibpth="$loclibpth /usr/lib/hpux64" |
243 | libc='/usr/lib/hpux64/libc.so' ;; |
244 | esac |
245 | if [ ! -f "$libc" ]; then |
246 | cat <<EOM >&4 |
247 | |
248 | *** You do not seem to have the 64-bit libc. |
249 | *** I cannot find the file $libc. |
250 | *** Cannot continue, aborting. |
251 | EOM |
252 | exit 1 |
253 | fi |
bf0c440f |
254 | |
dcd01700 |
255 | case "$ccisgcc" in |
256 | $define|true|[Yy]) |
257 | # For the moment, don't care that it ain't supported (yet) |
258 | # by gcc (up to and including 2.95.3), cause it'll crash |
259 | # anyway. Expect auto-detection of 64-bit enabled gcc on |
260 | # HP-UX soon, including a user-friendly exit |
261 | case $gcc_64native in |
16c1da12 |
262 | no) case "$gccversion" in |
b951dd56 |
263 | [1234]*) |
264 | ccflags="$ccflags -mlp64" |
265 | case "$archname" in |
266 | PA-RISC*) |
267 | ldflags="$ldflags -Wl,+DD64" |
268 | ;; |
269 | IA64*) |
270 | ldflags="$ldflags -mlp64" |
271 | ;; |
272 | esac |
16c1da12 |
273 | ;; |
274 | esac |
dcd01700 |
275 | ;; |
276 | esac |
277 | ;; |
278 | *) |
279 | ccflags="$ccflags +DD64" |
280 | ldflags="$ldflags +DD64" |
281 | ;; |
282 | esac |
bf0c440f |
283 | |
1dc48e02 |
284 | # Reset the library checker to make sure libraries |
285 | # are the right type |
38dbb4c5 |
286 | # (NOTE: on IA64, this doesn't work with .a files.) |
1dc48e02 |
287 | libscheck='case "`/usr/bin/file $xxx`" in |
288 | *ELF-64*|*LP64*|*PA-RISC2.0*) ;; |
289 | *) xxx=/no/64-bit$xxx ;; |
290 | esac' |
291 | |
292 | ;; |
293 | |
294 | *) # Not in 64-bit mode |
295 | |
296 | case "$archname" in |
297 | PA-RISC*) |
298 | libc='/lib/libc.sl' ;; |
e5a5d6fc |
299 | IA64*) |
1dc48e02 |
300 | loclibpth="$loclibpth /usr/lib/hpux32" |
301 | libc='/usr/lib/hpux32/libc.so' ;; |
302 | esac |
303 | ;; |
304 | esac |
305 | |
dcd01700 |
306 | # By setting the deferred flag below, this means that if you run perl |
307 | # on a system that does not have the required shared library that you |
308 | # linked it with, it will die when you try to access a symbol in the |
309 | # (missing) shared library. If you would rather know at perl startup |
310 | # time that you are missing an important shared library, switch the |
311 | # comments so that immediate, rather than deferred loading is |
312 | # performed. Even with immediate loading, you can postpone errors for |
313 | # undefined (or multiply defined) routines until actual access by |
314 | # adding the "nonfatal" option. |
315 | # ccdlflags="-Wl,-E -Wl,-B,immediate $ccdlflags" |
316 | # ccdlflags="-Wl,-E -Wl,-B,immediate,-B,nonfatal $ccdlflags" |
317 | if [ "$gnu_ld" = "yes" ]; then |
318 | ccdlflags="-Wl,-E $ccdlflags" |
319 | else |
320 | ccdlflags="-Wl,-E -Wl,-B,deferred $ccdlflags" |
321 | fi |
322 | |
1dc48e02 |
323 | |
324 | ### COMPILER SPECIFICS |
bf0c440f |
325 | |
7f128676 |
326 | ## Local restrictions (point to README.hpux to lift these) |
327 | |
328 | ## Optimization limits |
329 | cat >try.c <<EOF |
33773f1a |
330 | #include <stdio.h> |
7f128676 |
331 | #include <sys/resource.h> |
332 | |
333 | int main () |
334 | { |
335 | struct rlimit rl; |
336 | int i = getrlimit (RLIMIT_DATA, &rl); |
798b24a8 |
337 | printf ("%d\n", (int)(rl.rlim_cur / (1024 * 1024))); |
7f128676 |
338 | } /* main */ |
339 | EOF |
340 | $cc -o try $ccflags $ldflags try.c |
341 | maxdsiz=`try` |
303aa268 |
342 | rm -f try try.c core |
7f128676 |
343 | if [ $maxdsiz -le 64 ]; then |
344 | # 64 Mb is probably not enough to optimize toke.c |
345 | # and regexp.c with -O2 |
346 | cat <<EOM >&4 |
347 | Your kernel limits the data section of your programs to $maxdsiz Mb, |
348 | which is (sadly) not enough to fully optimize some parts of the |
349 | perl binary. I'll try to use a lower optimization level for |
350 | those parts. If you are a sysadmin, and you *do* want full |
351 | optimization, raise the 'maxdsiz' kernel configuration parameter |
352 | to at least 0x08000000 (128 Mb) and rebuild your kernel. |
353 | EOM |
a6bab54c |
354 | regexec_cflags='' |
38dbb4c5 |
355 | doop_cflags='' |
4aa4159a |
356 | op_cflags='' |
7f128676 |
357 | fi |
358 | |
b36fec95 |
359 | case "$ccisgcc" in |
1dc48e02 |
360 | $define|true|[Yy]) |
e5a5d6fc |
361 | |
1dc48e02 |
362 | case "$optimize" in |
c723583c |
363 | "") optimize="-g -O" ;; |
364 | *O[3456789]*) optimize=`echo "$optimize" | sed -e 's/O[3-9]/O2/'` ;; |
1dc48e02 |
365 | esac |
c723583c |
366 | #ld="$cc" |
5e2807cc |
367 | ld=/usr/bin/ld |
1dc48e02 |
368 | cccdlflags='-fPIC' |
c723583c |
369 | #lddlflags='-shared' |
5e2807cc |
370 | lddlflags='-b' |
c723583c |
371 | case "$optimize" in |
372 | *-g*-O*|*-O*-g*) |
373 | # gcc without gas will not accept -g |
374 | echo "main(){}">try.c |
375 | case "`$cc $optimize -c try.c 2>&1`" in |
376 | *"-g option disabled"*) |
377 | set `echo "X $optimize " | sed -e 's/ -g / /'` |
378 | shift |
379 | optimize="$*" |
380 | ;; |
381 | esac |
382 | ;; |
383 | esac |
7f128676 |
384 | if [ $maxdsiz -le 64 ]; then |
7f128676 |
385 | case "$optimize" in |
386 | *O2*) opt=`echo "$optimize" | sed -e 's/O2/O1/'` |
a6bab54c |
387 | toke_cflags="$toke_cflags;optimize=\"$opt\"" |
388 | regexec_cflags="optimize=\"$opt\"" |
7f128676 |
389 | ;; |
390 | esac |
391 | fi |
1dc48e02 |
392 | ;; |
393 | |
394 | *) # HP's compiler cannot combine -g and -O |
395 | case "$optimize" in |
5e2807cc |
396 | "") optimize="+O2 +Onolimit" ;; |
c723583c |
397 | *O[3456789]*) optimize=`echo "$optimize" | sed -e 's/O[3-9]/O2/'` ;; |
1dc48e02 |
398 | esac |
38dbb4c5 |
399 | case "$optimize" in |
400 | *-O*|\ |
1717e83e |
401 | *O2*) opt=`echo "$optimize" | sed -e 's/-O/+O2/' -e 's/O2/O1/' -e 's/ *+Onolimit//'` |
38dbb4c5 |
402 | ;; |
1717e83e |
403 | *) opt="$optimize" |
404 | ;; |
405 | esac |
38dbb4c5 |
406 | case "$archname" in |
407 | IA64*) |
798b24a8 |
408 | case "$ccversion" in |
409 | B3910B*A.06.0[12345]) |
410 | # > cc --version |
411 | # cc: HP aC++/ANSI C B3910B A.06.05 [Jul 25 2005] |
412 | # Has optimizing problems with -O2 and up for both |
413 | # maint (5.8.8+) and blead (5.9.3+) |
414 | # -O1/+O1 passed all tests (m)'05 [ 10 Jan 2005 ] |
415 | optimize="$opt" ;; |
4aa4159a |
416 | *) doop_cflags="optimize=\"$opt\"" |
417 | op_cflags="optimize=\"$opt\"" ;; |
798b24a8 |
418 | esac |
38dbb4c5 |
419 | ;; |
420 | esac |
798b24a8 |
421 | if [ $maxdsiz -le 64 ]; then |
422 | toke_cflags="$toke_cflags;optimize=\"$opt\"" |
423 | regexec_cflags="optimize=\"$opt\"" |
424 | fi |
1dc48e02 |
425 | ld=/usr/bin/ld |
426 | cccdlflags='+Z' |
c723583c |
427 | lddlflags='-b +vnocompatwarnings' |
1dc48e02 |
428 | ;; |
b36fec95 |
429 | esac |
8e07c86e |
430 | |
1dc48e02 |
431 | ## LARGEFILES |
bf5ca8fd |
432 | if [ $xxOsRev -lt 1020 ]; then |
433 | uselargefiles="$undef" |
434 | fi |
774d564b |
435 | |
c723583c |
436 | #case "$uselargefiles-$ccisgcc" in |
e5a5d6fc |
437 | # "$define-$define"|'-define') |
c723583c |
438 | # cat <<EOM >&4 |
439 | # |
440 | #*** I'm ignoring large files for this build because |
441 | #*** I don't know how to do use large files in HP-UX using gcc. |
442 | # |
443 | #EOM |
444 | # uselargefiles="$undef" |
445 | # ;; |
446 | # esac |
dc45a647 |
447 | |
aed17120 |
448 | # Once we have the compiler flags defined, Configure will |
449 | # execute the following call-back script. See hints/README.hints |
450 | # for details. |
451 | cat > UU/cc.cbu <<'EOCBU' |
452 | # This script UU/cc.cbu will get 'called-back' by Configure after it |
453 | # has prompted the user for the C compiler to use. |
454 | |
455 | # Compile and run the a test case to see if a certain gcc bug is |
456 | # present. If so, lower the optimization level when compiling |
457 | # pp_pack.c. This works around a bug in unpack. |
458 | |
459 | if test -z "$ccisgcc" -a -z "$gccversion"; then |
460 | : no tests needed for HPc |
461 | else |
462 | echo " " |
463 | echo "Testing for a certain gcc bug is fixed in your compiler..." |
464 | |
465 | # Try compiling the test case. |
03ae59b2 |
466 | if $cc -o t001 -O $ccflags $ldflags -lm ../hints/t001.c; then |
aed17120 |
467 | gccbug=`$run ./t001` |
468 | case "$gccbug" in |
469 | *fails*) |
470 | cat >&4 <<EOF |
471 | This C compiler ($gccversion) is known to have optimizer |
472 | problems when compiling pp_pack.c. |
473 | |
474 | Disabling optimization for pp_pack.c. |
475 | EOF |
476 | case "$pp_pack_cflags" in |
477 | '') pp_pack_cflags='optimize=' |
478 | echo "pp_pack_cflags='optimize=\"\"'" >> config.sh ;; |
479 | *) echo "You specified pp_pack_cflags yourself, so we'll go with your value." >&4 ;; |
480 | esac |
481 | ;; |
482 | *) echo "Your compiler is ok." >&4 |
483 | ;; |
484 | esac |
485 | else |
486 | echo " " |
487 | echo "*** WHOA THERE!!! ***" >&4 |
488 | echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4 |
489 | case "$knowitall" in |
490 | '') echo " You'd better start hunting for one and let me know about it." >&4 |
491 | exit 1 |
492 | ;; |
493 | esac |
494 | fi |
495 | |
496 | rm -f t001$_o t001$_exe |
497 | fi |
498 | EOCBU |
499 | |
1dc48e02 |
500 | cat >UU/uselargefiles.cbu <<'EOCBU' |
e5a5d6fc |
501 | # This script UU/uselargefiles.cbu will get 'called-back' by Configure |
1dc48e02 |
502 | # after it has prompted the user for whether to use large files. |
503 | case "$uselargefiles" in |
504 | ""|$define|true|[yY]*) |
505 | # there are largefile flags available via getconf(1) |
506 | # but we cheat for now. (Keep that in the left margin.) |
507 | ccflags_uselargefiles="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" |
5cf1d1f1 |
508 | |
38dbb4c5 |
509 | case " $ccflags " in |
510 | *" $ccflags_uselargefiles "*) ;; |
0fb2d8c6 |
511 | *) ccflags="$ccflags $ccflags_uselargefiles" ;; |
512 | esac |
1dc48e02 |
513 | |
1717e83e |
514 | if test -z "$ccisgcc" -a -z "$gccversion"; then |
1dc48e02 |
515 | # The strict ANSI mode (-Aa) doesn't like large files. |
516 | ccflags=`echo " $ccflags "|sed 's@ -Aa @ @g'` |
517 | case "$ccflags" in |
518 | *-Ae*) ;; |
519 | *) ccflags="$ccflags -Ae" ;; |
520 | esac |
fa2879fb |
521 | fi |
522 | ;; |
523 | esac |
1dc48e02 |
524 | EOCBU |
fa2879fb |
525 | |
1dc48e02 |
526 | # THREADING |
104d25b7 |
527 | |
e5a5d6fc |
528 | # This script UU/usethreads.cbu will get 'called-back' by Configure |
104d25b7 |
529 | # after it has prompted the user for whether to use threads. |
1dc48e02 |
530 | cat >UU/usethreads.cbu <<'EOCBU' |
104d25b7 |
531 | case "$usethreads" in |
1dc48e02 |
532 | $define|true|[yY]*) |
533 | if [ "$xxOsRevMajor" -lt 10 ]; then |
534 | cat <<EOM >&4 |
f1ee07ac |
535 | |
104d25b7 |
536 | HP-UX $xxOsRevMajor cannot support POSIX threads. |
537 | Consider upgrading to at least HP-UX 11. |
538 | Cannot continue, aborting. |
539 | EOM |
1dc48e02 |
540 | exit 1 |
541 | fi |
542 | |
543 | if [ "$xxOsRevMajor" -eq 10 ]; then |
544 | # Under 10.X, a threaded perl can be built |
545 | if [ -f /usr/include/pthread.h ]; then |
c7d9b096 |
546 | if [ -f /usr/lib/libcma.sl ]; then |
547 | # DCE (from Core OS CD) is installed |
548 | |
1717e83e |
549 | # Check if it is pristine, or patched |
550 | cmavsn=`what /usr/lib/libcma.sl 2>&1 | grep 1996` |
551 | if [ ! -z "$cmavsn" ]; then |
552 | cat <<EOM >&4 |
fa01be49 |
553 | \a |
554 | *************************************************************************** |
555 | |
556 | Perl will support threading through /usr/lib/libcma.sl from |
557 | the HP DCE package, but the version found is too old to be |
558 | reliable. |
559 | |
560 | If you are not depending on this specific version of the library, |
561 | consider to upgrade using patch PHSS_23672 (read README.hpux) |
562 | |
563 | *************************************************************************** |
564 | |
565 | (sleeping for 10 seconds...) |
566 | EOM |
1717e83e |
567 | sleep 10 |
568 | fi |
fa01be49 |
569 | |
1dc48e02 |
570 | # It needs # libcma and OLD_PTHREADS_API. Also |
571 | # <pthread.h> needs to be #included before any |
572 | # other includes (in perl.h) |
c7d9b096 |
573 | |
574 | # HP-UX 10.X uses the old pthreads API |
575 | d_oldpthreads="$define" |
576 | |
577 | # include libcma before all the others |
578 | libswanted="cma $libswanted" |
579 | |
1dc48e02 |
580 | # tell perl.h to include <pthread.h> before other |
581 | # include files |
c7d9b096 |
582 | ccflags="$ccflags -DPTHREAD_H_FIRST" |
5a5efdd7 |
583 | # First column on purpose: |
584 | # this is not a standard Configure variable |
585 | # but we need to get this noticed. |
cce6a207 |
586 | pthread_h_first="$define" |
5a5efdd7 |
587 | |
588 | # HP-UX 10.X seems to have no easy |
589 | # way of detecting these *time_r protos. |
590 | d_gmtime_r_proto='define' |
591 | gmtime_r_proto='REENTRANT_PROTO_I_TS' |
592 | d_localtime_r_proto='define' |
593 | localtime_r_proto='REENTRANT_PROTO_I_TS' |
594 | |
58a9dc44 |
595 | # Avoid the poisonous conflicting (and irrelevant) |
e5a5d6fc |
596 | # prototypes of setkey (). |
58a9dc44 |
597 | i_crypt="$undef" |
c7d9b096 |
598 | |
1dc48e02 |
599 | # CMA redefines select to cma_select, and cma_select |
600 | # expects int * instead of fd_set * (just like 9.X) |
c7d9b096 |
601 | selecttype='int *' |
602 | |
603 | elif [ -f /usr/lib/libpthread.sl ]; then |
604 | # PTH package is installed |
605 | libswanted="pthread $libswanted" |
606 | else |
607 | libswanted="no_threads_available" |
608 | fi |
609 | else |
610 | libswanted="no_threads_available" |
611 | fi |
612 | |
1dc48e02 |
613 | if [ $libswanted = "no_threads_available" ]; then |
614 | cat <<EOM >&4 |
f1ee07ac |
615 | |
104d25b7 |
616 | In HP-UX 10.X for POSIX threads you need both of the files |
c7d9b096 |
617 | /usr/include/pthread.h and either /usr/lib/libcma.sl or /usr/lib/libpthread.sl. |
618 | Either you must upgrade to HP-UX 11 or install a posix thread library: |
f1ee07ac |
619 | |
620 | DCE-CoreTools from HP-UX 10.20 Hardware Extensions 3.0 CD (B3920-13941) |
621 | |
622 | or |
623 | |
1dc48e02 |
624 | PTH package from e.g. http://hpux.tn.tudelft.nl/hppd/hpux/alpha.html |
f1ee07ac |
625 | |
104d25b7 |
626 | Cannot continue, aborting. |
627 | EOM |
1dc48e02 |
628 | exit 1 |
c7d9b096 |
629 | fi |
1dc48e02 |
630 | else |
631 | # 12 may want upping the _POSIX_C_SOURCE datestamp... |
10bc17b6 |
632 | ccflags=" -D_POSIX_C_SOURCE=199506L -D_REENTRANT $ccflags" |
1dc48e02 |
633 | set `echo X "$libswanted "| sed -e 's/ c / pthread c /'` |
634 | shift |
635 | libswanted="$*" |
104d25b7 |
636 | |
1a9d5acd |
637 | # HP-UX 11.X seems to have no easy |
638 | # way of detecting these *time_r protos. |
639 | d_gmtime_r_proto='define' |
640 | gmtime_r_proto='REENTRANT_PROTO_S_TS' |
641 | d_localtime_r_proto='define' |
642 | localtime_r_proto='REENTRANT_PROTO_S_TS' |
643 | fi |
104d25b7 |
644 | ;; |
1dc48e02 |
645 | esac |
bd9b35c9 |
646 | EOCBU |
758a5d79 |
647 | |
e5a5d6fc |
648 | # There used to be: |
649 | # The mysterious io_xs memory corruption in 11.00 32bit seems to get |
650 | # fixed by not using Perl's malloc. Flip side is performance loss. |
651 | # So we want mymalloc for all situations possible |
652 | # That set usemymalloc to 'n' for threaded builds and non-gcc 32bit |
653 | # non-debugging builds and 'y' for all others |
b1157548 |
654 | |
c2eedc99 |
655 | usemymalloc='n' |
7b9f4e92 |
656 | case "$useperlio" in |
657 | $undef|false|[nN]*) usemymalloc='y' ;; |
658 | esac |
c2eedc99 |
659 | |
da0b61dd |
660 | # malloc wrap works |
661 | case "$usemallocwrap" in |
e5a5d6fc |
662 | '') usemallocwrap='define' ;; |
663 | esac |
da0b61dd |
664 | |
e5a5d6fc |
665 | # ctime_r () and asctime_r () seem to have issues for versions before |
b91b8403 |
666 | # HP-UX 11 |
667 | if [ $xxOsRevMajor -lt 11 ]; then |
668 | d_ctime_r="$undef" |
669 | d_asctime_r="$undef" |
670 | fi |
671 | |
672 | |
e5a5d6fc |
673 | # fpclassify () is a macro, the library call is Fpclassify |
38dbb4c5 |
674 | # Similarly with the others below. |
758a5d79 |
675 | d_fpclassify='define' |
38dbb4c5 |
676 | d_isnan='define' |
677 | d_isinf='define' |
678 | d_isfinite='define' |
679 | d_unordered='define' |
90e831dc |
680 | # Next one(s) need the leading tab. These are special 'hint' symbols that |
681 | # are not to be propagated to config.sh, all related to pthreads draft 4 |
682 | # interfaces. |
683 | case "$d_oldpthreads" in |
684 | ''|$undef) |
685 | d_crypt_r_proto='undef' |
686 | d_getgrent_r_proto='undef' |
687 | d_getpwent_r_proto='undef' |
688 | d_strerror_r_proto='undef' |
689 | ;; |
690 | esac |