[master] a776169 Check for __attribute__((visibility)) support
Tollef Fog Heen
tfheen at varnish-cache.org
Fri Jan 28 14:52:32 CET 2011
commit a776169645967061d22ed87bf26236ca6d6f9488
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Fri Jan 28 14:50:41 2011 +0100
Check for __attribute__((visibility)) support
The solaris compiler does not support the GNU C extension
__attribute__((visibility("hidden"))), leading to build failures.
This commit adds a check for that support and defines NO_VIZ if it's
visibility setting is not supported.
Fixes #852
diff --git a/configure.ac b/configure.ac
index 2e79d93..7b17ba6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -209,6 +209,30 @@ if test "$ac_cv_so_sendfile_works" = yes; then
AC_DEFINE([SENDFILE_WORKS], [1], [Define if SENDFILE works])
fi
+# Support for visibility attribute
+save_CFLAGS="${CFLAGS}"
+CFLAGS="${CFLAGS} -Werror"
+
+AC_CACHE_CHECK([whether we have support for visibility attributes],
+ [ac_cv_have_viz],
+ [AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM([[
+ #if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33)
+ # define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
+ #else
+ # define ZLIB_INTERNAL
+ #endif
+ int ZLIB_INTERNAL foo;
+ ]],[])],
+ [ac_cv_have_viz=yes],
+ [ac_cv_have_viz=no])
+])
+if test "$ac_cv_have_viz" = no; then
+ libvgz_extra_cflags="-DNO_VIZ"
+ AC_SUBST(libvgz_extra_cflags)
+fi
+CFLAGS="${save_CFLAGS}"
+
# Userland slab allocator, available only on Solaris
case $target in
*-*-solaris*)
diff --git a/lib/libvgz/Makefile.am b/lib/libvgz/Makefile.am
index 573e033..ab9b561 100644
--- a/lib/libvgz/Makefile.am
+++ b/lib/libvgz/Makefile.am
@@ -3,7 +3,7 @@
lib_LTLIBRARIES = libvgz.la
libvgz_la_LDFLAGS = -version-info 1:0:0
-libvgz_la_CFLAGS = -D_LARGEFILE64_SOURCE=1
+libvgz_la_CFLAGS = -D_LARGEFILE64_SOURCE=1 $(libvgz_extra_cflags)
libvgz_la_SOURCES = \
adler32.c \
More information about the varnish-commit
mailing list