1 # lib-link.m4 serial 10 (gettext-0.16.1)
2 dnl Copyright (C) 2001-2006 Free Software Foundation, Inc.
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.
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],
19 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
20 AC_REQUIRE([AC_LIB_RPATH])
21 define([Name],[translit([$1],[./-], [___])])
22 define([NAME],[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"
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)
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.
46 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
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. If found, it
50 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
51 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
52 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
53 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
54 dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
55 dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
56 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
58 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
59 AC_REQUIRE([AC_LIB_RPATH])
60 define([Name],[translit([$1],[./-], [___])])
61 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
62 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
64 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
66 AC_LIB_LINKFLAGS_BODY([$1], [$2])
68 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
69 dnl because if the user has installed lib[]Name and not disabled its use
70 dnl via --without-lib[]Name-prefix, he wants to use it.
71 ac_save_CPPFLAGS="$CPPFLAGS"
72 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
74 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
76 LIBS="$LIBS $LIB[]NAME"
77 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
80 if test "$ac_cv_lib[]Name" = yes; then
82 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
83 AC_MSG_CHECKING([how to link with lib[]$1])
84 AC_MSG_RESULT([$LIB[]NAME])
87 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
88 dnl $INC[]NAME either.
89 CPPFLAGS="$ac_save_CPPFLAGS"
94 AC_SUBST([HAVE_LIB]NAME)
97 AC_SUBST([LIB]NAME[_PREFIX])
102 dnl Determine the platform dependent parameters needed to use rpath:
103 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
104 dnl hardcode_direct, hardcode_minus_L.
105 AC_DEFUN([AC_LIB_RPATH],
107 dnl Tell automake >= 1.10 to complain if config.rpath is missing.
108 m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
109 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
110 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
111 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
112 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
113 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
114 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
115 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
121 libext="$acl_cv_libext"
122 shlibext="$acl_cv_shlibext"
123 hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
124 hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
125 hardcode_direct="$acl_cv_hardcode_direct"
126 hardcode_minus_L="$acl_cv_hardcode_minus_L"
127 dnl Determine whether the user wants rpath handling at all.
129 [ --disable-rpath do not hardcode runtime library paths],
133 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
134 dnl the libraries corresponding to explicit and implicit dependencies.
135 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
136 dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
137 dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
138 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
140 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
141 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
142 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
143 dnl Autoconf >= 2.61 supports dots in --with options.
144 define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])])
145 dnl By default, look in $includedir and $libdir.
147 AC_LIB_WITH_FINAL_PREFIX([
148 eval additional_includedir=\"$includedir\"
149 eval additional_libdir=\"$libdir\"
151 AC_LIB_ARG_WITH([lib]N_A_M_E[-prefix],
152 [ --with-lib]N_A_M_E[-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
153 --without-lib]N_A_M_E[-prefix don't search for lib$1 in includedir and libdir],
155 if test "X$withval" = "Xno"; then
158 if test "X$withval" = "X"; then
159 AC_LIB_WITH_FINAL_PREFIX([
160 eval additional_includedir=\"$includedir\"
161 eval additional_libdir=\"$libdir\"
164 additional_includedir="$withval/include"
165 additional_libdir="$withval/$acl_libdirstem"
169 dnl Search the library and its dependencies in $additional_libdir and
170 dnl $LDFLAGS. Using breadth-first-seach.
177 names_already_handled=
178 names_next_round='$1 $2'
179 while test -n "$names_next_round"; do
180 names_this_round="$names_next_round"
182 for name in $names_this_round; do
184 for n in $names_already_handled; do
185 if test "$n" = "$name"; then
190 if test -z "$already_handled"; then
191 names_already_handled="$names_already_handled $name"
192 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
193 dnl or AC_LIB_HAVE_LINKFLAGS call.
194 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
195 eval value=\"\$HAVE_LIB$uppername\"
196 if test -n "$value"; then
197 if test "$value" = yes; then
198 eval value=\"\$LIB$uppername\"
199 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
200 eval value=\"\$LTLIB$uppername\"
201 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
203 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
204 dnl that this library doesn't exist. So just drop it.
208 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
209 dnl and the already constructed $LIBNAME/$LTLIBNAME.
214 if test $use_additional = yes; then
215 if test -n "$shlibext" \
216 && { test -f "$additional_libdir/lib$name.$shlibext" \
217 || { test "$shlibext" = dll \
218 && test -f "$additional_libdir/lib$name.dll.a"; }; }; then
219 found_dir="$additional_libdir"
220 if test -f "$additional_libdir/lib$name.$shlibext"; then
221 found_so="$additional_libdir/lib$name.$shlibext"
223 found_so="$additional_libdir/lib$name.dll.a"
225 if test -f "$additional_libdir/lib$name.la"; then
226 found_la="$additional_libdir/lib$name.la"
229 if test -f "$additional_libdir/lib$name.$libext"; then
230 found_dir="$additional_libdir"
231 found_a="$additional_libdir/lib$name.$libext"
232 if test -f "$additional_libdir/lib$name.la"; then
233 found_la="$additional_libdir/lib$name.la"
238 if test "X$found_dir" = "X"; then
239 for x in $LDFLAGS $LTLIB[]NAME; do
240 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
243 dir=`echo "X$x" | sed -e 's/^X-L//'`
244 if test -n "$shlibext" \
245 && { test -f "$dir/lib$name.$shlibext" \
246 || { test "$shlibext" = dll \
247 && test -f "$dir/lib$name.dll.a"; }; }; then
249 if test -f "$dir/lib$name.$shlibext"; then
250 found_so="$dir/lib$name.$shlibext"
252 found_so="$dir/lib$name.dll.a"
254 if test -f "$dir/lib$name.la"; then
255 found_la="$dir/lib$name.la"
258 if test -f "$dir/lib$name.$libext"; then
260 found_a="$dir/lib$name.$libext"
261 if test -f "$dir/lib$name.la"; then
262 found_la="$dir/lib$name.la"
268 if test "X$found_dir" != "X"; then
273 if test "X$found_dir" != "X"; then
274 dnl Found the library.
275 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
276 if test "X$found_so" != "X"; then
277 dnl Linking with a shared library. We attempt to hardcode its
278 dnl directory into the executable's runpath, unless it's the
279 dnl standard /usr/lib.
280 if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
281 dnl No hardcoding is needed.
282 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
284 dnl Use an explicit option to hardcode DIR into the resulting
286 dnl Potentially add DIR to ltrpathdirs.
287 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
289 for x in $ltrpathdirs; do
290 if test "X$x" = "X$found_dir"; then
295 if test -z "$haveit"; then
296 ltrpathdirs="$ltrpathdirs $found_dir"
298 dnl The hardcoding into $LIBNAME is system dependent.
299 if test "$hardcode_direct" = yes; then
300 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
301 dnl resulting binary.
302 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
304 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
305 dnl Use an explicit option to hardcode DIR into the resulting
307 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
308 dnl Potentially add DIR to rpathdirs.
309 dnl The rpathdirs will be appended to $LIBNAME at the end.
311 for x in $rpathdirs; do
312 if test "X$x" = "X$found_dir"; then
317 if test -z "$haveit"; then
318 rpathdirs="$rpathdirs $found_dir"
321 dnl Rely on "-L$found_dir".
322 dnl But don't add it if it's already contained in the LDFLAGS
323 dnl or the already constructed $LIBNAME
325 for x in $LDFLAGS $LIB[]NAME; do
326 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
327 if test "X$x" = "X-L$found_dir"; then
332 if test -z "$haveit"; then
333 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
335 if test "$hardcode_minus_L" != no; then
336 dnl FIXME: Not sure whether we should use
337 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
339 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
341 dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
342 dnl here, because this doesn't fit in flags passed to the
343 dnl compiler. So give up. No hardcoding. This affects only
344 dnl very old systems.
345 dnl FIXME: Not sure whether we should use
346 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
348 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
354 if test "X$found_a" != "X"; then
355 dnl Linking with a static library.
356 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
358 dnl We shouldn't come here, but anyway it's good to have a
360 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
363 dnl Assume the include files are nearby.
364 additional_includedir=
366 */$acl_libdirstem | */$acl_libdirstem/)
367 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
368 LIB[]NAME[]_PREFIX="$basedir"
369 additional_includedir="$basedir/include"
372 if test "X$additional_includedir" != "X"; then
373 dnl Potentially add $additional_includedir to $INCNAME.
375 dnl 1. if it's the standard /usr/include,
376 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
377 dnl 3. if it's already present in $CPPFLAGS or the already
378 dnl constructed $INCNAME,
379 dnl 4. if it doesn't exist as a directory.
380 if test "X$additional_includedir" != "X/usr/include"; then
382 if test "X$additional_includedir" = "X/usr/local/include"; then
383 if test -n "$GCC"; then
385 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
389 if test -z "$haveit"; then
390 for x in $CPPFLAGS $INC[]NAME; do
391 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
392 if test "X$x" = "X-I$additional_includedir"; then
397 if test -z "$haveit"; then
398 if test -d "$additional_includedir"; then
399 dnl Really add $additional_includedir to $INCNAME.
400 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
406 dnl Look for dependencies.
407 if test -n "$found_la"; then
408 dnl Read the .la file. It defines the variables
409 dnl dlname, library_names, old_library, dependency_libs, current,
410 dnl age, revision, installed, dlopen, dlpreopen, libdir.
411 save_libdir="$libdir"
413 */* | *\\*) . "$found_la" ;;
414 *) . "./$found_la" ;;
416 libdir="$save_libdir"
417 dnl We use only dependency_libs.
418 for dep in $dependency_libs; do
421 additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
422 dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
424 dnl 1. if it's the standard /usr/lib,
425 dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
426 dnl 3. if it's already present in $LDFLAGS or the already
427 dnl constructed $LIBNAME,
428 dnl 4. if it doesn't exist as a directory.
429 if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
431 if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
432 if test -n "$GCC"; then
434 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
438 if test -z "$haveit"; then
440 for x in $LDFLAGS $LIB[]NAME; do
441 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
442 if test "X$x" = "X-L$additional_libdir"; then
447 if test -z "$haveit"; then
448 if test -d "$additional_libdir"; then
449 dnl Really add $additional_libdir to $LIBNAME.
450 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
454 for x in $LDFLAGS $LTLIB[]NAME; do
455 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
456 if test "X$x" = "X-L$additional_libdir"; then
461 if test -z "$haveit"; then
462 if test -d "$additional_libdir"; then
463 dnl Really add $additional_libdir to $LTLIBNAME.
464 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
471 dir=`echo "X$dep" | sed -e 's/^X-R//'`
472 if test "$enable_rpath" != no; then
473 dnl Potentially add DIR to rpathdirs.
474 dnl The rpathdirs will be appended to $LIBNAME at the end.
476 for x in $rpathdirs; do
477 if test "X$x" = "X$dir"; then
482 if test -z "$haveit"; then
483 rpathdirs="$rpathdirs $dir"
485 dnl Potentially add DIR to ltrpathdirs.
486 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
488 for x in $ltrpathdirs; do
489 if test "X$x" = "X$dir"; then
494 if test -z "$haveit"; then
495 ltrpathdirs="$ltrpathdirs $dir"
500 dnl Handle this in the next round.
501 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
504 dnl Handle this in the next round. Throw away the .la's
505 dnl directory; it is already contained in a preceding -L
507 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
510 dnl Most likely an immediate library name.
511 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
512 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
518 dnl Didn't find the library; assume it is in the system directories
519 dnl known to the linker and runtime loader. (All the system
520 dnl directories known to the linker should also be known to the
521 dnl runtime loader, otherwise the system is severely misconfigured.)
522 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
523 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
529 if test "X$rpathdirs" != "X"; then
530 if test -n "$hardcode_libdir_separator"; then
531 dnl Weird platform: only the last -rpath option counts, the user must
532 dnl pass all path elements in one option. We can arrange that for a
533 dnl single library, but not when more than one $LIBNAMEs are used.
535 for found_dir in $rpathdirs; do
536 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
538 dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
539 acl_save_libdir="$libdir"
541 eval flag=\"$hardcode_libdir_flag_spec\"
542 libdir="$acl_save_libdir"
543 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
545 dnl The -rpath options are cumulative.
546 for found_dir in $rpathdirs; do
547 acl_save_libdir="$libdir"
549 eval flag=\"$hardcode_libdir_flag_spec\"
550 libdir="$acl_save_libdir"
551 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
555 if test "X$ltrpathdirs" != "X"; then
556 dnl When using libtool, the option that works for both libraries and
557 dnl executables is -R. The -R options are cumulative.
558 for found_dir in $ltrpathdirs; do
559 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
564 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
565 dnl unless already present in VAR.
566 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
567 dnl contains two or three consecutive elements that belong together.
568 AC_DEFUN([AC_LIB_APPENDTOVAR],
570 for element in [$2]; do
573 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
574 if test "X$x" = "X$element"; then
579 if test -z "$haveit"; then
580 [$1]="${[$1]}${[$1]:+ }$element"
585 dnl For those cases where a variable contains several -L and -l options
586 dnl referring to unknown libraries and directories, this macro determines the
587 dnl necessary additional linker options for the runtime path.
588 dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
589 dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
590 dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
591 dnl otherwise linking without libtool is assumed.
592 AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
594 AC_REQUIRE([AC_LIB_RPATH])
595 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
597 if test "$enable_rpath" != no; then
598 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
599 dnl Use an explicit option to hardcode directories into the resulting
604 if test -n "$next"; then
606 dnl No need to hardcode the standard /usr/lib.
607 if test "X$dir" != "X/usr/$acl_libdirstem"; then
608 rpathdirs="$rpathdirs $dir"
614 -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
615 dnl No need to hardcode the standard /usr/lib.
616 if test "X$dir" != "X/usr/$acl_libdirstem"; then
617 rpathdirs="$rpathdirs $dir"
624 if test "X$rpathdirs" != "X"; then
625 if test -n ""$3""; then
626 dnl libtool is used for linking. Use -R options.
627 for dir in $rpathdirs; do
628 $1="${$1}${$1:+ }-R$dir"
631 dnl The linker is used for linking directly.
632 if test -n "$hardcode_libdir_separator"; then
633 dnl Weird platform: only the last -rpath option counts, the user
634 dnl must pass all path elements in one option.
636 for dir in $rpathdirs; do
637 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$dir"
639 acl_save_libdir="$libdir"
641 eval flag=\"$hardcode_libdir_flag_spec\"
642 libdir="$acl_save_libdir"
645 dnl The -rpath options are cumulative.
646 for dir in $rpathdirs; do
647 acl_save_libdir="$libdir"
649 eval flag=\"$hardcode_libdir_flag_spec\"
650 libdir="$acl_save_libdir"
651 $1="${$1}${$1:+ }$flag"