summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-04-19 00:34:59 +0200
committerHaru <haru@dotalux.com>2016-04-19 00:34:59 +0200
commitdff7391bd829eb73ad28b6f03a3310daad5605cc (patch)
treeeb8780e10e1e88a37dcb46e6805bf7c140c1d025
parent367e95d6596c7d6f39efc9dc0e236b8c91e8689a (diff)
downloadhercules-dff7391bd829eb73ad28b6f03a3310daad5605cc.tar.gz
hercules-dff7391bd829eb73ad28b6f03a3310daad5605cc.tar.bz2
hercules-dff7391bd829eb73ad28b6f03a3310daad5605cc.tar.xz
hercules-dff7391bd829eb73ad28b6f03a3310daad5605cc.zip
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 <haru@dotalux.com>
-rwxr-xr-xconfigure72
-rw-r--r--configure.in55
2 files changed, 126 insertions, 1 deletions
diff --git a/configure b/configure
index 249124006..ba2cc3815 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in bbcb040.
+# From configure.in 367e95d.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
@@ -703,6 +703,7 @@ enable_64bit
enable_lto
enable_static
enable_sanitize
+enable_Werror
enable_renewal
with_maxconn
with_mysql
@@ -1366,6 +1367,8 @@ Optional Features:
disabled by default)
--enable-sanitize[=ARG] Enables sanitizer. (disabled by default) (available
options: yes, no, full)
+ --enable-Werror Enables -Werror in the compiler flags. (disabled by
+ default)
--disable-renewal Disable Ragnarok Renewal support (override settings
in src/config/renewal.h)
@@ -3706,6 +3709,29 @@ fi
#
+# -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
+#
+# Check whether --enable-Werror was given.
+if test "${enable_Werror+set}" = set; then :
+ enableval=$enable_Werror;
+ enable_Werror="$enableval"
+ case $enableval in
+ "no");;
+ "yes");;
+ *) as_fn_error $? "invalid argument --enable-Werror=$enableval... stopping" "$LINENO" 5;;
+ esac
+
+else
+ enable_Werror="no"
+
+fi
+
+
+
+#
# Renewal
#
# Check whether --enable-renewal was given.
@@ -8993,6 +9019,50 @@ fi
LIBS="$OLD_LIBS"
fi
+#
+# -Werror compiler flag
+#
+if test "$enable_Werror" != "no" ; then
+
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Werror" >&5
+$as_echo_n "checking whether $CC supports -Werror... " >&6; }
+ if test "$cross_compiling" = yes; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: guessing no" >&5
+$as_echo "guessing no" >&6; }
+
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ int main(int argc, char **argv){
+ return 0;
+ }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+ LDFLAGS="$OLD_LDFLAGS"
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+
STATIC=${STATIC}
PLUGINSTATIC=${PLUGINSTATIC}
diff --git a/configure.in b/configure.in
index c276f7a31..848e055ea 100644
--- a/configure.in
+++ b/configure.in
@@ -339,6 +339,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
#
AC_ARG_ENABLE(
@@ -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})