configure: make symbol visibility dependent in the configure test, misc changes.

This commit is contained in:
Juan RP 2011-01-15 12:21:38 +01:00
parent 6051eb29ab
commit 3482e68491
2 changed files with 26 additions and 12 deletions

33
configure vendored
View File

@ -14,6 +14,7 @@ BUILD_PIE=
EXTERNAL_PROPLIB= EXTERNAL_PROPLIB=
EXTERNAL_LIBFETCH= EXTERNAL_LIBFETCH=
SILENT= SILENT=
HAVE_VISIBILITY=no
usage() usage()
{ {
@ -257,6 +258,10 @@ if [ $? -eq 0 ]; then
check_compiler_flag "p,-D_FORTIFY_SOURCE=2" W check_compiler_flag "p,-D_FORTIFY_SOURCE=2" W
fi fi
check_compiler_flag "visibility=default" f SHAREDLIB_CFLAGS check_compiler_flag "visibility=default" f SHAREDLIB_CFLAGS
if [ $? -eq 0 ]; then
HAVE_VISIBILITY=yes
echo "CPPFLAGS += -DHAVE_VISIBILITY=1" >>$CONFIG_MK
fi
check_compiler_flag "std=c99" "" CFLAGS check_compiler_flag "std=c99" "" CFLAGS
check_compiler_flag "l,--as-needed" W LDFLAGS check_compiler_flag "l,--as-needed" W LDFLAGS
@ -380,14 +385,14 @@ fi
# Check if external proplib via pkg-config should be used instead. # Check if external proplib via pkg-config should be used instead.
# #
if [ -z "$EXTERNAL_PROPLIB" ]; then if [ -z "$EXTERNAL_PROPLIB" ]; then
EXTERNAL_PROPLIB_VALUE=no EXTERNAL_PROPLIB_VALUE="no (using internal copy)"
echo "CPPFLAGS += -I\$(TOPDIR)/lib/portableproplib" >>$CONFIG_MK echo "CPPFLAGS += -I\$(TOPDIR)/lib/portableproplib" >>$CONFIG_MK
echo "LDFLAGS += -lpthread" >>$CONFIG_MK echo "LDFLAGS += -lpthread" >>$CONFIG_MK
echo "STATIC_LIBS += -lpthread" >>$CONFIG_MK echo "STATIC_LIBS += -lpthread" >>$CONFIG_MK
else else
EXTERNAL_PROPLIB_VALUE=yes EXTERNAL_PROPLIB_VALUE=yes
echo "USE_EXTERNAL_PROPLIB = 1" >>$CONFIG_MK echo "USE_EXTERNAL_PROPLIB = 1" >>$CONFIG_MK
printf "Checking for proplib via pkg-config ... " printf "Checking for portable proplib via pkg-config ... "
if ! $PKGCONFIG_BIN --exists proplib; then if ! $PKGCONFIG_BIN --exists proplib; then
echo "proplib.pc file not found, exiting." echo "proplib.pc file not found, exiting."
exit 1 exit 1
@ -420,7 +425,7 @@ fi
# Check if external libfetch should be used. # Check if external libfetch should be used.
# #
if [ -z "$EXTERNAL_LIBFETCH" ]; then if [ -z "$EXTERNAL_LIBFETCH" ]; then
EXTERNAL_LIBFETCH_VALUE=no EXTERNAL_LIBFETCH_VALUE="no (using internal copy)"
echo "CPPFLAGS += -I\$(TOPDIR)/lib/fetch" >>$CONFIG_MK echo "CPPFLAGS += -I\$(TOPDIR)/lib/fetch" >>$CONFIG_MK
else else
EXTERNAL_LIBFETCH_VALUE=yes EXTERNAL_LIBFETCH_VALUE=yes
@ -458,13 +463,21 @@ echo " LIBDIR = $LIBDIR"
echo " INCLUDEDIR = $INCLUDEDIR" echo " INCLUDEDIR = $INCLUDEDIR"
echo " SHAREDIR = $SHAREDIR" echo " SHAREDIR = $SHAREDIR"
echo " MANDIR = $MANDIR" echo " MANDIR = $MANDIR"
echo " BUILD_API_DOCS = $BUILD_API_DOCS_VALUE" if [ -n "$CFLAGS" ]; then
echo " BUILD_PIE = $BUILD_PIE_VAL" echo " CFLAGS = $CFLAGS"
echo " DEBUG = $DEBUG" fi
echo " EXTERNAL PROPLIB = $EXTERNAL_PROPLIB_VALUE" if [ -n "$LDFLAGS" ]; then
echo " EXTERNAL_LIBFETCH = $EXTERNAL_LIBFETCH_VALUE" echo " LDFLAGS = $LDFLAGS"
echo " CFLAGS = $CFLAGS" fi
echo " LDFLAGS = $LDFLAGS" echo
echo " Build API documentation = $BUILD_API_DOCS_VALUE"
echo " Build programs as PIE = $BUILD_PIE_VAL"
echo " Build with debug = $DEBUG"
echo " Use external proplib = $EXTERNAL_PROPLIB_VALUE"
echo " Use external libfetch = $EXTERNAL_LIBFETCH_VALUE"
if [ -n "$HAVE_VISIBILITY" ]; then
echo " Symbol visibility = $HAVE_VISIBILITY"
fi
echo echo
echo " You can now run make && make install clean." echo " You can now run make && make install clean."
echo echo

View File

@ -49,9 +49,10 @@
/* /*
* By default all public functions have default visibility, unless * By default all public functions have default visibility, unless
* gcc >= 4.x and the HIDDEN definition is used. * visibility has been detected by configure and the HIDDEN definition
* is used.
*/ */
#if __GNUC__ >= 4 #if HAVE_VISIBILITY
#define HIDDEN __attribute__ ((visibility("hidden"))) #define HIDDEN __attribute__ ((visibility("hidden")))
#else #else
#define HIDDEN #define HIDDEN