summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2018-08-07 02:00:37 +0200
committerBruno Haible <bruno@clisp.org>2018-08-07 02:00:37 +0200
commit00ce4c600ff2dab879eb25c066e933d457bea64b (patch)
tree4be678e4a460d768fcf6cdea4452cb63ea77875f
parentc6d92bd5ede1ad472cacf08e433644762cba4a66 (diff)
downloadgnulib-00ce4c600ff2dab879eb25c066e933d457bea64b.tar.gz
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.
-rw-r--r--ChangeLog14
-rw-r--r--m4/ansi-c++.m412
-rw-r--r--m4/fnmatch_h.m412
-rw-r--r--m4/iconv_h.m411
-rw-r--r--m4/monetary_h.m411
-rw-r--r--m4/utime_h.m422
-rw-r--r--modules/ansi-c++-opt2
7 files changed, 65 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 69834cd12a..dcf55c0811 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
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).
* lib/fnmatch.in.h: Fix conditions.
diff --git a/m4/ansi-c++.m4 b/m4/ansi-c++.m4
index 0cabd3425d..9eb362c82f 100644
--- a/m4/ansi-c++.m4
+++ b/m4/ansi-c++.m4
@@ -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 @@ EOF
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])
+])
diff --git a/m4/fnmatch_h.m4 b/m4/fnmatch_h.m4
index a5a1aa2dca..c40d0a713b 100644
--- a/m4/fnmatch_h.m4
+++ b/m4/fnmatch_h.m4
@@ -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 @@ dnl From Bruno Haible.
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 @@ AC_DEFUN([gl_FNMATCH_H],
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])
diff --git a/m4/iconv_h.m4 b/m4/iconv_h.m4
index 918969e911..253c00837b 100644
--- a/m4/iconv_h.m4
+++ b/m4/iconv_h.m4
@@ -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_MODULE_INDICATOR],
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 @@ AC_DEFUN([gl_ICONV_H_DEFAULTS],
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"])
])
diff --git a/m4/monetary_h.m4 b/m4/monetary_h.m4
index 0866b80826..887ed91f67 100644
--- a/m4/monetary_h.m4
+++ b/m4/monetary_h.m4
@@ -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],
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])
diff --git a/m4/utime_h.m4 b/m4/utime_h.m4
index ab459fe8f1..89a9981849 100644
--- a/m4/utime_h.m4
+++ b/m4/utime_h.m4
@@ -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_DEFUN([gl_UTIME_H],
[
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 @@ AC_DEFUN([gl_UTIME_H],
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])
diff --git a/modules/ansi-c++-opt b/modules/ansi-c++-opt
index 719c076a4b..176f174579 100644
--- a/modules/ansi-c++-opt
+++ b/modules/ansi-c++-opt
@@ -7,7 +7,7 @@ m4/ansi-c++.m4
Depends-on:
configure.ac:
-gl_PROG_ANSI_CXX([CXX], [ANSICXX])
+AC_REQUIRE([gl_ANSI_CXX])
Makefile.am: