Math Processor Unit Library

libmpu – library of arithmetic functions for integer, real, and complex numbers of increased digit capacity

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