diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2022-05-17 16:54:41 +0100 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2022-06-01 09:46:18 +0100 |
commit | 7359f75059bad3216b0a9a886b4c211011a68e05 (patch) | |
tree | fc09dc522040adf7e098b612078f1ea95cfb3f22 /configure.ac | |
parent | 64bffc6bdff1d5048442659d7b1bcca9b0f715ec (diff) | |
download | ghostpdl-7359f75059bad3216b0a9a886b4c211011a68e05.tar.gz |
ug 705279: Make hidden symbols the default in the .so build.
This avoids symbol name clashes when linking our shared library with something
that also links to over shared libraries.
This also enforces a defined API in our shared library, like the Windows DLL
does.
Requires commit 64bffc6bd
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac index e10346230..2a8427a32 100644 --- a/configure.ac +++ b/configure.ac @@ -2877,17 +2877,17 @@ GPDL_SONAME="lib\$(GPDL${libname1}" GPDL_SONAME_MAJOR="lib\$(GPDL${libname2}" GPDL_SONAME_MAJOR_MINOR="lib\$(GPDL${libname3}" -hide_symbols=no +hide_symbols=yes attr_default= attr_hidden= _ldflags= AC_ARG_ENABLE([hidden-visibility], - AS_HELP_STRING([--enable-hidden-visibility], - [hide all shared library symbols which are not part of its public API]), - [hide_symbols=yes]) + AS_HELP_STRING([--disable-hidden-visibility], + [expose all shared library symbols even those which are not part of its public API]), + [hide_symbols=no]) -if test x$hide_symbols = xyes -a x"$GCC" = x"yes"; then +if test x"$hide_symbols" = x"yes" -a x"$GCC" = x"yes"; then attr_default="__attribute__((visibility(\\\"default\\\")))" attr_hidden="__attribute__((visibility(\\\"hidden\\\")))" fi @@ -2909,7 +2909,7 @@ case $host in SO_LIB_EXT=".so" ;; *-mingw*|*-msys*) - if test x$hide_symbols = xyes; then + if test x"$hide_symbols" = x"yes"; then attr_default="__declspec(dllexport)" attr_hidden="" else @@ -2941,7 +2941,7 @@ case $host in GPDL_SONAME_MAJOR_MINOR="lib\$(GPDL${libname2}" ;; *-cygwin*) - if test x$hide_symbols = xyes; then + if test x"$hide_symbols" = x"yes"; then attr_default="__declspec(dllexport)" attr_hidden="" fi @@ -2991,7 +2991,7 @@ case $host in DYNAMIC_CFLAGS="-fPIC $DYNAMIC_CFLAGS" else DYNAMIC_CFLAGS="-KPIC $DYNAMIC_CFLAGS" - #if test x$hide_symbols = xyes; then + #if test x"$hide_symbols" = x"yes"; then # attr_default="__global" # attr_hidden="__hidden" # _ldflags="-xldscope=hidden" @@ -3028,16 +3028,17 @@ case $host in ;; esac -if test x$hide_symbols = xyes ; then +if test x"$hide_symbols" = x"yes" ; then if test x"$GCC" = x"yes"; then DYNAMIC_CFLAGS="$DYNAMIC_CFLAGS -fvisibility=hidden" fi DYNAMIC_CFLAGS="$DYNAMIC_CFLAGS -DGSDLLEXPORT=\"$attr_default\"" if test "x$FT_BRIDGE" = x1 -a "x$SHARE_FT" = x0 ; then - DYNAMIC_CFLAGS="$DYNAMIC_CFLAGS -D\"FT_EXPORT(x)\"=\"$attr_hidden x\"" + # disable warnings for redefined macros, so our abuse of FT_EXPORT() to hide symbols doesn't flag warnings + FT_HIDDEN_CFLAGS="-Wp,-w -D\"FT_EXPORT(x)\"=\"$attr_hidden x\" -D\"FT_EXPORT_DEF(x)\"=\"$attr_hidden x\"" fi if test "x$SHARE_EXPAT" = x0 ; then - DYNAMIC_CFLAGS="$DYNAMIC_CFLAGS -DXML_STATIC -DXMLIMPORT=\"$attr_hidden\"" + XML_HIDDEN_CFLAGS="-DXML_STATIC -DXMLIMPORT=\"$attr_hidden\"" fi fi @@ -3059,6 +3060,9 @@ AC_SUBST(GPDL_SONAME) AC_SUBST(GPDL_SONAME_MAJOR) AC_SUBST(GPDL_SONAME_MAJOR_MINOR) +AC_SUBST(FT_HIDDEN_CFLAGS) +AC_SUBST(XML_HIDDEN_CFLAGS) + AC_ARG_ENABLE([dynamic], AS_HELP_STRING([--enable-dynamic], [Enable dynamically loaded drivers]), [ |