@ -1,19 +1,17 @@
# lib-link.m4 serial 13 (gettext-0.17 )
# lib-link.m4 serial 9 (gettext-0.16 )
dnl Copyright (C) 2001-2007 Free Software Foundation, Inc.
dnl Copyright (C) 2001-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
dnl From Bruno Haible.
AC_PREREQ(2.54 )
AC_PREREQ(2.50 )
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
dnl the libraries corresponding to explicit and implicit dependencies.
dnl the libraries corresponding to explicit and implicit dependencies.
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
dnl augments the CPPFLAGS variable.
dnl augments the CPPFLAGS variable.
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
AC_DEFUN([AC_LIB_LINKFLAGS],
AC_DEFUN([AC_LIB_LINKFLAGS],
[
[
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
@ -26,16 +24,13 @@ AC_DEFUN([AC_LIB_LINKFLAGS],
ac_cv_lib[]Name[]_libs="$LIB[]NAME"
ac_cv_lib[]Name[]_libs="$LIB[]NAME"
ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
])
])
LIB[]NAME="$ac_cv_lib[]Name[]_libs"
LIB[]NAME="$ac_cv_lib[]Name[]_libs"
LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
AC_SUBST([LIB]NAME)
AC_SUBST([LIB]NAME)
AC_SUBST([LTLIB]NAME)
AC_SUBST([LTLIB]NAME)
AC_SUBST([LIB]NAME[_PREFIX])
dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
dnl results of this search when this library appears as a dependency.
dnl results of this search when this library appears as a dependency.
HAVE_LIB[]NAME=yes
HAVE_LIB[]NAME=yes
@ -51,8 +46,6 @@ dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
[
[
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
@ -89,23 +82,17 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
CPPFLAGS="$ac_save_CPPFLAGS"
CPPFLAGS="$ac_save_CPPFLAGS"
LIB[]NAME=
LIB[]NAME=
LTLIB[]NAME=
LTLIB[]NAME=
LIB[]NAME[]_PREFIX=
fi
fi
AC_SUBST([HAVE_LIB]NAME)
AC_SUBST([HAVE_LIB]NAME)
AC_SUBST([LIB]NAME)
AC_SUBST([LIB]NAME)
AC_SUBST([LTLIB]NAME)
AC_SUBST([LTLIB]NAME)
AC_SUBST([LIB]NAME[_PREFIX])
undefine([Name])
undefine([Name])
undefine([NAME])
undefine([NAME])
])
])
dnl Determine the platform dependent parameters needed to use rpath:
dnl Determine the platform dependent parameters needed to use rpath:
dnl acl_libext,
dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
dnl acl_shlibext,
dnl hardcode_direct, hardcode_minus_L.
dnl acl_hardcode_libdir_flag_spec,
dnl acl_hardcode_libdir_separator,
dnl acl_hardcode_direct,
dnl acl_hardcode_minus_L.
AC_DEFUN([AC_LIB_RPATH],
AC_DEFUN([AC_LIB_RPATH],
[
[
dnl Tell automake >= 1.10 to complain if config.rpath is missing.
dnl Tell automake >= 1.10 to complain if config.rpath is missing.
@ -122,14 +109,12 @@ AC_DEFUN([AC_LIB_RPATH],
acl_cv_rpath=done
acl_cv_rpath=done
])
])
wl="$acl_cv_wl"
wl="$acl_cv_wl"
acl_libext="$acl_cv_libext"
libext="$acl_cv_libext"
acl_shlibext="$acl_cv_shlibext"
shlibext="$acl_cv_shlibext"
acl_libname_spec="$acl_cv_libname_spec"
hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
acl_library_names_spec="$acl_cv_library_names_spec"
hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
hardcode_direct="$acl_cv_hardcode_direct"
acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
hardcode_minus_L="$acl_cv_hardcode_minus_L"
acl_hardcode_direct="$acl_cv_hardcode_direct"
acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
dnl Determine whether the user wants rpath handling at all.
dnl Determine whether the user wants rpath handling at all.
AC_ARG_ENABLE(rpath,
AC_ARG_ENABLE(rpath,
[ --disable-rpath do not hardcode runtime library paths],
[ --disable-rpath do not hardcode runtime library paths],
@ -139,24 +124,20 @@ AC_DEFUN([AC_LIB_RPATH],
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
dnl the libraries corresponding to explicit and implicit dependencies.
dnl the libraries corresponding to explicit and implicit dependencies.
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
[
[
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
dnl Autoconf >= 2.61 supports dots in --with options.
define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])])
dnl By default, look in $includedir and $libdir.
dnl By default, look in $includedir and $libdir.
use_additional=yes
use_additional=yes
AC_LIB_WITH_FINAL_PREFIX([
AC_LIB_WITH_FINAL_PREFIX([
eval additional_includedir=\"$includedir\"
eval additional_includedir=\"$includedir\"
eval additional_libdir=\"$libdir\"
eval additional_libdir=\"$libdir\"
])
])
AC_LIB_ARG_WITH([lib]N_A_M_E[ -prefix],
AC_LIB_ARG_WITH([lib$1 -prefix],
[ --with-lib]N_A_M_E[ -prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
[ --with-lib$1 -prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
--without-lib]N_A_M_E[ -prefix don't search for lib$1 in includedir and libdir],
--without-lib$1 -prefix don't search for lib$1 in includedir and libdir],
[
[
if test "X$withval" = "Xno"; then
if test "X$withval" = "Xno"; then
use_additional=no
use_additional=no
@ -177,7 +158,6 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
LIB[]NAME=
LIB[]NAME=
LTLIB[]NAME=
LTLIB[]NAME=
INC[]NAME=
INC[]NAME=
LIB[]NAME[]_PREFIX=
rpathdirs=
rpathdirs=
ltrpathdirs=
ltrpathdirs=
names_already_handled=
names_already_handled=
@ -217,53 +197,27 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
found_la=
found_la=
found_so=
found_so=
found_a=
found_a=
eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
if test -n "$acl_shlibext"; then
shrext=".$acl_shlibext" # typically: shrext=.so
else
shrext=
fi
if test $use_additional = yes; then
if test $use_additional = yes; then
dir="$additional_libdir"
if test -n "$shlibext" \
dnl The same code as in the loop below:
&& { test -f "$additional_libdir/lib$name.$shlibext" \
dnl First look for a shared library.
|| { test "$shlibext" = dll \
if test -n "$acl_shlibext" ; then
&& test -f "$additional_libdir/lib$name.dll.a"; }; }; then
if test -f "$dir/$libname$shrext"; then
found_dir="$additional_libdir"
found_dir="$dir"
if test -f "$additional_libdir/lib$name.$shlibext"; then
found_so="$dir/$libname$shr ext"
found_so="$additional_libdir/lib$name.$shlib ext"
else
else
if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
found_so="$additional_libdir/lib$name.dll.a"
ver=`(cd "$dir" && \
for f in "$libname$shrext".*; do echo "$f"; done \
| sed -e "s,^$libname$shrext\\\\.,," \
| sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
| sed 1q ) 2>/dev/null`
if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
found_dir="$dir"
found_so="$dir/$libname$shrext.$ver"
fi
else
eval library_names=\"$acl_library_names_spec\"
for f in $library_names; do
if test -f "$dir/$f"; then
found_dir="$dir"
found_so="$dir/$f"
break
fi
done
fi
fi
fi
fi
if test -f "$additional_libdir/lib$name.la"; then
dnl Then look for a static library.
found_la="$additional_libdir/lib$name.la"
if test "X$found_dir" = "X"; then
if test -f "$dir/$libname.$acl_libext"; then
found_dir="$dir"
found_a="$dir/$libname.$acl_libext"
fi
fi
fi
else
if test "X$found_dir" != "X"; then
if test -f "$additional_libdir/lib$name.$libext"; then
if test -f "$dir/$libname.la"; then
found_dir="$additional_libdir"
found_la="$dir/$libname.la"
found_a="$additional_libdir/lib$name.$libext"
if test -f "$additional_libdir/lib$name.la"; then
found_la="$additional_libdir/lib$name.la"
fi
fi
fi
fi
fi
fi
fi
@ -273,44 +227,26 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
case "$x" in
case "$x" in
-L*)
-L*)
dir=`echo "X$x" | sed -e 's/^X-L//'`
dir=`echo "X$x" | sed -e 's/^X-L//'`
dnl First look for a shared library.
if test -n "$shlibext" \
if test -n "$acl_shlibext"; then
&& { test -f "$dir/lib$name.$shlibext" \
if test -f "$dir/$libname$shrext"; then
|| { test "$shlibext" = dll \
found_dir="$dir"
&& test -f "$dir/lib$name.dll.a"; }; }; then
found_so="$dir/$libname$shrext"
found_dir="$dir"
if test -f "$dir/lib$name.$shlibext"; then
found_so="$dir/lib$name.$shlibext"
else
else
if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
found_so="$dir/lib$name.dll.a"
ver=`(cd "$dir" && \
for f in "$libname$shrext".*; do echo "$f"; done \
| sed -e "s,^$libname$shrext\\\\.,," \
| sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
| sed 1q ) 2>/dev/null`
if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
found_dir="$dir"
found_so="$dir/$libname$shrext.$ver"
fi
else
eval library_names=\"$acl_library_names_spec\"
for f in $library_names; do
if test -f "$dir/$f"; then
found_dir="$dir"
found_so="$dir/$f"
break
fi
done
fi
fi
fi
fi
if test -f "$dir/lib$name.la"; then
dnl Then look for a static library.
found_la="$dir/lib$name.la"
if test "X$found_dir" = "X"; then
if test -f "$dir/$libname.$acl_libext"; then
found_dir="$dir"
found_a="$dir/$libname.$acl_libext"
fi
fi
fi
else
if test "X$found_dir" != "X"; then
if test -f "$dir/lib$name.$libext"; then
if test -f "$dir/$libname.la"; then
found_dir="$dir"
found_la="$dir/$libname.la"
found_a="$dir/lib$name.$libext"
if test -f "$dir/lib$name.la"; then
found_la="$dir/lib$name.la"
fi
fi
fi
fi
fi
;;
;;
@ -346,12 +282,12 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
ltrpathdirs="$ltrpathdirs $found_dir"
ltrpathdirs="$ltrpathdirs $found_dir"
fi
fi
dnl The hardcoding into $LIBNAME is system dependent.
dnl The hardcoding into $LIBNAME is system dependent.
if test "$acl_ hardcode_direct" = yes; then
if test "$hardcode_direct" = yes; then
dnl Using DIR/libNAME.so during linking hardcodes DIR into the
dnl Using DIR/libNAME.so during linking hardcodes DIR into the
dnl resulting binary.
dnl resulting binary.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
else
else
if test -n "$acl_ hardcode_libdir_flag_spec" && test "$acl_ hardcode_minus_L" = no; then
if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
dnl Use an explicit option to hardcode DIR into the resulting
dnl Use an explicit option to hardcode DIR into the resulting
dnl binary.
dnl binary.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
@ -382,13 +318,13 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
if test -z "$haveit"; then
if test -z "$haveit"; then
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
fi
fi
if test "$acl_ hardcode_minus_L" != no; then
if test "$hardcode_minus_L" != no; then
dnl FIXME: Not sure whether we should use
dnl FIXME: Not sure whether we should use
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
dnl here.
dnl here.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
else
else
dnl We cannot use $acl_ hardcode_runpath_var and LD_RUN_PATH
dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
dnl here, because this doesn't fit in flags passed to the
dnl here, because this doesn't fit in flags passed to the
dnl compiler. So give up. No hardcoding. This affects only
dnl compiler. So give up. No hardcoding. This affects only
dnl very old systems.
dnl very old systems.
@ -415,7 +351,6 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
case "$found_dir" in
case "$found_dir" in
*/$acl_libdirstem | */$acl_libdirstem/)
*/$acl_libdirstem | */$acl_libdirstem/)
basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
LIB[]NAME[]_PREFIX="$basedir"
additional_includedir="$basedir/include"
additional_includedir="$basedir/include"
;;
;;
esac
esac
@ -577,18 +512,18 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
done
done
done
done
if test "X$rpathdirs" != "X"; then
if test "X$rpathdirs" != "X"; then
if test -n "$acl_ hardcode_libdir_separator"; then
if test -n "$hardcode_libdir_separator"; then
dnl Weird platform: only the last -rpath option counts, the user must
dnl Weird platform: only the last -rpath option counts, the user must
dnl pass all path elements in one option. We can arrange that for a
dnl pass all path elements in one option. We can arrange that for a
dnl single library, but not when more than one $LIBNAMEs are used.
dnl single library, but not when more than one $LIBNAMEs are used.
alldirs=
alldirs=
for found_dir in $rpathdirs; do
for found_dir in $rpathdirs; do
alldirs="${alldirs}${alldirs:+$acl_ hardcode_libdir_separator}$found_dir"
alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
done
done
dnl Note: acl_ hardcode_libdir_flag_spec uses $libdir and $wl.
dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
acl_save_libdir="$libdir"
acl_save_libdir="$libdir"
libdir="$alldirs"
libdir="$alldirs"
eval flag=\"$acl_ hardcode_libdir_flag_spec\"
eval flag=\"$hardcode_libdir_flag_spec\"
libdir="$acl_save_libdir"
libdir="$acl_save_libdir"
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
else
else
@ -596,7 +531,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
for found_dir in $rpathdirs; do
for found_dir in $rpathdirs; do
acl_save_libdir="$libdir"
acl_save_libdir="$libdir"
libdir="$found_dir"
libdir="$found_dir"
eval flag=\"$acl_ hardcode_libdir_flag_spec\"
eval flag=\"$hardcode_libdir_flag_spec\"
libdir="$acl_save_libdir"
libdir="$acl_save_libdir"
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
done
done
@ -645,7 +580,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
$1=
$1=
if test "$enable_rpath" != no; then
if test "$enable_rpath" != no; then
if test -n "$acl_ hardcode_libdir_flag_spec" && test "$acl_ hardcode_minus_L" = no; then
if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
dnl Use an explicit option to hardcode directories into the resulting
dnl Use an explicit option to hardcode directories into the resulting
dnl binary.
dnl binary.
rpathdirs=
rpathdirs=
@ -679,16 +614,16 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
done
done
else
else
dnl The linker is used for linking directly.
dnl The linker is used for linking directly.
if test -n "$acl_ hardcode_libdir_separator"; then
if test -n "$hardcode_libdir_separator"; then
dnl Weird platform: only the last -rpath option counts, the user
dnl Weird platform: only the last -rpath option counts, the user
dnl must pass all path elements in one option.
dnl must pass all path elements in one option.
alldirs=
alldirs=
for dir in $rpathdirs; do
for dir in $rpathdirs; do
alldirs="${alldirs}${alldirs:+$acl_ hardcode_libdir_separator}$dir"
alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$dir"
done
done
acl_save_libdir="$libdir"
acl_save_libdir="$libdir"
libdir="$alldirs"
libdir="$alldirs"
eval flag=\"$acl_ hardcode_libdir_flag_spec\"
eval flag=\"$hardcode_libdir_flag_spec\"
libdir="$acl_save_libdir"
libdir="$acl_save_libdir"
$1="$flag"
$1="$flag"
else
else
@ -696,7 +631,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
for dir in $rpathdirs; do
for dir in $rpathdirs; do
acl_save_libdir="$libdir"
acl_save_libdir="$libdir"
libdir="$dir"
libdir="$dir"
eval flag=\"$acl_ hardcode_libdir_flag_spec\"
eval flag=\"$hardcode_libdir_flag_spec\"
libdir="$acl_save_libdir"
libdir="$acl_save_libdir"
$1="${$1}${$1:+ }$flag"
$1="${$1}${$1:+ }$flag"
done
done