Post by Sam SteingoldOn Darwin (Mac OS) the gt_NO_CXX test fails because "Is g++" is not a
valid repetition-operator operand.
The attached patch fixes the problem.
Thanks. There is also another problem in this macro: Since a preprocessor
is allowed to insert additional spaces, it may transform the line
Is g++
to
Is g++
Therefore we should also avoid spaces in AC_EGREP_CPP patterns.
Note about your comment "So far only g++ and clang++ are supported.":
While technically you are right, in gnulib we prefer to see clang as a
gcc compatible compiler. So, when we write "test for GCC" we implicitly
mean "test for GCC (or clang, which is GCC compatible)".
Rationale:
* In configure scripts, 'test -n "$GCC"' is true for clang.
* clang has GCC-compatible options for warnings and many other things.
Applied as follows.
2017-12-05 Sam Steingold <***@gnu.org>
Bruno Haible <***@clisp.org>
no-c++: Avoid "egrep: repetition-operator operand invalid" error.
* m4/no-c++.m4 (gt_NO_CXX): Don't use '+' characters nor spaces in the
AC_EGREP_CPP pattern.
diff --git a/m4/no-c++.m4 b/m4/no-c++.m4
index ed06b22..cf63f6d 100644
--- a/m4/no-c++.m4
+++ b/m4/no-c++.m4
@@ -1,4 +1,4 @@
-# no-c++.m4 serial 1
+# no-c++.m4 serial 2
dnl Copyright (C) 2006, 2009-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -7,14 +7,14 @@ dnl with or without modifications, as long as this notice is preserved.
# Support for C source files that cannot be compiled by a C++ compiler.
# Set NO_CXX to the C++ compiler flags needed to request C mode instead of
# C++ mode.
-# So far only g++ is supported.
+# So far only g++ is supported. This includes clang++, as it is g++ compatible.
AC_DEFUN([gt_NO_CXX],
[
NO_CXX=
- AC_EGREP_CPP([Is g++], [
+ AC_EGREP_CPP([Is_g_plus_plus], [
#if defined __GNUC__ && defined __cplusplus
- Is g++
+ Is_g_plus_plus
#endif
],
[NO_CXX="-x c"])