configure: use XC_LIBTOOL for portability across libtool versions

This commit is contained in:
Yang Tse 2013-03-08 13:26:08 +01:00
Родитель eacfb5d8a6
Коммит 70b5173410
5 изменённых файлов: 39 добавлений и 88 удалений

Просмотреть файл

@ -198,48 +198,19 @@ CURL_CONFIGURE_REENTRANT
dnl check for how to do large files dnl check for how to do large files
AC_SYS_LARGEFILE AC_SYS_LARGEFILE
dnl support building of Windows DLLs XC_LIBTOOL
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)]) # Automake conditionals based on libtool related checks
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)]) AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSION_INFO],
case $CC in [test "x$xc_lt_shlib_use_version_info" = 'xyes'])
icc | */icc) AM_CONDITIONAL([CURL_LT_SHLIB_USE_NO_UNDEFINED],
AC_MSG_RESULT([yes]) [test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
with_pic=yes AM_CONDITIONAL([CURL_LT_SHLIB_USE_MIMPURE_TEXT],
;; [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
*)
AC_MSG_RESULT([no])
;;
esac
dnl libtool setup
AC_PROG_LIBTOOL
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]) AC_MSG_CHECKING([if we need BUILDING_LIBCURL])
use_cppflag_building_libcurl="no" use_cppflag_building_libcurl="no"
@ -311,9 +282,6 @@ CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
CURL_CHECK_COMPILER_SYMBOL_HIDING CURL_CHECK_COMPILER_SYMBOL_HIDING
CURL_CHECK_NO_UNDEFINED
AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
CURL_CHECK_CURLDEBUG CURL_CHECK_CURLDEBUG
AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes) AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
@ -2613,8 +2581,10 @@ AC_MSG_RESULT(no)
] ]
) )
AC_SUBST(VERSIONED_FLAVOUR, ["$versioned_symbols_flavour"]) AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR],
AM_CONDITIONAL(VERSIONED_SYMBOLS, test "x$versioned_symbols" = "xyes") ["$versioned_symbols_flavour"])
AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
[test "x$versioned_symbols" = 'xyes'])
dnl ------------------------------------------------- dnl -------------------------------------------------
dnl check winidn option before other IDN libraries dnl check winidn option before other IDN libraries

Просмотреть файл

@ -73,6 +73,9 @@ AM_CPPFLAGS = -I$(top_builddir)/include/curl \
-I$(top_srcdir)/lib -I$(top_srcdir)/lib
endif endif
# Prevent LIBS from being used for all link targets
LIBS = $(BLANK_AT_MAKETIME)
# Mostly for Windows build targets, when building libcurl library # Mostly for Windows build targets, when building libcurl library
if USE_CPPFLAG_BUILDING_LIBCURL if USE_CPPFLAG_BUILDING_LIBCURL
AM_CPPFLAGS += -DBUILDING_LIBCURL AM_CPPFLAGS += -DBUILDING_LIBCURL
@ -111,25 +114,25 @@ endif
# #
# For the full guide on libcurl ABI rules, see docs/libcurl/ABI # For the full guide on libcurl ABI rules, see docs/libcurl/ABI
if NO_UNDEFINED libcurl_la_LDFLAGS_EXTRA =
# The -no-undefined flag is crucial to build fine on some platforms
UNDEF = -no-undefined if CURL_LT_SHLIB_USE_VERSION_INFO
libcurl_la_LDFLAGS_EXTRA += $(VERSIONINFO)
endif endif
if MIMPURE if CURL_LT_SHLIB_USE_NO_UNDEFINED
# This is for gcc on Solaris (8+ ?) to avoid "relocations remain against libcurl_la_LDFLAGS_EXTRA += -no-undefined
# allocatable but non-writable sections" problems.
MIMPURE = -mimpure-text
endif endif
if VERSIONED_SYMBOLS if CURL_LT_SHLIB_USE_MIMPURE_TEXT
VERSIONED_SYMBOLS = -Wl,--version-script=libcurl.vers libcurl_la_LDFLAGS_EXTRA += -mimpure-text
endif endif
# Prevent LIBS from being used for all link targets if CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS
LIBS = $(BLANK_AT_MAKETIME) 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 if DOING_CURL_SYMBOL_HIDING
libcurl_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_HIDDEN_SYMBOLS libcurl_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_HIDDEN_SYMBOLS

Просмотреть файл

@ -6,7 +6,7 @@ HIDDEN
_save*; _save*;
}; };
CURL_@VERSIONED_FLAVOUR@4 CURL_@CURL_LT_SHLIB_VERSIONED_FLAVOUR@4
{ {
global: curl_*; global: curl_*;
local: *; local: *;

Просмотреть файл

@ -21,7 +21,7 @@
#*************************************************************************** #***************************************************************************
# File version for 'aclocal' use. Keep it a single number. # File version for 'aclocal' use. Keep it a single number.
# serial 65 # serial 66
dnl CURL_CHECK_COMPILER 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. dnl shared libraries support undefined symbols.
AC_DEFUN([CURL_CHECK_CURLDEBUG], [ AC_DEFUN([CURL_CHECK_CURLDEBUG], [
AC_REQUIRE([XC_LIBTOOL])dnl
AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
supports_curldebug="unknown" supports_curldebug="unknown"
if test "$want_curldebug" = "yes"; then if test "$want_curldebug" = "yes"; then
@ -1210,7 +1211,7 @@ AC_DEFUN([CURL_CHECK_CURLDEBUG], [
fi fi
if test "$supports_curldebug" != "no"; then if test "$supports_curldebug" != "no"; then
if test "$enable_shared" = "yes" && if test "$enable_shared" = "yes" &&
test "$need_no_undefined" = "yes"; then test "x$xc_lt_shlib_use_no_undefined" = 'xyes'; then
supports_curldebug="no" supports_curldebug="no"
AC_MSG_WARN([shared library does not support undefined symbols.]) AC_MSG_WARN([shared library does not support undefined symbols.])
fi 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 CURL_CHECK_COMPILER_HALT_ON_ERROR
dnl ------------------------------------------------- dnl -------------------------------------------------

Просмотреть файл

@ -88,16 +88,18 @@ else
noinst_LTLIBRARIES = noinst_LTLIBRARIES =
endif endif
if NO_UNDEFINED libhostname_la_LDFLAGS_EXTRA = -module -avoid-version -rpath /nowhere
# The -no-undefined flag is crucial to build fine on some platforms
UNDEF = -no-undefined if CURL_LT_SHLIB_USE_NO_UNDEFINED
libhostname_la_LDFLAGS_EXTRA += -no-undefined
endif endif
libhostname_la_LDFLAGS = $(AM_LDFLAGS) $(libhostname_la_LDFLAGS_EXTRA)
libhostname_la_SOURCES = sethostname.c sethostname.h libhostname_la_SOURCES = sethostname.c sethostname.h
libhostname_la_LIBADD = libhostname_la_LIBADD =
libhostname_la_DEPENDENCIES = libhostname_la_DEPENDENCIES =
libhostname_la_LDFLAGS = -module -avoid-version $(UNDEF) -rpath /nowhere
if DOING_CURL_SYMBOL_HIDING if DOING_CURL_SYMBOL_HIDING
libhostname_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_HIDDEN_SYMBOLS libhostname_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_HIDDEN_SYMBOLS