1 dnl aclocal.m4 generated automatically by aclocal 1.4-p6
3 dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
13 # lib-prefix.m4 serial 3 (gettext-0.13)
14 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
15 dnl This file is free software, distributed under the terms of the GNU
16 dnl General Public License. As a special exception to the GNU General
17 dnl Public License, this file may be distributed as part of a program
18 dnl that contains a configuration script generated by Autoconf, under
19 dnl the same distribution terms as the rest of that program.
21 dnl From Bruno Haible.
23 dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
24 dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
25 dnl require excessive bracketing.
26 ifdef([AC_HELP_STRING],
27 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
28 [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
30 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
31 dnl to access previously installed libraries. The basic assumption is that
32 dnl a user will want packages to use other packages he previously installed
33 dnl with the same --prefix option.
34 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
35 dnl libraries, but is otherwise very convenient.
36 AC_DEFUN([AC_LIB_PREFIX],
38 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
39 AC_REQUIRE([AC_PROG_CC])
40 AC_REQUIRE([AC_CANONICAL_HOST])
41 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
42 dnl By default, look in $includedir and $libdir.
44 AC_LIB_WITH_FINAL_PREFIX([
45 eval additional_includedir=\"$includedir\"
46 eval additional_libdir=\"$libdir\"
48 AC_LIB_ARG_WITH([lib-prefix],
49 [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
50 --without-lib-prefix don't search for libraries in includedir and libdir],
52 if test "X$withval" = "Xno"; then
55 if test "X$withval" = "X"; then
56 AC_LIB_WITH_FINAL_PREFIX([
57 eval additional_includedir=\"$includedir\"
58 eval additional_libdir=\"$libdir\"
61 additional_includedir="$withval/include"
62 additional_libdir="$withval/lib"
66 if test $use_additional = yes; then
67 dnl Potentially add $additional_includedir to $CPPFLAGS.
69 dnl 1. if it's the standard /usr/include,
70 dnl 2. if it's already present in $CPPFLAGS,
71 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
72 dnl 4. if it doesn't exist as a directory.
73 if test "X$additional_includedir" != "X/usr/include"; then
75 for x in $CPPFLAGS; do
76 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
77 if test "X$x" = "X-I$additional_includedir"; then
82 if test -z "$haveit"; then
83 if test "X$additional_includedir" = "X/usr/local/include"; then
84 if test -n "$GCC"; then
90 if test -z "$haveit"; then
91 if test -d "$additional_includedir"; then
92 dnl Really add $additional_includedir to $CPPFLAGS.
93 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
98 dnl Potentially add $additional_libdir to $LDFLAGS.
100 dnl 1. if it's the standard /usr/lib,
101 dnl 2. if it's already present in $LDFLAGS,
102 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
103 dnl 4. if it doesn't exist as a directory.
104 if test "X$additional_libdir" != "X/usr/lib"; then
106 for x in $LDFLAGS; do
107 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
108 if test "X$x" = "X-L$additional_libdir"; then
113 if test -z "$haveit"; then
114 if test "X$additional_libdir" = "X/usr/local/lib"; then
115 if test -n "$GCC"; then
121 if test -z "$haveit"; then
122 if test -d "$additional_libdir"; then
123 dnl Really add $additional_libdir to $LDFLAGS.
124 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
132 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
133 dnl acl_final_exec_prefix, containing the values to which $prefix and
134 dnl $exec_prefix will expand at the end of the configure script.
135 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
137 dnl Unfortunately, prefix and exec_prefix get only finally determined
138 dnl at the end of configure.
139 if test "X$prefix" = "XNONE"; then
140 acl_final_prefix="$ac_default_prefix"
142 acl_final_prefix="$prefix"
144 if test "X$exec_prefix" = "XNONE"; then
145 acl_final_exec_prefix='${prefix}'
147 acl_final_exec_prefix="$exec_prefix"
149 acl_save_prefix="$prefix"
150 prefix="$acl_final_prefix"
151 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
152 prefix="$acl_save_prefix"
155 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
156 dnl variables prefix and exec_prefix bound to the values they will have
157 dnl at the end of the configure script.
158 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
160 acl_save_prefix="$prefix"
161 prefix="$acl_final_prefix"
162 acl_save_exec_prefix="$exec_prefix"
163 exec_prefix="$acl_final_exec_prefix"
165 exec_prefix="$acl_save_exec_prefix"
166 prefix="$acl_save_prefix"
169 # lib-link.m4 serial 4 (gettext-0.12)
170 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
171 dnl This file is free software, distributed under the terms of the GNU
172 dnl General Public License. As a special exception to the GNU General
173 dnl Public License, this file may be distributed as part of a program
174 dnl that contains a configuration script generated by Autoconf, under
175 dnl the same distribution terms as the rest of that program.
177 dnl From Bruno Haible.
179 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
180 dnl the libraries corresponding to explicit and implicit dependencies.
181 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
182 dnl augments the CPPFLAGS variable.
183 AC_DEFUN([AC_LIB_LINKFLAGS],
185 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
186 AC_REQUIRE([AC_LIB_RPATH])
187 define([Name],[translit([$1],[./-], [___])])
188 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
189 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
190 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
191 AC_LIB_LINKFLAGS_BODY([$1], [$2])
192 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
193 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
194 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
196 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
197 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
198 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
199 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
201 AC_SUBST([LTLIB]NAME)
202 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
203 dnl results of this search when this library appears as a dependency.
209 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
210 dnl searches for libname and the libraries corresponding to explicit and
211 dnl implicit dependencies, together with the specified include files and
212 dnl the ability to compile and link the specified testcode. If found, it
213 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
214 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
215 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
216 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
217 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
219 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
220 AC_REQUIRE([AC_LIB_RPATH])
221 define([Name],[translit([$1],[./-], [___])])
222 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
223 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
225 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
227 AC_LIB_LINKFLAGS_BODY([$1], [$2])
229 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
230 dnl because if the user has installed lib[]Name and not disabled its use
231 dnl via --without-lib[]Name-prefix, he wants to use it.
232 ac_save_CPPFLAGS="$CPPFLAGS"
233 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
235 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
237 LIBS="$LIBS $LIB[]NAME"
238 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
241 if test "$ac_cv_lib[]Name" = yes; then
243 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
244 AC_MSG_CHECKING([how to link with lib[]$1])
245 AC_MSG_RESULT([$LIB[]NAME])
248 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
249 dnl $INC[]NAME either.
250 CPPFLAGS="$ac_save_CPPFLAGS"
254 AC_SUBST([HAVE_LIB]NAME)
256 AC_SUBST([LTLIB]NAME)
261 dnl Determine the platform dependent parameters needed to use rpath:
262 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
263 dnl hardcode_direct, hardcode_minus_L.
264 AC_DEFUN([AC_LIB_RPATH],
266 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
267 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
268 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
269 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
270 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
271 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
272 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
278 libext="$acl_cv_libext"
279 shlibext="$acl_cv_shlibext"
280 hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
281 hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
282 hardcode_direct="$acl_cv_hardcode_direct"
283 hardcode_minus_L="$acl_cv_hardcode_minus_L"
284 dnl Determine whether the user wants rpath handling at all.
286 [ --disable-rpath do not hardcode runtime library paths],
290 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
291 dnl the libraries corresponding to explicit and implicit dependencies.
292 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
293 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
295 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
296 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
297 dnl By default, look in $includedir and $libdir.
299 AC_LIB_WITH_FINAL_PREFIX([
300 eval additional_includedir=\"$includedir\"
301 eval additional_libdir=\"$libdir\"
303 AC_LIB_ARG_WITH([lib$1-prefix],
304 [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
305 --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
307 if test "X$withval" = "Xno"; then
310 if test "X$withval" = "X"; then
311 AC_LIB_WITH_FINAL_PREFIX([
312 eval additional_includedir=\"$includedir\"
313 eval additional_libdir=\"$libdir\"
316 additional_includedir="$withval/include"
317 additional_libdir="$withval/lib"
321 dnl Search the library and its dependencies in $additional_libdir and
322 dnl $LDFLAGS. Using breadth-first-seach.
328 names_already_handled=
329 names_next_round='$1 $2'
330 while test -n "$names_next_round"; do
331 names_this_round="$names_next_round"
333 for name in $names_this_round; do
335 for n in $names_already_handled; do
336 if test "$n" = "$name"; then
341 if test -z "$already_handled"; then
342 names_already_handled="$names_already_handled $name"
343 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
344 dnl or AC_LIB_HAVE_LINKFLAGS call.
345 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
346 eval value=\"\$HAVE_LIB$uppername\"
347 if test -n "$value"; then
348 if test "$value" = yes; then
349 eval value=\"\$LIB$uppername\"
350 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
351 eval value=\"\$LTLIB$uppername\"
352 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
354 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
355 dnl that this library doesn't exist. So just drop it.
359 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
360 dnl and the already constructed $LIBNAME/$LTLIBNAME.
365 if test $use_additional = yes; then
366 if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
367 found_dir="$additional_libdir"
368 found_so="$additional_libdir/lib$name.$shlibext"
369 if test -f "$additional_libdir/lib$name.la"; then
370 found_la="$additional_libdir/lib$name.la"
373 if test -f "$additional_libdir/lib$name.$libext"; then
374 found_dir="$additional_libdir"
375 found_a="$additional_libdir/lib$name.$libext"
376 if test -f "$additional_libdir/lib$name.la"; then
377 found_la="$additional_libdir/lib$name.la"
382 if test "X$found_dir" = "X"; then
383 for x in $LDFLAGS $LTLIB[]NAME; do
384 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
387 dir=`echo "X$x" | sed -e 's/^X-L//'`
388 if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
390 found_so="$dir/lib$name.$shlibext"
391 if test -f "$dir/lib$name.la"; then
392 found_la="$dir/lib$name.la"
395 if test -f "$dir/lib$name.$libext"; then
397 found_a="$dir/lib$name.$libext"
398 if test -f "$dir/lib$name.la"; then
399 found_la="$dir/lib$name.la"
405 if test "X$found_dir" != "X"; then
410 if test "X$found_dir" != "X"; then
411 dnl Found the library.
412 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
413 if test "X$found_so" != "X"; then
414 dnl Linking with a shared library. We attempt to hardcode its
415 dnl directory into the executable's runpath, unless it's the
416 dnl standard /usr/lib.
417 if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
418 dnl No hardcoding is needed.
419 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
421 dnl Use an explicit option to hardcode DIR into the resulting
423 dnl Potentially add DIR to ltrpathdirs.
424 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
426 for x in $ltrpathdirs; do
427 if test "X$x" = "X$found_dir"; then
432 if test -z "$haveit"; then
433 ltrpathdirs="$ltrpathdirs $found_dir"
435 dnl The hardcoding into $LIBNAME is system dependent.
436 if test "$hardcode_direct" = yes; then
437 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
438 dnl resulting binary.
439 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
441 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
442 dnl Use an explicit option to hardcode DIR into the resulting
444 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
445 dnl Potentially add DIR to rpathdirs.
446 dnl The rpathdirs will be appended to $LIBNAME at the end.
448 for x in $rpathdirs; do
449 if test "X$x" = "X$found_dir"; then
454 if test -z "$haveit"; then
455 rpathdirs="$rpathdirs $found_dir"
458 dnl Rely on "-L$found_dir".
459 dnl But don't add it if it's already contained in the LDFLAGS
460 dnl or the already constructed $LIBNAME
462 for x in $LDFLAGS $LIB[]NAME; do
463 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
464 if test "X$x" = "X-L$found_dir"; then
469 if test -z "$haveit"; then
470 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
472 if test "$hardcode_minus_L" != no; then
473 dnl FIXME: Not sure whether we should use
474 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
476 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
478 dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
479 dnl here, because this doesn't fit in flags passed to the
480 dnl compiler. So give up. No hardcoding. This affects only
481 dnl very old systems.
482 dnl FIXME: Not sure whether we should use
483 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
485 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
491 if test "X$found_a" != "X"; then
492 dnl Linking with a static library.
493 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
495 dnl We shouldn't come here, but anyway it's good to have a
497 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
500 dnl Assume the include files are nearby.
501 additional_includedir=
504 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
505 additional_includedir="$basedir/include"
508 if test "X$additional_includedir" != "X"; then
509 dnl Potentially add $additional_includedir to $INCNAME.
511 dnl 1. if it's the standard /usr/include,
512 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
513 dnl 3. if it's already present in $CPPFLAGS or the already
514 dnl constructed $INCNAME,
515 dnl 4. if it doesn't exist as a directory.
516 if test "X$additional_includedir" != "X/usr/include"; then
518 if test "X$additional_includedir" = "X/usr/local/include"; then
519 if test -n "$GCC"; then
525 if test -z "$haveit"; then
526 for x in $CPPFLAGS $INC[]NAME; do
527 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
528 if test "X$x" = "X-I$additional_includedir"; then
533 if test -z "$haveit"; then
534 if test -d "$additional_includedir"; then
535 dnl Really add $additional_includedir to $INCNAME.
536 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
542 dnl Look for dependencies.
543 if test -n "$found_la"; then
544 dnl Read the .la file. It defines the variables
545 dnl dlname, library_names, old_library, dependency_libs, current,
546 dnl age, revision, installed, dlopen, dlpreopen, libdir.
547 save_libdir="$libdir"
549 */* | *\\*) . "$found_la" ;;
550 *) . "./$found_la" ;;
552 libdir="$save_libdir"
553 dnl We use only dependency_libs.
554 for dep in $dependency_libs; do
557 additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
558 dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
560 dnl 1. if it's the standard /usr/lib,
561 dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
562 dnl 3. if it's already present in $LDFLAGS or the already
563 dnl constructed $LIBNAME,
564 dnl 4. if it doesn't exist as a directory.
565 if test "X$additional_libdir" != "X/usr/lib"; then
567 if test "X$additional_libdir" = "X/usr/local/lib"; then
568 if test -n "$GCC"; then
574 if test -z "$haveit"; then
576 for x in $LDFLAGS $LIB[]NAME; do
577 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
578 if test "X$x" = "X-L$additional_libdir"; then
583 if test -z "$haveit"; then
584 if test -d "$additional_libdir"; then
585 dnl Really add $additional_libdir to $LIBNAME.
586 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
590 for x in $LDFLAGS $LTLIB[]NAME; do
591 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
592 if test "X$x" = "X-L$additional_libdir"; then
597 if test -z "$haveit"; then
598 if test -d "$additional_libdir"; then
599 dnl Really add $additional_libdir to $LTLIBNAME.
600 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
607 dir=`echo "X$dep" | sed -e 's/^X-R//'`
608 if test "$enable_rpath" != no; then
609 dnl Potentially add DIR to rpathdirs.
610 dnl The rpathdirs will be appended to $LIBNAME at the end.
612 for x in $rpathdirs; do
613 if test "X$x" = "X$dir"; then
618 if test -z "$haveit"; then
619 rpathdirs="$rpathdirs $dir"
621 dnl Potentially add DIR to ltrpathdirs.
622 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
624 for x in $ltrpathdirs; do
625 if test "X$x" = "X$dir"; then
630 if test -z "$haveit"; then
631 ltrpathdirs="$ltrpathdirs $dir"
636 dnl Handle this in the next round.
637 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
640 dnl Handle this in the next round. Throw away the .la's
641 dnl directory; it is already contained in a preceding -L
643 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
646 dnl Most likely an immediate library name.
647 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
648 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
654 dnl Didn't find the library; assume it is in the system directories
655 dnl known to the linker and runtime loader. (All the system
656 dnl directories known to the linker should also be known to the
657 dnl runtime loader, otherwise the system is severely misconfigured.)
658 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
659 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
665 if test "X$rpathdirs" != "X"; then
666 if test -n "$hardcode_libdir_separator"; then
667 dnl Weird platform: only the last -rpath option counts, the user must
668 dnl pass all path elements in one option. We can arrange that for a
669 dnl single library, but not when more than one $LIBNAMEs are used.
671 for found_dir in $rpathdirs; do
672 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
674 dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
675 acl_save_libdir="$libdir"
677 eval flag=\"$hardcode_libdir_flag_spec\"
678 libdir="$acl_save_libdir"
679 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
681 dnl The -rpath options are cumulative.
682 for found_dir in $rpathdirs; do
683 acl_save_libdir="$libdir"
685 eval flag=\"$hardcode_libdir_flag_spec\"
686 libdir="$acl_save_libdir"
687 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
691 if test "X$ltrpathdirs" != "X"; then
692 dnl When using libtool, the option that works for both libraries and
693 dnl executables is -R. The -R options are cumulative.
694 for found_dir in $ltrpathdirs; do
695 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
700 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
701 dnl unless already present in VAR.
702 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
703 dnl contains two or three consecutive elements that belong together.
704 AC_DEFUN([AC_LIB_APPENDTOVAR],
706 for element in [$2]; do
709 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
710 if test "X$x" = "X$element"; then
715 if test -z "$haveit"; then
716 [$1]="${[$1]}${[$1]:+ }$element"
721 # lib-ld.m4 serial 3 (gettext-0.13)
722 dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
723 dnl This file is free software, distributed under the terms of the GNU
724 dnl General Public License. As a special exception to the GNU General
725 dnl Public License, this file may be distributed as part of a program
726 dnl that contains a configuration script generated by Autoconf, under
727 dnl the same distribution terms as the rest of that program.
729 dnl Subroutines of libtool.m4,
730 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
733 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
734 AC_DEFUN([AC_LIB_PROG_LD_GNU],
735 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
736 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
737 case `$LD -v 2>&1 </dev/null` in
738 *GNU* | *'with BFD'*)
739 acl_cv_prog_gnu_ld=yes ;;
741 acl_cv_prog_gnu_ld=no ;;
743 with_gnu_ld=$acl_cv_prog_gnu_ld
746 dnl From libtool-1.4. Sets the variable LD.
747 AC_DEFUN([AC_LIB_PROG_LD],
749 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
750 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
751 AC_REQUIRE([AC_PROG_CC])dnl
752 AC_REQUIRE([AC_CANONICAL_HOST])dnl
753 # Prepare PATH_SEPARATOR.
754 # The user is always right.
755 if test "${PATH_SEPARATOR+set}" != set; then
756 echo "#! /bin/sh" >conf$$.sh
757 echo "exit 0" >>conf$$.sh
759 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
767 if test "$GCC" = yes; then
768 # Check if gcc -print-prog-name=ld gives a path.
769 AC_MSG_CHECKING([for ld used by GCC])
772 # gcc leaves a trailing carriage return which upsets mingw
773 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
775 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
778 # Accept absolute paths.
779 [[\\/]* | [A-Za-z]:[\\/]*)]
780 [re_direlt='/[^/][^/]*/\.\./']
781 # Canonicalize the path of ld
782 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
783 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
784 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
786 test -z "$LD" && LD="$ac_prog"
789 # If it fails, then pretend we aren't using GCC.
793 # If it is relative, then search for the first ld in PATH.
797 elif test "$with_gnu_ld" = yes; then
798 AC_MSG_CHECKING([for GNU ld])
800 AC_MSG_CHECKING([for non-GNU ld])
802 AC_CACHE_VAL(acl_cv_path_LD,
803 [if test -z "$LD"; then
804 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
805 for ac_dir in $PATH; do
806 test -z "$ac_dir" && ac_dir=.
807 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
808 acl_cv_path_LD="$ac_dir/$ac_prog"
809 # Check to see if the program is GNU ld. I'd rather use --version,
810 # but apparently some GNU ld's only accept -v.
811 # Break only if it was the GNU/non-GNU ld that we prefer.
812 case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
813 *GNU* | *'with BFD'*)
814 test "$with_gnu_ld" != no && break ;;
816 test "$with_gnu_ld" != yes && break ;;
822 acl_cv_path_LD="$LD" # Let the user override the test with a path.
825 if test -n "$LD"; then
830 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])