path: root/aclocal/prog-cc.m4
diff options
authorJoel Sherrill <>1998-02-19 16:23:56 +0000
committerJoel Sherrill <>1998-02-19 16:23:56 +0000
commit51c195d560b6d51d2bcd969b828b0c45c6c4adee (patch)
tree603d8bdd91bf9b6e00d4d1766cf3bb872b88ca29 /aclocal/prog-cc.m4
parent00632e5337861c5870e7bd5cd916cba7b31b459c (diff)
New files missed in previous merge.
Diffstat (limited to 'aclocal/prog-cc.m4')
1 files changed, 76 insertions, 0 deletions
diff --git a/aclocal/prog-cc.m4 b/aclocal/prog-cc.m4
new file mode 100644
index 0000000000..755cecfe35
--- /dev/null
+++ b/aclocal/prog-cc.m4
@@ -0,0 +1,76 @@
+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 (
+AC_BEFORE([$0], [AC_PROG_CPP])dnl
+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])
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+dnl Check whether -g works, even if CFLAGS is set, in case the package
+dnl plays around with CFLAGS (such as to build both debugging and
+dnl normal versions of a library), tasteless as that idea is.
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ elif test $ac_cv_prog_cc_g = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-O2"
+ fi
+ GCC=
+ 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])
+[void *malloc() { return 0; }
+ main(){return(0);}],
+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])