Re: What if NV_PRESERVES_UV_BITS is undef? (was: Re: [PATCH] Configure test code...
[p5sagit/p5-mst-13.2.git] / hints / dec_osf.sh
index fbdf624..336e0ef 100644 (file)
@@ -126,17 +126,23 @@ EOF
        # If it is, we can use it for being nauseatingly C99 ANSI --
        # but even then the lddlflags needs to stay -std1.
        # If it is not, we must use -std1 for both flags.
+       #
                case "`cc -c99 try.c 2>&1`" in
-       *"-c99: Unknown flag"*)         _ccflags_strict_ansi="-std1"  ;;
+       *"-c99: Unknown flag"*)
+               _ccflags_strict_ansi="-std1"
+               ;;
        *)      # However, use the -c99 only if compiling for
                # -DPERL_MEM_LOG, where the C99 feature __func__
                # is useful to have.  Otherwise use the good old
                # -std1 so that we stay C89 strict, which the goal
                # of the Perl C code base (no //, no code between
-               # declarations, etc).
+               # declarations, etc).  Moreover, the Tru64 cc is
+               # not fully C99, and most probably never will be.
+               #
                # The -DPERL_MEM_LOG can be either in ccflags
                # (if using an old config.sh) or in the command line
                # (which has been stowed away in UU/cmdline.opt).
+               #
                case "$ccflags `cat UU/cmdline.opt`" in
                *-DPERL_MEM_LOG*)       _ccflags_strict_ansi="-c99"  ;;
                *)                      _ccflags_strict_ansi="-std1" ;;
@@ -144,6 +150,9 @@ EOF
                ;;
        esac
        _lddlflags_strict_ansi="-std1"
+       # -no_ansi_alias because Perl code is not that strict
+       # (also gcc uses by default -fno-strict-aliasing).
+       _ccflags_strict_ansi="$_ccflags_strict_ansi -no_ansi_alias"
        # Cleanup.
        rm -f try.c try.o
        ;;
@@ -152,6 +161,17 @@ esac
 # Be nauseatingly ANSI
 ccflags="$ccflags $_ccflags_strict_ansi"
 
+# g++ needs a lot of definitions to see the same set of
+# prototypes from <unistd.h> et alia as cxx/cc see.
+# Note that we cannot define _XOPEN_SOURCE_EXTENDED or
+# its moral equivalent, _XOPEN_SOURCE=500 (which would
+# define a lot of the required prototypes for us), because
+# the gcc-processed version of <sys/wait.h> contains fatally
+# conflicting prototypes for wait3().
+case "$cc" in
+*g++*) ccflags="$ccflags -D_XOPEN_SOURCE -D_OSF_SOURCE -D_AES_SOURCE -D_BSD -D_POSIX_C_SOURCE=199309L -D_POSIX_PII_SOCKET" ;;
+esac
+
 # for gcc the Configure knows about the -fpic:
 # position-independent code for dynamic loading
 
@@ -170,10 +190,21 @@ case "$optimize" in
        ;;
 esac
 
+case "$isgcc" in
+gcc)   ;;
+*)     case "$optimize" in
+       *-O*)   # With both -O and -g, the -g must be -g3.
+               optimize="`echo $optimize | sed 's/-g[1-4]*/-g3/'`"
+               ;;
+       esac
+       ;;
+esac
+
 ## Optimization limits
 case "$isgcc" in
 gcc) #  gcc 3.2.1 wants a lot of memory for -O3'ing toke.c
 cat >try.c <<EOF
+#include <stdio.h>
 #include <sys/resource.h>
 
 int main ()
@@ -350,7 +381,7 @@ $define|true|[yY]*)
 extern int foo;        
 EOF
        $cc -c pthread.c 2> pthread.err
-       if grep -q "unrecognized compiler" pthread.err; then
+       if egrep -q "unrecognized compiler|syntax error" pthread.err; then
            cat >&4 <<EOF
 ***
 *** I'm sorry but your C compiler ($cc) cannot be used to