This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Configure: gcc 5 exists.
[perl5.git] / Configure
index 0e22542..07f0bc1 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -69,7 +69,10 @@ EOF
        exit 1
 fi
 
-if test ! -c /dev/null ; then
+if test -f /sys/utilities/MultiView ; then
+       # AmigaOS, test -c for /dev/null is not useful
+       :
+elif test ! -c /dev/null ; then
        cat <<EOF
 ***
 *** I'm sorry, but /dev/null appears to be a file rather than a device.
@@ -1676,7 +1679,6 @@ alldone=''
 error=''
 silent=''
 extractsh=''
-override=''
 knowitall=''
 rm -f optdef.sh posthint.sh
 cat >optdef.sh <<EOS
@@ -1706,7 +1708,7 @@ while test $# -gt 0; do
        -s) shift; silent=true; realsilent=true;;
        -E) shift; alldone=exit;;
        -K) shift; knowitall=true;;
-       -O) shift; override=true;;
+       -O) shift;;
        -S) shift; silent=true; extractsh=true;;
        -D)
                shift
@@ -1815,7 +1817,7 @@ Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
          -Dprefix=/opt/perl5      choose your destination
   -E : stop at the end of questions, after having produced config.sh.
   -K : do not use unless you know what you are doing.
-  -O : let -D and -U override definitions from loaded configuration file.
+  -O : ignored for backward compatibility
   -S : perform variable substitutions on all .SH files (can mix with -f)
   -U : undefine symbol:
          -U symbol    symbol gets the value 'undef'
@@ -1875,8 +1877,8 @@ touch posthint.sh
 package='perl5'
 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
-case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
-ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
+case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
+ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
 esac
 
@@ -2037,7 +2039,7 @@ true)
        echo "Fetching answers from $config_sh..."
        cd ..
        . $config_sh
-       test "$override" && . ./optdef.sh
+       . ./optdef.sh
        echo " "
        . UU/extract
        rm -rf UU
@@ -3208,8 +3210,8 @@ esac
 
 : see whether [:lower:] and [:upper:] are supported character classes
 echo " "
-case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
-ABYZ)
+case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
+ABYZ-abyz)
        echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
        up='[:upper:]'
        low='[:lower:]'
@@ -3359,6 +3361,7 @@ EOM
        $test -f /etc/saf/_sactab && osname=svr4
        $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
        $test -f /system/gnu_library/bin/ar.pm && osname=vos
+       $test -f /sys/utilities/MultiView && osname=amigaos
        if $test -d /MachTen -o -d /MachTen_Folder; then
                osname=machten
                if $test -x /sbin/version; then
@@ -3789,7 +3792,7 @@ cd UU
        hint=previous
        ;;
 esac
-test "$override" && . ./optdef.sh
+. ./optdef.sh
 
 : Restore computed paths
 for file in $loclist $trylist; do
@@ -4336,15 +4339,15 @@ case "$osname" in
 dos|vms)
        : XXX Should be a Configure test for double-dots in filenames.
        version=`echo $revision $patchlevel $subversion | \
-                $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
+                $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
        api_versionstring=`echo $api_revision $api_version $api_subversion | \
-                $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
+                $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
        ;;
 *)
        version=`echo $revision $patchlevel $subversion | \
-                $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
+                $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
        api_versionstring=`echo $api_revision $api_version $api_subversion | \
-                $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
+                $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
        ;;
 esac
 : Special case the 5.005_xx maintenance series, which used 5.005
@@ -5457,15 +5460,19 @@ default|recommended)
        # is to add the flag to the flags passed to the compiler at link time,
        # as that way the compiler can do the right implementation dependant
        # thing. (NWC)
-       case "$gccversion" in
-       ?*)     set stack-protector-strong -fstack-protector-strong
-               eval $checkccflag
-               case "$dflt" in
-               *-fstack-protector-strong*) ;; # It got added.
-               *) # Try the plain/older -fstack-protector.
-                  set stack-protector -fstack-protector
-                  eval $checkccflag
-                  ;;
+       case "$osname" in
+       amigaos) ;; # -fstack-protector builds but doesn't work
+       *)      case "$gccversion" in
+               ?*)     set stack-protector-strong -fstack-protector-strong
+                       eval $checkccflag
+                       case "$dflt" in
+                       *-fstack-protector-strong*) ;; # It got added.
+                       *) # Try the plain/older -fstack-protector.
+                          set stack-protector -fstack-protector
+                          eval $checkccflag
+                          ;;
+                       esac
+                       ;;
                esac
                ;;
        esac
@@ -5542,7 +5549,12 @@ esac
 : the following weeds options from ccflags that are of no interest to cpp
 case "$cppflags" in
 '') cppflags="$ccflags" ;;
-*)  cppflags="$cppflags $ccflags" ;;
+*)  set X $ccflags; shift
+    case " $cppflags " in
+    *" $1 "*) ;;  # Try to avoid doubling the cppflags.
+    *) cppflags="$cppflags $ccflags" ;;
+    esac
+    ;;
 esac
 case "$gccversion" in
 1*) cppflags="$cppflags -D__GNUC__"
@@ -5746,6 +5758,11 @@ $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
 echo " "
 echo "Computing filename position in cpp output for #include directives..." >&4
 case "$osname" in
+amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
+esac
+case "$fieldn" in
+'')
+case "$osname" in
 vos) testaccess=-e ;;
 *)   testaccess=-r ;;
 esac
@@ -5770,6 +5787,8 @@ EOF
 chmod +x fieldn
 fieldn=`./fieldn`
 $rm -f foo.c fieldn
+;;
+esac
 case $fieldn in
 '') pos='???';;
 1) pos=first;;
@@ -8264,6 +8283,7 @@ runnm=false
 : with g++ one needs -shared to get is-in-libc to work for dlopen
 case "$gccversion" in
 '')    ;;
+*Clang*)       ;;
 *)     case "$d_cplusplus" in
        "$define") ccflags="$ccflags -shared" ;;
        esac
@@ -8413,7 +8433,7 @@ int main() {
     exit(1); /* fail */
 }
 EOM
-       if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
+       if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
            bin_ELF="$define"
        fi
        $rm_try
@@ -13311,8 +13331,8 @@ echo " "
 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
 case "$eagain" in
 '')
-       case "$d_fork:$d_pipe" in
-       define:define)
+       case "$d_fork:$d_pipe:$d_alarm" in
+       define:define:define)
        $cat head.c > try.c
        $cat >>try.c <<EOCP
 #include <errno.h>
@@ -17144,14 +17164,21 @@ EOM
 set readlink d_readlink
 eval $inlibc
 
-: Check if exe is symlink to abs path of executing program
+: Check if there is a /proc symlink to the abs path of
+: the executing program.  We will honor hints of d_procselfexe=$undef
+: or procselfexe being non-empty, otherwise will try to determine both
+: if we have readlink.
+: AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
+: referenced, and AmigaOS does not have a proc filesystem anyway.
 echo " "
-procselfexe=''
 val="$undef"
-case "$d_readlink" in
-    "$define")
-       : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
-       : more tidy to avoid an extra level of symlink
+if $test "X$d_procselfexe" = Xundef; then
+       procselfexe=''
+elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
+       val="$define"
+elif $test "X$d_readlink" = Xdefine; then
+        : NetBSD first as /proc/self is a symlink to /proc/curproc,
+        : and it feels more tidy to avoid an extra level of symlink
        set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
        while test $# -gt 0; do
            type=$1; try=$2
@@ -17167,8 +17194,7 @@ case "$d_readlink" in
                fi
            fi
        done
-       ;;
-esac
+fi
 $rm -f reflect
 set d_procselfexe
 eval $setvar
@@ -21989,6 +22015,8 @@ EOM
 esac
 
 : Trace out the files included by signal.h, then look for SIGxxx names.
+case "$sig_num_init" in
+'')
 if [ "X$fieldn" = X ]; then
        : Just make some guesses.  We check them later.
        xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
@@ -22252,6 +22280,8 @@ echo $sig_name | $awk \
 }'
 sig_size=`echo $sig_name | awk '{print NF}'`
 $rm -f signal signal.c signal.awk signal.lst signal_cmd
+;;
+esac
 
 : Check size of size
 echo " "
@@ -23228,7 +23258,7 @@ fi
 
 : add -D_FORTIFY_SOURCE if feasible and not already there
 case "$gccversion" in
-4.*)   case "$optimize$ccflags" in
+[45].*)        case "$optimize$ccflags" in
        *-O*)   case "$ccflags$cppsymbols" in
                *_FORTIFY_SOURCE=*) # Don't add it again.
                        echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
@@ -23238,11 +23268,11 @@ case "$gccversion" in
                        ;;
                esac
                ;;
-       *)      echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
+       *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
                ;;
        esac
        ;;
-*)     echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
+*)     echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
        ;;
 esac
 
@@ -23459,13 +23489,13 @@ find_extensions='
        case "$xxx" in
            DynaLoader|dynaload) ;;
            *)
-           this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
+           this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
            case "$this_ext" in
                Scalar/List/Utils) this_ext="List/Util" ;;
                PathTools)         this_ext="Cwd"       ;;
            esac;
-           echo " $xs_extensions $nonxs_extensions" > $tdir/$$.tmp;
-           if $contains " $this_ext " $tdir/$$.tmp; then
+           echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
+           if $contains " $this_ext " "$tdir/$$.tmp"; then
                echo >&4;
                echo "Duplicate directories detected for extension $xxx" >&4;
                echo "Configure cannot correctly recover from this - shall I abort?" >&4;
@@ -23483,15 +23513,15 @@ find_extensions='
                esac;
                echo "Ok.  You will need to correct config.sh before running make." >&4;
            fi;
-           $ls -1 $xxx > $tdir/$$.tmp;
-           if   $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then
+           $ls -1 "$xxx" > "$tdir/$$.tmp";
+           if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
                xs_extensions="$xs_extensions $this_ext";
-           elif $contains "\.c$"  $tdir/$$.tmp > /dev/null 2>&1; then
+           elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
                xs_extensions="$xs_extensions $this_ext";
-           elif $test -d $xxx; then
+           elif $test -d "$xxx"; then
                nonxs_extensions="$nonxs_extensions $this_ext";
            fi;
-           $rm -f $tdir/$$.tmp;
+           $rm -f "$tdir/$$.tmp";
            ;;
        esac;
     done'
@@ -23521,6 +23551,11 @@ known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort
 avail_ext=''
 for xxx in $xs_extensions ; do
        case "$xxx" in
+       Amiga*)
+               case "$osname" in
+               amigaos) avail_ext="$avail_ext $xxx" ;;
+               esac
+               ;;
        DB_File|db_file)
                case "$i_db" in
                $define) avail_ext="$avail_ext $xxx" ;;
@@ -23590,9 +23625,14 @@ for xxx in $xs_extensions ; do
                esac
                ;;
        Sys/Syslog|sys/syslog)
-               : XXX syslog requires socket
-               case "$d_socket" in
-               true|$define|y) avail_ext="$avail_ext $xxx" ;;
+               case $osname in
+                       amigaos) ;; # not really very useful on AmigaOS
+                       *)
+                       : XXX syslog requires socket
+                       case "$d_socket" in
+                       true|$define|y) avail_ext="$avail_ext $xxx" ;;
+                       esac
+                       ;;
                esac
                ;;
        Thread|thread)