Commit 0418645b authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Handle g++ as a compiler when -Wstrict-prototypes is an invalid option, this...

Handle g++ as a compiler when -Wstrict-prototypes is an invalid option, this emits a warning which can become an error.

To add to the fun the standard test program uses 'int main()', so we need our own program to check things, also PACKAGE_URL is a macro re-define, also an error...
parent ff7c133a
......@@ -19,9 +19,6 @@
AC_INIT([SWIFT],[0.7.0],[https://gitlab.cosma.dur.ac.uk/swift/swiftsim])
swift_config_flags="$*"
# Need to define this, instead of using fifth argument of AC_INIT, until 2.64.
AC_DEFINE([PACKAGE_URL],["www.swiftsim.com"], [Package web pages])
AC_COPYRIGHT
AC_CONFIG_SRCDIR([src/space.c])
AC_CONFIG_AUX_DIR([.])
......@@ -687,7 +684,7 @@ if test "x$with_profiler" != "xno"; then
proflibs="-lprofiler"
fi
AC_CHECK_LIB([profiler],[ProfilerFlush],
[have_profiler="yes"
[have_profiler="yes"
AC_DEFINE([WITH_PROFILER],1,[Link against the gperftools profiling library.])],
[have_profiler="no"], $proflibs)
......@@ -830,16 +827,17 @@ if test "$enable_warn" != "no"; then
# We will do this by hand instead and only default to the macro for unknown compilers
case "$ax_cv_c_compiler_vendor" in
gnu | clang)
CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter -Wshadow -Wstrict-prototypes"
CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter -Wshadow"
;;
intel)
CFLAGS="$CFLAGS -w2 -Wunused-variable -Wshadow -Wstrict-prototypes"
CFLAGS="$CFLAGS -w2 -Wunused-variable -Wshadow"
;;
*)
AX_CFLAGS_WARN_ALL
;;
esac
# Add a "choke on warning" flag if it exists
if test "$enable_warn" = "error"; then
case "$ax_cv_c_compiler_vendor" in
......@@ -848,6 +846,11 @@ if test "$enable_warn" != "no"; then
;;
esac
fi
# We want strict-prototypes, but this must still work even if warnings
# are an error.
AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes],[CFLAGS="$CFLAGS -Wstrict-prototypes"],
[CFLAGS="$CFLAGS"],[$CFLAGS],[AC_LANG_SOURCE([int main(void){return 0;}])])
fi
# Various package configuration options.
......@@ -1211,6 +1214,11 @@ AC_DEFINE_UNQUOTED([SWIFT_CONFIG_FLAGS],["$swift_config_flags"],[Flags passed to
# Make sure the latest git revision string gets included
touch src/version.c
# Need to define this, instead of using fifth argument of AC_INIT, until
# 2.64. Defer until now as this redefines PACKAGE_URL, which can emit a
# compilation error when testing with -Werror.
AC_DEFINE([PACKAGE_URL],["www.swiftsim.com"], [Package web pages])
# Generate output.
AC_OUTPUT
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment