summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-21 20:13:47 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-21 20:59:20 +0300
commitfabe15b29d7db7823568548da998b24e75f2cce8 (patch)
tree2d020720ae4c433c7e490b8c4f63cfe5ded3a6c5 /configure.ac
parentc74d1843675c20f958fb71d2bdf9fd5c79fe835e (diff)
downloadevol-hercules-fabe15b29d7db7823568548da998b24e75f2cce8.tar.gz
evol-hercules-fabe15b29d7db7823568548da998b24e75f2cce8.tar.bz2
evol-hercules-fabe15b29d7db7823568548da998b24e75f2cce8.tar.xz
evol-hercules-fabe15b29d7db7823568548da998b24e75f2cce8.zip
Add same compiler flags what was used in hercules.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac58
1 files changed, 57 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 1f8435b..1a0a685 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,8 +74,64 @@ AC_ARG_ENABLE(
)
AM_CONDITIONAL(ENABLE_GPROF, test x$enable_gprof = xyes)
-AC_CHECK_FUNC([strnlen],[CFLAGS="$CFLAGS -DHAVE_STRNLEN"])
+AC_DEFUN([AC_CHECK_COMPILER_WFLAG],
+ [
+ AC_MSG_CHECKING([whether $CC supports -W$1])
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -W$1"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([int foo;])],
+ [
+ AC_MSG_RESULT([yes])
+ CFLAGS="$OLD_CFLAGS -W$1"
+ # Optionally, run a test
+ if test "x$2" != "x"; then
+ AC_MSG_CHECKING([whether $CC can actually use -W$1])
+ CFLAGS="$OLD_CFLAGS -Werror -W$1"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([$2])],
+ [
+ AC_MSG_RESULT([no])
+ CFLAGS="$OLD_CFLAGS"
+ ]
+ [
+ AC_MSG_RESULT([yes])
+ CFLAGS="$OLD_CFLAGS -W$1"
+ ],
+ )
+ fi
+ ],
+ [
+ AC_MSG_RESULT([no])
+ CFLAGS="$OLD_CFLAGS"
+ ]
+ )
+ ]
+)
+AC_CHECK_COMPILER_WFLAG(empty-body)
+AC_CHECK_COMPILER_WFLAG(newline-eof)
+AC_CHECK_COMPILER_WFLAG(int-conversion)
+AC_CHECK_COMPILER_WFLAG(init-self)
+AC_CHECK_COMPILER_WFLAG(pointer-arith)
+AC_CHECK_COMPILER_WFLAG(switch-bool)
+AC_CHECK_COMPILER_WFLAG(enum-conversion)
+AC_CHECK_COMPILER_WFLAG(shorten-64-to-32)
+AC_CHECK_COMPILER_WFLAG(constant-conversion)
+AC_CHECK_COMPILER_WFLAG(bool-conversion)
+AC_CHECK_COMPILER_WFLAG(format-security)
+AC_CHECK_COMPILER_WFLAG(format)
+AC_CHECK_COMPILER_WFLAG(format-signedness)
+AC_CHECK_COMPILER_WFLAG(format-y2k)
+AC_CHECK_COMPILER_WFLAG(missing-include-dirs)
+AC_CHECK_COMPILER_WFLAG(suggest-attribute=noreturn)
+AC_CHECK_COMPILER_WFLAG(undef)
+
+AC_CHECK_FUNC([strnlen],[CFLAGS="$CFLAGS -DHAVE_STRNLEN"])
AC_CHECK_FUNC([setrlimit],[CLAGS="$CFLAGS -DHAVE_SETRLIMIT"])
+AC_MSG_CHECKING([PCRE library])
+AC_CHECK_HEADER([pcre.h], [], [AC_MSG_ERROR([PCRE header not found])])
+AC_SEARCH_LIBS([pcre_study], [pcre], [], AC_MSG_ERROR([PCRE not found or incompatible]))
+
AC_OUTPUT(Makefile src/Makefile)