version 1.1, 2012/02/21 22:57:49
|
version 1.1.1.3, 2021/03/17 13:38:46
|
Line 1
|
Line 1
|
# lib-link.m4 serial 20 (gettext-0.18) | # lib-link.m4 serial 28 |
dnl Copyright (C) 2001-2009 Free Software Foundation, Inc. | dnl Copyright (C) 2001-2019 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.61]) |
|
|
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. |
Line 18 AC_DEFUN([AC_LIB_LINKFLAGS],
|
Line 18 AC_DEFUN([AC_LIB_LINKFLAGS],
|
[ |
[ |
AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) |
AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) |
AC_REQUIRE([AC_LIB_RPATH]) |
AC_REQUIRE([AC_LIB_RPATH]) |
pushdef([Name],[translit([$1],[./-], [___])]) | pushdef([Name],[m4_translit([$1],[./+-], [____])]) |
pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], | pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], |
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) | [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) |
AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ |
AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ |
AC_LIB_LINKFLAGS_BODY([$1], [$2]) |
AC_LIB_LINKFLAGS_BODY([$1], [$2]) |
ac_cv_lib[]Name[]_libs="$LIB[]NAME" |
ac_cv_lib[]Name[]_libs="$LIB[]NAME" |
Line 58 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
|
Line 58 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
|
[ |
[ |
AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) |
AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) |
AC_REQUIRE([AC_LIB_RPATH]) |
AC_REQUIRE([AC_LIB_RPATH]) |
pushdef([Name],[translit([$1],[./-], [___])]) | pushdef([Name],[m4_translit([$1],[./+-], [____])]) |
pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], | pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], |
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) | [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) |
|
|
dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME |
dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME |
dnl accordingly. |
dnl accordingly. |
Line 74 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
|
Line 74 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
|
|
|
AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ |
AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ |
ac_save_LIBS="$LIBS" |
ac_save_LIBS="$LIBS" |
LIBS="$LIBS $LIB[]NAME" | dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS, |
AC_TRY_LINK([$3], [$4], | dnl because these -l options might require -L options that are present in |
| dnl LIBS. -l options benefit only from the -L options listed before it. |
| dnl Otherwise, add it to the front of LIBS, because it may be a static |
| dnl library that depends on another static library that is present in LIBS. |
| dnl Static libraries benefit only from the static libraries listed after |
| dnl it. |
| case " $LIB[]NAME" in |
| *" -l"*) LIBS="$LIBS $LIB[]NAME" ;; |
| *) LIBS="$LIB[]NAME $LIBS" ;; |
| esac |
| AC_LINK_IFELSE( |
| [AC_LANG_PROGRAM([[$3]], [[$4]])], |
[ac_cv_lib[]Name=yes], |
[ac_cv_lib[]Name=yes], |
[ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])']) |
[ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])']) |
LIBS="$ac_save_LIBS" |
LIBS="$ac_save_LIBS" |
Line 105 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
|
Line 116 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
|
dnl Determine the platform dependent parameters needed to use rpath: |
dnl Determine the platform dependent parameters needed to use rpath: |
dnl acl_libext, |
dnl acl_libext, |
dnl acl_shlibext, |
dnl acl_shlibext, |
|
dnl acl_libname_spec, |
|
dnl acl_library_names_spec, |
dnl acl_hardcode_libdir_flag_spec, |
dnl acl_hardcode_libdir_flag_spec, |
dnl acl_hardcode_libdir_separator, |
dnl acl_hardcode_libdir_separator, |
dnl acl_hardcode_direct, |
dnl acl_hardcode_direct, |
dnl acl_hardcode_minus_L. |
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 Complain if config.rpath is missing. |
m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) | AC_REQUIRE_AUX_FILE([config.rpath]) |
AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS |
AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS |
AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld |
AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld |
AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host |
AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host |
Line 147 dnl package. This declaration must occur before an AC_
|
Line 160 dnl package. This declaration must occur before an AC_
|
dnl macro call that searches for libname. |
dnl macro call that searches for libname. |
AC_DEFUN([AC_LIB_FROMPACKAGE], |
AC_DEFUN([AC_LIB_FROMPACKAGE], |
[ |
[ |
pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], | pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], |
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) | [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) |
define([acl_frompackage_]NAME, [$2]) |
define([acl_frompackage_]NAME, [$2]) |
popdef([NAME]) |
popdef([NAME]) |
pushdef([PACK],[$2]) |
pushdef([PACK],[$2]) |
pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-], | pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], |
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) | [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) |
define([acl_libsinpackage_]PACKUP, |
define([acl_libsinpackage_]PACKUP, |
m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1]) | m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) |
popdef([PACKUP]) |
popdef([PACKUP]) |
popdef([PACK]) |
popdef([PACK]) |
]) |
]) |
Line 168 dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
|
Line 181 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]) |
pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], | pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], |
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) | [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) |
pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) |
pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) |
pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-], | pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], |
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) | [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) |
pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) |
pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) |
dnl Autoconf >= 2.61 supports dots in --with options. |
|
pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)]) |
|
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_ARG_WITH(P_A_C_K[-prefix], | AC_ARG_WITH(PACK[-prefix], |
[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib | [[ --with-]]PACK[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib |
--without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], | --without-]]PACK[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], |
[ |
[ |
if test "X$withval" = "Xno"; then |
if test "X$withval" = "Xno"; then |
use_additional=no |
use_additional=no |
Line 198 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
|
Line 209 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
|
additional_includedir="$withval/include" |
additional_includedir="$withval/include" |
additional_libdir="$withval/$acl_libdirstem" |
additional_libdir="$withval/$acl_libdirstem" |
if test "$acl_libdirstem2" != "$acl_libdirstem" \ |
if test "$acl_libdirstem2" != "$acl_libdirstem" \ |
&& ! test -d "$withval/$acl_libdirstem"; then | && test ! -d "$withval/$acl_libdirstem"; then |
additional_libdir="$withval/$acl_libdirstem2" |
additional_libdir="$withval/$acl_libdirstem2" |
fi |
fi |
fi |
fi |
Line 232 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
|
Line 243 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
|
names_already_handled="$names_already_handled $name" |
names_already_handled="$names_already_handled $name" |
dnl See if it was already located by an earlier AC_LIB_LINKFLAGS |
dnl See if it was already located by an earlier AC_LIB_LINKFLAGS |
dnl or AC_LIB_HAVE_LINKFLAGS call. |
dnl or AC_LIB_HAVE_LINKFLAGS call. |
uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` | uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` |
eval value=\"\$HAVE_LIB$uppername\" |
eval value=\"\$HAVE_LIB$uppername\" |
if test -n "$value"; then |
if test -n "$value"; then |
if test "$value" = yes; then |
if test "$value" = yes; then |
Line 657 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
|
Line 668 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
|
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" |
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" |
done |
done |
fi |
fi |
popdef([P_A_C_K]) |
|
popdef([PACKLIBS]) |
popdef([PACKLIBS]) |
popdef([PACKUP]) |
popdef([PACKUP]) |
popdef([PACK]) |
popdef([PACK]) |