From 5252a9ad51a480a8b070473b5dffeeaf4c64514c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 22 May 2008 17:32:18 +0200 Subject: Create a backend macro CC_CHECK_FLAGS_SILENT for specific flag macros, and use it for checking -fvisibility=hidden. --HG-- extra : transplant_source : %7B%9AW%E8%B4u%06%18%E4%25K%80d%CF%B2z%EA%0C%ECA --- m4/attributes.m4 | 56 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 25 deletions(-) (limited to 'm4') diff --git a/m4/attributes.m4 b/m4/attributes.m4 index 56cdd51d1..2b7175b1c 100644 --- a/m4/attributes.m4 +++ b/m4/attributes.m4 @@ -32,9 +32,8 @@ dnl distribute a modified version of the Autoconf Macro, you may extend dnl this special exception to the GPL to apply to your modified version as dnl well. -AC_DEFUN([CC_CHECK_CFLAGS], [ - AC_CACHE_CHECK([if $CC supports $1 flag], - AS_TR_SH([cc_cv_cflags_$1]), +AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [ + AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]), [ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $1" AC_COMPILE_IFELSE([int a;], @@ -50,6 +49,19 @@ AC_DEFUN([CC_CHECK_CFLAGS], [ fi ]) +AC_DEFUN([CC_CHECK_CFLAGS], [ + AC_CACHE_CHECK([if $CC supports $1 flag], + AS_TR_SH([cc_cv_cflags_$1]), + CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here! + ) + + if eval test [x$]AS_TR_SH([cc_cv_cflags_$1]) = xyes; then + ifelse([$2], , [:], [$2]) + else + ifelse([$3], , [:], [$3]) + fi +]) + dnl Check for a -Werror flag or equivalent. -Werror is the GCC dnl and ICC flag that tells the compiler to treat all the warnings dnl as fatal. We usually need this option to make sure that some @@ -175,28 +187,22 @@ AC_DEFUN([CC_ATTRIBUTE_PACKED], [ ]) AC_DEFUN([CC_FLAG_VISIBILITY], [ - AC_REQUIRE([CC_CHECK_WERROR]) - ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $cc_cv_werror" - AC_CACHE_CHECK([if compiler supports -fvisibility=hidden], - [cc_cv_flag_visibility], - [ - save_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -fvisibility=hidden" - AC_COMPILE_IFELSE([int a;], - [cc_cv_flag_visibility=yes], - [cc_cv_flag_visibility=no]) - CFLAGS="$save_CFLAGS" - ]) - CFLAGS="$ac_save_CFLAGS" - - if test "x$cc_cv_flag_visibility" = "xyes"; then - AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1, [Define this if the compiler supports the -fvisibility flag]) - $1 - else - true - $2 - fi + AC_REQUIRE([CC_CHECK_WERROR]) + AC_CACHE_CHECK([if $CC supports -fvisibility=hidden], + [cc_cv_flag_visibility], + [ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $cc_cv_werror" + CC_CHECK_CFLAGS_SILENT([-fvisibility=hidden], + cc_cv_flag_visibility='yes', + cc_cv_flag_visibility='no') + CFLAGS="$ac_save_CFLAGS"]) + + if test "x$cc_cv_flag_visibility" = "xyes"; then + AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1, [Define this if the compiler supports the -fvisibility flag]) + ifelse([$1], , [:], [$1]) + else + ifelse([$2], , [:], [$2]) + fi ]) AC_DEFUN([CC_FUNC_EXPECT], [ -- cgit v1.2.3