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