From b326998fc29c4015079c963c62caf7b9d2d1f125 Mon Sep 17 00:00:00 2001 From: Bob Friesenhahn Date: Sun, 22 Jan 2012 19:50:36 +0000 Subject: [PATCH] * configure.ac: Add support for using library symbol versioning on ELF systems with the GNU linker. Support is enabled via --enable-ld-version-script. Disabled by default for now until there is a decision for how to deploy a libtiff with versioned symbols after libtiff 4.0.0 was already released. --- ChangeLog | 8 +++++ configure | 71 ++++++++++++++++++++++++++++++++++++++++++- configure.ac | 32 +++++++++++++++++++ libtiff/Makefile.am | 10 +++++- libtiff/Makefile.in | 10 +++--- libtiff/libtiff.map | 4 +++ libtiff/libtiffxx.map | 4 +++ test/Makefile.in | 8 ++--- 8 files changed, 137 insertions(+), 10 deletions(-) create mode 100644 libtiff/libtiff.map create mode 100644 libtiff/libtiffxx.map diff --git a/ChangeLog b/ChangeLog index c3c213e1..8012c207 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-01-22 Bob Friesenhahn + + * configure.ac: Add support for using library symbol versioning on + ELF systems with the GNU linker. Support is enabled via + --enable-ld-version-script. Disabled by default for now until + there is a decision for how to deploy a libtiff with versioned + symbols after libtiff 4.0.0 was already released. + 2011-12-22 Bob Friesenhahn * libtiff/tif_win32.c: Eliminate some minor 64-bit warnings in diff --git a/configure b/configure index 832eb5d2..aa616769 100755 --- a/configure +++ b/configure @@ -672,6 +672,8 @@ LIBTOOL OBJDUMP DLLTOOL AS +HAVE_LD_VERSION_SCRIPT_FALSE +HAVE_LD_VERSION_SCRIPT_TRUE LN_S am__fastdepCC_FALSE am__fastdepCC_TRUE @@ -774,6 +776,7 @@ ac_user_opts=' enable_option_checking enable_maintainer_mode enable_dependency_tracking +enable_ld_version_script enable_shared enable_static with_pic @@ -1460,6 +1463,8 @@ Optional Features: (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors + --enable-ld-version-script + enable linker version script (default is disabled) --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] @@ -4561,6 +4566,66 @@ fi +# Check if LD supports linker scripts, and define automake conditional +# HAVE_LD_VERSION_SCRIPT if so. This functionality is currently +# constrained to compilers using GNU ld on ELF systems or systems +# which provide an adequate emulation thereof. +# Check whether --enable-ld-version-script was given. +if test "${enable_ld_version_script+set}" = set; then : + enableval=$enable_ld_version_script; have_ld_version_script=$enableval +else + have_ld_version_script=no +fi + +if test "$have_ld_version_script" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if LD -Wl,--version-script works" >&5 +$as_echo_n "checking if LD -Wl,--version-script works... " >&6; } + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" + cat > conftest.map <conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + have_ld_version_script=yes +else + have_ld_version_script=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + rm -f conftest.map + LDFLAGS="$save_LDFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_ld_version_script" >&5 +$as_echo "$have_ld_version_script" >&6; } +fi + if test "$have_ld_version_script" = "yes"; then + HAVE_LD_VERSION_SCRIPT_TRUE= + HAVE_LD_VERSION_SCRIPT_FALSE='#' +else + HAVE_LD_VERSION_SCRIPT_TRUE='#' + HAVE_LD_VERSION_SCRIPT_FALSE= +fi + + + + case `pwd` in @@ -6065,7 +6130,6 @@ test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - if test -n "$ac_tool_prefix"; then for ac_prog in ar do @@ -19919,6 +19983,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_LD_VERSION_SCRIPT_TRUE}" && test -z "${HAVE_LD_VERSION_SCRIPT_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LD_VERSION_SCRIPT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -22485,6 +22553,7 @@ echo " Documentation directory: ${LIBTIFF_DOCDIR}" echo " C compiler: ${CC} ${CFLAGS}" echo " C++ compiler: ${CXX} ${CXXFLAGS}" echo " Enable runtime linker paths: ${HAVE_RPATH}" +echo " Enable linker symbol versioning: ${have_ld_version_script}" echo " Support Microsoft Document Imaging: ${HAVE_MDI}" echo " Use win32 IO: ${win32_io_ok}" echo "" diff --git a/configure.ac b/configure.ac index da8e6a56..30d7c065 100644 --- a/configure.ac +++ b/configure.ac @@ -112,6 +112,37 @@ VL_PROG_CC_WARNINGS() AC_PROG_INSTALL AC_PROG_LN_S + +# Check if LD supports linker scripts, and define automake conditional +# HAVE_LD_VERSION_SCRIPT if so. This functionality is currently +# constrained to compilers using GNU ld on ELF systems or systems +# which provide an adequate emulation thereof. +AC_ARG_ENABLE([ld-version-script], + AS_HELP_STRING([--enable-ld-version-script], + [enable linker version script (default is disabled)]), + [have_ld_version_script=$enableval], [have_ld_version_script=no]) +if test "$have_ld_version_script" != no; then + AC_MSG_CHECKING([if LD -Wl,--version-script works]) + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" + cat > conftest.map <