fixed zlib
[kvm-coreboot.git] / packages / zlib / patches / zlib-1.2.3-visibility-support.patch
blobceb065e9c7bb90760757a59e33f27aff198f9226
1 Only export symbols that should be exported.
3 Patch by Mike Frysinger
5 http://bugs.gentoo.org/32764
6 http://bugs.gentoo.org/149929
8 --- zlib-1.2.3/configure
9 +++ zlib-1.2.3/configure
10 @@ -209,6 +209,20 @@
13 cat > $test.c <<EOF
14 +int foo __attribute__ ((visibility ("hidden")));
15 +int main()
17 + return 0;
19 +EOF
20 +if ($CC -c -fvisibility=hidden $CFLAGS $test.c) 2>/dev/null; then
21 + CFLAGS="$CFLAGS -DHAS_attribute_visibility -fvisibility=hidden"
22 + echo "Checking for attribute(visibility) support... Yes."
23 +else
24 + echo "Checking for attribute(visibility) support... No."
25 +fi
27 +cat > $test.c <<EOF
28 #include <stdio.h>
29 #include <stdarg.h>
30 #include "zconf.h"
31 --- zlib-1.2.3/zconf.in.h
32 +++ zlib-1.2.3/zconf.in.h
33 @@ -244,7 +244,11 @@
34 #endif
36 #ifndef ZEXTERN
37 -# define ZEXTERN extern
38 +# if defined(ZLIB_INTERNAL) && defined(HAS_attribute_visibility)
39 +# define ZEXTERN extern __attribute__ ((visibility("default")))
40 +# else
41 +# define ZEXTERN extern
42 +# endif
43 #endif
44 #ifndef ZEXPORT
45 # define ZEXPORT