This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Backporting work on AmigaOS
[metaconfig.git] / U / compline / ccflags.U
index fd6bf0e..4226327 100644 (file)
@@ -2,10 +2,10 @@
 ?RCS:
 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
 ?RCS:
-?RCS: You may redistribute only under the terms of the Artistic Licence,
+?RCS: You may redistribute only under the terms of the Artistic License,
 ?RCS: as specified in the README file that comes with the distribution.
 ?RCS: You may reuse parts of this distribution only within the terms of
-?RCS: that same Artistic Licence; a copy of which may be found at the root
+?RCS: that same Artistic License; a copy of which may be found at the root
 ?RCS: of the source tree for dist 3.0.
 ?RCS:
 ?RCS: $Log: ccflags.U,v $
@@ -21,7 +21,7 @@
 ?RCS: patch54: now checks for cc/ccflags/ldflags coherency
 ?RCS:
 ?RCS: Revision 3.0.1.6  1994/10/29  16:07:02  ram
-?RCS: patch36: gcc versionning no longer relies on the C compiler's name
+?RCS: patch36: gcc versioning no longer relies on the C compiler's name
 ?RCS: patch36: simplified check for gcc version checking (ADO)
 ?RCS:
 ?RCS: Revision 3.0.1.5  1994/08/29  16:06:35  ram
@@ -33,7 +33,7 @@
 ?RCS: patch23: magically added cc flags now only done the first time
 ?RCS:
 ?RCS: Revision 3.0.1.3  1993/09/13  15:58:29  ram
-?RCS: patch10: explicitely mention -DDEBUG just in case they need it (WAD)
+?RCS: patch10: explicitly mention -DDEBUG just in case they need it (WAD)
 ?RCS: patch10: removed all the "tans" variable usage (WAD)
 ?RCS:
 ?RCS: Revision 3.0.1.2  1993/08/27  14:39:38  ram
 ?RCS: Revision 3.0  1993/08/18  12:05:31  ram
 ?RCS: Baseline for dist 3.0 netwide release.
 ?RCS:
-?MAKE:ccflags ldflags lkflags cppflags optimize locincpth: test cat \
+?MAKE:ccflags ldflags lkflags cppflags optimize locincpth: test cat osname \
        Myread Guess Options Oldconfig +gccversion mips_type +usrinc \
        package contains rm +cc cppstdin cppminus cpprun cpplast libpth \
-       libs loclibpth hint usesocks sh run rm_try
+       libs loclibpth hint usesocks sh run rm_try sysroot
 ?MAKE: -pick add $@ %<
 ?S:ccflags:
 ?S:    This variable contains any additional C compiler flags desired by
@@ -85,6 +85,7 @@
 ?D:ccflags=''
 ?D:ldflags=''
 ?D:optimize=''
+?LINT:extern _sysroot
 ?INIT:: Possible local include directories to search.
 ?INIT:: Set locincpth to "" in a hint file to defeat local include searches.
 ?INIT:locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
@@ -95,7 +96,7 @@
 ?INIT:
 ?INIT:: Enable -DEBUGGING and -DDEBUGGING from the command line
 ?INIT:EBUGGING=''
-?INIT:DEBUGGING=old
+?INIT:DEBUGGING=''
 ?INIT:
 : determine optimization, if desired, or use for debug flag also
 ?X: Allow for Configure -Uoptimize -- it's not strictly sensible, but
@@ -156,8 +157,9 @@ esac
 checkccflag='check=$1; flag=$2; callback=$3;
 echo " ";
 echo "Checking if your compiler accepts $flag" 2>&1;
+[ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
 echo "int main(void) { return 0; }" > gcctest.c;
-if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
+if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
     echo "Yes, it does." 2>&1;
     if $test -s gcctest.out ; then
         echo "But your platform does not like it:";
@@ -229,9 +231,20 @@ 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 -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
        ;;
@@ -382,10 +395,16 @@ case "$ldflags" in
 esac
 # See note above about -fstack-protector
 case "$ccflags" in
-*-fstack-protector*) 
+*-fstack-protector-strong*)
+       case "$dflt" in
+       *-fstack-protector-strong*) ;; # Don't add it again
+       *) dflt="$dflt -fstack-protector-strong" ;;
+       esac
+       ;;
+*-fstack-protector*)
        case "$dflt" in
        *-fstack-protector*) ;; # Don't add it again
-       *) dflt="$dflt -fstack-protector" ;; 
+       *) dflt="$dflt -fstack-protector" ;;
        esac
        ;;
 esac
@@ -488,31 +507,12 @@ dflt=y
 ?X: We need to try the resulting executable, because cc might yield a 0 status
 ?X: even when ld failed, in which case the executable will not run properly,
 ?X: if its x bit is set at all...
-?X:
-?X: Also check the xxx=`$run ./try` output to check for misconfigured -lsfio.
-?X: If sfio's iffe goofed and it uses _exit instead of exit, then the
-?X: output buffers don't get flushed and we don't see any output
-?X: when run from within `backticks`.  What fun.
-?X: --Andy Dougherty 2/13/1998
 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
        if $sh -c "$run ./try " >>try.msg 2>&1; then
                xxx=`$run ./try`
                case "$xxx" in
                "Ok") dflt=n ;;
-               *)      echo 'The program compiled OK, but produced no output.' >> try.msg
-                       case " $libs " in
-                       *" -lsfio "*)
-                               cat >> try.msg <<'EOQS'
-If $libs contains -lsfio, and sfio is mis-configured, then it
-sometimes (apparently) runs and exits with a 0 status, but with no
-output!  It may have to do with sfio's use of _exit vs. exit.
-
-EOQS
-                               rp="You have a big problem.  Shall I abort Configure"
-                               dflt=y
-                               ;;
-                       esac
-                       ;;
+               *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
                esac
        else
                echo "The program compiled OK, but exited with status $?." >>try.msg