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 # AST_EXT_LIB([NAME], [FUNCTION], [package header], [package symbol name], [package friendly name], [additional LIB data])
15 AC_DEFUN([AST_EXT_LIB],
17 AC_ARG_WITH([$1], AC_HELP_STRING([--with-$1=PATH],[use $5 files in PATH]),[
34 if test "${USE_$1}" != "no"; then
36 if test "x${$1_DIR}" != "x"; then
37 libdir="-L${$1_DIR}/lib"
39 AC_CHECK_LIB([$1], [$2], [:], [], ${libdir} $6)
41 if test "${ac_cv_lib_$1_$2}" = "yes"; then
44 if test "x${$1_DIR}" != "x"; then
45 $1_LIB="${libdir} ${$1_LIB}"
46 $1_INCLUDE="-I${$1_DIR}/include"
47 if test "x$3" != "x" ; then
48 AC_CHECK_HEADER([${$1_DIR}/include/$3], [$4_HEADER_FOUND=1], [$4_HEADER_FOUND=0] )
51 if test "x$3" != "x" ; then
52 AC_CHECK_HEADER([$3], [$4_HEADER_FOUND=1], [$4_HEADER_FOUND=0] )
55 if test "x${$4_HEADER_FOUND}" = "x0" ; then
56 if test ! -z "${$1_MANDATORY}" ;
59 echo " *** It appears that you do not have the $1 development package installed."
60 echo " *** Please install it to include $5 support, or re-run configure"
61 echo " *** without explicitly specifying --with-$1"
69 AC_DEFINE_UNQUOTED([HAVE_$4], 1, [Define to indicate the $5 library])
71 elif test ! -z "${$1_MANDATORY}";
74 echo "*** The $5 installation on this system appears to be broken."
75 echo "*** Either correct the installation, or run configure"
76 echo "*** without explicity specifying --with-$1"
81 AC_SUBST([$1_INCLUDE])
87 [AST_CHECK_GNU_MAKE], [AC_CACHE_CHECK(for GNU make, GNU_MAKE,
88 GNU_MAKE='Not Found' ;
89 for a in make gmake gnumake ; do
90 if test -z "$a" ; then continue ; fi ;
91 if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
97 if test "x$GNU_MAKE" = "xNot Found" ; then
98 echo " *** Please install GNU make. It is required to build Asterisk!"
104 # lib-prefix.m4 serial 4 (gettext-0.14.2)
105 dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
106 dnl This file is free software; the Free Software Foundation
107 dnl gives unlimited permission to copy and/or distribute it,
108 dnl with or without modifications, as long as this notice is preserved.
110 dnl From Bruno Haible.
112 dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
113 dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
114 dnl require excessive bracketing.
115 ifdef([AC_HELP_STRING],
116 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
117 [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
119 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
120 dnl to access previously installed libraries. The basic assumption is that
121 dnl a user will want packages to use other packages he previously installed
122 dnl with the same --prefix option.
123 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
124 dnl libraries, but is otherwise very convenient.
125 AC_DEFUN([AC_LIB_PREFIX],
127 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
128 AC_REQUIRE([AC_PROG_CC])
129 AC_REQUIRE([AC_CANONICAL_HOST])
130 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
131 dnl By default, look in $includedir and $libdir.
133 AC_LIB_WITH_FINAL_PREFIX([
134 eval additional_includedir=\"$includedir\"
135 eval additional_libdir=\"$libdir\"
137 AC_LIB_ARG_WITH([lib-prefix],
138 [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
139 --without-lib-prefix don't search for libraries in includedir and libdir],
141 if test "X$withval" = "Xno"; then
144 if test "X$withval" = "X"; then
145 AC_LIB_WITH_FINAL_PREFIX([
146 eval additional_includedir=\"$includedir\"
147 eval additional_libdir=\"$libdir\"
150 additional_includedir="$withval/include"
151 additional_libdir="$withval/lib"
155 if test $use_additional = yes; then
156 dnl Potentially add $additional_includedir to $CPPFLAGS.
158 dnl 1. if it's the standard /usr/include,
159 dnl 2. if it's already present in $CPPFLAGS,
160 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
161 dnl 4. if it doesn't exist as a directory.
162 if test "X$additional_includedir" != "X/usr/include"; then
164 for x in $CPPFLAGS; do
165 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
166 if test "X$x" = "X-I$additional_includedir"; then
171 if test -z "$haveit"; then
172 if test "X$additional_includedir" = "X/usr/local/include"; then
173 if test -n "$GCC"; then
175 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
179 if test -z "$haveit"; then
180 if test -d "$additional_includedir"; then
181 dnl Really add $additional_includedir to $CPPFLAGS.
182 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
187 dnl Potentially add $additional_libdir to $LDFLAGS.
189 dnl 1. if it's the standard /usr/lib,
190 dnl 2. if it's already present in $LDFLAGS,
191 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
192 dnl 4. if it doesn't exist as a directory.
193 if test "X$additional_libdir" != "X/usr/lib"; then
195 for x in $LDFLAGS; do
196 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
197 if test "X$x" = "X-L$additional_libdir"; then
202 if test -z "$haveit"; then
203 if test "X$additional_libdir" = "X/usr/local/lib"; then
204 if test -n "$GCC"; then
210 if test -z "$haveit"; then
211 if test -d "$additional_libdir"; then
212 dnl Really add $additional_libdir to $LDFLAGS.
213 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
221 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
222 dnl acl_final_exec_prefix, containing the values to which $prefix and
223 dnl $exec_prefix will expand at the end of the configure script.
224 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
226 dnl Unfortunately, prefix and exec_prefix get only finally determined
227 dnl at the end of configure.
228 if test "X$prefix" = "XNONE"; then
229 acl_final_prefix="$ac_default_prefix"
231 acl_final_prefix="$prefix"
233 if test "X$exec_prefix" = "XNONE"; then
234 acl_final_exec_prefix='${prefix}'
236 acl_final_exec_prefix="$exec_prefix"
238 acl_save_prefix="$prefix"
239 prefix="$acl_final_prefix"
240 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
241 prefix="$acl_save_prefix"
244 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
245 dnl variables prefix and exec_prefix bound to the values they will have
246 dnl at the end of the configure script.
247 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
249 acl_save_prefix="$prefix"
250 prefix="$acl_final_prefix"
251 acl_save_exec_prefix="$exec_prefix"
252 exec_prefix="$acl_final_exec_prefix"
254 exec_prefix="$acl_save_exec_prefix"
255 prefix="$acl_save_prefix"
258 # lib-link.m4 serial 6 (gettext-0.14.3)
259 dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
260 dnl This file is free software; the Free Software Foundation
261 dnl gives unlimited permission to copy and/or distribute it,
262 dnl with or without modifications, as long as this notice is preserved.
264 dnl From Bruno Haible.
268 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
269 dnl the libraries corresponding to explicit and implicit dependencies.
270 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
271 dnl augments the CPPFLAGS variable.
272 AC_DEFUN([AC_LIB_LINKFLAGS],
274 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
275 AC_REQUIRE([AC_LIB_RPATH])
276 define([Name],[translit([$1],[./-], [___])])
277 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
278 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
279 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
280 AC_LIB_LINKFLAGS_BODY([$1], [$2])
281 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
282 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
283 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
285 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
286 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
287 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
288 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
290 AC_SUBST([LTLIB]NAME)
291 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
292 dnl results of this search when this library appears as a dependency.
298 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
299 dnl searches for libname and the libraries corresponding to explicit and
300 dnl implicit dependencies, together with the specified include files and
301 dnl the ability to compile and link the specified testcode. If found, it
302 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
303 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
304 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
305 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
306 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
308 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
309 AC_REQUIRE([AC_LIB_RPATH])
310 define([Name],[translit([$1],[./-], [___])])
311 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
312 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
314 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
316 AC_LIB_LINKFLAGS_BODY([$1], [$2])
318 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
319 dnl because if the user has installed lib[]Name and not disabled its use
320 dnl via --without-lib[]Name-prefix, he wants to use it.
321 ac_save_CPPFLAGS="$CPPFLAGS"
322 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
324 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
326 LIBS="$LIBS $LIB[]NAME"
327 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
330 if test "$ac_cv_lib[]Name" = yes; then
332 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
333 AC_MSG_CHECKING([how to link with lib[]$1])
334 AC_MSG_RESULT([$LIB[]NAME])
337 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
338 dnl $INC[]NAME either.
339 CPPFLAGS="$ac_save_CPPFLAGS"
343 AC_SUBST([HAVE_LIB]NAME)
345 AC_SUBST([LTLIB]NAME)
350 dnl Determine the platform dependent parameters needed to use rpath:
351 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
352 dnl hardcode_direct, hardcode_minus_L.
353 AC_DEFUN([AC_LIB_RPATH],
355 dnl Tell automake >= 1.10 to complain if config.rpath is missing.
356 m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
357 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
358 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
359 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
360 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
361 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
362 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
363 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
369 libext="$acl_cv_libext"
370 shlibext="$acl_cv_shlibext"
371 hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
372 hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
373 hardcode_direct="$acl_cv_hardcode_direct"
374 hardcode_minus_L="$acl_cv_hardcode_minus_L"
375 dnl Determine whether the user wants rpath handling at all.
377 [ --disable-rpath do not hardcode runtime library paths],
381 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
382 dnl the libraries corresponding to explicit and implicit dependencies.
383 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
384 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
386 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
387 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
388 dnl By default, look in $includedir and $libdir.
390 AC_LIB_WITH_FINAL_PREFIX([
391 eval additional_includedir=\"$includedir\"
392 eval additional_libdir=\"$libdir\"
394 AC_LIB_ARG_WITH([lib$1-prefix],
395 [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
396 --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
398 if test "X$withval" = "Xno"; then
401 if test "X$withval" = "X"; then
402 AC_LIB_WITH_FINAL_PREFIX([
403 eval additional_includedir=\"$includedir\"
404 eval additional_libdir=\"$libdir\"
407 additional_includedir="$withval/include"
408 additional_libdir="$withval/lib"
412 dnl Search the library and its dependencies in $additional_libdir and
413 dnl $LDFLAGS. Using breadth-first-seach.
419 names_already_handled=
420 names_next_round='$1 $2'
421 while test -n "$names_next_round"; do
422 names_this_round="$names_next_round"
424 for name in $names_this_round; do
426 for n in $names_already_handled; do
427 if test "$n" = "$name"; then
432 if test -z "$already_handled"; then
433 names_already_handled="$names_already_handled $name"
434 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
435 dnl or AC_LIB_HAVE_LINKFLAGS call.
436 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
437 eval value=\"\$HAVE_LIB$uppername\"
438 if test -n "$value"; then
439 if test "$value" = yes; then
440 eval value=\"\$LIB$uppername\"
441 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
442 eval value=\"\$LTLIB$uppername\"
443 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
445 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
446 dnl that this library doesn't exist. So just drop it.
450 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
451 dnl and the already constructed $LIBNAME/$LTLIBNAME.
456 if test $use_additional = yes; then
457 if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
458 found_dir="$additional_libdir"
459 found_so="$additional_libdir/lib$name.$shlibext"
460 if test -f "$additional_libdir/lib$name.la"; then
461 found_la="$additional_libdir/lib$name.la"
464 if test -f "$additional_libdir/lib$name.$libext"; then
465 found_dir="$additional_libdir"
466 found_a="$additional_libdir/lib$name.$libext"
467 if test -f "$additional_libdir/lib$name.la"; then
468 found_la="$additional_libdir/lib$name.la"
473 if test "X$found_dir" = "X"; then
474 for x in $LDFLAGS $LTLIB[]NAME; do
475 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
478 dir=`echo "X$x" | sed -e 's/^X-L//'`
479 if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
481 found_so="$dir/lib$name.$shlibext"
482 if test -f "$dir/lib$name.la"; then
483 found_la="$dir/lib$name.la"
486 if test -f "$dir/lib$name.$libext"; then
488 found_a="$dir/lib$name.$libext"
489 if test -f "$dir/lib$name.la"; then
490 found_la="$dir/lib$name.la"
496 if test "X$found_dir" != "X"; then
501 if test "X$found_dir" != "X"; then
502 dnl Found the library.
503 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
504 if test "X$found_so" != "X"; then
505 dnl Linking with a shared library. We attempt to hardcode its
506 dnl directory into the executable's runpath, unless it's the
507 dnl standard /usr/lib.
508 if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
509 dnl No hardcoding is needed.
510 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
512 dnl Use an explicit option to hardcode DIR into the resulting
514 dnl Potentially add DIR to ltrpathdirs.
515 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
517 for x in $ltrpathdirs; do
518 if test "X$x" = "X$found_dir"; then
523 if test -z "$haveit"; then
524 ltrpathdirs="$ltrpathdirs $found_dir"
526 dnl The hardcoding into $LIBNAME is system dependent.
527 if test "$hardcode_direct" = yes; then
528 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
529 dnl resulting binary.
530 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
532 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
533 dnl Use an explicit option to hardcode DIR into the resulting
535 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
536 dnl Potentially add DIR to rpathdirs.
537 dnl The rpathdirs will be appended to $LIBNAME at the end.
539 for x in $rpathdirs; do
540 if test "X$x" = "X$found_dir"; then
545 if test -z "$haveit"; then
546 rpathdirs="$rpathdirs $found_dir"
549 dnl Rely on "-L$found_dir".
550 dnl But don't add it if it's already contained in the LDFLAGS
551 dnl or the already constructed $LIBNAME
553 for x in $LDFLAGS $LIB[]NAME; do
554 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
555 if test "X$x" = "X-L$found_dir"; then
560 if test -z "$haveit"; then
561 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
563 if test "$hardcode_minus_L" != no; then
564 dnl FIXME: Not sure whether we should use
565 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
567 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
569 dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
570 dnl here, because this doesn't fit in flags passed to the
571 dnl compiler. So give up. No hardcoding. This affects only
572 dnl very old systems.
573 dnl FIXME: Not sure whether we should use
574 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
576 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
582 if test "X$found_a" != "X"; then
583 dnl Linking with a static library.
584 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
586 dnl We shouldn't come here, but anyway it's good to have a
588 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
591 dnl Assume the include files are nearby.
592 additional_includedir=
595 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
596 additional_includedir="$basedir/include"
599 if test "X$additional_includedir" != "X"; then
600 dnl Potentially add $additional_includedir to $INCNAME.
602 dnl 1. if it's the standard /usr/include,
603 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
604 dnl 3. if it's already present in $CPPFLAGS or the already
605 dnl constructed $INCNAME,
606 dnl 4. if it doesn't exist as a directory.
607 if test "X$additional_includedir" != "X/usr/include"; then
609 if test "X$additional_includedir" = "X/usr/local/include"; then
610 if test -n "$GCC"; then
612 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
616 if test -z "$haveit"; then
617 for x in $CPPFLAGS $INC[]NAME; do
618 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
619 if test "X$x" = "X-I$additional_includedir"; then
624 if test -z "$haveit"; then
625 if test -d "$additional_includedir"; then
626 dnl Really add $additional_includedir to $INCNAME.
627 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
633 dnl Look for dependencies.
634 if test -n "$found_la"; then
635 dnl Read the .la file. It defines the variables
636 dnl dlname, library_names, old_library, dependency_libs, current,
637 dnl age, revision, installed, dlopen, dlpreopen, libdir.
638 save_libdir="$libdir"
640 */* | *\\*) . "$found_la" ;;
641 *) . "./$found_la" ;;
643 libdir="$save_libdir"
644 dnl We use only dependency_libs.
645 for dep in $dependency_libs; do
648 additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
649 dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
651 dnl 1. if it's the standard /usr/lib,
652 dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
653 dnl 3. if it's already present in $LDFLAGS or the already
654 dnl constructed $LIBNAME,
655 dnl 4. if it doesn't exist as a directory.
656 if test "X$additional_libdir" != "X/usr/lib"; then
658 if test "X$additional_libdir" = "X/usr/local/lib"; then
659 if test -n "$GCC"; then
661 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
665 if test -z "$haveit"; then
667 for x in $LDFLAGS $LIB[]NAME; do
668 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
669 if test "X$x" = "X-L$additional_libdir"; then
674 if test -z "$haveit"; then
675 if test -d "$additional_libdir"; then
676 dnl Really add $additional_libdir to $LIBNAME.
677 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
681 for x in $LDFLAGS $LTLIB[]NAME; do
682 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
683 if test "X$x" = "X-L$additional_libdir"; then
688 if test -z "$haveit"; then
689 if test -d "$additional_libdir"; then
690 dnl Really add $additional_libdir to $LTLIBNAME.
691 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
698 dir=`echo "X$dep" | sed -e 's/^X-R//'`
699 if test "$enable_rpath" != no; then
700 dnl Potentially add DIR to rpathdirs.
701 dnl The rpathdirs will be appended to $LIBNAME at the end.
703 for x in $rpathdirs; do
704 if test "X$x" = "X$dir"; then
709 if test -z "$haveit"; then
710 rpathdirs="$rpathdirs $dir"
712 dnl Potentially add DIR to ltrpathdirs.
713 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
715 for x in $ltrpathdirs; do
716 if test "X$x" = "X$dir"; then
721 if test -z "$haveit"; then
722 ltrpathdirs="$ltrpathdirs $dir"
727 dnl Handle this in the next round.
728 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
731 dnl Handle this in the next round. Throw away the .la's
732 dnl directory; it is already contained in a preceding -L
734 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
737 dnl Most likely an immediate library name.
738 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
739 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
745 dnl Didn't find the library; assume it is in the system directories
746 dnl known to the linker and runtime loader. (All the system
747 dnl directories known to the linker should also be known to the
748 dnl runtime loader, otherwise the system is severely misconfigured.)
749 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
750 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
756 if test "X$rpathdirs" != "X"; then
757 if test -n "$hardcode_libdir_separator"; then
758 dnl Weird platform: only the last -rpath option counts, the user must
759 dnl pass all path elements in one option. We can arrange that for a
760 dnl single library, but not when more than one $LIBNAMEs are used.
762 for found_dir in $rpathdirs; do
763 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
765 dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
766 acl_save_libdir="$libdir"
768 eval flag=\"$hardcode_libdir_flag_spec\"
769 libdir="$acl_save_libdir"
770 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
772 dnl The -rpath options are cumulative.
773 for found_dir in $rpathdirs; do
774 acl_save_libdir="$libdir"
776 eval flag=\"$hardcode_libdir_flag_spec\"
777 libdir="$acl_save_libdir"
778 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
782 if test "X$ltrpathdirs" != "X"; then
783 dnl When using libtool, the option that works for both libraries and
784 dnl executables is -R. The -R options are cumulative.
785 for found_dir in $ltrpathdirs; do
786 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
791 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
792 dnl unless already present in VAR.
793 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
794 dnl contains two or three consecutive elements that belong together.
795 AC_DEFUN([AC_LIB_APPENDTOVAR],
797 for element in [$2]; do
800 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
801 if test "X$x" = "X$element"; then
806 if test -z "$haveit"; then
807 [$1]="${[$1]}${[$1]:+ }$element"
812 # lib-ld.m4 serial 3 (gettext-0.13)
813 dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
814 dnl This file is free software; the Free Software Foundation
815 dnl gives unlimited permission to copy and/or distribute it,
816 dnl with or without modifications, as long as this notice is preserved.
818 dnl Subroutines of libtool.m4,
819 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
822 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
823 AC_DEFUN([AC_LIB_PROG_LD_GNU],
824 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
825 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
826 case `$LD -v 2>&1 </dev/null` in
827 *GNU* | *'with BFD'*)
828 acl_cv_prog_gnu_ld=yes ;;
830 acl_cv_prog_gnu_ld=no ;;
832 with_gnu_ld=$acl_cv_prog_gnu_ld
835 dnl From libtool-1.4. Sets the variable LD.
836 AC_DEFUN([AC_LIB_PROG_LD],
838 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
839 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
840 AC_REQUIRE([AC_PROG_CC])dnl
841 AC_REQUIRE([AC_CANONICAL_HOST])dnl
842 # Prepare PATH_SEPARATOR.
843 # The user is always right.
844 if test "${PATH_SEPARATOR+set}" != set; then
845 echo "#! /bin/sh" >conf$$.sh
846 echo "exit 0" >>conf$$.sh
848 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
856 if test "$GCC" = yes; then
857 # Check if gcc -print-prog-name=ld gives a path.
858 AC_MSG_CHECKING([for ld used by GCC])
861 # gcc leaves a trailing carriage return which upsets mingw
862 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
864 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
867 # Accept absolute paths.
868 [[\\/]* | [A-Za-z]:[\\/]*)]
869 [re_direlt='/[^/][^/]*/\.\./']
870 # Canonicalize the path of ld
871 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
872 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
873 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
875 test -z "$LD" && LD="$ac_prog"
878 # If it fails, then pretend we aren't using GCC.
882 # If it is relative, then search for the first ld in PATH.
886 elif test "$with_gnu_ld" = yes; then
887 AC_MSG_CHECKING([for GNU ld])
889 AC_MSG_CHECKING([for non-GNU ld])
891 AC_CACHE_VAL(acl_cv_path_LD,
892 [if test -z "$LD"; then
893 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
894 for ac_dir in $PATH; do
895 test -z "$ac_dir" && ac_dir=.
896 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
897 acl_cv_path_LD="$ac_dir/$ac_prog"
898 # Check to see if the program is GNU ld. I'd rather use --version,
899 # but apparently some GNU ld's only accept -v.
900 # Break only if it was the GNU/non-GNU ld that we prefer.
901 case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
902 *GNU* | *'with BFD'*)
903 test "$with_gnu_ld" != no && break ;;
905 test "$with_gnu_ld" != yes && break ;;
911 acl_cv_path_LD="$LD" # Let the user override the test with a path.
914 if test -n "$LD"; then
919 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])