configure: use XC_LIBTOOL for portability across libtool versions

This commit is contained in:
Yang Tse 2013-02-19 14:11:26 +01:00
parent f454e82dc7
commit 715b499c79
3 changed files with 27 additions and 62 deletions

View File

@ -64,7 +64,7 @@ DISTCLEANFILES = ares_build.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libcares.pc
VER=-version-info 2:0:0
CARES_VERSION_INFO = -version-info 2:0:0
# This flag accepts an argument of the form current[:revision[:age]]. So,
# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
# 1.
@ -93,12 +93,21 @@ 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
libcares_la_LDFLAGS_EXTRA =
if CARES_LT_SHLIB_USE_VERSION_INFO
libcares_la_LDFLAGS_EXTRA += $(CARES_VERSION_INFO)
endif
libcares_la_LDFLAGS = $(UNDEF) $(VER)
if CARES_LT_SHLIB_USE_NO_UNDEFINED
libcares_la_LDFLAGS_EXTRA += -no-undefined
endif
if CARES_LT_SHLIB_USE_MIMPURE_TEXT
libcares_la_LDFLAGS_EXTRA += -mimpure-text
endif
libcares_la_LDFLAGS = $(AM_LDFLAGS) $(libcares_la_LDFLAGS_EXTRA)
# Add -Werror if defined
CFLAGS += @CARES_CFLAG_EXTRAS@

View File

@ -97,34 +97,19 @@ case $host_os in
;;
esac
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
#
# Automake conditionals based on libtool related checks
#
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
AM_CONDITIONAL([CARES_LT_SHLIB_USE_VERSION_INFO],
[test "x$xc_lt_shlib_use_version_info" = 'xyes'])
AM_CONDITIONAL([CARES_LT_SHLIB_USE_NO_UNDEFINED],
[test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
AM_CONDITIONAL([CARES_LT_SHLIB_USE_MIMPURE_TEXT],
[test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
dnl libtool setup
AC_PROG_LIBTOOL
AC_MSG_CHECKING([if we need CARES_BUILDING_LIBRARY])
use_cppflag_cares_building_library="no"
@ -179,9 +164,6 @@ CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
CARES_CHECK_COMPILER_PROTOTYPE_MISMATCH
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)

View File

@ -15,7 +15,7 @@
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
# serial 74
# serial 75
dnl CARES_CHECK_COMPILER
@ -23,7 +23,6 @@ dnl -------------------------------------------------
dnl Verify if the C compiler being used is known.
AC_DEFUN([CARES_CHECK_COMPILER], [
AC_BEFORE([$0],[CARES_CHECK_NO_UNDEFINED])dnl
#
compiler_id="unknown"
compiler_num="0"
@ -1192,6 +1191,7 @@ dnl shared libraries support undefined symbols, along with
dnl an equally configured libcurl.
AC_DEFUN([CARES_CHECK_CURLDEBUG], [
AC_REQUIRE([XC_LIBTOOL])dnl
AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
cares_builddir=`pwd`
supports_curldebug="unknown"
@ -1208,7 +1208,7 @@ AC_DEFUN([CARES_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
@ -1270,32 +1270,6 @@ AC_DEFUN([CARES_CHECK_CURLDEBUG], [
])
dnl CARES_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([CARES_CHECK_NO_UNDEFINED], [
AC_BEFORE([$0],[CARES_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 CARES_CHECK_COMPILER_HALT_ON_ERROR
dnl -------------------------------------------------
dnl Verifies if the compiler actually halts after the