summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-10-30 13:58:21 -0700
committerAnas Nashif <anas.nashif@intel.com>2012-11-07 09:57:55 -0800
commit8c8d79c34ba24c1be6871dfdca267746f626e56f (patch)
tree18bcf7a91bc04e0b5e8bfaae4cccf04202b068d3
parent9f9f9323ff7e7067798b6985648c64fdfeb24122 (diff)
downloadc-ares-8c8d79c34ba24c1be6871dfdca267746f626e56f.tar.gz
c-ares-8c8d79c34ba24c1be6871dfdca267746f626e56f.tar.bz2
c-ares-8c8d79c34ba24c1be6871dfdca267746f626e56f.zip
add symbol versioning support
-rw-r--r--Makefile.am11
-rw-r--r--c-ares.map72
-rw-r--r--configure.ac9
-rw-r--r--m4/ld-version-script.m453
4 files changed, 133 insertions, 12 deletions
diff --git a/Makefile.am b/Makefile.am
index 8969403..0379843 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -93,12 +93,13 @@ VER=-version-info 2:0:0
# set age to 0. (c:r:a=0)
#
-if NO_UNDEFINED
-# The -no-undefined flag is crucial for this to build fine on some platforms
-UNDEF = -no-undefined
-endif
+libcares_la_LDFLAGS = -no-undefined $(UNDEF) $(VER)
-libcares_la_LDFLAGS = $(UNDEF) $(VER)
+if HAVE_LD_VERSION_SCRIPT
+libcares_la_LDFLAGS += -Wl,--version-script=$(srcdir)/c-ares.map
+else
+libcares_la_LDFLAGS += -export-symbols-regex '^ares_.*'
+endif
# Add -Werror if defined
CFLAGS += @CARES_CFLAG_EXTRAS@
diff --git a/c-ares.map b/c-ares.map
new file mode 100644
index 0000000..3b303a7
--- /dev/null
+++ b/c-ares.map
@@ -0,0 +1,72 @@
+CARES_1.2.0 {
+global:
+ ares_cancel;
+ ares_destroy;
+ ares_expand_name;
+ ares_expand_string;
+ ares_fds;
+ ares_free_data;
+ ares_free_hostent;
+ ares_free_string;
+ ares_get_servers;
+ ares_gethostbyaddr;
+ ares_gethostbyname;
+ ares_init;
+ ares_init_options;
+ ares_mkquery;
+ ares_parse_a_reply;
+ ares_parse_ptr_reply;
+ ares_process;
+ ares_query;
+ ares_search;
+ ares_send;
+ ares_set_local_dev;
+ ares_set_local_ip4;
+ ares_set_local_ip6;
+ ares_set_servers;
+ ares_set_servers_csv;
+ ares_strerror;
+ ares_timeout;
+ ares_version;
+local: *;
+};
+
+CARES_1.3.1 {
+global:
+ ares_parse_aaaa_reply;
+ ares_getnameinfo;
+ ares_getsock;
+} CARES_1.2.0;
+
+CARES_1.4.0 {
+global:
+ ares_save_options;
+ ares_destroy_options;
+ ares_parse_ns_reply;
+ ares_process_fd;
+} CARES_1.3.1;
+
+CARES_1.6.0 {
+global:
+ ares_dup;
+ ares_gethostbyname_file;
+} CARES_1.4.0;
+
+CARES_1.7.0 {
+global:
+ ares_set_socket_callback;
+ ares_parse_txt_reply;
+ ares_parse_srv_reply;
+ ares_library_init;
+ ares_library_cleanup;
+} CARES_1.6.0;
+
+CARES_1.7.1 {
+global:
+ ares_reinit;
+} CARES_1.7.0;
+
+CARES_1.7.2 {
+global:
+ ares_parse_mx_reply;
+} CARES_1.7.1;
diff --git a/configure.ac b/configure.ac
index da87ba9..5b8beac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,9 +97,6 @@ case $host_os in
;;
esac
-dnl support building of Windows DLLs
-AC_LIBTOOL_WIN32_DLL
-
dnl force libtool to build static libraries with PIC on AMD64-Linux & FreeBSD
AC_MSG_CHECKING([if arch-OS host is AMD64-Linux/FreeBSD (to build static libraries with PIC)])
case $host in
@@ -124,7 +121,8 @@ case $CC in
esac
dnl libtool setup
-AC_PROG_LIBTOOL
+LT_INIT([win32-dll pic-only disable-static])
+gl_LD_VERSION_SCRIPT
AC_MSG_CHECKING([if we need CARES_BUILDING_LIBRARY])
case $host in
@@ -171,9 +169,6 @@ CARES_CHECK_COMPILER_HALT_ON_ERROR
CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
CARES_CHECK_COMPILER_SYMBOL_HIDING
-CARES_CHECK_NO_UNDEFINED
-AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
-
CARES_CHECK_CURLDEBUG
AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
diff --git a/m4/ld-version-script.m4 b/m4/ld-version-script.m4
new file mode 100644
index 0000000..5ed93ef
--- /dev/null
+++ b/m4/ld-version-script.m4
@@ -0,0 +1,53 @@
+# ld-version-script.m4 serial 3
+dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Simon Josefsson
+
+# FIXME: The test below returns a false positive for mingw
+# cross-compiles, 'local:' statements does not reduce number of
+# exported symbols in a DLL. Use --disable-ld-version-script to work
+# around the problem.
+
+# gl_LD_VERSION_SCRIPT
+# --------------------
+# Check if LD supports linker scripts, and define automake conditional
+# HAVE_LD_VERSION_SCRIPT if so.
+AC_DEFUN([gl_LD_VERSION_SCRIPT],
+[
+ AC_ARG_ENABLE([ld-version-script],
+ AS_HELP_STRING([--enable-ld-version-script],
+ [enable linker version script (default is enabled when possible)]),
+ [have_ld_version_script=$enableval], [])
+ if test -z "$have_ld_version_script"; then
+ AC_MSG_CHECKING([if LD -Wl,--version-script works])
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
+ cat > conftest.map <<EOF
+foo
+EOF
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+ [accepts_syntax_errors=yes], [accepts_syntax_errors=no])
+ if test "$accepts_syntax_errors" = no; then
+ cat > conftest.map <<EOF
+VERS_1 {
+ global: sym;
+};
+
+VERS_2 {
+ global: sym;
+} VERS_1;
+EOF
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+ [have_ld_version_script=yes], [have_ld_version_script=no])
+ else
+ have_ld_version_script=no
+ fi
+ rm -f conftest.map
+ LDFLAGS="$save_LDFLAGS"
+ AC_MSG_RESULT($have_ld_version_script)
+ fi
+ AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
+])