changeset 39775:9e0852441f4b

Force generation of substitute .h file when C++ support is enabled. * m4/ansi-c++.m4 (gl_ANSI_CXX): New macro. * modules/ansi-c++-opt (configure.ac): Just require gl_ANSI_CXX. * m4/fnmatch_h.m4 (gl_FNMATCH_H): If C++ support is enabled, set FNMATCH_H to non-empty. * m4/iconv_h.m4 (gl_ICONV_H_DEFAULTS): If C++ support is enabled, set ICONV_H to non-empty. * m4/monetary_h.m4 (gl_MONETARY_H_BODY): If C++ support is enabled, set MONETARY_H to non-empty. * m4/utime_h.m4 (gl_UTIME_H): If C++ support is enabled, set UTIME_H to non-empty.
author Bruno Haible <bruno@clisp.org>
date Tue, 07 Aug 2018 02:00:37 +0200
parents a8ff12fcd1ea
children 620c49edf4cf
files ChangeLog m4/ansi-c++.m4 m4/fnmatch_h.m4 m4/iconv_h.m4 m4/monetary_h.m4 m4/utime_h.m4 modules/ansi-c++-opt
diffstat 7 files changed, 65 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Aug 07 00:25:13 2018 +0200
+++ b/ChangeLog	Tue Aug 07 02:00:37 2018 +0200
@@ -1,3 +1,17 @@
+2018-08-06  Bruno Haible  <bruno@clisp.org>
+
+	Force generation of substitute .h file when C++ support is enabled.
+	* m4/ansi-c++.m4 (gl_ANSI_CXX): New macro.
+	* modules/ansi-c++-opt (configure.ac): Just require gl_ANSI_CXX.
+	* m4/fnmatch_h.m4 (gl_FNMATCH_H): If C++ support is enabled, set
+	FNMATCH_H to non-empty.
+	* m4/iconv_h.m4 (gl_ICONV_H_DEFAULTS): If C++ support is enabled, set
+	ICONV_H to non-empty.
+	* m4/monetary_h.m4 (gl_MONETARY_H_BODY): If C++ support is enabled, set
+	MONETARY_H to non-empty.
+	* m4/utime_h.m4 (gl_UTIME_H): If C++ support is enabled, set UTIME_H to
+	non-empty.
+
 2018-08-06  Bruno Haible  <bruno@clisp.org>
 
 	fnmatch-h: Fix test compilation error on mingw (regression from today).
--- a/m4/ansi-c++.m4	Tue Aug 07 00:25:13 2018 +0200
+++ b/m4/ansi-c++.m4	Tue Aug 07 02:00:37 2018 +0200
@@ -1,4 +1,4 @@
-# ansi-c++.m4 serial 9
+# ansi-c++.m4 serial 10
 dnl Copyright (C) 2002-2003, 2005, 2010-2018 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -126,3 +126,13 @@
     AM_CONDITIONAL([am__fastdepCXX], [false])
   fi
 ])
+
+# gl_ANSI_CXX
+# Sets CXX to the name of a sufficiently ANSI C++ compliant compiler, or to
+# "no" if none is found.
+# Defines the Automake condition ANSICXX to true if such a compiler was found,
+# or to false if not.
+AC_DEFUN([gl_ANSI_CXX],
+[
+  gl_PROG_ANSI_CXX([CXX], [ANSICXX])
+])
--- a/m4/fnmatch_h.m4	Tue Aug 07 00:25:13 2018 +0200
+++ b/m4/fnmatch_h.m4	Tue Aug 07 02:00:37 2018 +0200
@@ -1,4 +1,4 @@
-# fnmatch_h.m4 serial 1
+# fnmatch_h.m4 serial 2
 dnl Copyright (C) 2009-2018 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,6 +9,7 @@
 AC_DEFUN([gl_FNMATCH_H],
 [
   AC_REQUIRE([gl_FNMATCH_H_DEFAULTS])
+  m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
   AC_CHECK_HEADERS_ONCE([fnmatch.h])
   gl_CHECK_NEXT_HEADERS([fnmatch.h])
 
@@ -28,9 +29,14 @@
   m4_ifdef([gl_POSIXCHECK],
     [FNMATCH_H=fnmatch.h],
     [FNMATCH_H=''
-     if test $ac_cv_header_fnmatch_h != yes; then
-       dnl Provide a substitute <fnmatch.h> file.
+     if m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]); then
+       dnl Override <fnmatch.h> always, to support the C++ GNULIB_NAMESPACE.
        FNMATCH_H=fnmatch.h
+     else
+       if test $ac_cv_header_fnmatch_h != yes; then
+         dnl Provide a substitute <fnmatch.h> file.
+         FNMATCH_H=fnmatch.h
+       fi
      fi
     ])
   AC_SUBST([FNMATCH_H])
--- a/m4/iconv_h.m4	Tue Aug 07 00:25:13 2018 +0200
+++ b/m4/iconv_h.m4	Tue Aug 07 02:00:37 2018 +0200
@@ -1,4 +1,4 @@
-# iconv_h.m4 serial 10
+# iconv_h.m4 serial 11
 dnl Copyright (C) 2007-2018 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -36,6 +36,7 @@
 
 AC_DEFUN([gl_ICONV_H_DEFAULTS],
 [
+  m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
   GNULIB_ICONV=0;       AC_SUBST([GNULIB_ICONV])
   dnl Assume proper GNU behavior unless another module says otherwise.
   ICONV_CONST=;         AC_SUBST([ICONV_CONST])
@@ -43,6 +44,12 @@
   REPLACE_ICONV_OPEN=0; AC_SUBST([REPLACE_ICONV_OPEN])
   REPLACE_ICONV_UTF=0;  AC_SUBST([REPLACE_ICONV_UTF])
   ICONV_H='';           AC_SUBST([ICONV_H])
-  m4_ifdef([gl_POSIXCHECK],[ICONV_H='iconv.h'])
+  m4_ifdef([gl_POSIXCHECK],
+    [ICONV_H='iconv.h'],
+    [if m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]); then
+       dnl Override <fnmatch.h> always, to support the C++ GNULIB_NAMESPACE.
+       ICONV_H='iconv.h'
+     fi
+    ])
   AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"])
 ])
--- a/m4/monetary_h.m4	Tue Aug 07 00:25:13 2018 +0200
+++ b/m4/monetary_h.m4	Tue Aug 07 02:00:37 2018 +0200
@@ -1,4 +1,4 @@
-# monetary_h.m4 serial 2
+# monetary_h.m4 serial 3
 dnl Copyright (C) 2017-2018 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,11 +14,14 @@
 AC_DEFUN([gl_MONETARY_H_BODY],
 [
   AC_REQUIRE([gl_MONETARY_H_DEFAULTS])
+  m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
 
   AC_CHECK_HEADERS_ONCE([monetary.h])
-  dnl For now, we provide a <monetary.h> wrapper only if the system already
-  dnl has a <monetary.h>.
-  if m4_ifdef([gl_POSIXCHECK],[true],[test $ac_cv_header_monetary_h = yes]); then
+  dnl For now, we provide a <monetary.h> wrapper only if
+  dnl - module 'posixcheck' is present, or
+  dnl - C++ GNULIB_NAMESPACE support may be requested, or
+  dnl - the system already has a <monetary.h>.
+  if m4_ifdef([gl_POSIXCHECK], [true], [m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]) || test $ac_cv_header_monetary_h = yes]); then
     MONETARY_H='monetary.h'
 
     gl_CHECK_NEXT_HEADERS([monetary.h])
--- a/m4/utime_h.m4	Tue Aug 07 00:25:13 2018 +0200
+++ b/m4/utime_h.m4	Tue Aug 07 02:00:37 2018 +0200
@@ -1,4 +1,4 @@
-# utime_h.m4 serial 2
+# utime_h.m4 serial 3
 dnl Copyright (C) 2017-2018 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,6 +10,7 @@
 [
   AC_REQUIRE([AC_CANONICAL_HOST])
   AC_REQUIRE([gl_UTIME_H_DEFAULTS])
+  m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
   AC_CHECK_HEADERS_ONCE([utime.h])
   gl_CHECK_NEXT_HEADERS([utime.h])
 
@@ -23,15 +24,20 @@
   m4_ifdef([gl_POSIXCHECK],
     [UTIME_H=utime.h],
     [UTIME_H=''
-     if test $ac_cv_header_utime_h != yes; then
-       dnl Provide a substitute <utime.h> file.
+     if m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]); then
+       dnl Override <utime.h> always, to support the C++ GNULIB_NAMESPACE.
        UTIME_H=utime.h
      else
-       case "$host_os" in
-         mingw*) dnl Need special handling of 'struct utimbuf'.
-           UTIME_H=utime.h
-           ;;
-       esac
+       if test $ac_cv_header_utime_h != yes; then
+         dnl Provide a substitute <utime.h> file.
+         UTIME_H=utime.h
+       else
+         case "$host_os" in
+           mingw*) dnl Need special handling of 'struct utimbuf'.
+             UTIME_H=utime.h
+             ;;
+         esac
+       fi
      fi
     ])
   AC_SUBST([UTIME_H])
--- a/modules/ansi-c++-opt	Tue Aug 07 00:25:13 2018 +0200
+++ b/modules/ansi-c++-opt	Tue Aug 07 02:00:37 2018 +0200
@@ -7,7 +7,7 @@
 Depends-on:
 
 configure.ac:
-gl_PROG_ANSI_CXX([CXX], [ANSICXX])
+AC_REQUIRE([gl_ANSI_CXX])
 
 Makefile.am: