diff options
author | Yang Tse <yangsita@gmail.com> | 2013-03-08 13:26:08 +0100 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2013-03-08 13:27:45 +0100 |
commit | 70b5173410baaa67ccdb50382870012949549c3d (patch) | |
tree | 8c7fa34b3286dac4aecab1c57e6e581554914818 | |
parent | eacfb5d8a6d4ce9e3d17a87eae4d9356b56d9422 (diff) |
configure: use XC_LIBTOOL for portability across libtool versions
-rw-r--r-- | configure.ac | 58 | ||||
-rw-r--r-- | lib/Makefile.am | 27 | ||||
-rw-r--r-- | lib/libcurl.vers.in | 2 | ||||
-rw-r--r-- | m4/curl-compilers.m4 | 30 | ||||
-rw-r--r-- | tests/libtest/Makefile.am | 10 |
5 files changed, 39 insertions, 88 deletions
diff --git a/configure.ac b/configure.ac index 18c77fb55..522d4cc33 100644 --- a/configure.ac +++ b/configure.ac @@ -198,48 +198,19 @@ CURL_CONFIGURE_REENTRANT dnl check for how to do large files AC_SYS_LARGEFILE -dnl support building of Windows DLLs -AC_LIBTOOL_WIN32_DLL +XC_LIBTOOL -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 - x86_64*linux*|amd64*freebsd*|ia64*freebsd*) - AC_MSG_RESULT([yes]) - with_pic=yes - ;; - *) - AC_MSG_RESULT([no]) - ;; -esac - -AC_MSG_CHECKING([if compiler is icc (to build with PIC)]) -case $CC in - icc | */icc) - AC_MSG_RESULT([yes]) - with_pic=yes - ;; - *) - AC_MSG_RESULT([no]) - ;; -esac +# +# Automake conditionals based on libtool related checks +# -dnl libtool setup -AC_PROG_LIBTOOL +AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSION_INFO], + [test "x$xc_lt_shlib_use_version_info" = 'xyes']) +AM_CONDITIONAL([CURL_LT_SHLIB_USE_NO_UNDEFINED], + [test "x$xc_lt_shlib_use_no_undefined" = 'xyes']) +AM_CONDITIONAL([CURL_LT_SHLIB_USE_MIMPURE_TEXT], + [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes']) -AC_MSG_CHECKING([if we need -mimpure-text]) -mimpure=no -case $host in - *-*-solaris2*) - if test "$GCC" = "yes"; then - mimpure="yes" - fi - ;; - *) - ;; -esac -AC_MSG_RESULT($mimpure) -AM_CONDITIONAL(MIMPURE, test x$mimpure = xyes) AC_MSG_CHECKING([if we need BUILDING_LIBCURL]) use_cppflag_building_libcurl="no" @@ -311,9 +282,6 @@ CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH CURL_CHECK_COMPILER_SYMBOL_HIDING -CURL_CHECK_NO_UNDEFINED -AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes) - CURL_CHECK_CURLDEBUG AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes) @@ -2613,8 +2581,10 @@ AC_MSG_RESULT(no) ] ) -AC_SUBST(VERSIONED_FLAVOUR, ["$versioned_symbols_flavour"]) -AM_CONDITIONAL(VERSIONED_SYMBOLS, test "x$versioned_symbols" = "xyes") +AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR], + ["$versioned_symbols_flavour"]) +AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS], + [test "x$versioned_symbols" = 'xyes']) dnl ------------------------------------------------- dnl check winidn option before other IDN libraries diff --git a/lib/Makefile.am b/lib/Makefile.am index f777df1cd..5ff2f16bb 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -73,6 +73,9 @@ AM_CPPFLAGS = -I$(top_builddir)/include/curl \ -I$(top_srcdir)/lib endif +# Prevent LIBS from being used for all link targets +LIBS = $(BLANK_AT_MAKETIME) + # Mostly for Windows build targets, when building libcurl library if USE_CPPFLAG_BUILDING_LIBCURL AM_CPPFLAGS += -DBUILDING_LIBCURL @@ -111,25 +114,25 @@ endif # # For the full guide on libcurl ABI rules, see docs/libcurl/ABI -if NO_UNDEFINED -# The -no-undefined flag is crucial to build fine on some platforms -UNDEF = -no-undefined +libcurl_la_LDFLAGS_EXTRA = + +if CURL_LT_SHLIB_USE_VERSION_INFO +libcurl_la_LDFLAGS_EXTRA += $(VERSIONINFO) endif -if MIMPURE -# This is for gcc on Solaris (8+ ?) to avoid "relocations remain against -# allocatable but non-writable sections" problems. -MIMPURE = -mimpure-text +if CURL_LT_SHLIB_USE_NO_UNDEFINED +libcurl_la_LDFLAGS_EXTRA += -no-undefined endif -if VERSIONED_SYMBOLS -VERSIONED_SYMBOLS = -Wl,--version-script=libcurl.vers +if CURL_LT_SHLIB_USE_MIMPURE_TEXT +libcurl_la_LDFLAGS_EXTRA += -mimpure-text endif -# Prevent LIBS from being used for all link targets -LIBS = $(BLANK_AT_MAKETIME) +if CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS +libcurl_la_LDFLAGS_EXTRA += -Wl,--version-script=libcurl.vers +endif -libcurl_la_LDFLAGS = $(UNDEF) $(VERSIONINFO) $(MIMPURE) $(VERSIONED_SYMBOLS) $(LIBCURL_LIBS) +libcurl_la_LDFLAGS = $(AM_LDFLAGS) $(libcurl_la_LDFLAGS_EXTRA) $(LIBCURL_LIBS) if DOING_CURL_SYMBOL_HIDING libcurl_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_HIDDEN_SYMBOLS diff --git a/lib/libcurl.vers.in b/lib/libcurl.vers.in index 8294557b8..ae978a485 100644 --- a/lib/libcurl.vers.in +++ b/lib/libcurl.vers.in @@ -6,7 +6,7 @@ HIDDEN _save*; }; -CURL_@VERSIONED_FLAVOUR@4 +CURL_@CURL_LT_SHLIB_VERSIONED_FLAVOUR@4 { global: curl_*; local: *; diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4 index ddbabbd63..2467128eb 100644 --- a/m4/curl-compilers.m4 +++ b/m4/curl-compilers.m4 @@ -21,7 +21,7 @@ #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. -# serial 65 +# serial 66 dnl CURL_CHECK_COMPILER @@ -1195,6 +1195,7 @@ dnl library or as a shared one on those systems on which dnl shared libraries support undefined symbols. AC_DEFUN([CURL_CHECK_CURLDEBUG], [ + AC_REQUIRE([XC_LIBTOOL])dnl AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl supports_curldebug="unknown" if test "$want_curldebug" = "yes"; then @@ -1210,7 +1211,7 @@ AC_DEFUN([CURL_CHECK_CURLDEBUG], [ fi if test "$supports_curldebug" != "no"; then if test "$enable_shared" = "yes" && - test "$need_no_undefined" = "yes"; then + test "x$xc_lt_shlib_use_no_undefined" = 'xyes'; then supports_curldebug="no" AC_MSG_WARN([shared library does not support undefined symbols.]) fi @@ -1238,31 +1239,6 @@ AC_DEFUN([CURL_CHECK_CURLDEBUG], [ ]) -dnl CURL_CHECK_NO_UNDEFINED -dnl ------------------------------------------------- -dnl Checks if the -no-undefined flag must be used when -dnl building shared libraries. This is required on all -dnl systems on which shared libraries should not have -dnl references to undefined symbols. This check should -dnl not be done before AC-PROG-LIBTOOL. - -AC_DEFUN([CURL_CHECK_NO_UNDEFINED], [ - AC_BEFORE([$0],[CURL_CHECK_CURLDEBUG])dnl - AC_MSG_CHECKING([if shared libraries need -no-undefined]) - need_no_undefined="no" - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc* | *-*-aix*) - need_no_undefined="yes" - ;; - esac - if test "x$allow_undefined" = "xno"; then - need_no_undefined="yes" - elif test "x$allow_undefined_flag" = "xunsupported"; then - need_no_undefined="yes" - fi - AC_MSG_RESULT($need_no_undefined) -]) - dnl CURL_CHECK_COMPILER_HALT_ON_ERROR dnl ------------------------------------------------- diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am index ba4097f8e..bc265f0e3 100644 --- a/tests/libtest/Makefile.am +++ b/tests/libtest/Makefile.am @@ -88,16 +88,18 @@ else noinst_LTLIBRARIES = endif -if NO_UNDEFINED -# The -no-undefined flag is crucial to build fine on some platforms -UNDEF = -no-undefined +libhostname_la_LDFLAGS_EXTRA = -module -avoid-version -rpath /nowhere + +if CURL_LT_SHLIB_USE_NO_UNDEFINED +libhostname_la_LDFLAGS_EXTRA += -no-undefined endif +libhostname_la_LDFLAGS = $(AM_LDFLAGS) $(libhostname_la_LDFLAGS_EXTRA) + libhostname_la_SOURCES = sethostname.c sethostname.h libhostname_la_LIBADD = libhostname_la_DEPENDENCIES = -libhostname_la_LDFLAGS = -module -avoid-version $(UNDEF) -rpath /nowhere if DOING_CURL_SYMBOL_HIDING libhostname_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_HIDDEN_SYMBOLS |