This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Do the cc sanity check both before the hints and
authorJarkko Hietaniemi <jhi@iki.fi>
Wed, 12 Jul 2000 05:03:59 +0000 (05:03 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Wed, 12 Jul 2000 05:03:59 +0000 (05:03 +0000)
after the cc selction.

p4raw-id: //depot/metaconfig@6378

U/modified/Oldconfig.U
U/modified/cc.U
U/perl/Checkcc.U [new file with mode: 0644]

index 45e3fdd..c227969 100644 (file)
@@ -57,7 +57,7 @@
 ?X: This unit tries to remember what we did last time we ran Configure, mostly
 ?X: for the sake of setting defaults.
 ?X:
-?MAKE:Oldconfig hint myuname osname osvers: Instruct Myread uname \
+?MAKE:Oldconfig hint myuname osname osvers: Instruct Myread uname Checkcc \
        sh awk sed test cat rm lns tr n c contains Loc Options Tr src trnl ln
 ?MAKE: -pick wipe $@ %<
 ?S:myuname:
@@ -165,6 +165,7 @@ if test -f config.sh; then
                ;;
        esac
 fi
+. ./UU/checkcc
 if test ! -f config.sh; then
        $cat <<EOM
 
index b59edd2..b7d3ede 100644 (file)
 ?RCS: Revision 3.0  1993/08/18  12:05:30  ram
 ?RCS: Baseline for dist 3.0 netwide release.
 ?RCS:
-?MAKE:cc: cat contains sysman +large cpp rm \
-       Mcc Myread Guess Options Oldconfig Loc test
+?MAKE:cc: cat contains sysman +large cpp \
+       Mcc Myread Guess Options Oldconfig Loc test Checkcc
 ?MAKE: -pick add $@ %<
 ?S:cc:
 ?S:    This variable holds the name of a command to execute a C compiler which
 ?S:    can resolve multiple global references that happen to have the same
 ?S:    name.  Usual values are 'cc', 'Mcc', 'cc -M', and 'gcc'.
-?S:    Fervent ANSI compilers may be called 'c89'.
-?S:    AIX has xlc.
+?S:    Fervent ANSI compilers may be called 'c89'. AIX has xlc.
 ?S:.
-?T:despair
-?T:trygcc
 ?F:!cc.cbu
 ?D:cc='cc'
 ?LINT:change cpp
@@ -97,44 +94,5 @@ fi
 if $test -f cc.cbu; then
     . ./cc.cbu
 fi
-: Quick sanity check, we will do a fuller one later when we know
-: the various flags and libs
-$rm -f try try.*
-$cat >try.c <<EOM
-int main(int argc, char *argv[]) {
-  return 0;
-}
-EOM
-if $cc -o try try.c; then
-   :
-else
-   echo "Uh-oh, the C compiler '$cc' doesn't seem to be working..." >&4
-   despair=yes
-   trygcc=yes
-   case "$cc" in
-   *gcc) trygcc=no ;;
-   esac
-   case "`$cc -v 2>&1`" in
-   *gcc*) trygcc=no ;;
-   esac
-   if $test X"$trygcc" = Xyes; then
-      if gcc -o try try.c; then
-        echo " "
-        echo "You seem to have a working gcc, though." >&4
-        rp="Do you want to use it?"
-        dflt=y
-        . ./myread
-        case "$ans" in
-        [yY]*) cc=gcc; despair=no ;;
-        esac
-      fi
-   fi
-   if $test X"$despair" = Xyes; then
-      echo "You need to find a working C compiler." >&4
-      echo "I cannot continue any further, aborting." >&4
-      exit 1
-   fi
-fi
-$rm -f try try.*
-
+. ./checkcc
 
diff --git a/U/perl/Checkcc.U b/U/perl/Checkcc.U
new file mode 100644 (file)
index 0000000..e8be55a
--- /dev/null
@@ -0,0 +1,73 @@
+?RCS:
+?RCS: $Id$
+?RCS:
+?RCS: Copyright (c) 2000, Jarkko Hietaniemi
+?RCS: 
+?X: 
+?X: This unit produces a bit of shell code that must be dotted in order
+?X: to make quick check on whether the current C compiler is working.
+?X:    
+?MAKE:Checkcc: rm cat test Myread startsh
+?MAKE: -pick add $@ %<
+?T: trygcc despair
+?F:./checkcc
+?LINT:extern cc
+?LINT:change cc
+?LINT:extern ccflags
+?LINT:change ccflags
+cat <<EOS >checkcc
+$startsh
+EOS
+cat <<'EOSC' >>checkcc
+case "$cc" in
+'') ;;
+*)  $rm -f try try.*
+    $cat >try.c <<EOM
+int main(int argc, char *argv[]) {
+  return 0;
+}
+EOM
+    if $cc -o try try.c; then
+       :
+    else
+        echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
+        despair=yes
+        trygcc=yes
+        case "$cc" in
+        *gcc*) trygcc=no ;;
+        esac
+        case "`$cc -v -c try.c 2>&1`" in
+        *gcc*) trygcc=no ;;
+        esac
+        if $test X"$trygcc" = Xyes; then
+            if gcc -o try -c try.c; then
+                echo " "
+                echo "You seem to have a working gcc, though." >&4
+                rp="Would you like to use it?"
+                dflt=y
+                if $test -f myread; then
+                    . ./myread
+                else
+                    if $test -f UU/myread; then
+                        . ./UU/myread
+                    else
+                        echo "Cannot find myread, sorry.  Aborting." >&2
+                        exit 1
+                    fi
+                fi  
+                case "$ans" in
+                [yY]*) cc=gcc; ccflags=''; despair=no ;;
+                esac
+            fi
+        fi
+        if $test X"$despair" = Xyes; then
+            echo "You need to find a working C compiler." >&4
+            echo "I cannot continue any further, aborting." >&4
+            exit 1
+        fi
+    fi
+    $rm -f try try.*
+    ;;
+esac
+EOSC
+