about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-05-26 21:28:20 +0000
committerUlrich Drepper <drepper@redhat.com>1997-05-26 21:28:20 +0000
commit654665b7c77594bf7c4209361bcede71e99f7b42 (patch)
tree71e4e4d67d2434db184f79bfababaa49d4f4e100
parentf0271955ecd0a247a164988cb7f5834461eeb78d (diff)
downloadglibc-654665b7c77594bf7c4209361bcede71e99f7b42.tar.gz
glibc-654665b7c77594bf7c4209361bcede71e99f7b42.tar.xz
glibc-654665b7c77594bf7c4209361bcede71e99f7b42.zip
Add AC_PROG_CC_LOCAL which does not fail for environments in which linking
is not possible at configure time (since te libc is just build).
-rw-r--r--aclocal.m459
1 files changed, 59 insertions, 0 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 2e7381987c..bf1ad40e2a 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -31,3 +31,62 @@ changequote([,])dnl
 fi
 AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
 dnl
+
+dnl These modifications are to allow for an empty cross compiler tree.
+dnl In the situation that cross-linking is impossible, the variable
+dnl `cross_linkable' will be substituted with "yes".
+AC_DEFUN(AC_PROG_CC_LOCAL,
+[AC_BEFORE([$0], [AC_PROG_CPP])dnl
+AC_CHECK_PROG(CC, gcc, gcc)
+if test -z "$CC"; then
+  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
+  test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
+fi
+
+AC_PROG_CC_WORKS_LOCAL
+AC_PROG_CC_GNU
+
+dnl The following differs from the AC_PROG_CC macro in autoconf.  Since
+dnl we require a recent version of gcc to be used we do not need to go
+dnl into lengths and test for bugs in old versions.  It must be gcc 2.7
+dnl or above.
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
+
+dnl Check the version
+  cat > conftest.c <<EOF
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+  yes;
+#endif
+EOF
+  if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
+    if test -z "$CFLAGS"; then
+      CFLAGS="-g -O2"
+    fi
+  else
+    AC_MSG_ERROR([We require GNU CC version 2.7 or newer])
+  fi
+else
+  AC_MSG_ERROR([GNU libc must be compiled using GNU CC])
+fi
+])
+
+AC_DEFUN(AC_PROG_CC_WORKS_LOCAL,
+[AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) works])
+AC_LANG_SAVE
+AC_LANG_C
+AC_TRY_COMPILER([main(){return(0);}], ac_cv_prog_cc_works, ac_cv_prog_cc_cross)
+AC_LANG_RESTORE
+AC_MSG_RESULT($ac_cv_prog_cc_works)
+if test $ac_cv_prog_cc_works = no; then
+ cross_linkable=no
+ ac_cv_prog_cc_cross=yes
+dnl AC_MSG_ERROR([installation or configuration problem: C compiler cannot create executables.])
+else
+ cross_linkable=yes
+fi
+AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
+AC_MSG_RESULT($ac_cv_prog_cc_cross)
+AC_SUBST(cross_linkable)
+cross_compiling=$ac_cv_prog_cc_cross
+])