3 ### SYSTEM ARCHITECTURE
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`;
8 xxOsRevMinor=`uname -r | sed -e 's/^[^0-9]*//' | cut -d. -f2`;
9 xxOsRev=`expr 100 \* $xxOsRevMajor + $xxOsRevMinor`
10 if [ "$xxOsRevMajor" -ge 10 ]; then
11 # This system is running >= 10.x
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.
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
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" |
25 sed -e s/_RISC/-RISC/ -e s/HP_// -e s/_/./ -e "s/[[:space:]]*//g"`;
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.
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`;
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
40 if [ "$xxOsRevMajor" -le 10 ]; then
44 echo "Archname is $archname"
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.
51 ### HP-UX OS specific behaviour
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.
57 set `echo "X $libswanted " | sed -e 's/ ld / /' -e 's/ dbm / /' -e 's/ BSD / /' -e 's/ PW / /'`
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.
65 set `echo "X $ccflags " | sed -e 's/ -A[ea] / /' -e 's/ -D_HPUX_SOURCE / /'`
67 cc_cppflags="$* -D_HPUX_SOURCE"
68 cppflags="-Aa -D__STDC_EXT__ $cc_cppflags"
71 "") prefix='/opt/perl5' ;;
76 case `$cc -v 2>&1`"" in
77 *gcc*) ccisgcc="$define"
78 ccflags="$cc_cppflags"
79 if [ "X$gccversion" = "X" ]; then
80 # Done too late in Configure if hinted
81 gccversion=`$cc --version | sed 's/.*(GCC) *//'`
84 [012]*) # HP-UX and gcc-2.* break UINT32_MAX :-(
85 ccflags="$ccflags -DUINT32_MAX_BROKEN"
87 [34]*) # GCC (both 32bit and 64bit) will define __STDC_EXT__
88 # by default when using GCC 3.0 and newer versions of
90 cppflags="$cc_cppflags"
93 case "`getconf KERNEL_BITS 2>/dev/null`" in
102 *) ccflags="$ccflags -mpa-risc-2-0" ;;
107 *) # gcc with gas will not accept +DA2.0
108 case "`$cc -c -Wa,+DA2.0 try.c 2>&1`" in
113 ccflags="$ccflags -Wa,+DA2.0"
118 # gcc with gld will not accept +vnocompatwarnings
119 case "`$cc -o try -Wl,+vnocompatwarnings try.c 2>&1`" in
120 *"+vnocompat"*) # gld
124 case "$gccversion" in
126 # Why not 3 as well here?
127 # Since not relevant to IA64, not changed.
128 ldflags="$ldflags -Wl,+vnocompatwarnings"
129 ccflags="$ccflags -Wl,+vnocompatwarnings"
139 # What cannot be use in combination with ccache links :(
141 for p in `echo $PATH | tr : ' ''` ; do
143 if [ -f $x ] && [ -x $x ]; then
145 l=`ls -l $x | sed 's,.*-> ,,'`
151 x=`echo $x | sed 's,/\./,/,g'`
154 *) [ -z "$cc_found" ] && cc_found=$x ;;
158 [ -z "$cc_found" ] && cc_found=`which cc`
160 ccversion=`what $cc_found | awk '/Compiler/{print $2}/Itanium/{print $6,$7}/for Integrity/{print $7}'`
163 *) ccflags="-Ae $cc_cppflags"
164 # +vnocompatwarnings not known in 10.10 and older
165 if [ $xxOsRev -ge 1020 ]; then
166 ccflags="$ccflags -Wl,+vnocompatwarnings"
170 # Needed because cpp does only support -Aa (not -Ae)
173 cppstdin='cc -E -Aa -D__STDC_EXT__'
175 # case "$d_casti32" in
176 # "") d_casti32='undef' ;;
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"'
186 # Some gcc versions do native 64 bit long (e.g. 2.9-hppa-000310 and gcc-3.0)
187 # We have to force 64bitness to go search the right libraries
191 echo 'int main(){long l;printf("%d\\n",sizeof(l));}'>try.c
192 $cc -o try $ccflags $ldflags try.c
193 if [ "`try`" = "8" ]; then
196 *** This version of gcc uses 64 bit longs. -Duse64bitall is
197 *** implicitly set to enable continuation
205 case "$use64bitall" in
206 $define|true|[yY]*) use64bitint="$define" ;;
209 case "$usemorebits" in
210 $define|true|[yY]*) use64bitint="$define"; uselongdouble="$define" ;;
215 # While here, override so=sl auto-detection
219 case "$uselongdouble" in
224 *** long doubles are not (yet) supported on HP-UX (any version)
225 *** Until it does, we cannot continue, aborting.
232 case "$use64bitint" in
235 if [ "$xxOsRevMajor" -lt 11 ]; then
238 *** 64-bit compilation is not supported on HP-UX $xxOsRevMajor.
239 *** You need at least HP-UX 11.0.
240 *** Cannot continue, aborting.
245 # Set libc and the library paths
248 loclibpth="$loclibpth /lib/pa20_64"
249 libc='/lib/pa20_64/libc.sl' ;;
251 loclibpth="$loclibpth /usr/lib/hpux64"
252 libc='/usr/lib/hpux64/libc.so' ;;
254 if [ ! -f "$libc" ]; then
257 *** You do not seem to have the 64-bit libc.
258 *** I cannot find the file $libc.
259 *** Cannot continue, aborting.
266 # For the moment, don't care that it ain't supported (yet)
267 # by gcc (up to and including 2.95.3), cause it'll crash
268 # anyway. Expect auto-detection of 64-bit enabled gcc on
269 # HP-UX soon, including a user-friendly exit
270 case $gcc_64native in
271 no) case "$gccversion" in
273 ccflags="$ccflags -mlp64"
276 ldflags="$ldflags -Wl,+DD64"
279 ldflags="$ldflags -mlp64"
288 ccflags="$ccflags +DD64"
289 ldflags="$ldflags +DD64"
293 # Reset the library checker to make sure libraries
295 # (NOTE: on IA64, this doesn't work with .a files.)
296 libscheck='case "`/usr/bin/file $xxx`" in
297 *ELF-64*|*LP64*|*PA-RISC2.0*) ;;
298 *) xxx=/no/64-bit$xxx ;;
303 *) # Not in 64-bit mode
307 libc='/lib/libc.sl' ;;
309 loclibpth="$loclibpth /usr/lib/hpux32"
310 libc='/usr/lib/hpux32/libc.so' ;;
315 # By setting the deferred flag below, this means that if you run perl
316 # on a system that does not have the required shared library that you
317 # linked it with, it will die when you try to access a symbol in the
318 # (missing) shared library. If you would rather know at perl startup
319 # time that you are missing an important shared library, switch the
320 # comments so that immediate, rather than deferred loading is
321 # performed. Even with immediate loading, you can postpone errors for
322 # undefined (or multiply defined) routines until actual access by
323 # adding the "nonfatal" option.
324 # ccdlflags="-Wl,-E -Wl,-B,immediate $ccdlflags"
325 # ccdlflags="-Wl,-E -Wl,-B,immediate,-B,nonfatal $ccdlflags"
326 if [ "$gnu_ld" = "yes" ]; then
327 ccdlflags="-Wl,-E $ccdlflags"
329 ccdlflags="-Wl,-E -Wl,-B,deferred $ccdlflags"
333 ### COMPILER SPECIFICS
335 ## Local restrictions (point to README.hpux to lift these)
337 ## Optimization limits
339 #include <sys/resource.h>
344 int i = getrlimit (RLIMIT_DATA, &rl);
345 printf ("%d\n", (int)(rl.rlim_cur / (1024 * 1024)));
348 $cc -o try $ccflags $ldflags try.c
351 if [ $maxdsiz -le 64 ]; then
352 # 64 Mb is probably not enough to optimize toke.c
353 # and regexp.c with -O2
355 Your kernel limits the data section of your programs to $maxdsiz Mb,
356 which is (sadly) not enough to fully optimize some parts of the
357 perl binary. I'll try to use a lower optimization level for
358 those parts. If you are a sysadmin, and you *do* want full
359 optimization, raise the 'maxdsiz' kernel configuration parameter
360 to at least 0x08000000 (128 Mb) and rebuild your kernel.
370 "") optimize="-g -O" ;;
371 *O[3456789]*) optimize=`echo "$optimize" | sed -e 's/O[3-9]/O2/'` ;;
380 # gcc without gas will not accept -g
381 echo "main(){}">try.c
382 case "`$cc $optimize -c try.c 2>&1`" in
383 *"-g option disabled"*)
384 set `echo "X $optimize " | sed -e 's/ -g / /'`
391 if [ $maxdsiz -le 64 ]; then
393 *O2*) opt=`echo "$optimize" | sed -e 's/O2/O1/'`
394 toke_cflags="$toke_cflags;optimize=\"$opt\""
395 regexec_cflags="optimize=\"$opt\""
401 *) # HP's compiler cannot combine -g and -O
403 "") optimize="+O2 +Onolimit" ;;
404 *O[3456789]*) optimize=`echo "$optimize" | sed -e 's/O[3-9]/O2/'` ;;
408 *O2*) opt=`echo "$optimize" | sed -e 's/-O/+O2/' -e 's/O2/O1/' -e 's/ *+Onolimit//'`
416 B3910B*A.06.0[12345])
418 # cc: HP aC++/ANSI C B3910B A.06.05 [Jul 25 2005]
419 # Has optimizing problems with -O2 and up for both
420 # maint (5.8.8+) and blead (5.9.3+)
421 # -O1/+O1 passed all tests (m)'05 [ 10 Jan 2005 ]
423 *) doop_cflags="optimize=\"$opt\"" ;;
427 if [ $maxdsiz -le 64 ]; then
428 toke_cflags="$toke_cflags;optimize=\"$opt\""
429 regexec_cflags="optimize=\"$opt\""
433 lddlflags='-b +vnocompatwarnings'
438 if [ $xxOsRev -lt 1020 ]; then
439 uselargefiles="$undef"
442 #case "$uselargefiles-$ccisgcc" in
443 # "$define-$define"|'-define')
446 #*** I'm ignoring large files for this build because
447 #*** I don't know how to do use large files in HP-UX using gcc.
450 # uselargefiles="$undef"
454 # Once we have the compiler flags defined, Configure will
455 # execute the following call-back script. See hints/README.hints
457 cat > UU/cc.cbu <<'EOCBU'
458 # This script UU/cc.cbu will get 'called-back' by Configure after it
459 # has prompted the user for the C compiler to use.
461 # Compile and run the a test case to see if a certain gcc bug is
462 # present. If so, lower the optimization level when compiling
463 # pp_pack.c. This works around a bug in unpack.
465 if test -z "$ccisgcc" -a -z "$gccversion"; then
466 : no tests needed for HPc
469 echo "Testing for a certain gcc bug is fixed in your compiler..."
471 # Try compiling the test case.
472 if $cc -o t001 -O $ccflags $ldflags -lm ../hints/t001.c; then
477 This C compiler ($gccversion) is known to have optimizer
478 problems when compiling pp_pack.c.
480 Disabling optimization for pp_pack.c.
482 case "$pp_pack_cflags" in
483 '') pp_pack_cflags='optimize='
484 echo "pp_pack_cflags='optimize=\"\"'" >> config.sh ;;
485 *) echo "You specified pp_pack_cflags yourself, so we'll go with your value." >&4 ;;
488 *) echo "Your compiler is ok." >&4
493 echo "*** WHOA THERE!!! ***" >&4
494 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
496 '') echo " You'd better start hunting for one and let me know about it." >&4
502 rm -f t001$_o t001$_exe
506 cat >UU/uselargefiles.cbu <<'EOCBU'
507 # This script UU/uselargefiles.cbu will get 'called-back' by Configure
508 # after it has prompted the user for whether to use large files.
509 case "$uselargefiles" in
510 ""|$define|true|[yY]*)
511 # there are largefile flags available via getconf(1)
512 # but we cheat for now. (Keep that in the left margin.)
513 ccflags_uselargefiles="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
516 *" $ccflags_uselargefiles "*) ;;
517 *) ccflags="$ccflags $ccflags_uselargefiles" ;;
520 if test -z "$ccisgcc" -a -z "$gccversion"; then
521 # The strict ANSI mode (-Aa) doesn't like large files.
522 ccflags=`echo " $ccflags "|sed 's@ -Aa @ @g'`
525 *) ccflags="$ccflags -Ae" ;;
534 # This script UU/usethreads.cbu will get 'called-back' by Configure
535 # after it has prompted the user for whether to use threads.
536 cat >UU/usethreads.cbu <<'EOCBU'
537 case "$usethreads" in
539 if [ "$xxOsRevMajor" -lt 10 ]; then
542 HP-UX $xxOsRevMajor cannot support POSIX threads.
543 Consider upgrading to at least HP-UX 11.
544 Cannot continue, aborting.
549 if [ "$xxOsRevMajor" -eq 10 ]; then
550 # Under 10.X, a threaded perl can be built
551 if [ -f /usr/include/pthread.h ]; then
552 if [ -f /usr/lib/libcma.sl ]; then
553 # DCE (from Core OS CD) is installed
555 # Check if it is pristine, or patched
556 cmavsn=`what /usr/lib/libcma.sl 2>&1 | grep 1996`
557 if [ ! -z "$cmavsn" ]; then
560 ***************************************************************************
562 Perl will support threading through /usr/lib/libcma.sl from
563 the HP DCE package, but the version found is too old to be
566 If you are not depending on this specific version of the library,
567 consider to upgrade using patch PHSS_23672 (read README.hpux)
569 ***************************************************************************
571 (sleeping for 10 seconds...)
576 # It needs # libcma and OLD_PTHREADS_API. Also
577 # <pthread.h> needs to be #included before any
578 # other includes (in perl.h)
580 # HP-UX 10.X uses the old pthreads API
581 d_oldpthreads="$define"
583 # include libcma before all the others
584 libswanted="cma $libswanted"
586 # tell perl.h to include <pthread.h> before other
588 ccflags="$ccflags -DPTHREAD_H_FIRST"
589 # First column on purpose:
590 # this is not a standard Configure variable
591 # but we need to get this noticed.
592 pthread_h_first="$define"
594 # HP-UX 10.X seems to have no easy
595 # way of detecting these *time_r protos.
596 d_gmtime_r_proto='define'
597 gmtime_r_proto='REENTRANT_PROTO_I_TS'
598 d_localtime_r_proto='define'
599 localtime_r_proto='REENTRANT_PROTO_I_TS'
601 # Avoid the poisonous conflicting (and irrelevant)
602 # prototypes of setkey ().
605 # CMA redefines select to cma_select, and cma_select
606 # expects int * instead of fd_set * (just like 9.X)
609 elif [ -f /usr/lib/libpthread.sl ]; then
610 # PTH package is installed
611 libswanted="pthread $libswanted"
613 libswanted="no_threads_available"
616 libswanted="no_threads_available"
619 if [ $libswanted = "no_threads_available" ]; then
622 In HP-UX 10.X for POSIX threads you need both of the files
623 /usr/include/pthread.h and either /usr/lib/libcma.sl or /usr/lib/libpthread.sl.
624 Either you must upgrade to HP-UX 11 or install a posix thread library:
626 DCE-CoreTools from HP-UX 10.20 Hardware Extensions 3.0 CD (B3920-13941)
630 PTH package from e.g. http://hpux.tn.tudelft.nl/hppd/hpux/alpha.html
632 Cannot continue, aborting.
637 # 12 may want upping the _POSIX_C_SOURCE datestamp...
638 ccflags=" -D_POSIX_C_SOURCE=199506L -D_REENTRANT $ccflags"
639 set `echo X "$libswanted "| sed -e 's/ c / pthread c /'`
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
657 $undef|false|[nN]*) usemymalloc='y' ;;
661 case "$usemallocwrap" in
662 '') usemallocwrap='define' ;;
665 # ctime_r () and asctime_r () seem to have issues for versions before
667 if [ $xxOsRevMajor -lt 11 ]; then
673 # fpclassify () is a macro, the library call is Fpclassify
674 # Similarly with the others below.
675 d_fpclassify='define'
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
683 case "$d_oldpthreads" in
685 d_crypt_r_proto='undef'
686 d_getgrent_r_proto='undef'
687 d_getpwent_r_proto='undef'
688 d_strerror_r_proto='undef'