* configure.in: Don't get CC from the host Makefile fragment if we
authorIan Lance Taylor <ian@airs.com>
Thu, 15 Feb 1996 22:43:59 +0000 (22:43 +0000)
committerIan Lance Taylor <ian@airs.com>
Thu, 15 Feb 1996 22:43:59 +0000 (22:43 +0000)
can find gcc in PATH, or if this is a Canadian Cross.  Move the
Solaris test for /usr/ucb/cc to the post target script, just after
the compiler sanity test.

ChangeLog
configure.in

index 738d2f6..be850ca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Thu Feb 15 17:42:25 1996  Ian Lance Taylor  <ian@cygnus.com>
+
+       * configure.in: Don't get CC from the host Makefile fragment if we
+       can find gcc in PATH, or if this is a Canadian Cross.  Move the
+       Solaris test for /usr/ucb/cc to the post target script, just after
+       the compiler sanity test.
+
 Wed Feb 14 16:57:40 1996  Ian Lance Taylor  <ian@cygnus.com>
 
        * config.sub: Merge with FSF.
index 54b350f..0d5cbb2 100644 (file)
@@ -128,9 +128,20 @@ case "${host}" in
 esac
 fi
 
-# See if we can extract a definition of CC from the fragment.
-if [ -z "${CC}" ]; then
-  if [ -n "${host_makefile_frag}" -a -f "${srcdir}/${host_makefile_frag}" ]; then
+# If we aren't going to be using gcc, see if we can extract a definition
+# of CC from the fragment.
+if [ -z "${CC}" -a "${build}" = "${host}" ]; then
+  IFS="${IFS=  }"; save_ifs="$IFS"; IFS="${IFS}:"
+  found=
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/gcc; then
+      found=yes
+      break
+    fi
+  done
+  IFS="$save_ifs"
+  if [ -z "${found}" -a -n "${host_makefile_frag}" -a -f "${srcdir}/${host_makefile_frag}" ]; then
     xx=`sed -n -e 's/^[        ]*CC[   ]*=[    ]*\(.*\)$/\1/p' < ${srcdir}/${host_makefile_frag}`
     if [ -n "${xx}" ] ; then
       CC=$xx
@@ -138,33 +149,6 @@ if [ -z "${CC}" ]; then
   fi
 fi
 
-# The Solaris /usr/ucb/cc compiler does not appear to work.
-case "${host}" in
-  sparc-sun-solaris2*)
-      if [ "`/usr/bin/which ${CC-cc}`" = "/usr/ucb/cc" ] ; then
-          could_use=
-          [ -d /opt/SUNWspro/bin ] && could_use="/opt/SUNWspro/bin"
-          if [ -d /opt/cygnus/bin ] ; then
-              if [ "$could_use" = "" ] ; then
-                  could_use="/opt/cygnus/bin"
-              else
-                  could_use="$could_use or /opt/cygnus/bin"
-              fi
-          fi
-        if [ "$could_use" = "" ] ; then
-            echo "Warning: compilation may fail because you're using"
-            echo "/usr/ucb/cc.  You should change your PATH or CC "
-            echo "variable and rerun configure."
-        else
-            echo "Warning: compilation may fail because you're using"
-            echo "/usr/ucb/cc, when you should use the C compiler from"
-            echo "$could_use.  You should change your"
-            echo "PATH or CC variable and rerun configure."
-        fi
-      fi
-  ;;
-esac
-
 # We default to --with-shared on platforms where -fpic is meaningless.
 # Well, we don't yet, but we will.
 if false && [ "${host}" = "${target}" ] && [ x${enable_shared} = x ]; then
@@ -710,6 +694,33 @@ else
 fi
 rm -f conftest*
 
+# The Solaris /usr/ucb/cc compiler does not appear to work.
+case "${host}" in
+  sparc-sun-solaris2*)
+      if [ "`/usr/bin/which ${CC-cc}`" = "/usr/ucb/cc" ] ; then
+          could_use=
+          [ -d /opt/SUNWspro/bin ] && could_use="/opt/SUNWspro/bin"
+          if [ -d /opt/cygnus/bin ] ; then
+              if [ "$could_use" = "" ] ; then
+                  could_use="/opt/cygnus/bin"
+              else
+                  could_use="$could_use or /opt/cygnus/bin"
+              fi
+          fi
+        if [ "$could_use" = "" ] ; then
+            echo "Warning: compilation may fail because you're using"
+            echo "/usr/ucb/cc.  You should change your PATH or CC "
+            echo "variable and rerun configure."
+        else
+            echo "Warning: compilation may fail because you're using"
+            echo "/usr/ucb/cc, when you should use the C compiler from"
+            echo "$could_use.  You should change your"
+            echo "PATH or CC variable and rerun configure."
+        fi
+      fi
+  ;;
+esac
+
 # If --enable-shared was set, we must set LD_LIBRARY_PATH so that the
 # binutils tools will find libbfd.so.
 if [ "${enable_shared}" = "yes" ]; then