summaryrefslogtreecommitdiff
blob: ceb065e9c7bb90760757a59e33f27aff198f9226 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Only export symbols that should be exported.

Patch by Mike Frysinger

http://bugs.gentoo.org/32764
http://bugs.gentoo.org/149929

--- zlib-1.2.3/configure
+++ zlib-1.2.3/configure
@@ -209,6 +209,20 @@
 fi
 
 cat > $test.c <<EOF
+int foo __attribute__ ((visibility ("hidden")));
+int main()
+{
+  return 0;
+}
+EOF
+if ($CC -c -fvisibility=hidden $CFLAGS $test.c) 2>/dev/null; then
+  CFLAGS="$CFLAGS -DHAS_attribute_visibility -fvisibility=hidden"
+  echo "Checking for attribute(visibility) support... Yes."
+else
+  echo "Checking for attribute(visibility) support... No."
+fi
+
+cat > $test.c <<EOF
 #include <stdio.h>
 #include <stdarg.h>
 #include "zconf.h"
--- zlib-1.2.3/zconf.in.h
+++ zlib-1.2.3/zconf.in.h
@@ -244,7 +244,11 @@
 #endif
 
 #ifndef ZEXTERN
-#  define ZEXTERN extern
+#  if defined(ZLIB_INTERNAL) && defined(HAS_attribute_visibility)
+#    define ZEXTERN extern __attribute__ ((visibility("default")))
+#  else
+#    define ZEXTERN extern
+#  endif
 #endif
 #ifndef ZEXPORT
 #  define ZEXPORT