path: root/aclocal/prog-cc.m4
diff options
authorJoel Sherrill <>1998-05-20 17:06:57 +0000
committerJoel Sherrill <>1998-05-20 17:06:57 +0000
commit2efdd08b402f42579548349e62c73c9fe999bc98 (patch)
tree28856228b02ded770e9e81a935e13ec7cb6bf07c /aclocal/prog-cc.m4
parent17a8d60365ce0684b0494886fc1c2a20a67d8ba6 (diff)
Patch from Ralf Corseipus to fix latent configure problems suddenly triggered:
The breakdown: * CC_FOR_TARGET and CXX_FOR_TARGET were not correctly re-read from autoconf's configuration cache (config.cache) * If <target>-[gcc|g++] was not found while running configure, the config macros tried to use other (wrong) compilers (e.g. cc). Changes: * New RTEMS_PROG_CC macro (aclocal/prog-cc.m4). * New RTEMS_PROG_CXX macro (aclocal/prog-cxx.m4) * Moved a shell script fragment from to a new m4-autoconf macro (New file: aclocal/tool-prefix.m4) * Minor changes to I tested it with linux/posix (native gcc/primary libc) and sh-rtems/gensh1 on a linux host and didn't notice any bugs related to the problems mentioned above. There seem to be more bugs with the posix bsp, but I consider them minor as the build run completed successfully. It is just too late for me to attempt to fix them now.
Diffstat (limited to 'aclocal/prog-cc.m4')
1 files changed, 24 insertions, 34 deletions
diff --git a/aclocal/prog-cc.m4 b/aclocal/prog-cc.m4
index 7d8a286ec3..864a3c3e07 100644
--- a/aclocal/prog-cc.m4
+++ b/aclocal/prog-cc.m4
@@ -3,22 +3,29 @@ dnl $Id$
dnl Check for target gcc
-dnl Adaptation of autoconf-2.12's AC_PROG_CC to rtems
-dnl 98/02/10 Ralf Corsepius (
+dnl 98/05/20 Ralf Corsepius (
+dnl Completely reworked
AC_BEFORE([$0], [AC_PROG_CC])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])
+dnl Only accept gcc and cc
+dnl NOTE: This might be too restrictive for native compilation
+AC_PATH_PROGS(CC_FOR_TARGET, "$program_prefix"gcc "$program_prefix"cc )
+test -z "$CC_FOR_TARGET" \
+ && AC_MSG_ERROR([no acceptable cc found in \$PATH])
+dnl backup
+dnl temporarily set CC
if test $ac_cv_prog_gcc = yes; then
@@ -42,34 +49,17 @@ else
test "${CFLAGS+set}" = set || CFLAGS="-g"
dnl restore initial values
-unset CC
unset ac_cv_prog_gcc
unset ac_cv_prog_cc_g
-unset ac_cv_prog_CC
-dnl Almost identical to AC_PROG_CC_WORKS
-dnl added malloc to program fragment, because rtems has its own malloc
-dnl which is not available while bootstrapping rtems
-[AC_MSG_CHECKING([whether the target C compiler ($CC $CFLAGS $LDFLAGS) works])
-rtems_cv_prog_cc_works, rtems_cv_prog_cc_cross)
-if test $rtems_cv_prog_cc_works = no; then
- AC_MSG_ERROR([installation or configuration problem: target C compiler cannot create executables.])
-AC_MSG_CHECKING([whether the target C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
+unset ac_cv_prog_cc_works
+unset ac_cv_prog_cc_cross