This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test changes
[perl5.git] / Configure
index dc24cf7..20b4b35 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -85,6 +85,12 @@ done
 PATH=.$p_$PATH
 export PATH
 
+: This should not matter in scripts, but apparently it does, sometimes
+case "$CDPATH" in
+'')    ;;
+*)     CDPATH='' ;;
+esac
+
 : Sanity checks
 if test ! -t 0; then
        echo "Say 'sh $me', not 'sh <$me'"
@@ -112,6 +118,7 @@ EOM
 especially on older exotic systems.  If yours does, try the Bourne 
 shell instead.)
 EOM
+               unset ENV
         fi
     fi
 else
@@ -202,6 +209,7 @@ tr=''
 troff=''
 uname=''
 uniq=''
+usethreads=''
 uuname=''
 vi=''
 zcat=''
@@ -304,6 +312,7 @@ d_ftime=''
 d_gettimeod=''
 d_Gconvert=''
 d_getgrps=''
+d_setgrps=''
 d_gethent=''
 aphostname=''
 d_gethname=''
@@ -731,7 +740,7 @@ loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
 
 : general looking path for locating libraries
-glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
+glibpth="/shlib /usr/shlib /usr/lib/pa1.1 /usr/lib/large"
 glibpth="$glibpth /lib /usr/lib $xlibpth"
 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
@@ -793,7 +802,7 @@ case "$sh" in
 '')    cat <<EOM >&2
 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
 Usually it's in /bin/sh.  How did you even get this far?
-Please contact me (Chip Salzenberg) at chip@atlantic.net and 
+Please contact me (Chip Salzenberg) at chip@perl.com and 
 we'll try to straigten this all out.
 EOM
        exit 1
@@ -1165,7 +1174,7 @@ THIS PACKAGE SEEMS TO BE INCOMPLETE.
 You have the option of continuing the configuration process, despite the
 distinct possibility that your kit is damaged, by typing 'y'es.  If you
 do, don't blame me if something goes wrong.  I advise you to type 'n'o
-and contact the author (chip@atlantic.net).
+and contact the author (chip@perl.com).
 
 EOM
                echo $n "Continue? [n] $c" >&4
@@ -1356,7 +1365,7 @@ If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
 the questions and use the computed defaults (or the previous answers if there
 was already a config.sh file). Type 'Configure -h' for a list of options.
 You may also start interactively and then answer '& -d' at any prompt to turn
-on the non-interactive behaviour for the remaining of the execution.
+on the non-interactive behavior for the remainder of the execution.
 
 EOH
        . ./myread
@@ -1366,7 +1375,7 @@ Much effort has been expended to ensure that this shell script will run on any
 Unix system.  If despite that it blows up on yours, your best bet is to edit
 Configure and run it again.  If you can't run Configure for some reason,
 you'll have to generate a config.sh file by hand.  Whatever problems you
-have, let me (chip@atlantic.net) know how I blew it.
+have, let me (chip@perl.com) know how I blew it.
 
 This installation script affects things in two ways:
 
@@ -1656,7 +1665,7 @@ EOM
        cd hints; ls -C *.sh | $sed 's/\.sh/   /g' >&4
        dflt=''
        : Half the following guesses are probably wrong... If you have better
-       : tests or hints, please send them to chip@atlantic.net
+       : tests or hints, please send them to chip@perl.com
        : The metaconfig authors would also appreciate a copy...
        $test -f /irix && osname=irix
        $test -f /xenix && osname=sco_xenix
@@ -1696,7 +1705,6 @@ EOM
                        esac;;
                [23]100) osname=mips ;;
                next*) osname=next ;;
-               news*) osname=news ;;
                i386*)
                        if $test -f /etc/kconfig; then
                                osname=isc
@@ -1757,16 +1765,25 @@ EOM
                        ;;
                linux) osname=linux
                        case "$3" in
-                       1*) osvers=1 ;;
                        *)      osvers="$3" ;;
                        esac
                        ;;
                netbsd*) osname=netbsd 
                        osvers="$3"
                        ;;
+               news-os) osvers="$3"
+                       case "$3" in
+                       4*) osname=newsos4 ;;
+                       *) osname=newsos ;;
+                       esac
+                       ;;
                bsd386) osname=bsd386
                        osvers=`$uname -r`
                        ;;
+               powerux | power_ux | powermax_os | powermaxos | \
+               powerunix | power_unix) osname=powerux
+                       osvers="$3"
+                       ;;
                next*) osname=next ;;
                solaris) osname=solaris
                        case "$3" in
@@ -1864,10 +1881,10 @@ EOM
                        ;;
                esac
        else
-               if test -f /vmunix -a -f news_os.sh; then
+               if test -f /vmunix -a -f newsos4.sh; then
                        (what /vmunix | ../UU/tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
                        if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
-                               osname=news_os
+                               osname=newsos4
                        fi
                        $rm -f ../UU/kernel.what
                elif test -d c:/.; then
@@ -2035,7 +2052,7 @@ esac
 
 
 : who configured the system
-cf_time=`$date 2>&1`
+cf_time=`LC_ALL=C; export LC_ALL; $date 2>&1`
 cf_by=`(logname) 2>/dev/null`
 case "$cf_by" in "")
        cf_by=`(whoami) 2>/dev/null`
@@ -2072,7 +2089,12 @@ case "$archname" in
 esac
 rp='What is your architecture name'
 . ./myread
-archname="$ans"
+case "$usethreads" in
+$define)  archname="$ans-thread"
+          echo "usethreads selected... architecture name is now $archname." >&4
+          ;;
+*)        archname="$ans" ;;
+esac
 myarchname="$tarch"
 
 : is AFS running?
@@ -2523,9 +2545,10 @@ archlibexp="$ansexp"
 if $afs; then
        $cat <<EOM
 
-Since you are running AFS, I need to distinguish the directory in which
-private files reside from the directory in which they are installed (and from
-which they are presumably copied to the former directory by occult means).
+Since you are running AFS, I need to distinguish the directory in
+which architecture-dependent library files reside from the directory
+in which they are installed (and from which they are presumably copied
+to the former directory by occult means).
 
 EOM
        case "$installarchlib" in
@@ -2824,9 +2847,10 @@ sitelibexp="$ansexp"
 if $afs; then
        $cat <<EOM
 
-Since you are running AFS, I need to distinguish the directory in which
-private files reside from the directory in which they are installed (and from
-which they are presumably copied to the former directory by occult means).
+Since you are running AFS, I need to distinguish the directory in
+which site-specific files reside from the directory in which they are
+installed (and from which they are presumably copied to the former
+directory by occult means).
 
 EOM
        case "$installsitelib" in
@@ -2834,7 +2858,7 @@ EOM
        *) dflt="$installsitelib";;
        esac
        fn=de~
-       rp='Where will private files be installed?'
+       rp='Where will site-specific files be installed?'
        . ./getfile
        installsitelib="$ans"
 else
@@ -2867,9 +2891,10 @@ sitearchexp="$ansexp"
 if $afs; then
        $cat <<EOM
 
-Since you are running AFS, I need to distinguish the directory in which
-private files reside from the directory in which they are installed (and from
-which they are presumably copied to the former directory by occult means).
+Since you are running AFS, I need to distinguish the directory in
+which site-specific architecture-dependent library files reside from
+the directory in which they are installed (and from which they are
+presumably copied to the former directory by occult means).
 
 EOM
        case "$installsitearch" in
@@ -2877,7 +2902,7 @@ EOM
        *) dflt="$installsitearch";;
        esac
        fn=de~
-       rp='Where will private files be installed?'
+       rp='Where will site-specific architecture-dependent files be installed?'
        . ./getfile
        installsitearch="$ans"
 else
@@ -2990,8 +3015,8 @@ main() {
 #endif
 }
 EOP
-       cc -o pdp11 pdp11.c >/dev/null 2>&1
-       if ./pdp11 2>/dev/null; then
+       (cc -o pdp11 pdp11.c) >/dev/null 2>&1
+       if $test -f pdp11 && ./pdp11 2>/dev/null; then
                dflt='unsplit split'
        else
                tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
@@ -3557,7 +3582,7 @@ $rm -f testcpp.c testcpp.out
 
 : determine optimize, if desired, or use for debug flag also
 case "$optimize" in
-' ') dflt='none';;
+' '|$undef) dflt='none';;
 '') dflt='-O';;
 *) dflt="$optimize";;
 esac
@@ -3693,7 +3718,7 @@ EOM
                -*) ftry="$flag";;
                *) ftry="$previous $flag";;
                esac
-               if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \
+               if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
                        >cpp1.out 2>/dev/null && \
                        $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \
                        >cpp2.out 2>/dev/null && \
@@ -3793,17 +3818,17 @@ if sh -c "$cc $optimize $ccflags -o try try.c $ldflags $libs" >>try.msg 2>&1; th
                dflt=n
        else
                echo "The program compiled OK, but exited with status $?." >>try.msg
-               rp="You have a problem.  Shall I abort Configure"
+               rp="You have a problem.  Shall I abort Configure (and explain the problem)"
                dflt=y
        fi
 else
        echo "I can't compile the test program." >>try.msg
-       rp="You have a BIG problem.  Shall I abort Configure"
+       rp="You have a BIG problem.  Shall I abort Configure (and explain the problem)"
        dflt=y
 fi
 case "$dflt" in
 y)
-       $cat try.msg
+       $cat try.msg >&4
        case "$knowitall" in
        '')
                echo "(The supplied flags might be incorrect with this C compiler.)"
@@ -3899,7 +3924,7 @@ case "$nm_opt" in
                nm_opt='-p'     # Solaris (and SunOS?)
        elif $test -f /dgux; then
                nm_opt='-p'     # DG-UX
-       elif $test -x /lib64/rld; then
+       elif $test -f /lib64/rld; then
                nm_opt='-p'     # 64-bit Irix
        else
                nm_opt=''
@@ -4412,12 +4437,19 @@ EOM
                '') case "$osname" in
                        hpux)   dflt='+z' ;;
                        next)   dflt='none' ;;
-                       solaris|svr4*|esix*) dflt='-Kpic' ;;
-                       irix*)  dflt='-KPIC' ;;
+                       svr4*|esix*)    dflt='-Kpic' ;;
+                       irix*)  dflt='-KPIC' ;;
+                       solaris) case "$ccflags" in
+                               *-DDEBUGGING*)  dflt='-KPIC' ;;
+                               *)              dflt='-Kpic' ;;
+                               esac ;;
                        sunos)  dflt='-pic' ;;
                        *)      dflt='none' ;;
                    esac ;;
-               *)      dflt='-fpic' ;;
+               *)  case "$osname/$ccflags" in
+                       solaris/*-DDEBUGGING*)  dflt='-fPIC' ;;
+                       *)                      dflt='-fpic' ;;
+                   esac ;;
            esac ;;
     *) dflt="$cccdlflags" ;;
     esac
@@ -4555,31 +4587,31 @@ $undef)
        ;;
 *)     case "$useshrplib" in
        '')     case "$osname" in
-               svr4|dgux|dynixptx|esix|powerux)
-                       dflt='yes'
+               svr4*|dgux|dynixptx|esix|powerux)
+                       dflt=y
                        also='Building a shared libperl is required for dynamic loading to work on your system.'
                        ;;
                next*)
                        case "$osvers" in
-                       4*)     dflt='yes'
+                       4*)     dflt=y
                                also='Building a shared libperl is needed for MAB support.'
                                ;;
-                       *)      dflt='no'
+                       *)      dflt=n
                                ;;
                        esac
                        ;;
                sunos)
-                       dflt='no'
+                       dflt=n
                        also='Building a shared libperl will definitely not work on SunOS 4.'
                        ;;
-               *)      dflt='no'
+               *)      dflt=n
                        ;;
                esac
                ;;
        $define|true|[Yy]*)
-               dflt='yes'
+               dflt=y
                ;;
-       *)      dflt='no'
+       *)      dflt=n
                ;;
        esac
        $cat << EOM
@@ -4687,8 +4719,8 @@ case "$shrpdir" in
 *)     $cat >&4 <<EOM
 WARNING:  Use of the shrpdir variable for the installation location of
 the shared $libperl is not supported.  It was never documented and
-will not work in this version.  Let me (chip@atlantic.net)
-know of any problems this may cause.
+will not work in this version.  Let me (chip@perl.com) know of any
+problems this may cause.
 
 EOM
        case "$shrpdir" in
@@ -4718,6 +4750,9 @@ xxx=''
 tmp_shrpenv=''
 if "$useshrplib"; then
     case "$osname" in 
+       aix)
+               # We'll set it in Makefile.SH...
+               ;;
        solaris|netbsd)
                xxx="-R $shrpdir"
                ;;
@@ -4727,6 +4762,9 @@ if "$useshrplib"; then
        linux|irix*|dec_osf)
                xxx="-Wl,-rpath,$shrpdir"
                ;;
+       next)
+               # next doesn't like the default...
+               ;;
        *)
                tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
                ;;
@@ -5324,8 +5362,17 @@ EOH
                rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
                . ./myread
                case "$ans" in
-               none) startperl=": # use perl";;
-               *) startperl="#!$ans";;
+               none)   startperl=": # use perl";;
+               *)      startperl="#!$ans"
+                       if $test 30 -lt `echo "$ans" | wc -c`; then
+                               $cat >&4 <<EOM
+
+WARNING:  Some systems limit the #! command to 32 characters.
+If you experience difficulty running Perl scripts with #!, try
+installing Perl in a directory with a shorter pathname.
+
+EOM
+                       fi ;;
                esac
                ;;
        *) startperl=": # use perl"
@@ -6077,12 +6124,15 @@ eval $setvar
 
 : get csh whereabouts
 case "$csh" in
-'csh') val="$undef" ;;
-*) val="$define" ;;
+'csh') val="$undef" ;;
+*)     val="$define" ;;
 esac
 set d_csh
 eval $setvar
-full_csh=$csh
+: Respect a hint or command line value for full_csh.
+case "$full_csh" in
+'') full_csh=$csh ;;
+esac
 
 : see if cuserid exists
 set cuserid d_cuserid
@@ -6336,7 +6386,7 @@ main() {
 EOCP
 : check sys/file.h first to get FREAD on Sun
 if $test `./findhdr sys/file.h` && \
-               $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
+        $cc $ccflags "-DI_SYS_FILE" -o open3 $ldflags open3.c $libs >/dev/null 2>&1 ; then
        h_sysfile=true;
        echo "<sys/file.h> defines the O_* constants..." >&4
        if ./open3; then
@@ -6347,7 +6397,7 @@ if $test `./findhdr sys/file.h` && \
                val="$undef"
        fi
 elif $test `./findhdr fcntl.h` && \
-               $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
+        $cc $ccflags "-DI_FCNTL" -o open3 $ldflags open3.c $libs >/dev/null 2>&1 ; then
        h_fcntl=true;
        echo "<fcntl.h> defines the O_* constants..." >&4
        if ./open3; then
@@ -8222,6 +8272,55 @@ set db.h i_db
 eval $inhdr
 
 case "$i_db" in
+$define)
+       : Check db version.  We can not use version 2.
+       echo " "
+       echo "Checking Berkeley DB version ..." >&4
+       $cat >try.c <<EOCP
+#$d_const HASCONST
+#ifndef HASCONST
+#define const
+#endif
+#include <sys/types.h>
+#include <stdio.h>
+#include <db.h>
+main()
+{
+#ifdef DB_VERSION_MAJOR        /* DB version >= 2: not yet. */
+    printf("You have Berkeley DB Version %d.%d\n",
+               DB_VERSION_MAJOR, DB_VERSION_MINOR);
+    printf("Perl currently only supports up to version 1.86.\n");
+    exit(2);
+#else
+#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
+    exit(0);   /* DB version < 2: the coast is clear. */
+#else
+    exit(1);   /* <db.h> not Berkeley DB? */
+#endif
+#endif
+}
+EOCP
+       if $cc $optimize $ccflags $ldflags -o try try.c $libs && ./try; then
+               echo 'Looks OK.  (Perl supports up to version 1.86).' >&4
+       else
+               echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
+               i_db=$undef
+               case " $libs " in
+               *"-ldb "*)
+                       : Remove db from list of libraries to use
+                       echo "Removing unusable -ldb from library list" >&4
+                       set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
+                       shift
+                       libs="$*"
+                       echo "libs = $libs" >&4
+                       ;;
+               esac
+       fi
+       $rm -f try.*
+       ;;
+esac
+
+case "$i_db" in
 define)
        : Check the return type needed for hash 
        echo " "
@@ -8251,13 +8350,15 @@ EOCP
                        db_hashtype='u_int32_t'
                fi
        else
-               echo "I can't seem to compile the test program." >&4
-               db_hashtype=int
+               : XXX Maybe we should just give up here.
+               db_hashtype=u_int32_t
+               echo "Help:  I can't seem to compile the db test program." >&4
+               echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
        fi
        $rm -f try.*
        echo "Your version of Berkeley DB uses $db_hashtype for hash."
        ;;
-*)     db_hashtype=int
+*)     db_hashtype=u_int32_t
        ;;
 esac
 
@@ -8291,13 +8392,15 @@ EOCP
                        db_prefixtype='size_t'
                fi
        else
-               echo "I can't seem to compile the test program." >&4
-               db_prefixtype='int'
+               db_prefixtype='size_t'
+               : XXX Maybe we should just give up here.
+               echo "Help:  I can't seem to compile the db test program." >&4
+               echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
        fi
        $rm -f try.*
        echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
        ;;
-*)     db_prefixtype='int'
+*)     db_prefixtype='size_t'
        ;;
 esac
 
@@ -8432,20 +8535,24 @@ gidtype="$ans"
 set getgroups d_getgrps
 eval $inlibc
 
-: Find type of 2nd arg to getgroups
+: see if setgroups exists
+set setgroups d_setgrps
+eval $inlibc
+
+: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
 echo " "
-case "$d_getgrps" in
-'define')
+case "$d_getgrps$d_setgrps" in
+*define*)
        case "$groupstype" in
        '') dflt="$gidtype" ;;
        *)  dflt="$groupstype" ;;
        esac
        $cat <<EOM
-What is the type of the second argument to getgroups()?  Usually this
-is the same as group ids, $gidtype, but not always.
+What is the type of the second argument to getgroups() and setgroups()?
+Usually this is the same as group ids, $gidtype, but not always.
 
 EOM
-       rp='What type is the second argument to getgroups()?'
+       rp='What type is the second argument to getgroups() and setgroups()?'
        . ./myread
        groupstype="$ans"
        ;;
@@ -9004,7 +9111,7 @@ EOP
 $cat >signal_cmd <<EOS
 $startsh
 $test -s signal.lst && exit 0
-if $cc $ccflags signal.c -o signal $ldflags >/dev/null 2>&1; then
+if $cc $ccflags $ldflags signal.c -o signal >/dev/null 2>&1; then
        ./signal | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
 else
        echo "(I can't seem be able to compile the test program -- Guessing)"
@@ -9016,7 +9123,7 @@ else
        0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
        esac
        echo \$@ | $tr ' ' '\012' | \
-               $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst
+               $awk '{ printf \$1; printf " %d\n", ++s; }' >signal.lst
 fi
 $rm -f signal.c signal signal.o
 EOS
@@ -9722,6 +9829,10 @@ for xxx in $known_extensions ; do
            $define) avail_ext="$avail_ext $xxx" ;;
            esac
            ;;
+    Thread) case "$usethreads" in 
+           $define) avail_ext="$avail_ext $xxx" ;;
+           esac
+           ;;
     *)      avail_ext="$avail_ext $xxx"
            ;;
     esac
@@ -9863,10 +9974,10 @@ echo "Creating config.sh..." >&4
 $spitshell <<EOT >config.sh
 $startsh
 #
-# This file was produced by running the Configure script. It holds all the
-# definitions figured out by Configure. Should you modify one of these values,
-# do not forget to propagate your changes by running "Configure -der". You may
-# instead choose to run each of the .SH files by yourself, or "Configure -S".
+# This file was produced by running the Configure script.  It holds all
+# the definitions figured out by Configure.  Should you modify any of
+# these values, do not forget to propagate your changes by running
+# "Configure -S"; or, equivalently, you may run each .SH file yourself.
 #
 
 # Configuration time: $cf_time
@@ -9977,6 +10088,7 @@ d_fpathconf='$d_fpathconf'
 d_fsetpos='$d_fsetpos'
 d_ftime='$d_ftime'
 d_getgrps='$d_getgrps'
+d_setgrps='$d_setgrps'
 d_gethent='$d_gethent'
 d_gethname='$d_gethname'
 d_getlogin='$d_getlogin'