1 |
# lib-link.m4 serial 4 (gettext-0.12) |
2 |
dnl Copyright © 2001-2003 Free Software Foundation, Inc. |
3 |
dnl This file is free software, distributed under the terms of the GNU |
4 |
dnl General Public License. As a special exception to the GNU General |
5 |
dnl Public License, this file may be distributed as part of a program |
6 |
dnl that contains a configuration script generated by Autoconf, under |
7 |
dnl the same distribution terms as the rest of that program. |
8 |
|
9 |
dnl From Bruno Haible. |
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 |
AC_DEFUN([AC_LIB_LINKFLAGS], |
16 |
[ |
17 |
AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) |
18 |
AC_REQUIRE([AC_LIB_RPATH]) |
19 |
define([Name],[translit([$1],[./-], [___])]) |
20 |
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], |
21 |
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) |
22 |
AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ |
23 |
AC_LIB_LINKFLAGS_BODY([$1], [$2]) |
24 |
ac_cv_lib[]Name[]_libs="$LIB[]NAME" |
25 |
ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" |
26 |
ac_cv_lib[]Name[]_cppflags="$INC[]NAME" |
27 |
]) |
28 |
LIB[]NAME="$ac_cv_lib[]Name[]_libs" |
29 |
LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" |
30 |
INC[]NAME="$ac_cv_lib[]Name[]_cppflags" |
31 |
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) |
32 |
AC_SUBST([LIB]NAME) |
33 |
AC_SUBST([LTLIB]NAME) |
34 |
dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the |
35 |
dnl results of this search when this library appears as a dependency. |
36 |
HAVE_LIB[]NAME=yes |
37 |
undefine([Name]) |
38 |
undefine([NAME]) |
39 |
]) |
40 |
|
41 |
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) |
42 |
dnl searches for libname and the libraries corresponding to explicit and |
43 |
dnl implicit dependencies, together with the specified include files and |
44 |
dnl the ability to compile and link the specified testcode. If found, it |
45 |
dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and |
46 |
dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and |
47 |
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs |
48 |
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. |
49 |
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], |
50 |
[ |
51 |
AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) |
52 |
AC_REQUIRE([AC_LIB_RPATH]) |
53 |
define([Name],[translit([$1],[./-], [___])]) |
54 |
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], |
55 |
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) |
56 |
|
57 |
dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME |
58 |
dnl accordingly. |
59 |
AC_LIB_LINKFLAGS_BODY([$1], [$2]) |
60 |
|
61 |
dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, |
62 |
dnl because if the user has installed lib[]Name and not disabled its use |
63 |
dnl via --without-lib[]Name-prefix, he wants to use it. |
64 |
ac_save_CPPFLAGS="$CPPFLAGS" |
65 |
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) |
66 |
|
67 |
AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ |
68 |
ac_save_LIBS="$LIBS" |
69 |
LIBS="$LIBS $LIB[]NAME" |
70 |
AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) |
71 |
LIBS="$ac_save_LIBS" |
72 |
]) |
73 |
if test "$ac_cv_lib[]Name" = yes; then |
74 |
HAVE_LIB[]NAME=yes |
75 |
AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) |
76 |
AC_MSG_CHECKING([how to link with lib[]$1]) |
77 |
AC_MSG_RESULT([$LIB[]NAME]) |
78 |
else |
79 |
HAVE_LIB[]NAME=no |
80 |
dnl If $LIB[]NAME didn't lead to a usable library, we don't need |
81 |
dnl $INC[]NAME either. |
82 |
CPPFLAGS="$ac_save_CPPFLAGS" |
83 |
LIB[]NAME= |
84 |
LTLIB[]NAME= |
85 |
fi |
86 |
AC_SUBST([HAVE_LIB]NAME) |
87 |
AC_SUBST([LIB]NAME) |
88 |
AC_SUBST([LTLIB]NAME) |
89 |
undefine([Name]) |
90 |
undefine([NAME]) |
91 |
]) |
92 |
|
93 |
dnl Determine the platform dependent parameters needed to use rpath: |
94 |
dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, |
95 |
dnl hardcode_direct, hardcode_minus_L. |
96 |
AC_DEFUN([AC_LIB_RPATH], |
97 |
[ |
98 |
AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS |
99 |
AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld |
100 |
AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host |
101 |
AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir |
102 |
AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ |
103 |
CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ |
104 |
${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh |
105 |
. ./conftest.sh |
106 |
rm -f ./conftest.sh |
107 |
acl_cv_rpath=done |
108 |
]) |
109 |
wl="$acl_cv_wl" |
110 |
libext="$acl_cv_libext" |
111 |
shlibext="$acl_cv_shlibext" |
112 |
hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" |
113 |
hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" |
114 |
hardcode_direct="$acl_cv_hardcode_direct" |
115 |
hardcode_minus_L="$acl_cv_hardcode_minus_L" |
116 |
]) |
117 |
|
118 |
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and |
119 |
dnl the libraries corresponding to explicit and implicit dependencies. |
120 |
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. |
121 |
AC_DEFUN([AC_LIB_LINKFLAGS_BODY], |
122 |
[ |
123 |
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], |
124 |
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) |
125 |
dnl By default, look in $includedir and $libdir. |
126 |
use_additional=yes |
127 |
AC_LIB_WITH_FINAL_PREFIX([ |
128 |
eval additional_includedir=\"$includedir\" |
129 |
eval additional_libdir=\"$libdir\" |
130 |
]) |
131 |
AC_LIB_ARG_WITH([lib$1-prefix], |
132 |
[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib |
133 |
--without-lib$1-prefix don't search for lib$1 in includedir and libdir], |
134 |
[ |
135 |
if test "X$withval" = "Xno"; then |
136 |
use_additional=no |
137 |
else |
138 |
if test "X$withval" = "X"; then |
139 |
AC_LIB_WITH_FINAL_PREFIX([ |
140 |
eval additional_includedir=\"$includedir\" |
141 |
eval additional_libdir=\"$libdir\" |
142 |
]) |
143 |
else |
144 |
additional_includedir="$withval/include" |
145 |
additional_libdir="$withval/lib" |
146 |
fi |
147 |
fi |
148 |
]) |
149 |
dnl Search the library and its dependencies in $additional_libdir and |
150 |
dnl $LDFLAGS. Using breadth-first-seach. |
151 |
LIB[]NAME= |
152 |
LTLIB[]NAME= |
153 |
INC[]NAME= |
154 |
rpathdirs= |
155 |
ltrpathdirs= |
156 |
names_already_handled= |
157 |
names_next_round='$1 $2' |
158 |
while test -n "$names_next_round"; do |
159 |
names_this_round="$names_next_round" |
160 |
names_next_round= |
161 |
for name in $names_this_round; do |
162 |
already_handled= |
163 |
for n in $names_already_handled; do |
164 |
if test "$n" = "$name"; then |
165 |
already_handled=yes |
166 |
break |
167 |
fi |
168 |
done |
169 |
if test -z "$already_handled"; then |
170 |
names_already_handled="$names_already_handled $name" |
171 |
dnl See if it was already located by an earlier AC_LIB_LINKFLAGS |
172 |
dnl or AC_LIB_HAVE_LINKFLAGS call. |
173 |
uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` |
174 |
eval value=\"\$HAVE_LIB$uppername\" |
175 |
if test -n "$value"; then |
176 |
if test "$value" = yes; then |
177 |
eval value=\"\$LIB$uppername\" |
178 |
test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" |
179 |
eval value=\"\$LTLIB$uppername\" |
180 |
test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" |
181 |
else |
182 |
dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined |
183 |
dnl that this library doesn't exist. So just drop it. |
184 |
: |
185 |
fi |
186 |
else |
187 |
dnl Search the library lib$name in $additional_libdir and $LDFLAGS |
188 |
dnl and the already constructed $LIBNAME/$LTLIBNAME. |
189 |
found_dir= |
190 |
found_la= |
191 |
found_so= |
192 |
found_a= |
193 |
if test $use_additional = yes; then |
194 |
if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then |
195 |
found_dir="$additional_libdir" |
196 |
found_so="$additional_libdir/lib$name.$shlibext" |
197 |
if test -f "$additional_libdir/lib$name.la"; then |
198 |
found_la="$additional_libdir/lib$name.la" |
199 |
fi |
200 |
else |
201 |
if test -f "$additional_libdir/lib$name.$libext"; then |
202 |
found_dir="$additional_libdir" |
203 |
found_a="$additional_libdir/lib$name.$libext" |
204 |
if test -f "$additional_libdir/lib$name.la"; then |
205 |
found_la="$additional_libdir/lib$name.la" |
206 |
fi |
207 |
fi |
208 |
fi |
209 |
fi |
210 |
if test "X$found_dir" = "X"; then |
211 |
for x in $LDFLAGS $LTLIB[]NAME; do |
212 |
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) |
213 |
case "$x" in |
214 |
-L*) |
215 |
dir=`echo "X$x" | sed -e 's/^X-L//'` |
216 |
if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then |
217 |
found_dir="$dir" |
218 |
found_so="$dir/lib$name.$shlibext" |
219 |
if test -f "$dir/lib$name.la"; then |
220 |
found_la="$dir/lib$name.la" |
221 |
fi |
222 |
else |
223 |
if test -f "$dir/lib$name.$libext"; then |
224 |
found_dir="$dir" |
225 |
found_a="$dir/lib$name.$libext" |
226 |
if test -f "$dir/lib$name.la"; then |
227 |
found_la="$dir/lib$name.la" |
228 |
fi |
229 |
fi |
230 |
fi |
231 |
;; |
232 |
esac |
233 |
if test "X$found_dir" != "X"; then |
234 |
break |
235 |
fi |
236 |
done |
237 |
fi |
238 |
if test "X$found_dir" != "X"; then |
239 |
dnl Found the library. |
240 |
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" |
241 |
if test "X$found_so" != "X"; then |
242 |
dnl Linking with a shared library. We attempt to hardcode its |
243 |
dnl directory into the executable's runpath, unless it's the |
244 |
dnl standard /usr/lib. |
245 |
if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then |
246 |
dnl No hardcoding is needed. |
247 |
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" |
248 |
else |
249 |
dnl Use an explicit option to hardcode DIR into the resulting |
250 |
dnl binary. |
251 |
dnl Potentially add DIR to ltrpathdirs. |
252 |
dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. |
253 |
haveit= |
254 |
for x in $ltrpathdirs; do |
255 |
if test "X$x" = "X$found_dir"; then |
256 |
haveit=yes |
257 |
break |
258 |
fi |
259 |
done |
260 |
if test -z "$haveit"; then |
261 |
ltrpathdirs="$ltrpathdirs $found_dir" |
262 |
fi |
263 |
dnl The hardcoding into $LIBNAME is system dependent. |
264 |
if test "$hardcode_direct" = yes; then |
265 |
dnl Using DIR/libNAME.so during linking hardcodes DIR into the |
266 |
dnl resulting binary. |
267 |
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" |
268 |
else |
269 |
if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then |
270 |
dnl Use an explicit option to hardcode DIR into the resulting |
271 |
dnl binary. |
272 |
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" |
273 |
dnl Potentially add DIR to rpathdirs. |
274 |
dnl The rpathdirs will be appended to $LIBNAME at the end. |
275 |
haveit= |
276 |
for x in $rpathdirs; do |
277 |
if test "X$x" = "X$found_dir"; then |
278 |
haveit=yes |
279 |
break |
280 |
fi |
281 |
done |
282 |
if test -z "$haveit"; then |
283 |
rpathdirs="$rpathdirs $found_dir" |
284 |
fi |
285 |
else |
286 |
dnl Rely on "-L$found_dir". |
287 |
dnl But don't add it if it's already contained in the LDFLAGS |
288 |
dnl or the already constructed $LIBNAME |
289 |
haveit= |
290 |
for x in $LDFLAGS $LIB[]NAME; do |
291 |
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) |
292 |
if test "X$x" = "X-L$found_dir"; then |
293 |
haveit=yes |
294 |
break |
295 |
fi |
296 |
done |
297 |
if test -z "$haveit"; then |
298 |
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" |
299 |
fi |
300 |
if test "$hardcode_minus_L" != no; then |
301 |
dnl FIXME: Not sure whether we should use |
302 |
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" |
303 |
dnl here. |
304 |
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" |
305 |
else |
306 |
dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH |
307 |
dnl here, because this doesn't fit in flags passed to the |
308 |
dnl compiler. So give up. No hardcoding. This affects only |
309 |
dnl very old systems. |
310 |
dnl FIXME: Not sure whether we should use |
311 |
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" |
312 |
dnl here. |
313 |
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" |
314 |
fi |
315 |
fi |
316 |
fi |
317 |
fi |
318 |
else |
319 |
if test "X$found_a" != "X"; then |
320 |
dnl Linking with a static library. |
321 |
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" |
322 |
else |
323 |
dnl We shouldn't come here, but anyway it's good to have a |
324 |
dnl fallback. |
325 |
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" |
326 |
fi |
327 |
fi |
328 |
dnl Assume the include files are nearby. |
329 |
additional_includedir= |
330 |
case "$found_dir" in |
331 |
*/lib | */lib/) |
332 |
basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` |
333 |
additional_includedir="$basedir/include" |
334 |
;; |
335 |
esac |
336 |
if test "X$additional_includedir" != "X"; then |
337 |
dnl Potentially add $additional_includedir to $INCNAME. |
338 |
dnl But don't add it |
339 |
dnl 1. if it's the standard /usr/include, |
340 |
dnl 2. if it's /usr/local/include and we are using GCC on Linux, |
341 |
dnl 3. if it's already present in $CPPFLAGS or the already |
342 |
dnl constructed $INCNAME, |
343 |
dnl 4. if it doesn't exist as a directory. |
344 |
if test "X$additional_includedir" != "X/usr/include"; then |
345 |
haveit= |
346 |
if test "X$additional_includedir" = "X/usr/local/include"; then |
347 |
if test -n "$GCC"; then |
348 |
case $host_os in |
349 |
linux*) haveit=yes;; |
350 |
esac |
351 |
fi |
352 |
fi |
353 |
if test -z "$haveit"; then |
354 |
for x in $CPPFLAGS $INC[]NAME; do |
355 |
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) |
356 |
if test "X$x" = "X-I$additional_includedir"; then |
357 |
haveit=yes |
358 |
break |
359 |
fi |
360 |
done |
361 |
if test -z "$haveit"; then |
362 |
if test -d "$additional_includedir"; then |
363 |
dnl Really add $additional_includedir to $INCNAME. |
364 |
INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" |
365 |
fi |
366 |
fi |
367 |
fi |
368 |
fi |
369 |
fi |
370 |
dnl Look for dependencies. |
371 |
if test -n "$found_la"; then |
372 |
dnl Read the .la file. It defines the variables |
373 |
dnl dlname, library_names, old_library, dependency_libs, current, |
374 |
dnl age, revision, installed, dlopen, dlpreopen, libdir. |
375 |
save_libdir="$libdir" |
376 |
case "$found_la" in |
377 |
*/* | *\\*) . "$found_la" ;; |
378 |
*) . "./$found_la" ;; |
379 |
esac |
380 |
libdir="$save_libdir" |
381 |
dnl We use only dependency_libs. |
382 |
for dep in $dependency_libs; do |
383 |
case "$dep" in |
384 |
-L*) |
385 |
additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` |
386 |
dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. |
387 |
dnl But don't add it |
388 |
dnl 1. if it's the standard /usr/lib, |
389 |
dnl 2. if it's /usr/local/lib and we are using GCC on Linux, |
390 |
dnl 3. if it's already present in $LDFLAGS or the already |
391 |
dnl constructed $LIBNAME, |
392 |
dnl 4. if it doesn't exist as a directory. |
393 |
if test "X$additional_libdir" != "X/usr/lib"; then |
394 |
haveit= |
395 |
if test "X$additional_libdir" = "X/usr/local/lib"; then |
396 |
if test -n "$GCC"; then |
397 |
case $host_os in |
398 |
linux*) haveit=yes;; |
399 |
esac |
400 |
fi |
401 |
fi |
402 |
if test -z "$haveit"; then |
403 |
haveit= |
404 |
for x in $LDFLAGS $LIB[]NAME; do |
405 |
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) |
406 |
if test "X$x" = "X-L$additional_libdir"; then |
407 |
haveit=yes |
408 |
break |
409 |
fi |
410 |
done |
411 |
if test -z "$haveit"; then |
412 |
if test -d "$additional_libdir"; then |
413 |
dnl Really add $additional_libdir to $LIBNAME. |
414 |
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" |
415 |
fi |
416 |
fi |
417 |
haveit= |
418 |
for x in $LDFLAGS $LTLIB[]NAME; do |
419 |
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) |
420 |
if test "X$x" = "X-L$additional_libdir"; then |
421 |
haveit=yes |
422 |
break |
423 |
fi |
424 |
done |
425 |
if test -z "$haveit"; then |
426 |
if test -d "$additional_libdir"; then |
427 |
dnl Really add $additional_libdir to $LTLIBNAME. |
428 |
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" |
429 |
fi |
430 |
fi |
431 |
fi |
432 |
fi |
433 |
;; |
434 |
-R*) |
435 |
dir=`echo "X$dep" | sed -e 's/^X-R//'` |
436 |
if test "$enable_rpath" != no; then |
437 |
dnl Potentially add DIR to rpathdirs. |
438 |
dnl The rpathdirs will be appended to $LIBNAME at the end. |
439 |
haveit= |
440 |
for x in $rpathdirs; do |
441 |
if test "X$x" = "X$dir"; then |
442 |
haveit=yes |
443 |
break |
444 |
fi |
445 |
done |
446 |
if test -z "$haveit"; then |
447 |
rpathdirs="$rpathdirs $dir" |
448 |
fi |
449 |
dnl Potentially add DIR to ltrpathdirs. |
450 |
dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. |
451 |
haveit= |
452 |
for x in $ltrpathdirs; do |
453 |
if test "X$x" = "X$dir"; then |
454 |
haveit=yes |
455 |
break |
456 |
fi |
457 |
done |
458 |
if test -z "$haveit"; then |
459 |
ltrpathdirs="$ltrpathdirs $dir" |
460 |
fi |
461 |
fi |
462 |
;; |
463 |
-l*) |
464 |
dnl Handle this in the next round. |
465 |
names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` |
466 |
;; |
467 |
*.la) |
468 |
dnl Handle this in the next round. Throw away the .la's |
469 |
dnl directory; it is already contained in a preceding -L |
470 |
dnl option. |
471 |
names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` |
472 |
;; |
473 |
*) |
474 |
dnl Most likely an immediate library name. |
475 |
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" |
476 |
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" |
477 |
;; |
478 |
esac |
479 |
done |
480 |
fi |
481 |
else |
482 |
dnl Didn't find the library; assume it is in the system directories |
483 |
dnl known to the linker and runtime loader. (All the system |
484 |
dnl directories known to the linker should also be known to the |
485 |
dnl runtime loader, otherwise the system is severely misconfigured.) |
486 |
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" |
487 |
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" |
488 |
fi |
489 |
fi |
490 |
fi |
491 |
done |
492 |
done |
493 |
if test "X$rpathdirs" != "X"; then |
494 |
if test -n "$hardcode_libdir_separator"; then |
495 |
dnl Weird platform: only the last -rpath option counts, the user must |
496 |
dnl pass all path elements in one option. We can arrange that for a |
497 |
dnl single library, but not when more than one $LIBNAMEs are used. |
498 |
alldirs= |
499 |
for found_dir in $rpathdirs; do |
500 |
alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" |
501 |
done |
502 |
dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. |
503 |
acl_save_libdir="$libdir" |
504 |
libdir="$alldirs" |
505 |
eval flag=\"$hardcode_libdir_flag_spec\" |
506 |
libdir="$acl_save_libdir" |
507 |
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" |
508 |
else |
509 |
dnl The -rpath options are cumulative. |
510 |
for found_dir in $rpathdirs; do |
511 |
acl_save_libdir="$libdir" |
512 |
libdir="$found_dir" |
513 |
eval flag=\"$hardcode_libdir_flag_spec\" |
514 |
libdir="$acl_save_libdir" |
515 |
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" |
516 |
done |
517 |
fi |
518 |
fi |
519 |
if test "X$ltrpathdirs" != "X"; then |
520 |
dnl When using libtool, the option that works for both libraries and |
521 |
dnl executables is -R. The -R options are cumulative. |
522 |
for found_dir in $ltrpathdirs; do |
523 |
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" |
524 |
done |
525 |
fi |
526 |
]) |
527 |
|
528 |
dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, |
529 |
dnl unless already present in VAR. |
530 |
dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes |
531 |
dnl contains two or three consecutive elements that belong together. |
532 |
AC_DEFUN([AC_LIB_APPENDTOVAR], |
533 |
[ |
534 |
for element in [$2]; do |
535 |
haveit= |
536 |
for x in $[$1]; do |
537 |
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) |
538 |
if test "X$x" = "X$element"; then |
539 |
haveit=yes |
540 |
break |
541 |
fi |
542 |
done |
543 |
if test -z "$haveit"; then |
544 |
[$1]="${[$1]}${[$1]:+ }$element" |
545 |
fi |
546 |
done |
547 |
]) |