Make symbols exported by this library versioned Signed-off-by: Jonas Karlsson Index: curl/configure.ac =================================================================== --- curl.orig/configure.ac 2008-06-04 19:03:18.000000000 +0200 +++ curl/configure.ac 2008-06-04 19:03:26.000000000 +0200 @@ -1687,6 +1687,52 @@ CURL_CHECK_CA_BUNDLE 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 may want to rerun configure using --with-gnu-ld to enable versioned symbols. +) +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 "$OPENSSL_ENABLED" = "1"; then + versioned_symbols_flavour="OPENSSL_" + else + if test "$OPT_GNUTLS" != "no"; then + versioned_symbols_flavour="GNUTLS_" + fi + 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 "$versioned_symbols" = "yes") + + +dnl ********************************************************************** dnl Check for the presence of IDN libraries and headers dnl ********************************************************************** @@ -2489,6 +2535,7 @@ include/curl/Makefile \ src/Makefile \ lib/Makefile \ + lib/libcurl.vers \ tests/Makefile \ tests/data/Makefile \ tests/server/Makefile \ Index: curl/lib/Makefile.am =================================================================== --- curl.orig/lib/Makefile.am 2008-06-04 19:03:18.000000000 +0200 +++ curl/lib/Makefile.am 2008-06-04 19:03:37.000000000 +0200 @@ -91,7 +91,11 @@ 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) $(LIBCURL_LIBS) $(VERSIONED_SYMBOLS) # Makefile.inc provides the CSOURCES and HHEADERS defines include Makefile.inc Index: curl/lib/libcurl.vers.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ curl/lib/libcurl.vers.in 2008-06-04 19:03:26.000000000 +0200 @@ -0,0 +1,13 @@ +HIDDEN +{ + local: + __*; + _rest*; + _save*; +}; + +CURL_@VERSIONED_FLAVOUR@3 +{ + global: curl_*; + local: *; +}; --- curl-7.19.3/lib/Makefile.in.old 2009-02-05 10:54:12.000000000 +0100 +++ curl-7.19.3/lib/Makefile.in 2009-02-05 10:53:40.000000000 +0100 @@ -348,7 +348,9 @@ # This is for gcc on Solaris (8+ ?) to avoid "relocations remain against # allocatable but non-writable sections" problems. @MIMPURE_TRUE@MIMPURE = -mimpure-text -libcurl_la_LDFLAGS = $(UNDEF) $(VERSIONINFO) $(MIMPURE) $(LIBCURL_LIBS) +@VERSIONED_SYMBOLS_TRUE@VERSIONED_SYMBOLS = -Wl,--version-script=libcurl.vers + +libcurl_la_LDFLAGS = $(UNDEF) $(VERSIONINFO) $(MIMPURE) $(LIBCURL_LIBS) $(VERSIONED_SYMBOLS) CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c \ cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c \ ldap.c ssluse.c version.c getenv.c escape.c mprintf.c telnet.c \ --- curl-7.19.3/configure.old 2009-02-05 13:04:46.000000000 +0100 +++ curl-7.19.3/configure 2009-02-05 13:05:36.000000000 +0100 @@ -992,6 +992,9 @@ USE_NSS SSL_ENABLED CURL_CA_BUNDLE +VERSIONED_FLAVOUR +VERSIONED_SYMBOLS_TRUE +VERSIONED_SYMBOLS_FALSE IDN_ENABLED IPV6_ENABLED PERL @@ -1641,6 +1644,10 @@ --enable-libgcc use libgcc when linking --enable-ipv6 Enable ipv6 (with ipv4) support --disable-ipv6 Disable ipv6 support + --enable-versioned-symbols + Enable versioned symbols in shared library + --disable-versioned-symbols + Disable versioned symbols in shared library --disable-thread don't look for thread-safe functions --enable-thread look for thread-safe functions --enable-nonblocking Enable non-blocking communications @@ -8939,13 +8946,13 @@ else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:8942: $ac_compile\"" >&5) + (eval echo "\"\$as_me:8949: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:8945: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:8952: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:8948: output\"" >&5) + (eval echo "\"\$as_me:8955: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -10163,7 +10170,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 10166 "configure"' > conftest.$ac_ext + echo '#line 10173 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -11536,11 +11543,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11539: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11546: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11543: \$? = $ac_status" >&5 + echo "$as_me:11550: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -11875,11 +11882,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11878: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11885: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11882: \$? = $ac_status" >&5 + echo "$as_me:11889: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -11980,11 +11987,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11983: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11990: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11987: \$? = $ac_status" >&5 + echo "$as_me:11994: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12035,11 +12042,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12038: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12045: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12042: \$? = $ac_status" >&5 + echo "$as_me:12049: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14741,7 +14748,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 14744 "configure" +#line 14751 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14837,7 +14844,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 14840 "configure" +#line 14847 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -26110,6 +26117,72 @@ +{ echo "$as_me:$LINENO: checking if libraries can be versioned" >&5 +echo $ECHO_N "checking if libraries can be versioned... $ECHO_C" >&6; } +GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script` +if test -z "$GLD"; then + versioned_symbols_flavour= + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + { echo "$as_me:$LINENO: WARNING: *** +*** You may want to rerun configure using --with-gnu-ld to enable versioned symbols. +" >&5 +echo "$as_me: WARNING: *** +*** You may want to rerun configure using --with-gnu-ld to enable versioned symbols. +" >&2;} +else + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +{ echo "$as_me:$LINENO: checking whether versioned symbols are wanted" >&5 +echo $ECHO_N "checking whether versioned symbols are wanted... $ECHO_C" >&6; } +versioned_symbols_flavour= + +# Check whether --enable-versioned-symbols was given. +if test "${enable_versioned_symbols+set}" = set; then + enableval=$enable_versioned_symbols; case "$enableval" in + yes) { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + if test "$OPENSSL_ENABLED" = "1"; then + versioned_symbols_flavour="OPENSSL_" + else + if test "$OPT_GNUTLS" != "no"; then + versioned_symbols_flavour="GNUTLS_" + fi + fi + versioned_symbols="yes" + ;; + + *) { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + ;; + esac + +else + +{ echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + + +fi + +fi + +VERSIONED_FLAVOUR="$versioned_symbols_flavour" + + + +if test "$versioned_symbols" = "yes"; then + VERSIONED_SYMBOLS_TRUE= + VERSIONED_SYMBOLS_FALSE='#' +else + VERSIONED_SYMBOLS_TRUE='#' + VERSIONED_SYMBOLS_FALSE= +fi + + + + { echo "$as_me:$LINENO: checking whether to build with libidn" >&5 echo $ECHO_N "checking whether to build with libidn... $ECHO_C" >&6; } @@ -46616,7 +46689,7 @@ squeeze LIBCURL_LIBS squeeze TEST_SERVER_LIBS -ac_config_files="$ac_config_files Makefile docs/Makefile docs/examples/Makefile docs/libcurl/Makefile include/Makefile include/curl/Makefile src/Makefile lib/Makefile tests/Makefile tests/data/Makefile tests/server/Makefile tests/libtest/Makefile packages/Makefile packages/Win32/Makefile packages/Win32/cygwin/Makefile packages/Linux/Makefile packages/Linux/RPM/Makefile packages/Linux/RPM/curl.spec packages/Linux/RPM/curl-ssl.spec packages/Solaris/Makefile packages/DOS/Makefile packages/EPM/curl.list packages/EPM/Makefile packages/vms/Makefile packages/AIX/Makefile packages/AIX/RPM/Makefile packages/AIX/RPM/curl.spec curl-config libcurl.pc" +ac_config_files="$ac_config_files Makefile docs/Makefile docs/examples/Makefile docs/libcurl/Makefile include/Makefile include/curl/Makefile src/Makefile lib/Makefile lib/libcurl.vers tests/Makefile tests/data/Makefile tests/server/Makefile tests/libtest/Makefile packages/Makefile packages/Win32/Makefile packages/Win32/cygwin/Makefile packages/Linux/Makefile packages/Linux/RPM/Makefile packages/Linux/RPM/curl.spec packages/Linux/RPM/curl-ssl.spec packages/Solaris/Makefile packages/DOS/Makefile packages/EPM/curl.list packages/EPM/Makefile packages/vms/Makefile packages/AIX/Makefile packages/AIX/RPM/Makefile packages/AIX/RPM/curl.spec curl-config libcurl.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -46770,6 +46843,13 @@ Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${VERSIONED_SYMBOLS_TRUE}" && test -z "${VERSIONED_SYMBOLS_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"VERSIONED_SYMBOLS\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"VERSIONED_SYMBOLS\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${USE_MANUAL_TRUE}" && test -z "${USE_MANUAL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"USE_MANUAL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -47514,6 +47594,7 @@ "include/curl/Makefile") CONFIG_FILES="$CONFIG_FILES include/curl/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; + "lib/libcurl.vers") CONFIG_FILES="$CONFIG_FILES lib/libcurl.vers" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "tests/data/Makefile") CONFIG_FILES="$CONFIG_FILES tests/data/Makefile" ;; "tests/server/Makefile") CONFIG_FILES="$CONFIG_FILES tests/server/Makefile" ;; @@ -47780,6 +47861,9 @@ USE_NSS!$USE_NSS$ac_delim SSL_ENABLED!$SSL_ENABLED$ac_delim CURL_CA_BUNDLE!$CURL_CA_BUNDLE$ac_delim +VERSIONED_FLAVOUR!$VERSIONED_FLAVOUR$ac_delim +VERSIONED_SYMBOLS_TRUE!$VERSIONED_SYMBOLS_TRUE$ac_delim +VERSIONED_SYMBOLS_FALSE!$VERSIONED_SYMBOLS_FALSE$ac_delim IDN_ENABLED!$IDN_ENABLED$ac_delim IPV6_ENABLED!$IPV6_ENABLED$ac_delim PERL!$PERL$ac_delim @@ -47803,7 +47887,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 66; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 69; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5