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