Skip to content

Commit ee14f96

Browse files
authored
Merge pull request #1191 from jimklimov/gcc-49-optional
Problem: test for C++11 (so g++-4.9) is unavoidable now
2 parents 49ef949 + bf6e619 commit ee14f96

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

zproject_autotools.gsl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,16 @@ AS_IF([test "x$enable_Werror" = "xyes" || test "x$enable_Werror" = "xauto"],
12381238
# One of big missing features in gcc-4.8 was std::regex support fixed in 4.9
12391239
# Testing code from https://stackoverflow.com/a/41186162/4715872
12401240
# caveats apply (use of unguaranteed private macros)
1241+
AC_ARG_ENABLE([gcc-std-regex],
1242+
AS_HELP_STRING([--enable-gcc-std-regex],
1243+
[Check for std::regex support if compiler is GCC, assuming it means satisfactory level of C++11 there [default=yes]]),
1244+
[enable_gcc_std_regex=$enableval],
1245+
[enable_gcc_std_regex=$defaultval])
1246+
1247+
AM_CONDITIONAL([ENABLE_GCC_STD_REGEX], [test x$enable_gcc_std_regex != xno])
1248+
12411249
AS_IF([test -n "$CXX"],[AS_IF([$CXX --version 2>&1 | grep 'Free Software Foundation' > /dev/null && test "x$GCC" = "xyes"],
1250+
[AS_IF([test "x$enable_gcc_std_regex" = "xyes" || test "x$enable_gcc_std_regex" = "xauto"],
12421251
[AC_MSG_CHECKING([for GNU C++11 support level expected by gcc-4.9 release or newer])
12431252
CXXFLAGS="$CXXFLAGS --std=c++11"
12441253
AC_LANG_PUSH([C++])
@@ -1269,9 +1278,12 @@ int main() {
12691278
#endif
12701279
return result ? EXIT_SUCCESS : EXIT_FAILURE;
12711280
}
1272-
], AC_MSG_RESULT([ok]), AC_MSG_ERROR([test for std::regex failed]) )
1281+
], AC_MSG_RESULT([ok]), AC_MSG_ERROR([test for std::regex failed]) )
12731282
AC_LANG_POP([C++])
12741283
]
1284+
,[AC_MSG_WARN([Not checking for GNU C++11 support level expected by gcc-4.9 release or newer, due to explicit configure option])
1285+
AC_MSG_WARN([YOU ARE AT RISK OF SOMETHING NOT WORKING WITH THIS BUILD OF THE CODEBASE])]
1286+
)]
12751287
)])
12761288

12771289
.endif

0 commit comments

Comments
 (0)