nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | # ansi-c++.m4 serial 9 |
2 | dnl Copyright (C) 2002-2003, 2005, 2010-2016 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. |
||
6 | |||
7 | dnl From Bruno Haible. |
||
8 | |||
9 | # Sets CXX_CHOICE to 'yes' or 'no', depending on the preferred use of C++. |
||
10 | # The default is 'yes'. If the configure.ac contains a definition of the |
||
11 | # macro gl_CXX_CHOICE_DEFAULT_NO, then the default is 'no'. In both cases, |
||
12 | # the user can change the value by passing the option --disable-cxx or |
||
13 | # --enable-cxx, respectively. |
||
14 | |||
15 | AC_DEFUN([gl_CXX_CHOICE], |
||
16 | [ |
||
17 | AC_MSG_CHECKING([whether to use C++]) |
||
18 | dnl Plus signs are supported in AC_ARG_ENABLE starting with autoconf-2.66. |
||
19 | m4_version_prereq([2.66], |
||
20 | [m4_ifdef([gl_CXX_CHOICE_DEFAULT_NO], |
||
21 | [AC_ARG_ENABLE([c++], |
||
22 | [ --enable-c++ also build C++ sources], |
||
23 | [CXX_CHOICE="$enableval"], |
||
24 | [CXX_CHOICE=no])], |
||
25 | [AC_ARG_ENABLE([c++], |
||
26 | [ --disable-c++ do not build C++ sources], |
||
27 | [CXX_CHOICE="$enableval"], |
||
28 | [CXX_CHOICE=yes])])], |
||
29 | [m4_ifdef([gl_CXX_CHOICE_DEFAULT_NO], |
||
30 | [AC_ARG_ENABLE([cxx], |
||
31 | [ --enable-cxx also build C++ sources], |
||
32 | [CXX_CHOICE="$enableval"], |
||
33 | [CXX_CHOICE=no])], |
||
34 | [AC_ARG_ENABLE([cxx], |
||
35 | [ --disable-cxx do not build C++ sources], |
||
36 | [CXX_CHOICE="$enableval"], |
||
37 | [CXX_CHOICE=yes])])]) |
||
38 | AC_MSG_RESULT([$CXX_CHOICE]) |
||
39 | AC_SUBST([CXX_CHOICE]) |
||
40 | ]) |
||
41 | |||
42 | # gl_PROG_ANSI_CXX([ANSICXX_VARIABLE], [ANSICXX_CONDITIONAL]) |
||
43 | # Sets ANSICXX_VARIABLE to the name of a sufficiently ANSI C++ compliant |
||
44 | # compiler, or to "no" if none is found. |
||
45 | # Defines the Automake condition ANSICXX_CONDITIONAL to true if such a compiler |
||
46 | # was found, or to false if not. |
||
47 | |||
48 | AC_DEFUN([gl_PROG_ANSI_CXX], |
||
49 | [ |
||
50 | AC_REQUIRE([gl_CXX_CHOICE]) |
||
51 | m4_if([$1], [CXX], [], |
||
52 | [gl_save_CXX="$CXX"]) |
||
53 | if test "$CXX_CHOICE" = no; then |
||
54 | CXX=no |
||
55 | fi |
||
56 | if test -z "$CXX"; then |
||
57 | if test -n "$CCC"; then |
||
58 | CXX="$CCC" |
||
59 | else |
||
60 | AC_CHECK_TOOLS([CXX], |
||
61 | [g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC], |
||
62 | [:]) |
||
63 | fi |
||
64 | fi |
||
65 | if test "$CXX" != no; then |
||
66 | dnl Use a modified version of AC_PROG_CXX_WORKS that does not exit |
||
67 | dnl upon failure. |
||
68 | AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works]) |
||
69 | AC_LANG_PUSH([C++]) |
||
70 | AC_ARG_VAR([CXX], [C++ compiler command]) |
||
71 | AC_ARG_VAR([CXXFLAGS], [C++ compiler flags]) |
||
72 | echo 'int main () { return 0; }' > conftest.$ac_ext |
||
73 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then |
||
74 | gl_cv_prog_ansicxx_works=yes |
||
75 | if (./conftest; exit) 2>/dev/null; then |
||
76 | gl_cv_prog_ansicxx_cross=no |
||
77 | else |
||
78 | gl_cv_prog_ansicxx_cross=yes |
||
79 | fi |
||
80 | else |
||
81 | gl_cv_prog_ansicxx_works=no |
||
82 | fi |
||
83 | rm -fr conftest* |
||
84 | AC_LANG_POP([C++]) |
||
85 | AC_MSG_RESULT([$gl_cv_prog_ansicxx_works]) |
||
86 | if test $gl_cv_prog_ansicxx_works = no; then |
||
87 | CXX=no |
||
88 | else |
||
89 | dnl Test for namespaces. |
||
90 | dnl We don't bother supporting pre-ANSI-C++ compilers. |
||
91 | AC_MSG_CHECKING([whether the C++ compiler supports namespaces]) |
||
92 | AC_LANG_PUSH([C++]) |
||
93 | cat <<EOF > conftest.$ac_ext |
||
94 | #include <iostream> |
||
95 | namespace test { using namespace std; } |
||
96 | std::ostream* ptr; |
||
97 | int main () { return 0; } |
||
98 | EOF |
||
99 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then |
||
100 | gl_cv_prog_ansicxx_namespaces=yes |
||
101 | else |
||
102 | gl_cv_prog_ansicxx_namespaces=no |
||
103 | fi |
||
104 | rm -fr conftest* |
||
105 | AC_LANG_POP([C++]) |
||
106 | AC_MSG_RESULT([$gl_cv_prog_ansicxx_namespaces]) |
||
107 | if test $gl_cv_prog_ansicxx_namespaces = no; then |
||
108 | CXX=no |
||
109 | fi |
||
110 | fi |
||
111 | fi |
||
112 | m4_if([$1], [CXX], [], |
||
113 | [$1="$CXX" |
||
114 | CXX="$gl_save_CXX"]) |
||
115 | AC_SUBST([$1]) |
||
116 | |||
117 | AM_CONDITIONAL([$2], [test "$$1" != no]) |
||
118 | |||
119 | if test "$$1" != no; then |
||
120 | dnl This macro invocation resolves an automake error: |
||
121 | dnl /usr/local/share/automake-1.11/am/depend2.am: am__fastdepCXX does not appear in AM_CONDITIONAL |
||
122 | dnl /usr/local/share/automake-1.11/am/depend2.am: The usual way to define 'am__fastdepCXX' is to add 'AC_PROG_CXX' |
||
123 | dnl /usr/local/share/automake-1.11/am/depend2.am: to 'configure.ac' and run 'aclocal' and 'autoconf' again. |
||
124 | _AM_DEPENDENCIES([CXX]) |
||
125 | else |
||
126 | AM_CONDITIONAL([am__fastdepCXX], [false]) |
||
127 | fi |
||
128 | ]) |