[51c195d5] | 1 | dnl |
---|
| 2 | dnl $Id$ |
---|
| 3 | dnl |
---|
| 4 | dnl Check for target g++ |
---|
| 5 | dnl |
---|
[2efdd08] | 6 | dnl 98/05/20 Ralf Corsepius (corsepiu@faw.uni-ulm.de) |
---|
| 7 | dnl Completely reworked |
---|
| 8 | |
---|
[51c195d5] | 9 | AC_DEFUN(RTEMS_PROG_CXX, |
---|
| 10 | [ |
---|
| 11 | AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl |
---|
| 12 | AC_BEFORE([$0], [AC_PROG_CXX])dnl |
---|
[2efdd08] | 13 | AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl |
---|
| 14 | |
---|
| 15 | dnl Only accept g++ and c++ |
---|
| 16 | dnl NOTE: This might be too restrictive for native compilation |
---|
| 17 | AC_PATH_PROGS(CXX_FOR_TARGET, "$program_prefix"g++ "$program_prefix"c++) |
---|
| 18 | test -z "$CXX_FOR_TARGET" \ |
---|
| 19 | && AC_MSG_ERROR([no acceptable c++ found in \$PATH]) |
---|
[51c195d5] | 20 | |
---|
[2efdd08] | 21 | dnl backup |
---|
| 22 | rtems_save_CXX=$CXX |
---|
| 23 | rtems_save_CXXFLAGS=$CXXFLAGS |
---|
| 24 | |
---|
| 25 | dnl temporarily set CXX |
---|
| 26 | CXX=$CXX_FOR_TARGET |
---|
| 27 | |
---|
| 28 | AC_PROG_CXX_WORKS |
---|
[51c195d5] | 29 | AC_PROG_CXX_GNU |
---|
| 30 | |
---|
| 31 | if test $ac_cv_prog_gxx = yes; then |
---|
| 32 | GXX=yes |
---|
| 33 | dnl Check whether -g works, even if CXXFLAGS is set, in case the package |
---|
| 34 | dnl plays around with CXXFLAGS (such as to build both debugging and |
---|
| 35 | dnl normal versions of a library), tasteless as that idea is. |
---|
| 36 | ac_test_CXXFLAGS="${CXXFLAGS+set}" |
---|
| 37 | ac_save_CXXFLAGS="$CXXFLAGS" |
---|
| 38 | CXXFLAGS= |
---|
| 39 | AC_PROG_CXX_G |
---|
| 40 | if test "$ac_test_CXXFLAGS" = set; then |
---|
| 41 | CXXFLAGS="$ac_save_CXXFLAGS" |
---|
| 42 | elif test $ac_cv_prog_cxx_g = yes; then |
---|
| 43 | CXXFLAGS="-g -O2" |
---|
| 44 | else |
---|
| 45 | CXXFLAGS="-O2" |
---|
| 46 | fi |
---|
| 47 | else |
---|
| 48 | GXX= |
---|
| 49 | test "${CXXFLAGS+set}" = set || CXXFLAGS="-g" |
---|
| 50 | fi |
---|
| 51 | |
---|
[2efdd08] | 52 | rtems_cv_prog_gxx=$ac_cv_prog_gxx |
---|
| 53 | rtems_cv_prog_cxx_g=$ac_cv_prog_cxx_g |
---|
| 54 | rtems_cv_prog_cxx_works=$ac_cv_prog_cxx_works |
---|
| 55 | rtems_cv_prog_cxx_cross=$ac_cv_prog_cxx_cross |
---|
[51c195d5] | 56 | |
---|
[2efdd08] | 57 | CXX=$rtems_save_CXX |
---|
| 58 | CXXFLAGS=$rtems_save_CXXFLAGS |
---|
[51c195d5] | 59 | |
---|
[2efdd08] | 60 | dnl restore initial values |
---|
| 61 | unset ac_cv_prog_gxx |
---|
| 62 | unset ac_cv_prog_cc_g |
---|
| 63 | unset ac_cv_prog_cxx_works |
---|
| 64 | unset ac_cv_prog_cxx_cross |
---|
[51c195d5] | 65 | ]) |
---|