xmalloc: Do not leak if underlying realloc is C99 compatible.
[gnulib.git] / m4 / ansi-c++.m4
index b8bd73f..d6352ee 100644 (file)
@@ -1,5 +1,5 @@
-# ansi-c++.m4 serial 4
-dnl Copyright (C) 2002-2003, 2005, 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.
@@ -15,17 +15,26 @@ dnl From Bruno Haible.
 AC_DEFUN([gl_CXX_CHOICE],
 [
   AC_MSG_CHECKING([whether to use C++])
-  dnl It would be so nice if plus signs were supported in AC_ARG_ENABLE.
-  dnl Feature request submitted on 2010-03-13.
-  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])])
+  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])
 ])
@@ -48,7 +57,9 @@ AC_DEFUN([gl_PROG_ANSI_CXX],
     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
@@ -105,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
 ])