1 | dnl |
---|
2 | dnl $Id$ |
---|
3 | dnl |
---|
4 | dnl Check for target g++ |
---|
5 | dnl |
---|
6 | dnl 98/05/20 Ralf Corsepius (corsepiu@faw.uni-ulm.de) |
---|
7 | dnl Completely reworked |
---|
8 | |
---|
9 | AC_DEFUN(RTEMS_PROG_CXX, |
---|
10 | [ |
---|
11 | AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl |
---|
12 | AC_BEFORE([$0], [AC_PROG_CXX])dnl |
---|
13 | AC_BEFORE([$0], [RTEMS_CANONICALIZE_TOOLS])dnl |
---|
14 | AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl |
---|
15 | AC_REQUIRE([RTEMS_ENABLE_LIBCDIR])dnl |
---|
16 | |
---|
17 | dnl Only accept g++ and c++ |
---|
18 | dnl NOTE: This might be too restrictive for native compilation |
---|
19 | AC_PATH_PROGS(CXX_FOR_TARGET, "$program_prefix"g++ "$program_prefix"c++) |
---|
20 | test -z "$CXX_FOR_TARGET" \ |
---|
21 | && AC_MSG_ERROR([no acceptable c++ found in \$PATH]) |
---|
22 | |
---|
23 | dnl backup |
---|
24 | rtems_save_CXX=$CXX |
---|
25 | rtems_save_CXXFLAGS=$CXXFLAGS |
---|
26 | |
---|
27 | dnl temporarily set CXX |
---|
28 | CXX=$CXX_FOR_TARGET |
---|
29 | |
---|
30 | AC_PROG_CXX_WORKS |
---|
31 | AC_PROG_CXX_GNU |
---|
32 | |
---|
33 | if test $ac_cv_prog_gxx = yes; then |
---|
34 | GXX=yes |
---|
35 | dnl Check whether -g works, even if CXXFLAGS is set, in case the package |
---|
36 | dnl plays around with CXXFLAGS (such as to build both debugging and |
---|
37 | dnl 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 |
---|
49 | else |
---|
50 | GXX= |
---|
51 | test "${CXXFLAGS+set}" = set || CXXFLAGS="-g" |
---|
52 | fi |
---|
53 | |
---|
54 | rtems_cv_prog_gxx=$ac_cv_prog_gxx |
---|
55 | rtems_cv_prog_cxx_g=$ac_cv_prog_cxx_g |
---|
56 | rtems_cv_prog_cxx_works=$ac_cv_prog_cxx_works |
---|
57 | rtems_cv_prog_cxx_cross=$ac_cv_prog_cxx_cross |
---|
58 | |
---|
59 | CXX=$rtems_save_CXX |
---|
60 | CXXFLAGS=$rtems_save_CXXFLAGS |
---|
61 | |
---|
62 | dnl restore initial values |
---|
63 | unset ac_cv_prog_gxx |
---|
64 | unset ac_cv_prog_cc_g |
---|
65 | unset ac_cv_prog_cxx_works |
---|
66 | unset ac_cv_prog_cxx_cross |
---|
67 | dnl somehow autoconf macros leave this file |
---|
68 | rm -f conftest.C |
---|
69 | ]) |
---|
70 | |
---|
71 | AC_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 | ]) |
---|