curl-library
[PATCH] configure: add symbols versioning option
From: Alessandro Ghedini <al3xbio_at_gmail.com>
Date: Fri, 16 Dec 2011 15:33:48 +0100
Date: Fri, 16 Dec 2011 15:33:48 +0100
Allow, at configure time, the production of versioned symbols. The symbols
will look like "CURL_<FLAVOUR>_<VERSION> <SYMBOL>", where <FLAVOUR>
represents the SSL flavour (e.g. OPENSSL, GNUTLS, NSS, ...), <VERSION> is
the major SONAME version and <SYMBOL> is the actual symbol name. If no SSL
library is enabled the symbols will be just "CURL_<VERSION> <SYMBOL>".
--- Makefile.am | 2 +- configure.ac | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ lib/Makefile.am | 6 ++++- lib/libcurl.vers.in | 13 ++++++++++++ 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 lib/libcurl.vers.in diff --git a/Makefile.am b/Makefile.am index 6c20109..c2a9cb4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -36,7 +36,7 @@ winbuild/MakefileBuild.vc winbuild/Makefile.vc EXTRA_DIST = CHANGES COPYING maketgz Makefile.dist curl-config.in \ curl-style.el sample.emacs RELEASE-NOTES buildconf \ libcurl.pc.in vc6curl.dsw MacOSX-Framework Android.mk $(CMAKE_DIST) \ - Makefile.msvc.names $(WINBUILD_DIST) + Makefile.msvc.names $(WINBUILD_DIST) lib/libcurl.vers.in bin_SCRIPTS = curl-config diff --git a/configure.ac b/configure.ac index 3e95b0c..cc7f888 100644 --- a/configure.ac +++ b/configure.ac @@ -2347,6 +2347,60 @@ if test X"$OPT_LIBRTMP" != Xno; then fi dnl ********************************************************************** +dnl Check for linker switch for versioned symbols +dnl ********************************************************************** + +AC_MSG_CHECKING([if libraries can be versioned]) +GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script` +if test -z "$GLD"; then + versioned_symbols_flavour= + AC_MSG_RESULT(no) + AC_MSG_WARN(*** +*** You need an ld version supporting the --version-script option. +) +else + AC_MSG_RESULT(yes) + +AC_MSG_CHECKING([whether versioned symbols are wanted]) +versioned_symbols_flavour= + +AC_ARG_ENABLE(versioned-symbols, +AC_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library]) +AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]), +[ case "$enableval" in + yes) AC_MSG_RESULT(yes) + if test "x$OPENSSL_ENABLED" = "x1"; then + versioned_symbols_flavour="OPENSSL_" + elif test "x$GNUTLS_ENABLED" == "x1"; then + versioned_symbols_flavour="GNUTLS_" + elif test "x$NSS_ENABLED" == "x1"; then + versioned_symbols_flavour="NSS_" + elif test "x$POLARSSL_ENABLED" == "x1"; then + versioned_symbols_flavour="POLARSSL_" + elif test "x$CYASSL_ENABLED" == "x1"; then + versioned_symbols_flavour="CYASSL_" + elif test "x$AXTLS_ENABLED" == "x1"; then + versioned_symbols_flavour="AXTLS_" + else + versioned_symbols_flavour="" + fi + versioned_symbols="yes" + ;; + + *) AC_MSG_RESULT(no) + ;; + esac +], [ +AC_MSG_RESULT(no) +] +) +fi + +AC_SUBST(VERSIONED_FLAVOUR, ["$versioned_symbols_flavour"]) +AM_CONDITIONAL(VERSIONED_SYMBOLS, test "x$versioned_symbols" = "xyes") + + +dnl ********************************************************************** dnl Check for the presence of IDN libraries and headers dnl ********************************************************************** @@ -3215,6 +3269,7 @@ AC_CONFIG_FILES([Makefile \ include/curl/Makefile \ src/Makefile \ lib/Makefile \ + lib/libcurl.vers \ tests/Makefile \ tests/data/Makefile \ tests/server/Makefile \ diff --git a/lib/Makefile.am b/lib/Makefile.am index f2e54db..d764274 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -116,7 +116,11 @@ if MIMPURE MIMPURE = -mimpure-text endif -libcurl_la_LDFLAGS = $(UNDEF) $(VERSIONINFO) $(MIMPURE) $(LIBCURL_LIBS) +if VERSIONED_SYMBOLS +VERSIONED_SYMBOLS = -Wl,--version-script=libcurl.vers +endif + +libcurl_la_LDFLAGS = $(UNDEF) $(VERSIONINFO) $(MIMPURE) $(VERSIONED_SYMBOLS) $(LIBCURL_LIBS) # unit testing static library built only along with unit tests if BUILD_UNITTESTS diff --git a/lib/libcurl.vers.in b/lib/libcurl.vers.in new file mode 100644 index 0000000..8294557 --- /dev/null +++ b/lib/libcurl.vers.in @@ -0,0 +1,13 @@ +HIDDEN +{ + local: + __*; + _rest*; + _save*; +}; + +CURL__at_VERSIONED_FLAVOUR_at_4 +{ + global: curl_*; + local: *; +}; -- 1.7.7.3 --ReaqsoxgOBHFXBhH Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html --ReaqsoxgOBHFXBhH--Received on 2001-09-17