From 3f4339b61b3737f6efdd55368488f0a5888e4935 Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Sun, 19 Feb 2012 23:31:55 -0800 Subject: [PATCH] Improve the detection of no hidden visibility attribute. --- configure | 16 ++++++++++++++-- gzguts.h | 3 +-- zutil.h | 3 +-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/configure b/configure index 52a50fb..eb103c8 100755 --- a/configure +++ b/configure @@ -136,6 +136,18 @@ else } fi +tryboth() +{ + show $* + got=`( $* ) 2>&1` + ret=$? + printf %s "$got" >> configure.log + if test $ret -ne 0; then + return $ret + fi + test "$got" = "" +} + echo >> configure.log cat > $test.c <> configure.log cat > $test.c <= 33) +#if ((__GNUC__-0) * 100 + __GNUC_MINOR__-0 >= 303) # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) #else # define ZLIB_INTERNAL @@ -637,7 +649,7 @@ int main() return 0; } EOF - if try $CC -c $CFLAGS $test.c; then + if tryboth $CC -c $CFLAGS $test.c; then echo "Checking for attribute(visibility) support... Yes." | tee -a configure.log else CFLAGS="$CFLAGS -DNO_VIZ" diff --git a/gzguts.h b/gzguts.h index 735e808..2ef95f3 100644 --- a/gzguts.h +++ b/gzguts.h @@ -12,8 +12,7 @@ # endif #endif -#define GCC_VER ((__GNUC__-0) * 100 + __GNUC_MINOR__-0) -#if ((GCC_VER >= 303 && !defined(__APPLE__)) || GCC_VER >= 400) && !defined(NO_VIZ) +#if ((__GNUC__-0) * 100 + __GNUC_MINOR__-0) >= 303 && !defined(NO_VIZ) # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) #else # define ZLIB_INTERNAL diff --git a/zutil.h b/zutil.h index 13ea44d..7a409fa 100644 --- a/zutil.h +++ b/zutil.h @@ -13,8 +13,7 @@ #ifndef ZUTIL_H #define ZUTIL_H -#define GCC_VER ((__GNUC__-0) * 100 + __GNUC_MINOR__-0) -#if ((GCC_VER >= 303 && !defined(__APPLE__)) || GCC_VER >= 400) && !defined(NO_VIZ) +#if ((__GNUC__-0) * 100 + __GNUC_MINOR__-0) >= 303 && !defined(NO_VIZ) # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) #else # define ZLIB_INTERNAL