1 # ansi-c++.m4 serial 1 (gettext-0.12)
2 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
9 # Sets CXX to the name of a sufficiently ANSI C++ compliant compiler,
10 # or to ":" if none is found.
12 AC_DEFUN([gt_PROG_ANSI_CXX],
14 AC_CHECK_PROGS(CXX, $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC, :)
15 if test "$CXX" != ":"; then
16 dnl Use a modified version of AC_PROG_CXX_WORKS that does not exit
18 AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works])
20 AC_ARG_VAR([CXX], [C++ compiler command])
21 AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])
22 echo 'int main () { return 0; }' > conftest.$ac_ext
23 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
24 ac_cv_prog_cxx_works=yes
25 if (./conftest; exit) 2>/dev/null; then
26 ac_cv_prog_cxx_cross=no
28 ac_cv_prog_cxx_cross=yes
31 ac_cv_prog_cxx_works=no
35 AC_MSG_RESULT($ac_cv_prog_cxx_works)
36 if test $ac_cv_prog_cxx_works = no; then
39 dnl Test for namespaces. Both libasprintf and tests/lang-c++ need it.
40 dnl We don't bother supporting pre-ANSI-C++ compilers.
41 AC_MSG_CHECKING([whether the C++ compiler supports namespaces])
43 cat <<EOF > conftest.$ac_ext
45 namespace test { using namespace std; }
47 int main () { return 0; }
49 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
50 gt_cv_prog_cxx_namespaces=yes
52 gt_cv_prog_cxx_namespaces=no
56 AC_MSG_RESULT($gt_cv_prog_cxx_namespaces)
57 if test $gt_cv_prog_cxx_namespaces = no; then