From: Bart Van Assche Date: Sun, 11 May 2008 06:41:46 +0000 (+0000) Subject: Added tests for -Wextra/-W and --param inline-unit-growth. Converted AC_COMPILE_IFELS... X-Git-Tag: svn/VALGRIND_3_4_0~602 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=63944deddee75fa85201ada2999cdaabc1425aaa;p=thirdparty%2Fvalgrind.git Added tests for -Wextra/-W and --param inline-unit-growth. Converted AC_COMPILE_IFELSE() into AC_TRY_COMPILE(). Removed trailing spaces. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8037 --- diff --git a/configure.in b/configure.in index d61786ba9f..cfc2d7585b 100644 --- a/configure.in +++ b/configure.in @@ -666,16 +666,13 @@ AC_MSG_RESULT([no]) AC_MSG_CHECKING([for pthread_mutex_t::__m_kind]) -AC_COMPILE_IFELSE( +AC_TRY_COMPILE( [ -#include -int main(int argc, char** argv) -{ + #include +], [ pthread_mutex_t m; return m.__m_kind; -} -], -[ +], [ AC_MSG_RESULT([yes]) AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1, [Define to 1 if pthread_mutex_t has a member called __m_kind.]) @@ -688,16 +685,13 @@ AC_MSG_RESULT([no]) AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind]) -AC_COMPILE_IFELSE( +AC_TRY_COMPILE( [ -#include -int main(int argc, char** argv) -{ +#include +], [ pthread_mutex_t m; return m.__data.__kind; -} -], -[ +], [ AC_MSG_RESULT([yes]) AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1, [Define to 1 if pthread_mutex_t has a member __data.__kind.]) @@ -908,7 +902,7 @@ AC_SUBST(PREFERRED_STACK_BOUNDARY) # does this compiler support -Wno-pointer-sign ? -AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ]) +AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign]) safe_CFLAGS=$CFLAGS CFLAGS="-Wno-pointer-sign" @@ -931,7 +925,7 @@ fi # does this compiler support -Wdeclaration-after-statement ? -AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement ]) +AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement]) safe_CFLAGS=$CFLAGS CFLAGS="-Wdeclaration-after-statement" @@ -957,8 +951,41 @@ if test x$declaration_after_statement = xyes; then fi +# does this compiler support -Wextra or the older -W ? + +AC_MSG_CHECKING([if gcc accepts -Wextra or -W]) + +safe_CFLAGS=$CFLAGS +CFLAGS="-Wextra" + +AC_TRY_COMPILE( +[ ], +[ + return 0; +], +[ +AC_SUBST([FLAG_W_EXTRA], [-Wextra]) +AC_MSG_RESULT([-Wextra]) +], [ + CFLAGS="-W" + AC_TRY_COMPILE( + [ ], + [ + return 0; + ], + [ + AC_SUBST([FLAG_W_EXTRA], [-W]) + AC_MSG_RESULT([-W]) + ], [ + AC_SUBST([FLAG_W_EXTRA], []) + AC_MSG_RESULT([not supported]) + ]) +]) +CFLAGS=$safe_CFLAGS + + # does this compiler support -fno-stack-protector ? -AC_MSG_CHECKING([if gcc accepts -fno-stack-protector ]) +AC_MSG_CHECKING([if gcc accepts -fno-stack-protector]) safe_CFLAGS=$CFLAGS CFLAGS="-fno-stack-protector" @@ -984,9 +1011,32 @@ if test x$no_stack_protector = xyes; then fi +# does this compiler support --param inline-unit-growth=... ? + +AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth]) + +safe_CFLAGS=$CFLAGS +CFLAGS="--param inline-unit-growth=900" + +AC_TRY_COMPILE( +[ ], +[ + return 0; +], +[ +AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], + ["--param inline-unit-growth=900"]) +AC_MSG_RESULT([yes]) +], [ +AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""]) +AC_MSG_RESULT([no]) +]) +CFLAGS=$safe_CFLAGS + + # does this compiler support __builtin_expect? AC_MSG_CHECKING([if gcc supports __builtin_expect]) - + AC_TRY_LINK(, [ return __builtin_expect(1, 1) ? 1 : 0 ],