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 5 (gettext-0.15)
14 dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
15 dnl This file is free software; the Free Software Foundation
16 dnl gives unlimited permission to copy and/or distribute it,
17 dnl with or without modifications, as long as this notice is preserved.
19 dnl From Bruno Haible.
21 dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
22 dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
23 dnl require excessive bracketing.
24 ifdef([AC_HELP_STRING],
25 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
26 [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
28 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
29 dnl to access previously installed libraries. The basic assumption is that
30 dnl a user will want packages to use other packages he previously installed
31 dnl with the same --prefix option.
32 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
33 dnl libraries, but is otherwise very convenient.
34 AC_DEFUN([AC_LIB_PREFIX],
36 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
37 AC_REQUIRE([AC_PROG_CC])
38 AC_REQUIRE([AC_CANONICAL_HOST])
39 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
40 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
41 dnl By default, look in $includedir and $libdir.
43 AC_LIB_WITH_FINAL_PREFIX([
44 eval additional_includedir=\"$includedir\"
45 eval additional_libdir=\"$libdir\"
47 AC_LIB_ARG_WITH([lib-prefix],
48 [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
49 --without-lib-prefix don't search for libraries in includedir and libdir],
51 if test "X$withval" = "Xno"; then
54 if test "X$withval" = "X"; then
55 AC_LIB_WITH_FINAL_PREFIX([
56 eval additional_includedir=\"$includedir\"
57 eval additional_libdir=\"$libdir\"
60 additional_includedir="$withval/include"
61 additional_libdir="$withval/$acl_libdirstem"
65 if test $use_additional = yes; then
66 dnl Potentially add $additional_includedir to $CPPFLAGS.
68 dnl 1. if it's the standard /usr/include,
69 dnl 2. if it's already present in $CPPFLAGS,
70 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
71 dnl 4. if it doesn't exist as a directory.
72 if test "X$additional_includedir" != "X/usr/include"; then
74 for x in $CPPFLAGS; do
75 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
76 if test "X$x" = "X-I$additional_includedir"; then
81 if test -z "$haveit"; then
82 if test "X$additional_includedir" = "X/usr/local/include"; then
83 if test -n "$GCC"; then
85 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
89 if test -z "$haveit"; then
90 if test -d "$additional_includedir"; then
91 dnl Really add $additional_includedir to $CPPFLAGS.
92 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
97 dnl Potentially add $additional_libdir to $LDFLAGS.
99 dnl 1. if it's the standard /usr/lib,
100 dnl 2. if it's already present in $LDFLAGS,
101 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
102 dnl 4. if it doesn't exist as a directory.
103 if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
105 for x in $LDFLAGS; do
106 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
107 if test "X$x" = "X-L$additional_libdir"; then
112 if test -z "$haveit"; then
113 if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
114 if test -n "$GCC"; then
120 if test -z "$haveit"; then
121 if test -d "$additional_libdir"; then
122 dnl Really add $additional_libdir to $LDFLAGS.
123 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
131 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
132 dnl acl_final_exec_prefix, containing the values to which $prefix and
133 dnl $exec_prefix will expand at the end of the configure script.
134 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
136 dnl Unfortunately, prefix and exec_prefix get only finally determined
137 dnl at the end of configure.
138 if test "X$prefix" = "XNONE"; then
139 acl_final_prefix="$ac_default_prefix"
141 acl_final_prefix="$prefix"
143 if test "X$exec_prefix" = "XNONE"; then
144 acl_final_exec_prefix='${prefix}'
146 acl_final_exec_prefix="$exec_prefix"
148 acl_save_prefix="$prefix"
149 prefix="$acl_final_prefix"
150 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
151 prefix="$acl_save_prefix"
154 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
155 dnl variables prefix and exec_prefix bound to the values they will have
156 dnl at the end of the configure script.
157 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
159 acl_save_prefix="$prefix"
160 prefix="$acl_final_prefix"
161 acl_save_exec_prefix="$exec_prefix"
162 exec_prefix="$acl_final_exec_prefix"
164 exec_prefix="$acl_save_exec_prefix"
165 prefix="$acl_save_prefix"
168 dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing
169 dnl the basename of the libdir, either "lib" or "lib64".
170 AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
172 dnl There is no formal standard regarding lib and lib64. The current
173 dnl practice is that on a system supporting 32-bit and 64-bit instruction
174 dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
175 dnl libraries go under $prefix/lib. We determine the compiler's default
176 dnl mode by looking at the compiler's library search path. If at least
177 dnl of its elements ends in /lib64 or points to a directory whose absolute
178 dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
179 dnl default, namely "lib".
181 searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
182 if test -n "$searchpath"; then
183 acl_save_IFS="${IFS= }"; IFS=":"
184 for searchdir in $searchpath; do
185 if test -d "$searchdir"; then
187 */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
188 *) searchdir=`cd "$searchdir" && pwd`
190 */lib64 ) acl_libdirstem=lib64 ;;
199 # lib-link.m4 serial 8 (gettext-0.15)
200 dnl Copyright (C) 2001-2006 Free Software Foundation, Inc.
201 dnl This file is free software; the Free Software Foundation
202 dnl gives unlimited permission to copy and/or distribute it,
203 dnl with or without modifications, as long as this notice is preserved.
205 dnl From Bruno Haible.
209 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
210 dnl the libraries corresponding to explicit and implicit dependencies.
211 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
212 dnl augments the CPPFLAGS variable.
213 AC_DEFUN([AC_LIB_LINKFLAGS],
215 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
216 AC_REQUIRE([AC_LIB_RPATH])
217 define([Name],[translit([$1],[./-], [___])])
218 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
219 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
220 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
221 AC_LIB_LINKFLAGS_BODY([$1], [$2])
222 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
223 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
224 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
226 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
227 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
228 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
229 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
231 AC_SUBST([LTLIB]NAME)
232 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
233 dnl results of this search when this library appears as a dependency.
239 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
240 dnl searches for libname and the libraries corresponding to explicit and
241 dnl implicit dependencies, together with the specified include files and
242 dnl the ability to compile and link the specified testcode. If found, it
243 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
244 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
245 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
246 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
247 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
249 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
250 AC_REQUIRE([AC_LIB_RPATH])
251 define([Name],[translit([$1],[./-], [___])])
252 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
253 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
255 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
257 AC_LIB_LINKFLAGS_BODY([$1], [$2])
259 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
260 dnl because if the user has installed lib[]Name and not disabled its use
261 dnl via --without-lib[]Name-prefix, he wants to use it.
262 ac_save_CPPFLAGS="$CPPFLAGS"
263 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
265 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
267 LIBS="$LIBS $LIB[]NAME"
268 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
271 if test "$ac_cv_lib[]Name" = yes; then
273 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
274 AC_MSG_CHECKING([how to link with lib[]$1])
275 AC_MSG_RESULT([$LIB[]NAME])
278 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
279 dnl $INC[]NAME either.
280 CPPFLAGS="$ac_save_CPPFLAGS"
284 AC_SUBST([HAVE_LIB]NAME)
286 AC_SUBST([LTLIB]NAME)
291 dnl Determine the platform dependent parameters needed to use rpath:
292 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
293 dnl hardcode_direct, hardcode_minus_L.
294 AC_DEFUN([AC_LIB_RPATH],
296 dnl Tell automake >= 1.10 to complain if config.rpath is missing.
297 m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
298 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
299 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
300 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
301 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
302 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
303 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
304 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
310 libext="$acl_cv_libext"
311 shlibext="$acl_cv_shlibext"
312 hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
313 hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
314 hardcode_direct="$acl_cv_hardcode_direct"
315 hardcode_minus_L="$acl_cv_hardcode_minus_L"
316 dnl Determine whether the user wants rpath handling at all.
318 [ --disable-rpath do not hardcode runtime library paths],
322 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
323 dnl the libraries corresponding to explicit and implicit dependencies.
324 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
325 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
327 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
328 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
329 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
330 dnl By default, look in $includedir and $libdir.
332 AC_LIB_WITH_FINAL_PREFIX([
333 eval additional_includedir=\"$includedir\"
334 eval additional_libdir=\"$libdir\"
336 AC_LIB_ARG_WITH([lib$1-prefix],
337 [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
338 --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
340 if test "X$withval" = "Xno"; then
343 if test "X$withval" = "X"; then
344 AC_LIB_WITH_FINAL_PREFIX([
345 eval additional_includedir=\"$includedir\"
346 eval additional_libdir=\"$libdir\"
349 additional_includedir="$withval/include"
350 additional_libdir="$withval/$acl_libdirstem"
354 dnl Search the library and its dependencies in $additional_libdir and
355 dnl $LDFLAGS. Using breadth-first-seach.
361 names_already_handled=
362 names_next_round='$1 $2'
363 while test -n "$names_next_round"; do
364 names_this_round="$names_next_round"
366 for name in $names_this_round; do
368 for n in $names_already_handled; do
369 if test "$n" = "$name"; then
374 if test -z "$already_handled"; then
375 names_already_handled="$names_already_handled $name"
376 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
377 dnl or AC_LIB_HAVE_LINKFLAGS call.
378 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
379 eval value=\"\$HAVE_LIB$uppername\"
380 if test -n "$value"; then
381 if test "$value" = yes; then
382 eval value=\"\$LIB$uppername\"
383 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
384 eval value=\"\$LTLIB$uppername\"
385 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
387 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
388 dnl that this library doesn't exist. So just drop it.
392 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
393 dnl and the already constructed $LIBNAME/$LTLIBNAME.
398 if test $use_additional = yes; then
399 if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
400 found_dir="$additional_libdir"
401 found_so="$additional_libdir/lib$name.$shlibext"
402 if test -f "$additional_libdir/lib$name.la"; then
403 found_la="$additional_libdir/lib$name.la"
406 if test -f "$additional_libdir/lib$name.$libext"; then
407 found_dir="$additional_libdir"
408 found_a="$additional_libdir/lib$name.$libext"
409 if test -f "$additional_libdir/lib$name.la"; then
410 found_la="$additional_libdir/lib$name.la"
415 if test "X$found_dir" = "X"; then
416 for x in $LDFLAGS $LTLIB[]NAME; do
417 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
420 dir=`echo "X$x" | sed -e 's/^X-L//'`
421 if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
423 found_so="$dir/lib$name.$shlibext"
424 if test -f "$dir/lib$name.la"; then
425 found_la="$dir/lib$name.la"
428 if test -f "$dir/lib$name.$libext"; then
430 found_a="$dir/lib$name.$libext"
431 if test -f "$dir/lib$name.la"; then
432 found_la="$dir/lib$name.la"
438 if test "X$found_dir" != "X"; then
443 if test "X$found_dir" != "X"; then
444 dnl Found the library.
445 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
446 if test "X$found_so" != "X"; then
447 dnl Linking with a shared library. We attempt to hardcode its
448 dnl directory into the executable's runpath, unless it's the
449 dnl standard /usr/lib.
450 if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
451 dnl No hardcoding is needed.
452 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
454 dnl Use an explicit option to hardcode DIR into the resulting
456 dnl Potentially add DIR to ltrpathdirs.
457 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
459 for x in $ltrpathdirs; do
460 if test "X$x" = "X$found_dir"; then
465 if test -z "$haveit"; then
466 ltrpathdirs="$ltrpathdirs $found_dir"
468 dnl The hardcoding into $LIBNAME is system dependent.
469 if test "$hardcode_direct" = yes; then
470 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
471 dnl resulting binary.
472 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
474 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
475 dnl Use an explicit option to hardcode DIR into the resulting
477 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
478 dnl Potentially add DIR to rpathdirs.
479 dnl The rpathdirs will be appended to $LIBNAME at the end.
481 for x in $rpathdirs; do
482 if test "X$x" = "X$found_dir"; then
487 if test -z "$haveit"; then
488 rpathdirs="$rpathdirs $found_dir"
491 dnl Rely on "-L$found_dir".
492 dnl But don't add it if it's already contained in the LDFLAGS
493 dnl or the already constructed $LIBNAME
495 for x in $LDFLAGS $LIB[]NAME; do
496 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
497 if test "X$x" = "X-L$found_dir"; then
502 if test -z "$haveit"; then
503 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
505 if test "$hardcode_minus_L" != no; then
506 dnl FIXME: Not sure whether we should use
507 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
509 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
511 dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
512 dnl here, because this doesn't fit in flags passed to the
513 dnl compiler. So give up. No hardcoding. This affects only
514 dnl very old systems.
515 dnl FIXME: Not sure whether we should use
516 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
518 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
524 if test "X$found_a" != "X"; then
525 dnl Linking with a static library.
526 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
528 dnl We shouldn't come here, but anyway it's good to have a
530 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
533 dnl Assume the include files are nearby.
534 additional_includedir=
536 */$acl_libdirstem | */$acl_libdirstem/)
537 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
538 additional_includedir="$basedir/include"
541 if test "X$additional_includedir" != "X"; then
542 dnl Potentially add $additional_includedir to $INCNAME.
544 dnl 1. if it's the standard /usr/include,
545 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
546 dnl 3. if it's already present in $CPPFLAGS or the already
547 dnl constructed $INCNAME,
548 dnl 4. if it doesn't exist as a directory.
549 if test "X$additional_includedir" != "X/usr/include"; then
551 if test "X$additional_includedir" = "X/usr/local/include"; then
552 if test -n "$GCC"; then
554 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
558 if test -z "$haveit"; then
559 for x in $CPPFLAGS $INC[]NAME; do
560 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
561 if test "X$x" = "X-I$additional_includedir"; then
566 if test -z "$haveit"; then
567 if test -d "$additional_includedir"; then
568 dnl Really add $additional_includedir to $INCNAME.
569 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
575 dnl Look for dependencies.
576 if test -n "$found_la"; then
577 dnl Read the .la file. It defines the variables
578 dnl dlname, library_names, old_library, dependency_libs, current,
579 dnl age, revision, installed, dlopen, dlpreopen, libdir.
580 save_libdir="$libdir"
582 */* | *\\*) . "$found_la" ;;
583 *) . "./$found_la" ;;
585 libdir="$save_libdir"
586 dnl We use only dependency_libs.
587 for dep in $dependency_libs; do
590 additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
591 dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
593 dnl 1. if it's the standard /usr/lib,
594 dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
595 dnl 3. if it's already present in $LDFLAGS or the already
596 dnl constructed $LIBNAME,
597 dnl 4. if it doesn't exist as a directory.
598 if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
600 if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
601 if test -n "$GCC"; then
603 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
607 if test -z "$haveit"; then
609 for x in $LDFLAGS $LIB[]NAME; do
610 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
611 if test "X$x" = "X-L$additional_libdir"; then
616 if test -z "$haveit"; then
617 if test -d "$additional_libdir"; then
618 dnl Really add $additional_libdir to $LIBNAME.
619 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
623 for x in $LDFLAGS $LTLIB[]NAME; do
624 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
625 if test "X$x" = "X-L$additional_libdir"; then
630 if test -z "$haveit"; then
631 if test -d "$additional_libdir"; then
632 dnl Really add $additional_libdir to $LTLIBNAME.
633 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
640 dir=`echo "X$dep" | sed -e 's/^X-R//'`
641 if test "$enable_rpath" != no; then
642 dnl Potentially add DIR to rpathdirs.
643 dnl The rpathdirs will be appended to $LIBNAME at the end.
645 for x in $rpathdirs; do
646 if test "X$x" = "X$dir"; then
651 if test -z "$haveit"; then
652 rpathdirs="$rpathdirs $dir"
654 dnl Potentially add DIR to ltrpathdirs.
655 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
657 for x in $ltrpathdirs; do
658 if test "X$x" = "X$dir"; then
663 if test -z "$haveit"; then
664 ltrpathdirs="$ltrpathdirs $dir"
669 dnl Handle this in the next round.
670 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
673 dnl Handle this in the next round. Throw away the .la's
674 dnl directory; it is already contained in a preceding -L
676 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
679 dnl Most likely an immediate library name.
680 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
681 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
687 dnl Didn't find the library; assume it is in the system directories
688 dnl known to the linker and runtime loader. (All the system
689 dnl directories known to the linker should also be known to the
690 dnl runtime loader, otherwise the system is severely misconfigured.)
691 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
692 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
698 if test "X$rpathdirs" != "X"; then
699 if test -n "$hardcode_libdir_separator"; then
700 dnl Weird platform: only the last -rpath option counts, the user must
701 dnl pass all path elements in one option. We can arrange that for a
702 dnl single library, but not when more than one $LIBNAMEs are used.
704 for found_dir in $rpathdirs; do
705 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
707 dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
708 acl_save_libdir="$libdir"
710 eval flag=\"$hardcode_libdir_flag_spec\"
711 libdir="$acl_save_libdir"
712 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
714 dnl The -rpath options are cumulative.
715 for found_dir in $rpathdirs; do
716 acl_save_libdir="$libdir"
718 eval flag=\"$hardcode_libdir_flag_spec\"
719 libdir="$acl_save_libdir"
720 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
724 if test "X$ltrpathdirs" != "X"; then
725 dnl When using libtool, the option that works for both libraries and
726 dnl executables is -R. The -R options are cumulative.
727 for found_dir in $ltrpathdirs; do
728 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
733 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
734 dnl unless already present in VAR.
735 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
736 dnl contains two or three consecutive elements that belong together.
737 AC_DEFUN([AC_LIB_APPENDTOVAR],
739 for element in [$2]; do
742 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
743 if test "X$x" = "X$element"; then
748 if test -z "$haveit"; then
749 [$1]="${[$1]}${[$1]:+ }$element"
754 dnl For those cases where a variable contains several -L and -l options
755 dnl referring to unknown libraries and directories, this macro determines the
756 dnl necessary additional linker options for the runtime path.
757 dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
758 dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
759 dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
760 dnl otherwise linking without libtool is assumed.
761 AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
763 AC_REQUIRE([AC_LIB_RPATH])
764 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
766 if test "$enable_rpath" != no; then
767 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
768 dnl Use an explicit option to hardcode directories into the resulting
773 if test -n "$next"; then
775 dnl No need to hardcode the standard /usr/lib.
776 if test "X$dir" != "X/usr/$acl_libdirstem"; then
777 rpathdirs="$rpathdirs $dir"
783 -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
784 dnl No need to hardcode the standard /usr/lib.
785 if test "X$dir" != "X/usr/$acl_libdirstem"; then
786 rpathdirs="$rpathdirs $dir"
793 if test "X$rpathdirs" != "X"; then
794 if test -n ""$3""; then
795 dnl libtool is used for linking. Use -R options.
796 for dir in $rpathdirs; do
797 $1="${$1}${$1:+ }-R$dir"
800 dnl The linker is used for linking directly.
801 if test -n "$hardcode_libdir_separator"; then
802 dnl Weird platform: only the last -rpath option counts, the user
803 dnl must pass all path elements in one option.
805 for dir in $rpathdirs; do
806 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$dir"
808 acl_save_libdir="$libdir"
810 eval flag=\"$hardcode_libdir_flag_spec\"
811 libdir="$acl_save_libdir"
814 dnl The -rpath options are cumulative.
815 for dir in $rpathdirs; do
816 acl_save_libdir="$libdir"
818 eval flag=\"$hardcode_libdir_flag_spec\"
819 libdir="$acl_save_libdir"
820 $1="${$1}${$1:+ }$flag"
830 # lib-ld.m4 serial 3 (gettext-0.13)
831 dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
832 dnl This file is free software; the Free Software Foundation
833 dnl gives unlimited permission to copy and/or distribute it,
834 dnl with or without modifications, as long as this notice is preserved.
836 dnl Subroutines of libtool.m4,
837 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
840 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
841 AC_DEFUN([AC_LIB_PROG_LD_GNU],
842 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
843 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
844 case `$LD -v 2>&1 </dev/null` in
845 *GNU* | *'with BFD'*)
846 acl_cv_prog_gnu_ld=yes ;;
848 acl_cv_prog_gnu_ld=no ;;
850 with_gnu_ld=$acl_cv_prog_gnu_ld
853 dnl From libtool-1.4. Sets the variable LD.
854 AC_DEFUN([AC_LIB_PROG_LD],
856 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
857 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
858 AC_REQUIRE([AC_PROG_CC])dnl
859 AC_REQUIRE([AC_CANONICAL_HOST])dnl
860 # Prepare PATH_SEPARATOR.
861 # The user is always right.
862 if test "${PATH_SEPARATOR+set}" != set; then
863 echo "#! /bin/sh" >conf$$.sh
864 echo "exit 0" >>conf$$.sh
866 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
874 if test "$GCC" = yes; then
875 # Check if gcc -print-prog-name=ld gives a path.
876 AC_MSG_CHECKING([for ld used by GCC])
879 # gcc leaves a trailing carriage return which upsets mingw
880 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
882 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
885 # Accept absolute paths.
886 [[\\/]* | [A-Za-z]:[\\/]*)]
887 [re_direlt='/[^/][^/]*/\.\./']
888 # Canonicalize the path of ld
889 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
890 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
891 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
893 test -z "$LD" && LD="$ac_prog"
896 # If it fails, then pretend we aren't using GCC.
900 # If it is relative, then search for the first ld in PATH.
904 elif test "$with_gnu_ld" = yes; then
905 AC_MSG_CHECKING([for GNU ld])
907 AC_MSG_CHECKING([for non-GNU ld])
909 AC_CACHE_VAL(acl_cv_path_LD,
910 [if test -z "$LD"; then
911 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
912 for ac_dir in $PATH; do
913 test -z "$ac_dir" && ac_dir=.
914 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
915 acl_cv_path_LD="$ac_dir/$ac_prog"
916 # Check to see if the program is GNU ld. I'd rather use --version,
917 # but apparently some GNU ld's only accept -v.
918 # Break only if it was the GNU/non-GNU ld that we prefer.
919 case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
920 *GNU* | *'with BFD'*)
921 test "$with_gnu_ld" != no && break ;;
923 test "$with_gnu_ld" != yes && break ;;
929 acl_cv_path_LD="$LD" # Let the user override the test with a path.
932 if test -n "$LD"; then
937 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
941 # Do all the work for Automake. This macro actually does too much --
942 # some checks are only needed if your package does certain things.
943 # But this isn't really a big deal.
948 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
950 AC_DEFUN([AM_INIT_AUTOMAKE],
951 [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
952 AC_REQUIRE([AC_PROG_INSTALL])
957 dnl test to see if srcdir already configured
958 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
959 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
962 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
963 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
964 AC_REQUIRE([AM_SANITY_CHECK])
965 AC_REQUIRE([AC_ARG_PROGRAM])
966 dnl FIXME This is truly gross.
967 missing_dir=`cd $ac_aux_dir && pwd`
968 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir)
969 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
970 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir)
971 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
972 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
973 AC_REQUIRE([AC_PROG_MAKE_SET])])
975 # Copyright 2002 Free Software Foundation, Inc.
977 # This program is free software; you can redistribute it and/or modify
978 # it under the terms of the GNU General Public License as published by
979 # the Free Software Foundation; either version 2, or (at your option)
982 # This program is distributed in the hope that it will be useful,
983 # but WITHOUT ANY WARRANTY; without even the implied warranty of
984 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
985 # GNU General Public License for more details.
987 # You should have received a copy of the GNU General Public License
988 # along with this program; if not, write to the Free Software
989 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
991 # AM_AUTOMAKE_VERSION(VERSION)
992 # ----------------------------
993 # Automake X.Y traces this macro to ensure aclocal.m4 has been
994 # generated from the m4 files accompanying Automake X.Y.
995 AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"])
997 # AM_SET_CURRENT_AUTOMAKE_VERSION
998 # -------------------------------
999 # Call AM_AUTOMAKE_VERSION so it can be traced.
1000 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
1001 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
1002 [AM_AUTOMAKE_VERSION([1.4-p6])])
1005 # Check to make sure that the build environment is sane.
1008 AC_DEFUN([AM_SANITY_CHECK],
1009 [AC_MSG_CHECKING([whether build environment is sane])
1012 echo timestamp > conftestfile
1013 # Do `set' in a subshell so we don't clobber the current shell's
1014 # arguments. Must try -L first in case configure is actually a
1015 # symlink; some systems play weird games with the mod time of symlinks
1016 # (eg FreeBSD returns the mod time of the symlink's containing
1019 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
1020 if test "[$]*" = "X"; then
1022 set X `ls -t $srcdir/configure conftestfile`
1024 if test "[$]*" != "X $srcdir/configure conftestfile" \
1025 && test "[$]*" != "X conftestfile $srcdir/configure"; then
1027 # If neither matched, then we have a broken ls. This can happen
1028 # if, for instance, CONFIG_SHELL is bash and it inherits a
1029 # broken ls alias from the environment. This has actually
1030 # happened. Such a system could not be considered "sane".
1031 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
1032 alias in your environment])
1035 test "[$]2" = conftestfile
1041 AC_MSG_ERROR([newly created file is older than distributed files!
1042 Check your system clock])
1045 AC_MSG_RESULT(yes)])
1047 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
1048 dnl The program must properly implement --version.
1049 AC_DEFUN([AM_MISSING_PROG],
1050 [AC_MSG_CHECKING(for working $2)
1051 # Run test in a subshell; some versions of sh will print an error if
1052 # an executable is not found, even if stderr is redirected.
1053 # Redirect stdin to placate older versions of autoconf. Sigh.
1054 if ($2 --version) < /dev/null > /dev/null 2>&1; then
1056 AC_MSG_RESULT(found)
1059 AC_MSG_RESULT(missing)