summaryrefslogtreecommitdiffstats
path: root/aclocal/prog-cxx.m4
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1998-05-20 17:06:57 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1998-05-20 17:06:57 +0000
commit2efdd08b402f42579548349e62c73c9fe999bc98 (patch)
tree28856228b02ded770e9e81a935e13ec7cb6bf07c /aclocal/prog-cxx.m4
parentSome patches in place from Brian Stevens which help the Solaris port (diff)
downloadrtems-2efdd08b402f42579548349e62c73c9fe999bc98.tar.bz2
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 configure.in to a new m4-autoconf macro (New file: aclocal/tool-prefix.m4) * Minor changes to configure.in 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 '')
-rw-r--r--aclocal/prog-cxx.m461
1 files changed, 29 insertions, 32 deletions
diff --git a/aclocal/prog-cxx.m4 b/aclocal/prog-cxx.m4
index 740b91df08..5875692943 100644
--- a/aclocal/prog-cxx.m4
+++ b/aclocal/prog-cxx.m4
@@ -3,18 +3,29 @@ dnl $Id$
dnl
dnl Check for target g++
dnl
-dnl Adaptation of autoconf-2.12's AC_PROG_CXX to rtems
-dnl
-dnl 98/02/10 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
-dnl
-
+dnl 98/05/20 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
+dnl Completely reworked
+
AC_DEFUN(RTEMS_PROG_CXX,
[
AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
AC_BEFORE([$0], [AC_PROG_CXX])dnl
-AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
+AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl
+
+dnl Only accept g++ and c++
+dnl NOTE: This might be too restrictive for native compilation
+AC_PATH_PROGS(CXX_FOR_TARGET, "$program_prefix"g++ "$program_prefix"c++)
+test -z "$CXX_FOR_TARGET" \
+ && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
-RTEMS_PROG_CXX_WORKS
+dnl backup
+rtems_save_CXX=$CXX
+rtems_save_CXXFLAGS=$CXXFLAGS
+
+dnl temporarily set CXX
+CXX=$CXX_FOR_TARGET
+
+AC_PROG_CXX_WORKS
AC_PROG_CXX_GNU
if test $ac_cv_prog_gxx = yes; then
@@ -37,32 +48,18 @@ else
GXX=
test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
fi
-CXX_FOR_TARGET=$CXX
-
-dnl restore initial values
-unset CXX
-unset ac_cv_prog_gxx
-])
+rtems_cv_prog_gxx=$ac_cv_prog_gxx
+rtems_cv_prog_cxx_g=$ac_cv_prog_cxx_g
+rtems_cv_prog_cxx_works=$ac_cv_prog_cxx_works
+rtems_cv_prog_cxx_cross=$ac_cv_prog_cxx_cross
-dnl Almost identical to AC_PROG_CXX_WORKS
-dnl Additional handling of malloc
-dnl NOTE: using newlib with a native compiler is cross-compiling, indeed.
-AC_DEFUN(RTEMS_PROG_CXX_WORKS,
-[AC_MSG_CHECKING([whether the target C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works])
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
+CXX=$rtems_save_CXX
+CXXFLAGS=$rtems_save_CXXFLAGS
-dnl this fails if rtems uses newlib, because rtems has its own malloc which
-dnl is not available at bootstrap
-AC_TRY_COMPILER(
- [main(){return(0);}],
- rtems_cv_prog_cxx_works, rtems_cv_prog_cxx_cross)
-AC_LANG_RESTORE
-AC_MSG_RESULT($rtems_cv_prog_cxx_works)
-if test $rtems_cv_prog_cxx_works = no; then
- AC_MSG_ERROR([installation or configuration problem: target C++ compiler cannot create executables.])
-fi
-AC_MSG_CHECKING([whether the target C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler])
-AC_MSG_RESULT($rtems_cv_prog_cxx_cross)
+dnl restore initial values
+unset ac_cv_prog_gxx
+unset ac_cv_prog_cc_g
+unset ac_cv_prog_cxx_works
+unset ac_cv_prog_cxx_cross
])