05d292b2 (kx 2023-03-24 03:51:10 +0300 1) # lib-link.m4 serial 26 (gettext-0.18.2)
05d292b2 (kx 2023-03-24 03:51:10 +0300 2) dnl Copyright (C) 2001-2016 Free Software Foundation, Inc.
05d292b2 (kx 2023-03-24 03:51:10 +0300 3) dnl This file is free software; the Free Software Foundation
05d292b2 (kx 2023-03-24 03:51:10 +0300 4) dnl gives unlimited permission to copy and/or distribute it,
05d292b2 (kx 2023-03-24 03:51:10 +0300 5) dnl with or without modifications, as long as this notice is preserved.
05d292b2 (kx 2023-03-24 03:51:10 +0300 6)
05d292b2 (kx 2023-03-24 03:51:10 +0300 7) dnl From Bruno Haible.
05d292b2 (kx 2023-03-24 03:51:10 +0300 8)
05d292b2 (kx 2023-03-24 03:51:10 +0300 9) AC_PREREQ([2.54])
05d292b2 (kx 2023-03-24 03:51:10 +0300 10)
05d292b2 (kx 2023-03-24 03:51:10 +0300 11) dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
05d292b2 (kx 2023-03-24 03:51:10 +0300 12) dnl the libraries corresponding to explicit and implicit dependencies.
05d292b2 (kx 2023-03-24 03:51:10 +0300 13) dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
05d292b2 (kx 2023-03-24 03:51:10 +0300 14) dnl augments the CPPFLAGS variable.
05d292b2 (kx 2023-03-24 03:51:10 +0300 15) dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
05d292b2 (kx 2023-03-24 03:51:10 +0300 16) dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
05d292b2 (kx 2023-03-24 03:51:10 +0300 17) AC_DEFUN([AC_LIB_LINKFLAGS],
05d292b2 (kx 2023-03-24 03:51:10 +0300 18) [
05d292b2 (kx 2023-03-24 03:51:10 +0300 19) AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
05d292b2 (kx 2023-03-24 03:51:10 +0300 20) AC_REQUIRE([AC_LIB_RPATH])
05d292b2 (kx 2023-03-24 03:51:10 +0300 21) pushdef([Name],[m4_translit([$1],[./+-], [____])])
05d292b2 (kx 2023-03-24 03:51:10 +0300 22) pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
05d292b2 (kx 2023-03-24 03:51:10 +0300 23) [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
05d292b2 (kx 2023-03-24 03:51:10 +0300 24) AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
05d292b2 (kx 2023-03-24 03:51:10 +0300 25) AC_LIB_LINKFLAGS_BODY([$1], [$2])
05d292b2 (kx 2023-03-24 03:51:10 +0300 26) ac_cv_lib[]Name[]_libs="$LIB[]NAME"
05d292b2 (kx 2023-03-24 03:51:10 +0300 27) ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
05d292b2 (kx 2023-03-24 03:51:10 +0300 28) ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
05d292b2 (kx 2023-03-24 03:51:10 +0300 29) ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
05d292b2 (kx 2023-03-24 03:51:10 +0300 30) ])
05d292b2 (kx 2023-03-24 03:51:10 +0300 31) LIB[]NAME="$ac_cv_lib[]Name[]_libs"
05d292b2 (kx 2023-03-24 03:51:10 +0300 32) LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
05d292b2 (kx 2023-03-24 03:51:10 +0300 33) INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
05d292b2 (kx 2023-03-24 03:51:10 +0300 34) LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
05d292b2 (kx 2023-03-24 03:51:10 +0300 35) AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
05d292b2 (kx 2023-03-24 03:51:10 +0300 36) AC_SUBST([LIB]NAME)
05d292b2 (kx 2023-03-24 03:51:10 +0300 37) AC_SUBST([LTLIB]NAME)
05d292b2 (kx 2023-03-24 03:51:10 +0300 38) AC_SUBST([LIB]NAME[_PREFIX])
05d292b2 (kx 2023-03-24 03:51:10 +0300 39) dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
05d292b2 (kx 2023-03-24 03:51:10 +0300 40) dnl results of this search when this library appears as a dependency.
05d292b2 (kx 2023-03-24 03:51:10 +0300 41) HAVE_LIB[]NAME=yes
05d292b2 (kx 2023-03-24 03:51:10 +0300 42) popdef([NAME])
05d292b2 (kx 2023-03-24 03:51:10 +0300 43) popdef([Name])
05d292b2 (kx 2023-03-24 03:51:10 +0300 44) ])
05d292b2 (kx 2023-03-24 03:51:10 +0300 45)
05d292b2 (kx 2023-03-24 03:51:10 +0300 46) dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
05d292b2 (kx 2023-03-24 03:51:10 +0300 47) dnl searches for libname and the libraries corresponding to explicit and
05d292b2 (kx 2023-03-24 03:51:10 +0300 48) dnl implicit dependencies, together with the specified include files and
05d292b2 (kx 2023-03-24 03:51:10 +0300 49) dnl the ability to compile and link the specified testcode. The missing-message
05d292b2 (kx 2023-03-24 03:51:10 +0300 50) dnl defaults to 'no' and may contain additional hints for the user.
05d292b2 (kx 2023-03-24 03:51:10 +0300 51) dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
05d292b2 (kx 2023-03-24 03:51:10 +0300 52) dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
05d292b2 (kx 2023-03-24 03:51:10 +0300 53) dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
05d292b2 (kx 2023-03-24 03:51:10 +0300 54) dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
05d292b2 (kx 2023-03-24 03:51:10 +0300 55) dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
05d292b2 (kx 2023-03-24 03:51:10 +0300 56) dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
05d292b2 (kx 2023-03-24 03:51:10 +0300 57) AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
05d292b2 (kx 2023-03-24 03:51:10 +0300 58) [
05d292b2 (kx 2023-03-24 03:51:10 +0300 59) AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
05d292b2 (kx 2023-03-24 03:51:10 +0300 60) AC_REQUIRE([AC_LIB_RPATH])
05d292b2 (kx 2023-03-24 03:51:10 +0300 61) pushdef([Name],[m4_translit([$1],[./+-], [____])])
05d292b2 (kx 2023-03-24 03:51:10 +0300 62) pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
05d292b2 (kx 2023-03-24 03:51:10 +0300 63) [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
05d292b2 (kx 2023-03-24 03:51:10 +0300 64)
05d292b2 (kx 2023-03-24 03:51:10 +0300 65) dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
05d292b2 (kx 2023-03-24 03:51:10 +0300 66) dnl accordingly.
05d292b2 (kx 2023-03-24 03:51:10 +0300 67) AC_LIB_LINKFLAGS_BODY([$1], [$2])
05d292b2 (kx 2023-03-24 03:51:10 +0300 68)
05d292b2 (kx 2023-03-24 03:51:10 +0300 69) dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
05d292b2 (kx 2023-03-24 03:51:10 +0300 70) dnl because if the user has installed lib[]Name and not disabled its use
05d292b2 (kx 2023-03-24 03:51:10 +0300 71) dnl via --without-lib[]Name-prefix, he wants to use it.
05d292b2 (kx 2023-03-24 03:51:10 +0300 72) ac_save_CPPFLAGS="$CPPFLAGS"
05d292b2 (kx 2023-03-24 03:51:10 +0300 73) AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
05d292b2 (kx 2023-03-24 03:51:10 +0300 74)
05d292b2 (kx 2023-03-24 03:51:10 +0300 75) AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
05d292b2 (kx 2023-03-24 03:51:10 +0300 76) ac_save_LIBS="$LIBS"
05d292b2 (kx 2023-03-24 03:51:10 +0300 77) dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
05d292b2 (kx 2023-03-24 03:51:10 +0300 78) dnl because these -l options might require -L options that are present in
05d292b2 (kx 2023-03-24 03:51:10 +0300 79) dnl LIBS. -l options benefit only from the -L options listed before it.
05d292b2 (kx 2023-03-24 03:51:10 +0300 80) dnl Otherwise, add it to the front of LIBS, because it may be a static
05d292b2 (kx 2023-03-24 03:51:10 +0300 81) dnl library that depends on another static library that is present in LIBS.
05d292b2 (kx 2023-03-24 03:51:10 +0300 82) dnl Static libraries benefit only from the static libraries listed after
05d292b2 (kx 2023-03-24 03:51:10 +0300 83) dnl it.
05d292b2 (kx 2023-03-24 03:51:10 +0300 84) case " $LIB[]NAME" in
05d292b2 (kx 2023-03-24 03:51:10 +0300 85) *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 86) *) LIBS="$LIB[]NAME $LIBS" ;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 87) esac
05d292b2 (kx 2023-03-24 03:51:10 +0300 88) AC_LINK_IFELSE(
05d292b2 (kx 2023-03-24 03:51:10 +0300 89) [AC_LANG_PROGRAM([[$3]], [[$4]])],
05d292b2 (kx 2023-03-24 03:51:10 +0300 90) [ac_cv_lib[]Name=yes],
05d292b2 (kx 2023-03-24 03:51:10 +0300 91) [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
05d292b2 (kx 2023-03-24 03:51:10 +0300 92) LIBS="$ac_save_LIBS"
05d292b2 (kx 2023-03-24 03:51:10 +0300 93) ])
05d292b2 (kx 2023-03-24 03:51:10 +0300 94) if test "$ac_cv_lib[]Name" = yes; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 95) HAVE_LIB[]NAME=yes
05d292b2 (kx 2023-03-24 03:51:10 +0300 96) AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
05d292b2 (kx 2023-03-24 03:51:10 +0300 97) AC_MSG_CHECKING([how to link with lib[]$1])
05d292b2 (kx 2023-03-24 03:51:10 +0300 98) AC_MSG_RESULT([$LIB[]NAME])
05d292b2 (kx 2023-03-24 03:51:10 +0300 99) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 100) HAVE_LIB[]NAME=no
05d292b2 (kx 2023-03-24 03:51:10 +0300 101) dnl If $LIB[]NAME didn't lead to a usable library, we don't need
05d292b2 (kx 2023-03-24 03:51:10 +0300 102) dnl $INC[]NAME either.
05d292b2 (kx 2023-03-24 03:51:10 +0300 103) CPPFLAGS="$ac_save_CPPFLAGS"
05d292b2 (kx 2023-03-24 03:51:10 +0300 104) LIB[]NAME=
05d292b2 (kx 2023-03-24 03:51:10 +0300 105) LTLIB[]NAME=
05d292b2 (kx 2023-03-24 03:51:10 +0300 106) LIB[]NAME[]_PREFIX=
05d292b2 (kx 2023-03-24 03:51:10 +0300 107) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 108) AC_SUBST([HAVE_LIB]NAME)
05d292b2 (kx 2023-03-24 03:51:10 +0300 109) AC_SUBST([LIB]NAME)
05d292b2 (kx 2023-03-24 03:51:10 +0300 110) AC_SUBST([LTLIB]NAME)
05d292b2 (kx 2023-03-24 03:51:10 +0300 111) AC_SUBST([LIB]NAME[_PREFIX])
05d292b2 (kx 2023-03-24 03:51:10 +0300 112) popdef([NAME])
05d292b2 (kx 2023-03-24 03:51:10 +0300 113) popdef([Name])
05d292b2 (kx 2023-03-24 03:51:10 +0300 114) ])
05d292b2 (kx 2023-03-24 03:51:10 +0300 115)
05d292b2 (kx 2023-03-24 03:51:10 +0300 116) dnl Determine the platform dependent parameters needed to use rpath:
05d292b2 (kx 2023-03-24 03:51:10 +0300 117) dnl acl_libext,
05d292b2 (kx 2023-03-24 03:51:10 +0300 118) dnl acl_shlibext,
05d292b2 (kx 2023-03-24 03:51:10 +0300 119) dnl acl_libname_spec,
05d292b2 (kx 2023-03-24 03:51:10 +0300 120) dnl acl_library_names_spec,
05d292b2 (kx 2023-03-24 03:51:10 +0300 121) dnl acl_hardcode_libdir_flag_spec,
05d292b2 (kx 2023-03-24 03:51:10 +0300 122) dnl acl_hardcode_libdir_separator,
05d292b2 (kx 2023-03-24 03:51:10 +0300 123) dnl acl_hardcode_direct,
05d292b2 (kx 2023-03-24 03:51:10 +0300 124) dnl acl_hardcode_minus_L.
05d292b2 (kx 2023-03-24 03:51:10 +0300 125) AC_DEFUN([AC_LIB_RPATH],
05d292b2 (kx 2023-03-24 03:51:10 +0300 126) [
05d292b2 (kx 2023-03-24 03:51:10 +0300 127) dnl Tell automake >= 1.10 to complain if config.rpath is missing.
05d292b2 (kx 2023-03-24 03:51:10 +0300 128) m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
05d292b2 (kx 2023-03-24 03:51:10 +0300 129) AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
05d292b2 (kx 2023-03-24 03:51:10 +0300 130) AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
05d292b2 (kx 2023-03-24 03:51:10 +0300 131) AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
05d292b2 (kx 2023-03-24 03:51:10 +0300 132) AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
05d292b2 (kx 2023-03-24 03:51:10 +0300 133) AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
05d292b2 (kx 2023-03-24 03:51:10 +0300 134) CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
05d292b2 (kx 2023-03-24 03:51:10 +0300 135) ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
05d292b2 (kx 2023-03-24 03:51:10 +0300 136) . ./conftest.sh
05d292b2 (kx 2023-03-24 03:51:10 +0300 137) rm -f ./conftest.sh
05d292b2 (kx 2023-03-24 03:51:10 +0300 138) acl_cv_rpath=done
05d292b2 (kx 2023-03-24 03:51:10 +0300 139) ])
05d292b2 (kx 2023-03-24 03:51:10 +0300 140) wl="$acl_cv_wl"
05d292b2 (kx 2023-03-24 03:51:10 +0300 141) acl_libext="$acl_cv_libext"
05d292b2 (kx 2023-03-24 03:51:10 +0300 142) acl_shlibext="$acl_cv_shlibext"
05d292b2 (kx 2023-03-24 03:51:10 +0300 143) acl_libname_spec="$acl_cv_libname_spec"
05d292b2 (kx 2023-03-24 03:51:10 +0300 144) acl_library_names_spec="$acl_cv_library_names_spec"
05d292b2 (kx 2023-03-24 03:51:10 +0300 145) acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
05d292b2 (kx 2023-03-24 03:51:10 +0300 146) acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
05d292b2 (kx 2023-03-24 03:51:10 +0300 147) acl_hardcode_direct="$acl_cv_hardcode_direct"
05d292b2 (kx 2023-03-24 03:51:10 +0300 148) acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
05d292b2 (kx 2023-03-24 03:51:10 +0300 149) dnl Determine whether the user wants rpath handling at all.
05d292b2 (kx 2023-03-24 03:51:10 +0300 150) AC_ARG_ENABLE([rpath],
05d292b2 (kx 2023-03-24 03:51:10 +0300 151) [ --disable-rpath do not hardcode runtime library paths],
05d292b2 (kx 2023-03-24 03:51:10 +0300 152) :, enable_rpath=yes)
05d292b2 (kx 2023-03-24 03:51:10 +0300 153) ])
05d292b2 (kx 2023-03-24 03:51:10 +0300 154)
05d292b2 (kx 2023-03-24 03:51:10 +0300 155) dnl AC_LIB_FROMPACKAGE(name, package)
05d292b2 (kx 2023-03-24 03:51:10 +0300 156) dnl declares that libname comes from the given package. The configure file
05d292b2 (kx 2023-03-24 03:51:10 +0300 157) dnl will then not have a --with-libname-prefix option but a
05d292b2 (kx 2023-03-24 03:51:10 +0300 158) dnl --with-package-prefix option. Several libraries can come from the same
05d292b2 (kx 2023-03-24 03:51:10 +0300 159) dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
05d292b2 (kx 2023-03-24 03:51:10 +0300 160) dnl macro call that searches for libname.
05d292b2 (kx 2023-03-24 03:51:10 +0300 161) AC_DEFUN([AC_LIB_FROMPACKAGE],
05d292b2 (kx 2023-03-24 03:51:10 +0300 162) [
05d292b2 (kx 2023-03-24 03:51:10 +0300 163) pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
05d292b2 (kx 2023-03-24 03:51:10 +0300 164) [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
05d292b2 (kx 2023-03-24 03:51:10 +0300 165) define([acl_frompackage_]NAME, [$2])
05d292b2 (kx 2023-03-24 03:51:10 +0300 166) popdef([NAME])
05d292b2 (kx 2023-03-24 03:51:10 +0300 167) pushdef([PACK],[$2])
05d292b2 (kx 2023-03-24 03:51:10 +0300 168) pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
05d292b2 (kx 2023-03-24 03:51:10 +0300 169) [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
05d292b2 (kx 2023-03-24 03:51:10 +0300 170) define([acl_libsinpackage_]PACKUP,
05d292b2 (kx 2023-03-24 03:51:10 +0300 171) m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
05d292b2 (kx 2023-03-24 03:51:10 +0300 172) popdef([PACKUP])
05d292b2 (kx 2023-03-24 03:51:10 +0300 173) popdef([PACK])
05d292b2 (kx 2023-03-24 03:51:10 +0300 174) ])
05d292b2 (kx 2023-03-24 03:51:10 +0300 175)
05d292b2 (kx 2023-03-24 03:51:10 +0300 176) dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
05d292b2 (kx 2023-03-24 03:51:10 +0300 177) dnl the libraries corresponding to explicit and implicit dependencies.
05d292b2 (kx 2023-03-24 03:51:10 +0300 178) dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
05d292b2 (kx 2023-03-24 03:51:10 +0300 179) dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
05d292b2 (kx 2023-03-24 03:51:10 +0300 180) dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
05d292b2 (kx 2023-03-24 03:51:10 +0300 181) AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
05d292b2 (kx 2023-03-24 03:51:10 +0300 182) [
05d292b2 (kx 2023-03-24 03:51:10 +0300 183) AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
05d292b2 (kx 2023-03-24 03:51:10 +0300 184) pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
05d292b2 (kx 2023-03-24 03:51:10 +0300 185) [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
05d292b2 (kx 2023-03-24 03:51:10 +0300 186) pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
05d292b2 (kx 2023-03-24 03:51:10 +0300 187) pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
05d292b2 (kx 2023-03-24 03:51:10 +0300 188) [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
05d292b2 (kx 2023-03-24 03:51:10 +0300 189) pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
05d292b2 (kx 2023-03-24 03:51:10 +0300 190) dnl Autoconf >= 2.61 supports dots in --with options.
05d292b2 (kx 2023-03-24 03:51:10 +0300 191) pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)])
05d292b2 (kx 2023-03-24 03:51:10 +0300 192) dnl By default, look in $includedir and $libdir.
05d292b2 (kx 2023-03-24 03:51:10 +0300 193) use_additional=yes
05d292b2 (kx 2023-03-24 03:51:10 +0300 194) AC_LIB_WITH_FINAL_PREFIX([
05d292b2 (kx 2023-03-24 03:51:10 +0300 195) eval additional_includedir=\"$includedir\"
05d292b2 (kx 2023-03-24 03:51:10 +0300 196) eval additional_libdir=\"$libdir\"
05d292b2 (kx 2023-03-24 03:51:10 +0300 197) ])
05d292b2 (kx 2023-03-24 03:51:10 +0300 198) AC_ARG_WITH(P_A_C_K[-prefix],
05d292b2 (kx 2023-03-24 03:51:10 +0300 199) [[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib
05d292b2 (kx 2023-03-24 03:51:10 +0300 200) --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]],
05d292b2 (kx 2023-03-24 03:51:10 +0300 201) [
05d292b2 (kx 2023-03-24 03:51:10 +0300 202) if test "X$withval" = "Xno"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 203) use_additional=no
05d292b2 (kx 2023-03-24 03:51:10 +0300 204) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 205) if test "X$withval" = "X"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 206) AC_LIB_WITH_FINAL_PREFIX([
05d292b2 (kx 2023-03-24 03:51:10 +0300 207) eval additional_includedir=\"$includedir\"
05d292b2 (kx 2023-03-24 03:51:10 +0300 208) eval additional_libdir=\"$libdir\"
05d292b2 (kx 2023-03-24 03:51:10 +0300 209) ])
05d292b2 (kx 2023-03-24 03:51:10 +0300 210) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 211) additional_includedir="$withval/include"
05d292b2 (kx 2023-03-24 03:51:10 +0300 212) additional_libdir="$withval/$acl_libdirstem"
05d292b2 (kx 2023-03-24 03:51:10 +0300 213) if test "$acl_libdirstem2" != "$acl_libdirstem" \
05d292b2 (kx 2023-03-24 03:51:10 +0300 214) && ! test -d "$withval/$acl_libdirstem"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 215) additional_libdir="$withval/$acl_libdirstem2"
05d292b2 (kx 2023-03-24 03:51:10 +0300 216) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 217) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 218) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 219) ])
05d292b2 (kx 2023-03-24 03:51:10 +0300 220) dnl Search the library and its dependencies in $additional_libdir and
05d292b2 (kx 2023-03-24 03:51:10 +0300 221) dnl $LDFLAGS. Using breadth-first-seach.
05d292b2 (kx 2023-03-24 03:51:10 +0300 222) LIB[]NAME=
05d292b2 (kx 2023-03-24 03:51:10 +0300 223) LTLIB[]NAME=
05d292b2 (kx 2023-03-24 03:51:10 +0300 224) INC[]NAME=
05d292b2 (kx 2023-03-24 03:51:10 +0300 225) LIB[]NAME[]_PREFIX=
05d292b2 (kx 2023-03-24 03:51:10 +0300 226) dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
05d292b2 (kx 2023-03-24 03:51:10 +0300 227) dnl computed. So it has to be reset here.
05d292b2 (kx 2023-03-24 03:51:10 +0300 228) HAVE_LIB[]NAME=
05d292b2 (kx 2023-03-24 03:51:10 +0300 229) rpathdirs=
05d292b2 (kx 2023-03-24 03:51:10 +0300 230) ltrpathdirs=
05d292b2 (kx 2023-03-24 03:51:10 +0300 231) names_already_handled=
05d292b2 (kx 2023-03-24 03:51:10 +0300 232) names_next_round='$1 $2'
05d292b2 (kx 2023-03-24 03:51:10 +0300 233) while test -n "$names_next_round"; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 234) names_this_round="$names_next_round"
05d292b2 (kx 2023-03-24 03:51:10 +0300 235) names_next_round=
05d292b2 (kx 2023-03-24 03:51:10 +0300 236) for name in $names_this_round; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 237) already_handled=
05d292b2 (kx 2023-03-24 03:51:10 +0300 238) for n in $names_already_handled; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 239) if test "$n" = "$name"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 240) already_handled=yes
05d292b2 (kx 2023-03-24 03:51:10 +0300 241) break
05d292b2 (kx 2023-03-24 03:51:10 +0300 242) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 243) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 244) if test -z "$already_handled"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 245) names_already_handled="$names_already_handled $name"
05d292b2 (kx 2023-03-24 03:51:10 +0300 246) dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
05d292b2 (kx 2023-03-24 03:51:10 +0300 247) dnl or AC_LIB_HAVE_LINKFLAGS call.
05d292b2 (kx 2023-03-24 03:51:10 +0300 248) uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
05d292b2 (kx 2023-03-24 03:51:10 +0300 249) eval value=\"\$HAVE_LIB$uppername\"
05d292b2 (kx 2023-03-24 03:51:10 +0300 250) if test -n "$value"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 251) if test "$value" = yes; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 252) eval value=\"\$LIB$uppername\"
05d292b2 (kx 2023-03-24 03:51:10 +0300 253) test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
05d292b2 (kx 2023-03-24 03:51:10 +0300 254) eval value=\"\$LTLIB$uppername\"
05d292b2 (kx 2023-03-24 03:51:10 +0300 255) test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
05d292b2 (kx 2023-03-24 03:51:10 +0300 256) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 257) dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
05d292b2 (kx 2023-03-24 03:51:10 +0300 258) dnl that this library doesn't exist. So just drop it.
05d292b2 (kx 2023-03-24 03:51:10 +0300 259) :
05d292b2 (kx 2023-03-24 03:51:10 +0300 260) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 261) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 262) dnl Search the library lib$name in $additional_libdir and $LDFLAGS
05d292b2 (kx 2023-03-24 03:51:10 +0300 263) dnl and the already constructed $LIBNAME/$LTLIBNAME.
05d292b2 (kx 2023-03-24 03:51:10 +0300 264) found_dir=
05d292b2 (kx 2023-03-24 03:51:10 +0300 265) found_la=
05d292b2 (kx 2023-03-24 03:51:10 +0300 266) found_so=
05d292b2 (kx 2023-03-24 03:51:10 +0300 267) found_a=
05d292b2 (kx 2023-03-24 03:51:10 +0300 268) eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
05d292b2 (kx 2023-03-24 03:51:10 +0300 269) if test -n "$acl_shlibext"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 270) shrext=".$acl_shlibext" # typically: shrext=.so
05d292b2 (kx 2023-03-24 03:51:10 +0300 271) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 272) shrext=
05d292b2 (kx 2023-03-24 03:51:10 +0300 273) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 274) if test $use_additional = yes; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 275) dir="$additional_libdir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 276) dnl The same code as in the loop below:
05d292b2 (kx 2023-03-24 03:51:10 +0300 277) dnl First look for a shared library.
05d292b2 (kx 2023-03-24 03:51:10 +0300 278) if test -n "$acl_shlibext"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 279) if test -f "$dir/$libname$shrext"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 280) found_dir="$dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 281) found_so="$dir/$libname$shrext"
05d292b2 (kx 2023-03-24 03:51:10 +0300 282) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 283) if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 284) ver=`(cd "$dir" && \
05d292b2 (kx 2023-03-24 03:51:10 +0300 285) for f in "$libname$shrext".*; do echo "$f"; done \
05d292b2 (kx 2023-03-24 03:51:10 +0300 286) | sed -e "s,^$libname$shrext\\\\.,," \
05d292b2 (kx 2023-03-24 03:51:10 +0300 287) | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
05d292b2 (kx 2023-03-24 03:51:10 +0300 288) | sed 1q ) 2>/dev/null`
05d292b2 (kx 2023-03-24 03:51:10 +0300 289) if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 290) found_dir="$dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 291) found_so="$dir/$libname$shrext.$ver"
05d292b2 (kx 2023-03-24 03:51:10 +0300 292) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 293) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 294) eval library_names=\"$acl_library_names_spec\"
05d292b2 (kx 2023-03-24 03:51:10 +0300 295) for f in $library_names; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 296) if test -f "$dir/$f"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 297) found_dir="$dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 298) found_so="$dir/$f"
05d292b2 (kx 2023-03-24 03:51:10 +0300 299) break
05d292b2 (kx 2023-03-24 03:51:10 +0300 300) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 301) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 302) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 303) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 304) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 305) dnl Then look for a static library.
05d292b2 (kx 2023-03-24 03:51:10 +0300 306) if test "X$found_dir" = "X"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 307) if test -f "$dir/$libname.$acl_libext"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 308) found_dir="$dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 309) found_a="$dir/$libname.$acl_libext"
05d292b2 (kx 2023-03-24 03:51:10 +0300 310) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 311) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 312) if test "X$found_dir" != "X"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 313) if test -f "$dir/$libname.la"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 314) found_la="$dir/$libname.la"
05d292b2 (kx 2023-03-24 03:51:10 +0300 315) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 316) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 317) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 318) if test "X$found_dir" = "X"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 319) for x in $LDFLAGS $LTLIB[]NAME; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 320) AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
05d292b2 (kx 2023-03-24 03:51:10 +0300 321) case "$x" in
05d292b2 (kx 2023-03-24 03:51:10 +0300 322) -L*)
05d292b2 (kx 2023-03-24 03:51:10 +0300 323) dir=`echo "X$x" | sed -e 's/^X-L//'`
05d292b2 (kx 2023-03-24 03:51:10 +0300 324) dnl First look for a shared library.
05d292b2 (kx 2023-03-24 03:51:10 +0300 325) if test -n "$acl_shlibext"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 326) if test -f "$dir/$libname$shrext"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 327) found_dir="$dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 328) found_so="$dir/$libname$shrext"
05d292b2 (kx 2023-03-24 03:51:10 +0300 329) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 330) if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 331) ver=`(cd "$dir" && \
05d292b2 (kx 2023-03-24 03:51:10 +0300 332) for f in "$libname$shrext".*; do echo "$f"; done \
05d292b2 (kx 2023-03-24 03:51:10 +0300 333) | sed -e "s,^$libname$shrext\\\\.,," \
05d292b2 (kx 2023-03-24 03:51:10 +0300 334) | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
05d292b2 (kx 2023-03-24 03:51:10 +0300 335) | sed 1q ) 2>/dev/null`
05d292b2 (kx 2023-03-24 03:51:10 +0300 336) if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 337) found_dir="$dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 338) found_so="$dir/$libname$shrext.$ver"
05d292b2 (kx 2023-03-24 03:51:10 +0300 339) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 340) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 341) eval library_names=\"$acl_library_names_spec\"
05d292b2 (kx 2023-03-24 03:51:10 +0300 342) for f in $library_names; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 343) if test -f "$dir/$f"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 344) found_dir="$dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 345) found_so="$dir/$f"
05d292b2 (kx 2023-03-24 03:51:10 +0300 346) break
05d292b2 (kx 2023-03-24 03:51:10 +0300 347) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 348) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 349) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 350) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 351) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 352) dnl Then look for a static library.
05d292b2 (kx 2023-03-24 03:51:10 +0300 353) if test "X$found_dir" = "X"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 354) if test -f "$dir/$libname.$acl_libext"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 355) found_dir="$dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 356) found_a="$dir/$libname.$acl_libext"
05d292b2 (kx 2023-03-24 03:51:10 +0300 357) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 358) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 359) if test "X$found_dir" != "X"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 360) if test -f "$dir/$libname.la"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 361) found_la="$dir/$libname.la"
05d292b2 (kx 2023-03-24 03:51:10 +0300 362) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 363) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 364) ;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 365) esac
05d292b2 (kx 2023-03-24 03:51:10 +0300 366) if test "X$found_dir" != "X"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 367) break
05d292b2 (kx 2023-03-24 03:51:10 +0300 368) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 369) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 370) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 371) if test "X$found_dir" != "X"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 372) dnl Found the library.
05d292b2 (kx 2023-03-24 03:51:10 +0300 373) LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
05d292b2 (kx 2023-03-24 03:51:10 +0300 374) if test "X$found_so" != "X"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 375) dnl Linking with a shared library. We attempt to hardcode its
05d292b2 (kx 2023-03-24 03:51:10 +0300 376) dnl directory into the executable's runpath, unless it's the
05d292b2 (kx 2023-03-24 03:51:10 +0300 377) dnl standard /usr/lib.
05d292b2 (kx 2023-03-24 03:51:10 +0300 378) if test "$enable_rpath" = no \
05d292b2 (kx 2023-03-24 03:51:10 +0300 379) || test "X$found_dir" = "X/usr/$acl_libdirstem" \
05d292b2 (kx 2023-03-24 03:51:10 +0300 380) || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 381) dnl No hardcoding is needed.
05d292b2 (kx 2023-03-24 03:51:10 +0300 382) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
05d292b2 (kx 2023-03-24 03:51:10 +0300 383) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 384) dnl Use an explicit option to hardcode DIR into the resulting
05d292b2 (kx 2023-03-24 03:51:10 +0300 385) dnl binary.
05d292b2 (kx 2023-03-24 03:51:10 +0300 386) dnl Potentially add DIR to ltrpathdirs.
05d292b2 (kx 2023-03-24 03:51:10 +0300 387) dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
05d292b2 (kx 2023-03-24 03:51:10 +0300 388) haveit=
05d292b2 (kx 2023-03-24 03:51:10 +0300 389) for x in $ltrpathdirs; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 390) if test "X$x" = "X$found_dir"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 391) haveit=yes
05d292b2 (kx 2023-03-24 03:51:10 +0300 392) break
05d292b2 (kx 2023-03-24 03:51:10 +0300 393) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 394) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 395) if test -z "$haveit"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 396) ltrpathdirs="$ltrpathdirs $found_dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 397) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 398) dnl The hardcoding into $LIBNAME is system dependent.
05d292b2 (kx 2023-03-24 03:51:10 +0300 399) if test "$acl_hardcode_direct" = yes; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 400) dnl Using DIR/libNAME.so during linking hardcodes DIR into the
05d292b2 (kx 2023-03-24 03:51:10 +0300 401) dnl resulting binary.
05d292b2 (kx 2023-03-24 03:51:10 +0300 402) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
05d292b2 (kx 2023-03-24 03:51:10 +0300 403) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 404) if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 405) dnl Use an explicit option to hardcode DIR into the resulting
05d292b2 (kx 2023-03-24 03:51:10 +0300 406) dnl binary.
05d292b2 (kx 2023-03-24 03:51:10 +0300 407) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
05d292b2 (kx 2023-03-24 03:51:10 +0300 408) dnl Potentially add DIR to rpathdirs.
05d292b2 (kx 2023-03-24 03:51:10 +0300 409) dnl The rpathdirs will be appended to $LIBNAME at the end.
05d292b2 (kx 2023-03-24 03:51:10 +0300 410) haveit=
05d292b2 (kx 2023-03-24 03:51:10 +0300 411) for x in $rpathdirs; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 412) if test "X$x" = "X$found_dir"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 413) haveit=yes
05d292b2 (kx 2023-03-24 03:51:10 +0300 414) break
05d292b2 (kx 2023-03-24 03:51:10 +0300 415) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 416) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 417) if test -z "$haveit"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 418) rpathdirs="$rpathdirs $found_dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 419) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 420) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 421) dnl Rely on "-L$found_dir".
05d292b2 (kx 2023-03-24 03:51:10 +0300 422) dnl But don't add it if it's already contained in the LDFLAGS
05d292b2 (kx 2023-03-24 03:51:10 +0300 423) dnl or the already constructed $LIBNAME
05d292b2 (kx 2023-03-24 03:51:10 +0300 424) haveit=
05d292b2 (kx 2023-03-24 03:51:10 +0300 425) for x in $LDFLAGS $LIB[]NAME; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 426) AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
05d292b2 (kx 2023-03-24 03:51:10 +0300 427) if test "X$x" = "X-L$found_dir"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 428) haveit=yes
05d292b2 (kx 2023-03-24 03:51:10 +0300 429) break
05d292b2 (kx 2023-03-24 03:51:10 +0300 430) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 431) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 432) if test -z "$haveit"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 433) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 434) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 435) if test "$acl_hardcode_minus_L" != no; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 436) dnl FIXME: Not sure whether we should use
05d292b2 (kx 2023-03-24 03:51:10 +0300 437) dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
05d292b2 (kx 2023-03-24 03:51:10 +0300 438) dnl here.
05d292b2 (kx 2023-03-24 03:51:10 +0300 439) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
05d292b2 (kx 2023-03-24 03:51:10 +0300 440) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 441) dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
05d292b2 (kx 2023-03-24 03:51:10 +0300 442) dnl here, because this doesn't fit in flags passed to the
05d292b2 (kx 2023-03-24 03:51:10 +0300 443) dnl compiler. So give up. No hardcoding. This affects only
05d292b2 (kx 2023-03-24 03:51:10 +0300 444) dnl very old systems.
05d292b2 (kx 2023-03-24 03:51:10 +0300 445) dnl FIXME: Not sure whether we should use
05d292b2 (kx 2023-03-24 03:51:10 +0300 446) dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
05d292b2 (kx 2023-03-24 03:51:10 +0300 447) dnl here.
05d292b2 (kx 2023-03-24 03:51:10 +0300 448) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
05d292b2 (kx 2023-03-24 03:51:10 +0300 449) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 450) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 451) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 452) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 453) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 454) if test "X$found_a" != "X"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 455) dnl Linking with a static library.
05d292b2 (kx 2023-03-24 03:51:10 +0300 456) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
05d292b2 (kx 2023-03-24 03:51:10 +0300 457) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 458) dnl We shouldn't come here, but anyway it's good to have a
05d292b2 (kx 2023-03-24 03:51:10 +0300 459) dnl fallback.
05d292b2 (kx 2023-03-24 03:51:10 +0300 460) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
05d292b2 (kx 2023-03-24 03:51:10 +0300 461) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 462) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 463) dnl Assume the include files are nearby.
05d292b2 (kx 2023-03-24 03:51:10 +0300 464) additional_includedir=
05d292b2 (kx 2023-03-24 03:51:10 +0300 465) case "$found_dir" in
05d292b2 (kx 2023-03-24 03:51:10 +0300 466) */$acl_libdirstem | */$acl_libdirstem/)
05d292b2 (kx 2023-03-24 03:51:10 +0300 467) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
05d292b2 (kx 2023-03-24 03:51:10 +0300 468) if test "$name" = '$1'; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 469) LIB[]NAME[]_PREFIX="$basedir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 470) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 471) additional_includedir="$basedir/include"
05d292b2 (kx 2023-03-24 03:51:10 +0300 472) ;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 473) */$acl_libdirstem2 | */$acl_libdirstem2/)
05d292b2 (kx 2023-03-24 03:51:10 +0300 474) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
05d292b2 (kx 2023-03-24 03:51:10 +0300 475) if test "$name" = '$1'; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 476) LIB[]NAME[]_PREFIX="$basedir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 477) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 478) additional_includedir="$basedir/include"
05d292b2 (kx 2023-03-24 03:51:10 +0300 479) ;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 480) esac
05d292b2 (kx 2023-03-24 03:51:10 +0300 481) if test "X$additional_includedir" != "X"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 482) dnl Potentially add $additional_includedir to $INCNAME.
05d292b2 (kx 2023-03-24 03:51:10 +0300 483) dnl But don't add it
05d292b2 (kx 2023-03-24 03:51:10 +0300 484) dnl 1. if it's the standard /usr/include,
05d292b2 (kx 2023-03-24 03:51:10 +0300 485) dnl 2. if it's /usr/local/include and we are using GCC on Linux,
05d292b2 (kx 2023-03-24 03:51:10 +0300 486) dnl 3. if it's already present in $CPPFLAGS or the already
05d292b2 (kx 2023-03-24 03:51:10 +0300 487) dnl constructed $INCNAME,
05d292b2 (kx 2023-03-24 03:51:10 +0300 488) dnl 4. if it doesn't exist as a directory.
05d292b2 (kx 2023-03-24 03:51:10 +0300 489) if test "X$additional_includedir" != "X/usr/include"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 490) haveit=
05d292b2 (kx 2023-03-24 03:51:10 +0300 491) if test "X$additional_includedir" = "X/usr/local/include"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 492) if test -n "$GCC"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 493) case $host_os in
05d292b2 (kx 2023-03-24 03:51:10 +0300 494) linux* | gnu* | k*bsd*-gnu) haveit=yes;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 495) esac
05d292b2 (kx 2023-03-24 03:51:10 +0300 496) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 497) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 498) if test -z "$haveit"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 499) for x in $CPPFLAGS $INC[]NAME; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 500) AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
05d292b2 (kx 2023-03-24 03:51:10 +0300 501) if test "X$x" = "X-I$additional_includedir"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 502) haveit=yes
05d292b2 (kx 2023-03-24 03:51:10 +0300 503) break
05d292b2 (kx 2023-03-24 03:51:10 +0300 504) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 505) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 506) if test -z "$haveit"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 507) if test -d "$additional_includedir"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 508) dnl Really add $additional_includedir to $INCNAME.
05d292b2 (kx 2023-03-24 03:51:10 +0300 509) INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 510) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 511) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 512) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 513) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 514) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 515) dnl Look for dependencies.
05d292b2 (kx 2023-03-24 03:51:10 +0300 516) if test -n "$found_la"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 517) dnl Read the .la file. It defines the variables
05d292b2 (kx 2023-03-24 03:51:10 +0300 518) dnl dlname, library_names, old_library, dependency_libs, current,
05d292b2 (kx 2023-03-24 03:51:10 +0300 519) dnl age, revision, installed, dlopen, dlpreopen, libdir.
05d292b2 (kx 2023-03-24 03:51:10 +0300 520) save_libdir="$libdir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 521) case "$found_la" in
05d292b2 (kx 2023-03-24 03:51:10 +0300 522) */* | *\\*) . "$found_la" ;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 523) *) . "./$found_la" ;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 524) esac
05d292b2 (kx 2023-03-24 03:51:10 +0300 525) libdir="$save_libdir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 526) dnl We use only dependency_libs.
05d292b2 (kx 2023-03-24 03:51:10 +0300 527) for dep in $dependency_libs; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 528) case "$dep" in
05d292b2 (kx 2023-03-24 03:51:10 +0300 529) -L*)
05d292b2 (kx 2023-03-24 03:51:10 +0300 530) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
05d292b2 (kx 2023-03-24 03:51:10 +0300 531) dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
05d292b2 (kx 2023-03-24 03:51:10 +0300 532) dnl But don't add it
05d292b2 (kx 2023-03-24 03:51:10 +0300 533) dnl 1. if it's the standard /usr/lib,
05d292b2 (kx 2023-03-24 03:51:10 +0300 534) dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
05d292b2 (kx 2023-03-24 03:51:10 +0300 535) dnl 3. if it's already present in $LDFLAGS or the already
05d292b2 (kx 2023-03-24 03:51:10 +0300 536) dnl constructed $LIBNAME,
05d292b2 (kx 2023-03-24 03:51:10 +0300 537) dnl 4. if it doesn't exist as a directory.
05d292b2 (kx 2023-03-24 03:51:10 +0300 538) if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
05d292b2 (kx 2023-03-24 03:51:10 +0300 539) && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 540) haveit=
05d292b2 (kx 2023-03-24 03:51:10 +0300 541) if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
05d292b2 (kx 2023-03-24 03:51:10 +0300 542) || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 543) if test -n "$GCC"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 544) case $host_os in
05d292b2 (kx 2023-03-24 03:51:10 +0300 545) linux* | gnu* | k*bsd*-gnu) haveit=yes;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 546) esac
05d292b2 (kx 2023-03-24 03:51:10 +0300 547) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 548) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 549) if test -z "$haveit"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 550) haveit=
05d292b2 (kx 2023-03-24 03:51:10 +0300 551) for x in $LDFLAGS $LIB[]NAME; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 552) AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
05d292b2 (kx 2023-03-24 03:51:10 +0300 553) if test "X$x" = "X-L$additional_libdir"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 554) haveit=yes
05d292b2 (kx 2023-03-24 03:51:10 +0300 555) break
05d292b2 (kx 2023-03-24 03:51:10 +0300 556) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 557) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 558) if test -z "$haveit"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 559) if test -d "$additional_libdir"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 560) dnl Really add $additional_libdir to $LIBNAME.
05d292b2 (kx 2023-03-24 03:51:10 +0300 561) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 562) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 563) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 564) haveit=
05d292b2 (kx 2023-03-24 03:51:10 +0300 565) for x in $LDFLAGS $LTLIB[]NAME; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 566) AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
05d292b2 (kx 2023-03-24 03:51:10 +0300 567) if test "X$x" = "X-L$additional_libdir"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 568) haveit=yes
05d292b2 (kx 2023-03-24 03:51:10 +0300 569) break
05d292b2 (kx 2023-03-24 03:51:10 +0300 570) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 571) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 572) if test -z "$haveit"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 573) if test -d "$additional_libdir"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 574) dnl Really add $additional_libdir to $LTLIBNAME.
05d292b2 (kx 2023-03-24 03:51:10 +0300 575) LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 576) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 577) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 578) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 579) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 580) ;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 581) -R*)
05d292b2 (kx 2023-03-24 03:51:10 +0300 582) dir=`echo "X$dep" | sed -e 's/^X-R//'`
05d292b2 (kx 2023-03-24 03:51:10 +0300 583) if test "$enable_rpath" != no; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 584) dnl Potentially add DIR to rpathdirs.
05d292b2 (kx 2023-03-24 03:51:10 +0300 585) dnl The rpathdirs will be appended to $LIBNAME at the end.
05d292b2 (kx 2023-03-24 03:51:10 +0300 586) haveit=
05d292b2 (kx 2023-03-24 03:51:10 +0300 587) for x in $rpathdirs; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 588) if test "X$x" = "X$dir"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 589) haveit=yes
05d292b2 (kx 2023-03-24 03:51:10 +0300 590) break
05d292b2 (kx 2023-03-24 03:51:10 +0300 591) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 592) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 593) if test -z "$haveit"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 594) rpathdirs="$rpathdirs $dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 595) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 596) dnl Potentially add DIR to ltrpathdirs.
05d292b2 (kx 2023-03-24 03:51:10 +0300 597) dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
05d292b2 (kx 2023-03-24 03:51:10 +0300 598) haveit=
05d292b2 (kx 2023-03-24 03:51:10 +0300 599) for x in $ltrpathdirs; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 600) if test "X$x" = "X$dir"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 601) haveit=yes
05d292b2 (kx 2023-03-24 03:51:10 +0300 602) break
05d292b2 (kx 2023-03-24 03:51:10 +0300 603) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 604) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 605) if test -z "$haveit"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 606) ltrpathdirs="$ltrpathdirs $dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 607) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 608) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 609) ;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 610) -l*)
05d292b2 (kx 2023-03-24 03:51:10 +0300 611) dnl Handle this in the next round.
05d292b2 (kx 2023-03-24 03:51:10 +0300 612) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
05d292b2 (kx 2023-03-24 03:51:10 +0300 613) ;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 614) *.la)
05d292b2 (kx 2023-03-24 03:51:10 +0300 615) dnl Handle this in the next round. Throw away the .la's
05d292b2 (kx 2023-03-24 03:51:10 +0300 616) dnl directory; it is already contained in a preceding -L
05d292b2 (kx 2023-03-24 03:51:10 +0300 617) dnl option.
05d292b2 (kx 2023-03-24 03:51:10 +0300 618) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
05d292b2 (kx 2023-03-24 03:51:10 +0300 619) ;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 620) *)
05d292b2 (kx 2023-03-24 03:51:10 +0300 621) dnl Most likely an immediate library name.
05d292b2 (kx 2023-03-24 03:51:10 +0300 622) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
05d292b2 (kx 2023-03-24 03:51:10 +0300 623) LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
05d292b2 (kx 2023-03-24 03:51:10 +0300 624) ;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 625) esac
05d292b2 (kx 2023-03-24 03:51:10 +0300 626) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 627) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 628) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 629) dnl Didn't find the library; assume it is in the system directories
05d292b2 (kx 2023-03-24 03:51:10 +0300 630) dnl known to the linker and runtime loader. (All the system
05d292b2 (kx 2023-03-24 03:51:10 +0300 631) dnl directories known to the linker should also be known to the
05d292b2 (kx 2023-03-24 03:51:10 +0300 632) dnl runtime loader, otherwise the system is severely misconfigured.)
05d292b2 (kx 2023-03-24 03:51:10 +0300 633) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
05d292b2 (kx 2023-03-24 03:51:10 +0300 634) LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
05d292b2 (kx 2023-03-24 03:51:10 +0300 635) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 636) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 637) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 638) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 639) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 640) if test "X$rpathdirs" != "X"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 641) if test -n "$acl_hardcode_libdir_separator"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 642) dnl Weird platform: only the last -rpath option counts, the user must
05d292b2 (kx 2023-03-24 03:51:10 +0300 643) dnl pass all path elements in one option. We can arrange that for a
05d292b2 (kx 2023-03-24 03:51:10 +0300 644) dnl single library, but not when more than one $LIBNAMEs are used.
05d292b2 (kx 2023-03-24 03:51:10 +0300 645) alldirs=
05d292b2 (kx 2023-03-24 03:51:10 +0300 646) for found_dir in $rpathdirs; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 647) alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 648) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 649) dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
05d292b2 (kx 2023-03-24 03:51:10 +0300 650) acl_save_libdir="$libdir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 651) libdir="$alldirs"
05d292b2 (kx 2023-03-24 03:51:10 +0300 652) eval flag=\"$acl_hardcode_libdir_flag_spec\"
05d292b2 (kx 2023-03-24 03:51:10 +0300 653) libdir="$acl_save_libdir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 654) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
05d292b2 (kx 2023-03-24 03:51:10 +0300 655) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 656) dnl The -rpath options are cumulative.
05d292b2 (kx 2023-03-24 03:51:10 +0300 657) for found_dir in $rpathdirs; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 658) acl_save_libdir="$libdir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 659) libdir="$found_dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 660) eval flag=\"$acl_hardcode_libdir_flag_spec\"
05d292b2 (kx 2023-03-24 03:51:10 +0300 661) libdir="$acl_save_libdir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 662) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
05d292b2 (kx 2023-03-24 03:51:10 +0300 663) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 664) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 665) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 666) if test "X$ltrpathdirs" != "X"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 667) dnl When using libtool, the option that works for both libraries and
05d292b2 (kx 2023-03-24 03:51:10 +0300 668) dnl executables is -R. The -R options are cumulative.
05d292b2 (kx 2023-03-24 03:51:10 +0300 669) for found_dir in $ltrpathdirs; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 670) LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 671) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 672) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 673) popdef([P_A_C_K])
05d292b2 (kx 2023-03-24 03:51:10 +0300 674) popdef([PACKLIBS])
05d292b2 (kx 2023-03-24 03:51:10 +0300 675) popdef([PACKUP])
05d292b2 (kx 2023-03-24 03:51:10 +0300 676) popdef([PACK])
05d292b2 (kx 2023-03-24 03:51:10 +0300 677) popdef([NAME])
05d292b2 (kx 2023-03-24 03:51:10 +0300 678) ])
05d292b2 (kx 2023-03-24 03:51:10 +0300 679)
05d292b2 (kx 2023-03-24 03:51:10 +0300 680) dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
05d292b2 (kx 2023-03-24 03:51:10 +0300 681) dnl unless already present in VAR.
05d292b2 (kx 2023-03-24 03:51:10 +0300 682) dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
05d292b2 (kx 2023-03-24 03:51:10 +0300 683) dnl contains two or three consecutive elements that belong together.
05d292b2 (kx 2023-03-24 03:51:10 +0300 684) AC_DEFUN([AC_LIB_APPENDTOVAR],
05d292b2 (kx 2023-03-24 03:51:10 +0300 685) [
05d292b2 (kx 2023-03-24 03:51:10 +0300 686) for element in [$2]; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 687) haveit=
05d292b2 (kx 2023-03-24 03:51:10 +0300 688) for x in $[$1]; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 689) AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
05d292b2 (kx 2023-03-24 03:51:10 +0300 690) if test "X$x" = "X$element"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 691) haveit=yes
05d292b2 (kx 2023-03-24 03:51:10 +0300 692) break
05d292b2 (kx 2023-03-24 03:51:10 +0300 693) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 694) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 695) if test -z "$haveit"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 696) [$1]="${[$1]}${[$1]:+ }$element"
05d292b2 (kx 2023-03-24 03:51:10 +0300 697) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 698) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 699) ])
05d292b2 (kx 2023-03-24 03:51:10 +0300 700)
05d292b2 (kx 2023-03-24 03:51:10 +0300 701) dnl For those cases where a variable contains several -L and -l options
05d292b2 (kx 2023-03-24 03:51:10 +0300 702) dnl referring to unknown libraries and directories, this macro determines the
05d292b2 (kx 2023-03-24 03:51:10 +0300 703) dnl necessary additional linker options for the runtime path.
05d292b2 (kx 2023-03-24 03:51:10 +0300 704) dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
05d292b2 (kx 2023-03-24 03:51:10 +0300 705) dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
05d292b2 (kx 2023-03-24 03:51:10 +0300 706) dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
05d292b2 (kx 2023-03-24 03:51:10 +0300 707) dnl otherwise linking without libtool is assumed.
05d292b2 (kx 2023-03-24 03:51:10 +0300 708) AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
05d292b2 (kx 2023-03-24 03:51:10 +0300 709) [
05d292b2 (kx 2023-03-24 03:51:10 +0300 710) AC_REQUIRE([AC_LIB_RPATH])
05d292b2 (kx 2023-03-24 03:51:10 +0300 711) AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
05d292b2 (kx 2023-03-24 03:51:10 +0300 712) $1=
05d292b2 (kx 2023-03-24 03:51:10 +0300 713) if test "$enable_rpath" != no; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 714) if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 715) dnl Use an explicit option to hardcode directories into the resulting
05d292b2 (kx 2023-03-24 03:51:10 +0300 716) dnl binary.
05d292b2 (kx 2023-03-24 03:51:10 +0300 717) rpathdirs=
05d292b2 (kx 2023-03-24 03:51:10 +0300 718) next=
05d292b2 (kx 2023-03-24 03:51:10 +0300 719) for opt in $2; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 720) if test -n "$next"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 721) dir="$next"
05d292b2 (kx 2023-03-24 03:51:10 +0300 722) dnl No need to hardcode the standard /usr/lib.
05d292b2 (kx 2023-03-24 03:51:10 +0300 723) if test "X$dir" != "X/usr/$acl_libdirstem" \
05d292b2 (kx 2023-03-24 03:51:10 +0300 724) && test "X$dir" != "X/usr/$acl_libdirstem2"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 725) rpathdirs="$rpathdirs $dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 726) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 727) next=
05d292b2 (kx 2023-03-24 03:51:10 +0300 728) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 729) case $opt in
05d292b2 (kx 2023-03-24 03:51:10 +0300 730) -L) next=yes ;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 731) -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
05d292b2 (kx 2023-03-24 03:51:10 +0300 732) dnl No need to hardcode the standard /usr/lib.
05d292b2 (kx 2023-03-24 03:51:10 +0300 733) if test "X$dir" != "X/usr/$acl_libdirstem" \
05d292b2 (kx 2023-03-24 03:51:10 +0300 734) && test "X$dir" != "X/usr/$acl_libdirstem2"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 735) rpathdirs="$rpathdirs $dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 736) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 737) next= ;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 738) *) next= ;;
05d292b2 (kx 2023-03-24 03:51:10 +0300 739) esac
05d292b2 (kx 2023-03-24 03:51:10 +0300 740) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 741) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 742) if test "X$rpathdirs" != "X"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 743) if test -n ""$3""; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 744) dnl libtool is used for linking. Use -R options.
05d292b2 (kx 2023-03-24 03:51:10 +0300 745) for dir in $rpathdirs; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 746) $1="${$1}${$1:+ }-R$dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 747) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 748) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 749) dnl The linker is used for linking directly.
05d292b2 (kx 2023-03-24 03:51:10 +0300 750) if test -n "$acl_hardcode_libdir_separator"; then
05d292b2 (kx 2023-03-24 03:51:10 +0300 751) dnl Weird platform: only the last -rpath option counts, the user
05d292b2 (kx 2023-03-24 03:51:10 +0300 752) dnl must pass all path elements in one option.
05d292b2 (kx 2023-03-24 03:51:10 +0300 753) alldirs=
05d292b2 (kx 2023-03-24 03:51:10 +0300 754) for dir in $rpathdirs; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 755) alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 756) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 757) acl_save_libdir="$libdir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 758) libdir="$alldirs"
05d292b2 (kx 2023-03-24 03:51:10 +0300 759) eval flag=\"$acl_hardcode_libdir_flag_spec\"
05d292b2 (kx 2023-03-24 03:51:10 +0300 760) libdir="$acl_save_libdir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 761) $1="$flag"
05d292b2 (kx 2023-03-24 03:51:10 +0300 762) else
05d292b2 (kx 2023-03-24 03:51:10 +0300 763) dnl The -rpath options are cumulative.
05d292b2 (kx 2023-03-24 03:51:10 +0300 764) for dir in $rpathdirs; do
05d292b2 (kx 2023-03-24 03:51:10 +0300 765) acl_save_libdir="$libdir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 766) libdir="$dir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 767) eval flag=\"$acl_hardcode_libdir_flag_spec\"
05d292b2 (kx 2023-03-24 03:51:10 +0300 768) libdir="$acl_save_libdir"
05d292b2 (kx 2023-03-24 03:51:10 +0300 769) $1="${$1}${$1:+ }$flag"
05d292b2 (kx 2023-03-24 03:51:10 +0300 770) done
05d292b2 (kx 2023-03-24 03:51:10 +0300 771) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 772) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 773) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 774) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 775) fi
05d292b2 (kx 2023-03-24 03:51:10 +0300 776) AC_SUBST([$1])
05d292b2 (kx 2023-03-24 03:51:10 +0300 777) ])