From dff7391bd829eb73ad28b6f03a3310daad5605cc Mon Sep 17 00:00:00 2001 From: Haru Date: Tue, 19 Apr 2016 00:34:59 +0200 Subject: Added --enable-Werror option to the configure script It's not always possible (if at all) to pass -Werror in the CFLAGS, since autoconf often generates test-code that produces warnings. Example/reference: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734104 Signed-off-by: Haru --- configure.in | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'configure.in') diff --git a/configure.in b/configure.in index c276f7a31..848e055ea 100644 --- a/configure.in +++ b/configure.in @@ -338,6 +338,32 @@ AC_ARG_ENABLE( ) +# +# -Werror compiler flag +# It's not always possible (if at all) to pass -Werror in the CFLAGS, since +# autoconf often generates test-code that produces warnings. +# Reference: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734104 +# +AC_ARG_ENABLE( + [Werror], + AC_HELP_STRING( + [--enable-Werror], + [ + Enables -Werror in the compiler flags. (disabled by default) + ] + ), + [ + enable_Werror="$enableval" + case $enableval in + "no");; + "yes");; + *) AC_MSG_ERROR([[invalid argument --enable-Werror=$enableval... stopping]]);; + esac + ], + [enable_Werror="no"] +) + + # # Renewal # @@ -1379,6 +1405,35 @@ if test "$enable_static" != "no" ; then LIBS="$OLD_LIBS" fi +# +# -Werror compiler flag +# +if test "$enable_Werror" != "no" ; then + + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + + AC_MSG_CHECKING([whether $CC supports -Werror]) + AC_RUN_IFELSE( + [AC_LANG_SOURCE([ + int main(int argc, char **argv){ + return 0; + } + ])], + [ + AC_MSG_RESULT([yes]) + ], + [ + AC_MSG_RESULT([no]) + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + ], + [ + AC_MSG_RESULT([guessing no]) + ] + ) +fi + AC_SUBST(STATIC, ${STATIC}) AC_SUBST(PLUGINSTATIC, ${PLUGINSTATIC}) -- cgit v1.2.3-60-g2f50