]> git.lizzy.rs Git - zlib.git/commitdiff
Improve the detection of no hidden visibility attribute.
authorMark Adler <madler@alumni.caltech.edu>
Mon, 20 Feb 2012 07:31:55 +0000 (23:31 -0800)
committerMark Adler <madler@alumni.caltech.edu>
Mon, 20 Feb 2012 07:33:10 +0000 (23:33 -0800)
configure
gzguts.h
zutil.h

index 52a50fb49cb7df3b64b891b092510b90f99851d7..eb103c87d3613ecd814964aace0d1f587540c659 100755 (executable)
--- 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 <<EOF
@@ -626,7 +638,7 @@ fi
 if test "$gcc" -eq 1; then
   echo >> configure.log
   cat > $test.c <<EOF
-#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 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"
index 735e8082736e8aff26c09d2e4f1e9cd7e48c9fcc..2ef95f3e2fe634eb9fcf1150630af0c0037accf3 100644 (file)
--- 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 13ea44d76e34e25dded56f8535f523e09127f7ba..7a409fad66d53137495c9355d70a1b789af53857 100644 (file)
--- 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