source: rtems/aclocal/prog-cxx.m4 @ df49c60

4.104.114.84.9
Last change on this file since df49c60 was df49c60, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 12, 2000 at 3:00:15 PM

Merged from 4.5.0-beta3a

  • Property mode set to 100644
File size: 2.1 KB
Line 
1dnl
2dnl $Id$
3dnl
4dnl Check for target g++
5dnl
6dnl 98/05/20 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
7dnl                             Completely reworked
8
9AC_DEFUN(RTEMS_PROG_CXX,
10[
11AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
12AC_BEFORE([$0], [AC_PROG_CXX])dnl
13AC_BEFORE([$0], [RTEMS_CANONICALIZE_TOOLS])dnl
14AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl
15AC_REQUIRE([RTEMS_ENABLE_LIBCDIR])dnl
16
17dnl Only accept g++ and c++
18dnl NOTE: This might be too restrictive for native compilation
19AC_PATH_PROGS(CXX_FOR_TARGET, "$program_prefix"g++ "$program_prefix"c++)
20test -z "$CXX_FOR_TARGET" \
21  && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
22
23dnl backup
24rtems_save_CXX=$CXX
25rtems_save_CXXFLAGS=$CXXFLAGS
26
27dnl temporarily set CXX
28CXX=$CXX_FOR_TARGET
29
30AC_PROG_CXX_WORKS
31AC_PROG_CXX_GNU
32
33if test $ac_cv_prog_gxx = yes; then
34  GXX=yes
35dnl Check whether -g works, even if CXXFLAGS is set, in case the package
36dnl plays around with CXXFLAGS (such as to build both debugging and
37dnl normal versions of a library), tasteless as that idea is.
38  ac_test_CXXFLAGS="${CXXFLAGS+set}"
39  ac_save_CXXFLAGS="$CXXFLAGS"
40  CXXFLAGS=
41  AC_PROG_CXX_G
42  if test "$ac_test_CXXFLAGS" = set; then
43    CXXFLAGS="$ac_save_CXXFLAGS"
44  elif test $ac_cv_prog_cxx_g = yes; then
45    CXXFLAGS="-g -O2"
46  else
47    CXXFLAGS="-O2"
48  fi
49else
50  GXX=
51  test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
52fi
53
54rtems_cv_prog_gxx=$ac_cv_prog_gxx
55rtems_cv_prog_cxx_g=$ac_cv_prog_cxx_g
56rtems_cv_prog_cxx_works=$ac_cv_prog_cxx_works
57rtems_cv_prog_cxx_cross=$ac_cv_prog_cxx_cross
58
59CXX=$rtems_save_CXX
60CXXFLAGS=$rtems_save_CXXFLAGS
61
62dnl restore initial values
63unset ac_cv_prog_gxx
64unset ac_cv_prog_cc_g
65unset ac_cv_prog_cxx_works
66unset ac_cv_prog_cxx_cross
67dnl somehow autoconf macros leave this file
68rm -f conftest.C
69])
70
71AC_DEFUN(RTEMS_PROG_CXX_FOR_TARGET,
72[
73  RTEMS_PROG_CXX
74  if test "$rtems_cv_prog_cc_cross" != "$rtems_cv_prog_cxx_cross"; then
75    AC_MSG_ERROR([***]
76     [Inconsistency in compiler configuration:]
77     [Target C compiler and Target C++ compiler]
78     [must both either be cross compilers or native compilers]
79     [Hint: If building a posix bsp: LD_LIBRARY_PATH?] )
80  fi
81])
Note: See TracBrowser for help on using the repository browser.