X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Fansi-c%2B%2B.m4;h=d6352ee75872b1edb989ad0d4a7fe1f00145ffbe;hb=1a22d910adea20751cc5649b224574d07ba72815;hp=60662619c3cbc9612967dfb9872b6c14cfaa65d6;hpb=2893f5e97d5f56ccefdf3d315ed5b4a958eee769;p=gnulib.git diff --git a/m4/ansi-c++.m4 b/m4/ansi-c++.m4 index 60662619c..d6352ee75 100644 --- a/m4/ansi-c++.m4 +++ b/m4/ansi-c++.m4 @@ -1,11 +1,44 @@ -# ansi-c++.m4 serial 2 -dnl Copyright (C) 2002-2003, 2010 Free Software Foundation, Inc. +# ansi-c++.m4 serial 7 +dnl Copyright (C) 2002-2003, 2005, 2010-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. +# Sets CXX_CHOICE to 'yes' or 'no', depending on the preferred use of C++. +# The default is 'yes'. If the configure.ac contains a definition of the +# macro gl_CXX_CHOICE_DEFAULT_NO, then the default is 'no'. In both cases, +# the user can change the value by passing the option --disable-cxx or +# --enable-cxx, respectively. + +AC_DEFUN([gl_CXX_CHOICE], +[ + AC_MSG_CHECKING([whether to use C++]) + dnl Plus signs are supported in AC_ARG_ENABLE starting with autoconf-2.66. + m4_version_prereq([2.66], + [m4_ifdef([gl_CXX_CHOICE_DEFAULT_NO], + [AC_ARG_ENABLE([c++], + [ --enable-c++ also build C++ sources], + [CXX_CHOICE="$enableval"], + [CXX_CHOICE=no])], + [AC_ARG_ENABLE([c++], + [ --disable-c++ do not build C++ sources], + [CXX_CHOICE="$enableval"], + [CXX_CHOICE=yes])])], + [m4_ifdef([gl_CXX_CHOICE_DEFAULT_NO], + [AC_ARG_ENABLE([cxx], + [ --enable-cxx also build C++ sources], + [CXX_CHOICE="$enableval"], + [CXX_CHOICE=no])], + [AC_ARG_ENABLE([cxx], + [ --disable-cxx do not build C++ sources], + [CXX_CHOICE="$enableval"], + [CXX_CHOICE=yes])])]) + AC_MSG_RESULT([$CXX_CHOICE]) + AC_SUBST([CXX_CHOICE]) +]) + # gl_PROG_ANSI_CXX([ANSICXX_VARIABLE], [ANSICXX_CONDITIONAL]) # Sets ANSICXX_VARIABLE to the name of a sufficiently ANSI C++ compliant # compiler, or to ":" if none is found. @@ -14,13 +47,19 @@ dnl From Bruno Haible. AC_DEFUN([gl_PROG_ANSI_CXX], [ + AC_REQUIRE([gl_CXX_CHOICE]) m4_if([$1], [CXX], [], [gl_save_CXX="$CXX"]) + if test "$CXX_CHOICE" = no; then + CXX=":" + fi if test -z "$CXX"; then if test -n "$CCC"; then CXX="$CCC" else - AC_CHECK_PROGS([CXX], [g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC], [:]) + AC_CHECK_TOOLS([CXX], + [g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC], + [:]) fi fi if test "$CXX" != ":"; then @@ -77,9 +116,13 @@ EOF AM_CONDITIONAL([$2], [test "$$1" != ":"]) - dnl This macro invocation resolves an automake error: - dnl /usr/local/share/automake-1.11/am/depend2.am: am__fastdepCXX does not appear in AM_CONDITIONAL - dnl /usr/local/share/automake-1.11/am/depend2.am: The usual way to define `am__fastdepCXX' is to add `AC_PROG_CXX' - dnl /usr/local/share/automake-1.11/am/depend2.am: to `configure.ac' and run `aclocal' and `autoconf' again. - _AM_DEPENDENCIES([CXX]) + if test "$$1" != ":"; then + dnl This macro invocation resolves an automake error: + dnl /usr/local/share/automake-1.11/am/depend2.am: am__fastdepCXX does not appear in AM_CONDITIONAL + dnl /usr/local/share/automake-1.11/am/depend2.am: The usual way to define `am__fastdepCXX' is to add `AC_PROG_CXX' + dnl /usr/local/share/automake-1.11/am/depend2.am: to `configure.ac' and run `aclocal' and `autoconf' again. + _AM_DEPENDENCIES([CXX]) + else + AM_CONDITIONAL([am__fastdepCXX], [false]) + fi ])