From d816d2ac214f8a9bfbd58e092e083f42d0c2c34d Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Wed, 30 Jun 2010 15:06:44 +0200 Subject: [PATCH 5/7] [autotools] Set -ansi compiler flag early in configure.ac The -ansi compiler flag does not enable warnings, but turns of certain features of GCC. To force feature tests to use this flag, it should be set early in configure.ac This is important for the mingw compiler where header files refrain from declaring certain function (e.g. gettimeofday()) when the -ansi flag is set. --- configure.ac | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 48a3f15..bcf0ddc 100644 --- a/configure.ac +++ b/configure.ac @@ -25,6 +25,9 @@ AC_PROG_CC_STDC # CXX="gcc" #fi AC_PROG_CXX +if test "x$GXX" = "xyes"; then + CXXFLAGS="$CXXFLAGS -ansi" +fi AC_PROG_INSTALL AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Defines if gettimeofday is available on your system])) AC_CHECK_FUNC(localtime_r, AC_DEFINE(HAVE_LOCALTIME_R, 1, [Defines if localtime_r is available on your system])) @@ -596,8 +599,8 @@ if test "x$GCC" != xyes; then fi case "$enable_compile_warnings" in no) ;; - yes) CXXFLAGS="-Wall -Wno-write-strings -Woverloaded-virtual -Wnon-virtual-dtor -ansi $CXXFLAGS" ;; - kde) CXXFLAGS="-Wnon-virtual-dtor -Wno-long-long -Wundef -ansi \ + yes) CXXFLAGS="-Wall -Wno-write-strings -Woverloaded-virtual -Wnon-virtual-dtor $CXXFLAGS" ;; + kde) CXXFLAGS="-Wnon-virtual-dtor -Wno-long-long -Wundef \ -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -Wcast-align \ -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith \ -Wwrite-strings -O2 -Wformat-security \ -- 1.6.4.2