summaryrefslogtreecommitdiffstats
path: root/aclocal.m4
diff options
context:
space:
mode:
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m4141
1 files changed, 71 insertions, 70 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 41ce4209c7..3329007592 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -56,27 +56,52 @@ changequote([, ])dnl
AC_MSG_RESULT($target_cpu)
])
+dnl Set program_prefix
+dnl
+dnl 98/05/20 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
+dnl Extracted from configure
+
+AC_DEFUN(RTEMS_TOOL_PREFIX,
+[AC_REQUIRE([AC_CANONICAL_TARGET])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+
+if [[ "${program_prefix}" = "NONE" ]] ; then
+ if [[ "${target}" = "${host}" ]] ; then
+ program_prefix=
+ else
+ program_prefix=${target}-
+ fi
+fi
+])
+
dnl
dnl $Id$
dnl
dnl Check for target gcc
dnl
-dnl Adaptation of autoconf-2.12's AC_PROG_CC 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_CC,
[
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])
-fi
+AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl
+
+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
+rtems_save_CC=$CC
+rtems_save_CFLAGS=$CFLAGS
-RTEMS_PROG_CC_WORKS
+dnl temporarily set CC
+CC=$CC_FOR_TARGET
+
+AC_PROG_CC_WORKS
AC_PROG_CC_GNU
if test $ac_cv_prog_gcc = yes; then
@@ -100,36 +125,19 @@ else
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
-CC_FOR_TARGET=$CC
rtems_cv_prog_gcc=$ac_cv_prog_gcc
rtems_cv_prog_cc_g=$ac_cv_prog_cc_g
+rtems_cv_prog_cc_works=$ac_cv_prog_cc_works
+rtems_cv_prog_cc_cross=$ac_cv_prog_cc_cross
dnl restore initial values
-unset CC
+CC=$rtems_save_CC
+CFLAGS=$rtems_save_CFLAGS
+
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_DEFUN(RTEMS_PROG_CC_WORKS,
-[AC_MSG_CHECKING([whether the target C compiler ($CC $CFLAGS $LDFLAGS) works])
-AC_LANG_SAVE
-AC_LANG_C
-AC_TRY_COMPILER(
-[main(){return(0);}],
-rtems_cv_prog_cc_works, rtems_cv_prog_cc_cross)
-AC_LANG_RESTORE
-AC_MSG_RESULT($rtems_cv_prog_cc_works)
-if test $rtems_cv_prog_cc_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 ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
-AC_MSG_RESULT($rtems_cv_prog_cc_cross)
+unset ac_cv_prog_cc_works
+unset ac_cv_prog_cc_cross
])
dnl
@@ -188,18 +196,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])
+
+dnl backup
+rtems_save_CXX=$CXX
+rtems_save_CXXFLAGS=$CXXFLAGS
+
+dnl temporarily set CXX
+CXX=$CXX_FOR_TARGET
-RTEMS_PROG_CXX_WORKS
+AC_PROG_CXX_WORKS
AC_PROG_CXX_GNU
if test $ac_cv_prog_gxx = yes; then
@@ -222,34 +241,20 @@ 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
+CXX=$rtems_save_CXX
+CXXFLAGS=$rtems_save_CXXFLAGS
-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
-
-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
])
dnl $Id$
@@ -275,10 +280,6 @@ fi
dnl check whether the tools exist
dnl FIXME: What shall be done if they don't exist?
-dnl NOTE: CC_FOR_TARGET should always be valid at this point,
-dnl cf. RTEMS_PROG_CC
-AC_PATH_PROG(CC_FOR_TARGET,"$program_prefix"gcc,no)
-
dnl FIXME: This may fail if the compiler has not been recognized as gcc
dnl and uses tools with different names
AC_PATH_PROG(AR_FOR_TARGET,"$program_prefix"ar,no)