cURL / Mailing Lists / curl-library / Single Mail

curl-library

versioned symbols patch

From: Domenico Andreoli <cavok_at_libero.it>
Date: Fri, 16 Sep 2005 13:39:46 +0200

hi Daniel,

  here is my proposed patch to allow, at configure, time the production
of shared library with versioned symbols. i used it to build curl
7.14.1-1 debian package now in experimental.

i'd be very glad to see it applied to your source tree. feel free to
modify any part of it but please let me know the final tag name in
lib/libcurl.vers.in in order to match it in the next upload to debian
unstable.

cheers
domenico

Index: configure.ac
===================================================================
RCS file: /cvsroot/pkg-curl/debian/curl/configure.ac,v
retrieving revision 1.1.1.20
retrieving revision 1.2
diff -d -u -p -r1.1.1.20 -r1.2
--- configure.ac 1 Sep 2005 20:29:20 -0000 1.1.1.20
+++ configure.ac 15 Sep 2005 21:51:06 -0000 1.2
@@ -1105,9 +1105,50 @@ fi dnl only done if some kind of SSL was
 
 AM_CONDITIONAL(CABUNDLE, test x$ca != xno)
 
+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
+ ;;
+
+ *) AC_MSG_RESULT(no)
+ ;;
+ esac
+], [
+AC_MSG_RESULT(no)
+]
+)
+fi
+
+AC_SUBST(VERSIONED_FLAVOUR, ["$versioned_symbols_flavour"])
+AM_CONDITIONAL(VERSIONED_SYMBOLS, test "$versioned_symbols_flavour" != "")
 
-
 dnl **********************************************************************
 dnl Check for the presence of ZLIB libraries and headers
 dnl **********************************************************************
@@ -1861,6 +1902,7 @@ AC_CONFIG_FILES([Makefile \
            include/curl/Makefile \
            src/Makefile \
            lib/Makefile \
+ lib/libcurl.vers \
            tests/Makefile \
            tests/data/Makefile \
            tests/server/Makefile \
Index: lib/Makefile.am
===================================================================
RCS file: /cvsroot/pkg-curl/debian/curl/lib/Makefile.am,v
retrieving revision 1.1.1.18
retrieving revision 1.16
diff -d -u -p -r1.1.1.18 -r1.16
--- lib/Makefile.am 31 Mar 2005 07:02:03 -0000 1.1.1.18
+++ lib/Makefile.am 15 Sep 2005 21:51:32 -0000 1.16
@@ -82,7 +82,11 @@ if MIMPURE
 MIMPURE = -mimpure-text
 endif
 
-libcurl_la_LDFLAGS = $(UNDEF) $(VERSION) $(MIMPURE)
+if VERSIONED_SYMBOLS
+VERSIONED_SYMBOLS = -Wl,--version-script=libcurl.vers
+endif
+
+libcurl_la_LDFLAGS = $(UNDEF) $(VERSION) $(MIMPURE) $(VERSIONED_SYMBOLS)
 
 # Makefile.inc provides the CSOURCES and HHEADERS defines
 include Makefile.inc
Index: lib/libcurl.vers.in
===================================================================
RCS file: lib/libcurl.vers.in
diff -N lib/libcurl.vers.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/libcurl.vers.in 15 Sep 2005 21:47:03 -0000 1.1
@@ -0,0 +1,5 @@
+CURL__at_VERSIONED_FLAVOUR_at_3
+{
+ global: curl_*; curlx_*; Curl_*;
+ local: *;
+};

-----[ Domenico Andreoli, aka cavok
 --[ http://people.debian.org/~cavok/gpgkey.asc
   ---[ 3A0F 2F80 F79C 678A 8936 4FEE 0677 9033 A20E BC50
Received on 2005-09-16