Reviewers: hahnjo,
Message:
I don't think we should go this hacky way. For Clang
I'm already fixing this
issue with https://sourceforge.net/p/testlilyissues/issues/5608/
(Especially the confdefs.h should be fixed correctly,
by untangling AutoConf and StepMake and not define
the macro twice in the first place.)
I agree. My patch is rather a proof of concept to show what's
necessary. However, this 'untangling' is a tedious thing, and I favour
a quick 'n' dirty solution over something that needs a lot of thinking
and will happen in the far, far future... For example, we could mark is
as a hack even more prominently than the 'urg' notice. But maybe you
are working on this right now :-)
Description:
configure: Fix tests for compiler warning flags.
`AC_LANG_PROGRAM` ignores compiler warnings. This behaviour made the
tests
always true and thus without any effect. We now add `-Werror` to
enforce an
error in case the warning flag is not known.
To make that work it is also necessary to compile `confdefs.h` without
warnings; we add a hack to undefine macro `PACKAGE_NAME`, which gets
defined
twice for historical reasons.
Please review this at https://codereview.appspot.com/551210043/
Affected files (+7, -2 lines):
M aclocal.m4
M configure.ac
Index: aclocal.m4
diff --git a/aclocal.m4 b/aclocal.m4
index
5e049fe2aed903fc580412ae7d4cee11fe39c3ac..7d7881cb4f8224e7b451cdd4f5932f8a6da6fdc7
100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -912,6 +912,11 @@ AC_DEFUN(STEPMAKE_INIT, [
# AC_DEFINE_UNQUOTED(package, ["${package}"])
# AC_DEFINE_UNQUOTED(PACKAGE, ["${PACKAGE}"])
AC_DEFINE_UNQUOTED(PACKAGE, ["${package}"])
+
+ # ugh: PACKAGE_NAME is already defined by AC_INIT,
+ # which we call without arguments for historical reasons.
+ AS_ECHO([["#undef PACKAGE_NAME"]]) >> confdefs.h
+
AC_DEFINE_UNQUOTED(PACKAGE_NAME, ["${PACKAGE_NAME}"])
AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, ["${FULL_VERSION}"])
Index: configure.ac
diff --git a/configure.ac b/configure.ac
index
30e1f3b44c8c560fe0070ccc2997095ce86e4351..7df21b55236db7619a20e05f7215aaee11631bb2
100644
--- a/configure.ac
+++ b/configure.ac
@@ -221,7 +221,7 @@ CXXFLAGS="$save_CXXFLAGS"
# support the warning, so we have to check for the warning itself.
AC_MSG_CHECKING([whether $CXX supports -Wcast-function-type])
save_CXXFLAGS="$CXXFLAGS"
-CXXFLAGS=-Wcast-function-type
+CXXFLAGS="-Wcast-function-type -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])
CXXFLAGS="$save_CXXFLAGS -Wno-cast-function-type"],
@@ -235,7 +235,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
if test "$GUILEv2" != "yes"; then
AC_MSG_CHECKING([whether $CXX supports -Wsequence-point])
save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS=-Wsequence-point
+ CXXFLAGS="-Wsequence-point -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])
CXXFLAGS="$save_CXXFLAGS -Wno-sequence-point"],