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