a few random cleanups
[p5sagit/p5-mst-13.2.git] / Configure
index ae1b4f4..1d99afe 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -20,7 +20,7 @@
 
 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
 #
-# Generated on Fri Jan  8 10:36:44 EET 1999 [metaconfig 3.0 PL70]
+# Generated on Sat Jan  9 18:00:39 EET 1999 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by jhi@iki.fi)
 
 cat >/tmp/c1$$ <<EOF
@@ -2465,23 +2465,27 @@ To do so, Configure must be run with -Dusethreads.
 (See README.threads for details.)
 EOM
 case "$usethreads" in
-$define|true|[yY]*)    dflt='y';;
+$define|true|[yY]*)     dflt='y';;
 *) dflt='n';;
 esac
 rp='Build a threading Perl?'
 . ./myread
 case "$ans" in
-y|Y)   val="$define" ;;     
+y|Y)    val="$define" ;;     
 *)      val="$undef" ;;
 esac
 set usethreads
 eval $setvar 
-: Look for a hint-file generated 'call-back-unit'.  Now that the
-: user has specified if a threading perl is to be built, we may need 
-: to set or change some other defaults.
-if $test -f usethreads.cbu; then
-    . ./usethreads.cbu
-fi
+: Look for a hint-file generated 'call-back-unit'.  If the
+: user has specified that a threading perl is to be built,
+: we may need to set or change some other defaults.
+case "$usethreads" in
+$define|true|[yY]*)
+       if $test -f usethreads.cbu; then
+               . ./usethreads.cbu
+       fi
+       ;;
+esac
 case "$d_oldpthreads" in
 '')    : Configure tests would be welcome here.  For now, assume undef.
        val="$undef" ;;
@@ -2490,6 +2494,249 @@ esac
 set d_oldpthreads
 eval $setvar
 
+
+case "$usethreads" in
+"$define")
+    case "$osname" in
+    aix)
+        ccflags="$ccflags -DNEED_PTHREAD_INIT"
+        case "$cc" in
+        xlc_r | cc_r) ;;
+        cc) 
+           echo >&4 "Switching cc to xlc_r because of POSIX threads."
+           cc=xlc_r
+            ;;
+        '') 
+           cc=xlc_r
+            ;;
+        *)
+           cat >&4 <<EOM
+For pthreads you should use the AIX C compilers xlc_r or cc_r.
+(now your compiler was '$cc')
+Cannot continue, aborting.
+EOM
+           exit 1
+           ;;
+        esac
+
+        # Add the POSIX threads library and the re-entrant libc.
+
+        lddlflags=`echo $lddlflags | sed 's/ -lc$/ -lpthreads -lc_r -lc/'`
+
+        # Add the c_r library to the list of wanted libraries.
+        # Make sure the c_r library is before the c library or
+        # make will fail.
+        set `echo X "$libswanted "| sed -e 's/ c / c_r c /'`
+        shift
+        libswanted="$*"
+       ;;
+    dec_osf)
+        # Threads interfaces changed with V4.0.
+        case "`uname -r`" in
+        *[123].*)
+           libswanted="$libswanted pthreads mach exc c_r"
+           ccflags="-threads $ccflags"
+           ;;
+        *)
+           libswanted="$libswanted pthread exc"
+           ccflags="-pthread $ccflags"
+           ;;
+        esac
+
+        usemymalloc='n'
+       ;;
+    dos_djgpp)
+        set `echo X "$libswanted "| sed -e 's/ c / gthreads c /'`
+        shift
+        libswanted="$*"
+       ;;
+    freebsd)
+        case "$osvers" in  
+        [34].*) ldflags="-pthread $ldflags"
+              ;;
+        2.2*) if [ ! -r /usr/lib/libc_r ]; then
+              cat <<'EOM' >&4
+POSIX threads are not supported by default on FreeBSD $osvers.  Follow the
+instructions in 'man pthread' to build and install the needed libraries.
+EOM
+                 exit 1
+              fi
+              set `echo X "$libswanted "| sed -e 's/ c / c_r /'`
+              shift
+              libswanted="$*"
+              # Configure will probably pick the wrong libc to use for nm
+              # scan.
+              # The safest quick-fix is just to not use nm at all.
+              usenm=false
+              ;;
+         *)   cat <<'EOM' >&4
+
+It is not known if FreeBSD $osvers supports POSIX threads or not.
+Consider upgrading to the latest STABLE release.
+
+EOM
+              exit 1
+              ;;
+        esac
+       ;;
+    hpux)
+        if [ "$xxOsRevMajor" -lt 10 ]; then
+            cat <<EOM >&4
+HP-UX $xxOsRevMajor cannot support POSIX threads.
+Consider upgrading to at least HP-UX 11.
+Cannot continue, aborting.
+EOM
+            exit 1
+        fi
+        case "$xxOsRevMajor" in
+        10)
+            # Under 10.X, a threaded perl can be built, but it needs
+            # libcma and OLD_PTHREADS_API.  Also <pthread.h> needs to
+            # be #included before any other includes (in perl.h)
+            if [ ! -f /usr/include/pthread.h -o ! -f /usr/lib/libcma.sl ]; then
+                cat <<EOM >&4
+In HP-UX 10.X for POSIX threads you need both of the files
+/usr/include/pthread.h and /usr/lib/libcma.sl.
+Either you must install the CMA package or you must upgrade to HP-UX 11.
+Cannot continue, aborting.
+EOM
+               exit 1
+            fi
+
+            # HP-UX 10.X uses the old pthreads API
+            case "$d_oldpthreads" in
+            '') d_oldpthreads="$define" ;;
+            esac
+
+            # include libcma before all the others
+            libswanted="cma $libswanted"
+
+            # tell perl.h to include <pthread.h> before other include files
+            ccflags="$ccflags -DPTHREAD_H_FIRST"
+
+            # CMA redefines select to cma_select, and cma_select expects int *
+            # instead of fd_set * (just like 9.X)
+            selecttype='int *'
+            ;;
+        11 | 12) # 12 may want upping the _POSIX_C_SOURCE
+            ccflags="$ccflags -D_POSIX_C_SOURCE=199506L"
+            libswanted="$libswanted pthread"
+           ;;
+        esac
+       ;;
+    irix)
+        if test ! -f ${TOOLROOT}/usr/include/pthread.h -o ! -f /usr/lib/libpthread.so; then
+            case "`uname -r`" in
+            [1-5].*|6.[01]|6.[01])
+               cat >&4 <<EOM
+IRIX `uname -r` does not support POSIX threads.
+You should upgrade to at least IRIX 6.2 with pthread patches.
+EOM
+               ;;
+           6.2)
+               cat >&4 <<EOM
+IRIX 6.2 can have the POSIX threads.
+However,the following IRIX patches (or their replacements) MUST be installed:
+        1404 Irix 6.2 Posix 1003.1b man pages
+        1645 IRIX 6.2 & 6.3 POSIX header file updates
+        2000 Irix 6.2 Posix 1003.1b support modules
+        2254 Pthread library fixes
+       2401 6.2 all platform kernel rollup
+IMPORTANT:
+       Without patch 2401, a kernel bug in IRIX 6.2 will
+       cause your machine to panic and crash when running
+       threaded perl. IRIX 6.3 and up should be OK.
+EOM
+               ;;
+           [67].*)
+               cat >&4 <<EOM
+IRIX `uname -r` should have the POSIX threads.
+But, somehow, you do not seem to have them installed.
+EOM
+               ;;
+           esac
+            cat >&4 <<EOM
+Cannot continue, aborting.
+EOM
+            exit 1
+        fi
+        set `echo X "$libswanted "| sed -e 's/ c / pthread /'`
+        ld="${cc:-cc}"
+        shift
+        libswanted="$*"
+
+        usemymalloc='n'
+       ;;
+    linux)
+        ccflags="-D_REENTRANT $ccflags"
+
+        set `echo X "$libswanted "| sed -e 's/ c / pthread c /'`
+        shift
+        libswanted="$*"
+       ;;
+    os2)
+       ccflags="-Zmt $ccflags"
+        cppflags="-Zmt $cppflags"  # Do we really need to set this?
+        aout_ccflags="-DUSE_THREADS $aout_ccflags"
+        aout_cppflags="-DUSE_THREADS $aout_cppflags"
+        aout_lddlflags="-Zmt $aout_lddlflags"
+        aout_ldflags="-Zmt $aout_ldflags"
+       ;;
+    solaris)
+        ccflags="-D_REENTRANT $ccflags"
+
+        # sched_yield is in -lposix4
+        set `echo X "$libswanted "| sed -e 's/ c / posix4 pthread c /'`
+        shift
+        libswanted="$*"
+
+        # On Solaris 2.6 x86 there is a bug with sigsetjmp() and siglongjmp()
+        # when linked with the threads library, such that whatever positive
+        # value you pass to siglongjmp(), sigsetjmp() returns 1.
+        # Thanks to Simon Parsons <S.Parsons@ftel.co.uk> for this report.
+        # Sun BugID is 4117946, "sigsetjmp always returns 1 when called by
+        # siglongjmp in a MT program". As of 19980622, there is no patch
+        # available.
+        cat >try.c <<'EOM'
+       /* Test for sig(set|long)jmp bug. */
+       #include <setjmp.h>
+        
+       main()
+       {
+           sigjmp_buf env;
+           int ret;
+       
+           ret = sigsetjmp(env, 1);
+           if (ret) { return ret == 2; }
+           siglongjmp(env, 2);
+       }
+EOM
+        if test "`arch`" = i86pc -a "$osvers" = 2.6 && \
+           ${cc:-cc} try.c -lpthread >/dev/null 2>&1 && ./a.out; then
+           d_sigsetjmp=$undef
+           cat << 'EOM' >&2
+
+You will see a *** WHOA THERE!!! ***  message from Configure for
+d_sigsetjmp.  Keep the recommended value.  See hints/solaris_2.sh
+for more information.
+
+EOM
+        fi
+       ;;
+    vmesa)
+       ;;
+    *)
+        cat >&4 <<EOM
+$osname is not known to support threads.
+Please let me (jhi@iki.fi) know how to do that.
+
+Cannot continue, aborting.
+EOM
+       exit 1
+       ;;
+    esac # $osname
+    ;;
+esac # $usethreads
 cat <<EOM
 
 Perl can be built so that multiple Perl interpreters can coexist
@@ -2538,6 +2785,95 @@ eval $setvar
 
 archname64=''
 
+case "$use64bits" in
+"$define")
+       case "$osname" in
+       dec_osf)
+           # Pretty much everything is 64-bit already.
+           ;;
+       hpux)
+           if [ "$xxOsRevMajor" -lt 11 ]; then
+               cat <<EOM >&4
+64-bit compilation is not supported on HP-UX $xxOsRevMajor.
+You need at least HP-UX 11.0.
+Cannot continue, aborting.
+EOM
+               exit 1
+           fi
+           if [ ! -d /lib/pa20_64 ]; then
+               cat <<EOM >&4
+You do not seem to have the 64-bit libraries, /lib/pa20_64.
+Cannot continue, aborting.
+EOM
+               exit 1
+           fi
+           ccflags="$ccflags +DD64 -D_FILE_OFFSET_BITS=64"
+           ldflags="$ldflags +DD64"
+           ld=/usr/bin/ld
+           set `echo " $libswanted " | sed -e 's@ dl @ @'`
+           libswanted="$*"
+           glibpth="/lib/pa20_64"
+           ;;
+       irix)
+           case "`uname -r`" in
+           [1-5]*|6.[01])
+               cat >&4 <<EOM
+IRIX `uname -r` does not support 64-bit types.
+You should upgrade to at least IRIX 6.2.
+Cannot continue, aborting.
+EOM
+               exit 1
+               ;;
+           esac
+           case "$ccflags" in
+           *-n32*)
+               ccflags="$ccflags -DUSE_LONG_LONG"
+               archname64="-n32"
+               d_open64="$undef"
+               # In -n32 mode (ILP32LL64) we use the standard open().
+               # In -64 we will use the open64().
+               cat << 'EOM' >&2
+
+You will see a *** WHOA THERE!!! ***  message from Configure for
+d_open64.  Keep the recommended value.  See hints/irix6.sh
+for more information.
+
+EOM
+               ;;
+           esac
+           ccflags="$ccflags -DUSE_64_BIT_FILES"
+           ;;
+       solaris)
+           case "`uname -r`" in
+           1.*|2.[1-5])
+               cat >&4 <<EOM
+Solaris `uname -r` does not support 64-bit interfaces.
+You should upgrade to at least Solaris 2.6.
+EOM
+               exit 1
+               ;;
+           esac
+           ccflags="$ccflags `getconf LFS_CFLAGS` -DUSE_LONG_LONG"
+           ldflags="$ldflags `getconf LFS_LDFLAGS`"
+           libswanted="$libswanted `getconf LFS_LIBS`"
+           # When a 64-bit cc becomes available $archname64
+           # may need setting so that $archname gets it attached.
+           ;;
+       unicos)
+           # Pretty much everything is 64-bit already.
+           ;;
+       *)
+           cat >&4 <<EOM
+$osname is not known to support 64-bit interfaces.
+Please let me (jhi@iki.fi) know how to do that.
+
+Cannot continue, aborting.
+EOM
+           exit 1
+           ;;
+       esac
+       ;;
+esac
 : determine the architecture name
 echo " "
 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
@@ -4802,6 +5138,10 @@ elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
        eval $xscan;\
        $contains '^fprintf$' libc.list >/dev/null 2>&1; then
                eval $xrun
+elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
+       eval $xscan;\
+       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+               eval $xrun
 else
        $nm -p $* 2>/dev/null >libc.tmp
        $grep fprintf libc.tmp > libc.ptf