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 4 (gettext-0.14.2)
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_PREFIX])
40 dnl By default, look in $includedir and $libdir.
42 AC_LIB_WITH_FINAL_PREFIX([
43 eval additional_includedir=\"$includedir\"
44 eval additional_libdir=\"$libdir\"
46 AC_LIB_ARG_WITH([lib-prefix],
47 [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
48 --without-lib-prefix don't search for libraries in includedir and libdir],
50 if test "X$withval" = "Xno"; then
53 if test "X$withval" = "X"; then
54 AC_LIB_WITH_FINAL_PREFIX([
55 eval additional_includedir=\"$includedir\"
56 eval additional_libdir=\"$libdir\"
59 additional_includedir="$withval/include"
60 additional_libdir="$withval/lib"
64 if test $use_additional = yes; then
65 dnl Potentially add $additional_includedir to $CPPFLAGS.
67 dnl 1. if it's the standard /usr/include,
68 dnl 2. if it's already present in $CPPFLAGS,
69 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
70 dnl 4. if it doesn't exist as a directory.
71 if test "X$additional_includedir" != "X/usr/include"; then
73 for x in $CPPFLAGS; do
74 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
75 if test "X$x" = "X-I$additional_includedir"; then
80 if test -z "$haveit"; then
81 if test "X$additional_includedir" = "X/usr/local/include"; then
82 if test -n "$GCC"; then
84 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
88 if test -z "$haveit"; then
89 if test -d "$additional_includedir"; then
90 dnl Really add $additional_includedir to $CPPFLAGS.
91 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
96 dnl Potentially add $additional_libdir to $LDFLAGS.
98 dnl 1. if it's the standard /usr/lib,
99 dnl 2. if it's already present in $LDFLAGS,
100 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
101 dnl 4. if it doesn't exist as a directory.
102 if test "X$additional_libdir" != "X/usr/lib"; then
104 for x in $LDFLAGS; do
105 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
106 if test "X$x" = "X-L$additional_libdir"; then
111 if test -z "$haveit"; then
112 if test "X$additional_libdir" = "X/usr/local/lib"; then
113 if test -n "$GCC"; then
119 if test -z "$haveit"; then
120 if test -d "$additional_libdir"; then
121 dnl Really add $additional_libdir to $LDFLAGS.
122 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
130 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
131 dnl acl_final_exec_prefix, containing the values to which $prefix and
132 dnl $exec_prefix will expand at the end of the configure script.
133 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
135 dnl Unfortunately, prefix and exec_prefix get only finally determined
136 dnl at the end of configure.
137 if test "X$prefix" = "XNONE"; then
138 acl_final_prefix="$ac_default_prefix"
140 acl_final_prefix="$prefix"
142 if test "X$exec_prefix" = "XNONE"; then
143 acl_final_exec_prefix='${prefix}'
145 acl_final_exec_prefix="$exec_prefix"
147 acl_save_prefix="$prefix"
148 prefix="$acl_final_prefix"
149 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
150 prefix="$acl_save_prefix"
153 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
154 dnl variables prefix and exec_prefix bound to the values they will have
155 dnl at the end of the configure script.
156 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
158 acl_save_prefix="$prefix"
159 prefix="$acl_final_prefix"
160 acl_save_exec_prefix="$exec_prefix"
161 exec_prefix="$acl_final_exec_prefix"
163 exec_prefix="$acl_save_exec_prefix"
164 prefix="$acl_save_prefix"
167 # lib-link.m4 serial 6 (gettext-0.14.3)
168 dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
169 dnl This file is free software; the Free Software Foundation
170 dnl gives unlimited permission to copy and/or distribute it,
171 dnl with or without modifications, as long as this notice is preserved.
173 dnl From Bruno Haible.
177 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
178 dnl the libraries corresponding to explicit and implicit dependencies.
179 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
180 dnl augments the CPPFLAGS variable.
181 AC_DEFUN([AC_LIB_LINKFLAGS],
183 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
184 AC_REQUIRE([AC_LIB_RPATH])
185 define([Name],[translit([$1],[./-], [___])])
186 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
187 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
188 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
189 AC_LIB_LINKFLAGS_BODY([$1], [$2])
190 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
191 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
192 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
194 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
195 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
196 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
197 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
199 AC_SUBST([LTLIB]NAME)
200 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
201 dnl results of this search when this library appears as a dependency.
207 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
208 dnl searches for libname and the libraries corresponding to explicit and
209 dnl implicit dependencies, together with the specified include files and
210 dnl the ability to compile and link the specified testcode. If found, it
211 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
212 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
213 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
214 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
215 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
217 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
218 AC_REQUIRE([AC_LIB_RPATH])
219 define([Name],[translit([$1],[./-], [___])])
220 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
221 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
223 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
225 AC_LIB_LINKFLAGS_BODY([$1], [$2])
227 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
228 dnl because if the user has installed lib[]Name and not disabled its use
229 dnl via --without-lib[]Name-prefix, he wants to use it.
230 ac_save_CPPFLAGS="$CPPFLAGS"
231 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
233 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
235 LIBS="$LIBS $LIB[]NAME"
236 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
239 if test "$ac_cv_lib[]Name" = yes; then
241 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
242 AC_MSG_CHECKING([how to link with lib[]$1])
243 AC_MSG_RESULT([$LIB[]NAME])
246 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
247 dnl $INC[]NAME either.
248 CPPFLAGS="$ac_save_CPPFLAGS"
252 AC_SUBST([HAVE_LIB]NAME)
254 AC_SUBST([LTLIB]NAME)
259 dnl Determine the platform dependent parameters needed to use rpath:
260 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
261 dnl hardcode_direct, hardcode_minus_L.
262 AC_DEFUN([AC_LIB_RPATH],
264 dnl Tell automake >= 1.10 to complain if config.rpath is missing.
265 m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.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
521 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
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
570 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
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; the Free Software Foundation
724 dnl gives unlimited permission to copy and/or distribute it,
725 dnl with or without modifications, as long as this notice is preserved.
727 dnl Subroutines of libtool.m4,
728 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
731 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
732 AC_DEFUN([AC_LIB_PROG_LD_GNU],
733 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
734 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
735 case `$LD -v 2>&1 </dev/null` in
736 *GNU* | *'with BFD'*)
737 acl_cv_prog_gnu_ld=yes ;;
739 acl_cv_prog_gnu_ld=no ;;
741 with_gnu_ld=$acl_cv_prog_gnu_ld
744 dnl From libtool-1.4. Sets the variable LD.
745 AC_DEFUN([AC_LIB_PROG_LD],
747 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
748 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
749 AC_REQUIRE([AC_PROG_CC])dnl
750 AC_REQUIRE([AC_CANONICAL_HOST])dnl
751 # Prepare PATH_SEPARATOR.
752 # The user is always right.
753 if test "${PATH_SEPARATOR+set}" != set; then
754 echo "#! /bin/sh" >conf$$.sh
755 echo "exit 0" >>conf$$.sh
757 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
765 if test "$GCC" = yes; then
766 # Check if gcc -print-prog-name=ld gives a path.
767 AC_MSG_CHECKING([for ld used by GCC])
770 # gcc leaves a trailing carriage return which upsets mingw
771 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
773 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
776 # Accept absolute paths.
777 [[\\/]* | [A-Za-z]:[\\/]*)]
778 [re_direlt='/[^/][^/]*/\.\./']
779 # Canonicalize the path of ld
780 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
781 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
782 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
784 test -z "$LD" && LD="$ac_prog"
787 # If it fails, then pretend we aren't using GCC.
791 # If it is relative, then search for the first ld in PATH.
795 elif test "$with_gnu_ld" = yes; then
796 AC_MSG_CHECKING([for GNU ld])
798 AC_MSG_CHECKING([for non-GNU ld])
800 AC_CACHE_VAL(acl_cv_path_LD,
801 [if test -z "$LD"; then
802 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
803 for ac_dir in $PATH; do
804 test -z "$ac_dir" && ac_dir=.
805 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
806 acl_cv_path_LD="$ac_dir/$ac_prog"
807 # Check to see if the program is GNU ld. I'd rather use --version,
808 # but apparently some GNU ld's only accept -v.
809 # Break only if it was the GNU/non-GNU ld that we prefer.
810 case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
811 *GNU* | *'with BFD'*)
812 test "$with_gnu_ld" != no && break ;;
814 test "$with_gnu_ld" != yes && break ;;
820 acl_cv_path_LD="$LD" # Let the user override the test with a path.
823 if test -n "$LD"; then
828 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
832 # Do all the work for Automake. This macro actually does too much --
833 # some checks are only needed if your package does certain things.
834 # But this isn't really a big deal.
839 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
841 AC_DEFUN([AM_INIT_AUTOMAKE],
842 [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
843 AC_REQUIRE([AC_PROG_INSTALL])
848 dnl test to see if srcdir already configured
849 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
850 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
853 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
854 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
855 AC_REQUIRE([AM_SANITY_CHECK])
856 AC_REQUIRE([AC_ARG_PROGRAM])
857 dnl FIXME This is truly gross.
858 missing_dir=`cd $ac_aux_dir && pwd`
859 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir)
860 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
861 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir)
862 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
863 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
864 AC_REQUIRE([AC_PROG_MAKE_SET])])
866 # Copyright 2002 Free Software Foundation, Inc.
868 # This program is free software; you can redistribute it and/or modify
869 # it under the terms of the GNU General Public License as published by
870 # the Free Software Foundation; either version 2, or (at your option)
873 # This program is distributed in the hope that it will be useful,
874 # but WITHOUT ANY WARRANTY; without even the implied warranty of
875 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
876 # GNU General Public License for more details.
878 # You should have received a copy of the GNU General Public License
879 # along with this program; if not, write to the Free Software
880 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
882 # AM_AUTOMAKE_VERSION(VERSION)
883 # ----------------------------
884 # Automake X.Y traces this macro to ensure aclocal.m4 has been
885 # generated from the m4 files accompanying Automake X.Y.
886 AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"])
888 # AM_SET_CURRENT_AUTOMAKE_VERSION
889 # -------------------------------
890 # Call AM_AUTOMAKE_VERSION so it can be traced.
891 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
892 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
893 [AM_AUTOMAKE_VERSION([1.4-p6])])
896 # Check to make sure that the build environment is sane.
899 AC_DEFUN([AM_SANITY_CHECK],
900 [AC_MSG_CHECKING([whether build environment is sane])
903 echo timestamp > conftestfile
904 # Do `set' in a subshell so we don't clobber the current shell's
905 # arguments. Must try -L first in case configure is actually a
906 # symlink; some systems play weird games with the mod time of symlinks
907 # (eg FreeBSD returns the mod time of the symlink's containing
910 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
911 if test "[$]*" = "X"; then
913 set X `ls -t $srcdir/configure conftestfile`
915 if test "[$]*" != "X $srcdir/configure conftestfile" \
916 && test "[$]*" != "X conftestfile $srcdir/configure"; then
918 # If neither matched, then we have a broken ls. This can happen
919 # if, for instance, CONFIG_SHELL is bash and it inherits a
920 # broken ls alias from the environment. This has actually
921 # happened. Such a system could not be considered "sane".
922 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
923 alias in your environment])
926 test "[$]2" = conftestfile
932 AC_MSG_ERROR([newly created file is older than distributed files!
933 Check your system clock])
938 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
939 dnl The program must properly implement --version.
940 AC_DEFUN([AM_MISSING_PROG],
941 [AC_MSG_CHECKING(for working $2)
942 # Run test in a subshell; some versions of sh will print an error if
943 # an executable is not found, even if stderr is redirected.
944 # Redirect stdin to placate older versions of autoconf. Sigh.
945 if ($2 --version) < /dev/null > /dev/null 2>&1; then
950 AC_MSG_RESULT(missing)
954 # Add --enable-maintainer-mode option to configure.
959 AC_DEFUN([AM_MAINTAINER_MODE],
960 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
961 dnl maintainer-mode is disabled by default
962 AC_ARG_ENABLE(maintainer-mode,
963 [ --enable-maintainer-mode enable make rules and dependencies not useful
964 (and sometimes confusing) to the casual installer],
965 USE_MAINTAINER_MODE=$enableval,
966 USE_MAINTAINER_MODE=no)
967 AC_MSG_RESULT($USE_MAINTAINER_MODE)
968 AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
969 MAINT=$MAINTAINER_MODE_TRUE
974 # Define a conditional.
976 AC_DEFUN([AM_CONDITIONAL],
987 # Like AC_CONFIG_HEADER, but automatically create stamp file.
989 AC_DEFUN([AM_CONFIG_HEADER],
991 AC_CONFIG_HEADER([$1])
992 dnl When config.status generates a header, we must update the stamp-h file.
993 dnl This file resides in the same directory as the config header
994 dnl that is generated. We must strip everything past the first ":",
995 dnl and everything past the last "/".
996 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
997 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
998 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
1000 for am_file in <<$1>>; do
1001 case " <<$>>CONFIG_HEADERS " in
1002 *" <<$>>am_file "*<<)>>
1003 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
1006 am_indx=`expr "<<$>>am_indx" + 1`
1010 # isc-posix.m4 serial 2 (gettext-0.11.2)
1011 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
1012 dnl This file is free software; the Free Software Foundation
1013 dnl gives unlimited permission to copy and/or distribute it,
1014 dnl with or without modifications, as long as this notice is preserved.
1016 # This file is not needed with autoconf-2.53 and newer. Remove it in 2005.
1018 # This test replaces the one in autoconf.
1019 # Currently this macro should have the same name as the autoconf macro
1020 # because gettext's gettext.m4 (distributed in the automake package)
1021 # still uses it. Otherwise, the use in gettext.m4 makes autoheader
1022 # give these diagnostics:
1023 # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
1024 # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
1026 undefine([AC_ISC_POSIX])
1028 AC_DEFUN([AC_ISC_POSIX],
1030 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
1031 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
1038 # @defmac AC_PROG_CC_STDC
1039 # @maindex PROG_CC_STDC
1041 # If the C compiler in not in ANSI C mode by default, try to add an option
1042 # to output variable @code{CC} to make it so. This macro tries various
1043 # options that select ANSI C on some system or another. It considers the
1044 # compiler to be in ANSI C mode if it handles function prototypes correctly.
1046 # If you use this macro, you should check after calling it whether the C
1047 # compiler has been set to accept ANSI C; if not, the shell variable
1048 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
1049 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
1050 # program @code{ansi2knr}, which comes with Ghostscript.
1053 AC_DEFUN([AM_PROG_CC_STDC],
1054 [AC_REQUIRE([AC_PROG_CC])
1055 AC_BEFORE([$0], [AC_C_INLINE])
1056 AC_BEFORE([$0], [AC_C_CONST])
1057 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
1058 dnl a magic option to avoid problems with ANSI preprocessor commands
1060 dnl FIXME: can't do this because then AC_AIX won't work due to a
1061 dnl circular dependency.
1062 dnl AC_BEFORE([$0], [AC_PROG_CPP])
1063 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
1064 AC_CACHE_VAL(am_cv_prog_cc_stdc,
1065 [am_cv_prog_cc_stdc=no
1067 # Don't try gcc -ansi; that turns off useful extensions and
1068 # breaks some systems' header files.
1069 # AIX -qlanglvl=ansi
1070 # Ultrix and OSF/1 -std1
1071 # HP-UX -Aa -D_HPUX_SOURCE
1072 # SVR4 -Xc -D__EXTENSIONS__
1073 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
1075 CC="$ac_save_CC $ac_arg"
1077 [#include <stdarg.h>
1079 #include <sys/types.h>
1080 #include <sys/stat.h>
1081 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
1082 struct buf { int x; };
1083 FILE * (*rcsopen) (struct buf *, struct stat *, int);
1084 static char *e (p, i)
1090 static char *f (char * (*g) (char **, int), char **p, ...)
1095 s = g (p, va_arg (v,int));
1099 int test (int i, double x);
1100 struct s1 {int (*f) (int a);};
1101 struct s2 {int (*f) (double a);};
1102 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
1106 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
1108 [am_cv_prog_cc_stdc="$ac_arg"; break])
1112 if test -z "$am_cv_prog_cc_stdc"; then
1113 AC_MSG_RESULT([none needed])
1115 AC_MSG_RESULT($am_cv_prog_cc_stdc)
1117 case "x$am_cv_prog_cc_stdc" in
1119 *) CC="$CC $am_cv_prog_cc_stdc" ;;
1123 # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
1125 # Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1127 # This program is free software; you can redistribute it and/or modify
1128 # it under the terms of the GNU General Public License as published by
1129 # the Free Software Foundation; either version 2 of the License, or
1130 # (at your option) any later version.
1132 # This program is distributed in the hope that it will be useful, but
1133 # WITHOUT ANY WARRANTY; without even the implied warranty of
1134 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1135 # General Public License for more details.
1137 # You should have received a copy of the GNU General Public License
1138 # along with this program; if not, write to the Free Software
1139 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1141 # As a special exception to the GNU General Public License, if you
1142 # distribute this file as part of a program that contains a
1143 # configuration script generated by Autoconf, you may include it under
1144 # the same distribution terms that you use for the rest of that program.
1146 # PKG_PROG_PKG_CONFIG([MIN-VERSION])
1147 # ----------------------------------
1148 AC_DEFUN([PKG_PROG_PKG_CONFIG],
1149 [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1150 m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1151 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1152 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1153 AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1155 if test -n "$PKG_CONFIG"; then
1156 _pkg_min_version=m4_default([$1], [0.9.0])
1157 AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1158 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1159 AC_MSG_RESULT([yes])
1166 ])# PKG_PROG_PKG_CONFIG
1168 # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1170 # Check to see whether a particular set of modules exists. Similar
1171 # to PKG_CHECK_MODULES(), but does not set variables or print errors.
1174 # Similar to PKG_CHECK_MODULES, make sure that the first instance of
1175 # this or PKG_CHECK_MODULES is called, or make sure to call
1176 # PKG_CHECK_EXISTS manually
1177 # --------------------------------------------------------------
1178 AC_DEFUN([PKG_CHECK_EXISTS],
1179 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1180 if test -n "$PKG_CONFIG" && \
1181 AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1182 m4_ifval([$2], [$2], [:])
1183 m4_ifvaln([$3], [else
1188 # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1189 # ---------------------------------------------
1190 m4_define([_PKG_CONFIG],
1191 [if test -n "$PKG_CONFIG"; then
1192 if test -n "$$1"; then
1195 PKG_CHECK_EXISTS([$3],
1196 [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1204 # _PKG_SHORT_ERRORS_SUPPORTED
1205 # -----------------------------
1206 AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1207 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1208 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1209 _pkg_short_errors_supported=yes
1211 _pkg_short_errors_supported=no
1213 ])# _PKG_SHORT_ERRORS_SUPPORTED
1216 # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1217 # [ACTION-IF-NOT-FOUND])
1220 # Note that if there is a possibility the first call to
1221 # PKG_CHECK_MODULES might not happen, you should be sure to include an
1222 # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1225 # --------------------------------------------------------------
1226 AC_DEFUN([PKG_CHECK_MODULES],
1227 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1228 AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1229 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1232 AC_MSG_CHECKING([for $1])
1234 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1235 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
1237 m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1238 and $1[]_LIBS to avoid the need to call pkg-config.
1239 See the pkg-config man page for more details.])
1241 if test $pkg_failed = yes; then
1242 _PKG_SHORT_ERRORS_SUPPORTED
1243 if test $_pkg_short_errors_supported = yes; then
1244 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
1246 $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1248 # Put the nasty error message in config.log where it belongs
1249 echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1251 ifelse([$4], , [AC_MSG_ERROR(dnl
1252 [Package requirements ($2) were not met:
1256 Consider adjusting the PKG_CONFIG_PATH environment variable if you
1257 installed software in a non-standard prefix.
1262 elif test $pkg_failed = untried; then
1263 ifelse([$4], , [AC_MSG_FAILURE(dnl
1264 [The pkg-config script could not be found or is too old. Make sure it
1265 is in your PATH or set the PKG_CONFIG environment variable to the full
1270 To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
1273 $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1274 $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1275 AC_MSG_RESULT([yes])
1276 ifelse([$3], , :, [$3])
1278 ])# PKG_CHECK_MODULES
1280 # Copyright (C) 1995-2002 Free Software Foundation, Inc.
1281 # Copyright (C) 2001-2003,2004 Red Hat, Inc.
1283 # This file is free software, distributed under the terms of the GNU
1284 # General Public License. As a special exception to the GNU General
1285 # Public License, this file may be distributed as part of a program
1286 # that contains a configuration script generated by Autoconf, under
1287 # the same distribution terms as the rest of that program.
1289 # This file can be copied and used freely without restrictions. It can
1290 # be used in projects which are not available under the GNU Public License
1291 # but which still want to provide support for the GNU gettext functionality.
1293 # Macro to add for using GNU gettext.
1294 # Ulrich Drepper <drepper@cygnus.com>, 1995, 1996
1296 # Modified to never use included libintl.
1297 # Owen Taylor <otaylor@redhat.com>, 12/15/1998
1299 # Major rework to remove unused code
1300 # Owen Taylor <otaylor@redhat.com>, 12/11/2002
1302 # Added better handling of ALL_LINGUAS from GNU gettext version
1303 # written by Bruno Haible, Owen Taylor <otaylor.redhat.com> 5/30/3002
1305 # Modified to require ngettext
1306 # Matthias Clasen <mclasen@redhat.com> 08/06/2004
1308 # We need this here as well, since someone might use autoconf-2.5x
1309 # to configure GLib then an older version to configure a package
1310 # using AM_GLIB_GNU_GETTEXT
1314 dnl We go to great lengths to make sure that aclocal won't
1315 dnl try to pull in the installed version of these macros
1316 dnl when running aclocal in the glib directory.
1318 m4_copy([AC_DEFUN],[glib_DEFUN])
1319 m4_copy([AC_REQUIRE],[glib_REQUIRE])
1321 dnl At the end, if we're not within glib, we'll define the public
1322 dnl definitions in terms of our private definitions.
1326 #--------------------
1327 glib_DEFUN([GLIB_LC_MESSAGES],
1328 [AC_CHECK_HEADERS([locale.h])
1329 if test $ac_cv_header_locale_h = yes; then
1330 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1331 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1332 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1333 if test $am_cv_val_LC_MESSAGES = yes; then
1334 AC_DEFINE(HAVE_LC_MESSAGES, 1,
1335 [Define if your <locale.h> file defines LC_MESSAGES.])
1339 # GLIB_PATH_PROG_WITH_TEST
1340 #----------------------------
1341 dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1342 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1343 glib_DEFUN([GLIB_PATH_PROG_WITH_TEST],
1344 [# Extract the first word of "$2", so it can be a program name with args.
1345 set dummy $2; ac_word=[$]2
1346 AC_MSG_CHECKING([for $ac_word])
1347 AC_CACHE_VAL(ac_cv_path_$1,
1350 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1353 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1354 for ac_dir in ifelse([$5], , $PATH, [$5]); do
1355 test -z "$ac_dir" && ac_dir=.
1356 if test -f $ac_dir/$ac_word; then
1358 ac_cv_path_$1="$ac_dir/$ac_word"
1364 dnl If no 4th arg is given, leave the cache variable unset,
1365 dnl so AC_PATH_PROGS will keep looking.
1366 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1371 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
1372 AC_MSG_RESULT([$]$1)
1381 glib_DEFUN([GLIB_WITH_NLS],
1382 dnl NLS is obligatory
1386 gt_cv_have_gettext=no
1392 AC_CHECK_HEADER(libintl.h,
1393 [gt_cv_func_dgettext_libintl="no"
1394 libintl_extra_libs=""
1397 # First check in libc
1399 AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc,
1401 #include <libintl.h>
1403 [return !ngettext ("","", 1)],
1404 gt_cv_func_ngettext_libc=yes,
1405 gt_cv_func_ngettext_libc=no)
1408 if test "$gt_cv_func_ngettext_libc" = "yes" ; then
1409 AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
1411 #include <libintl.h>
1413 [return !dgettext ("","")],
1414 gt_cv_func_dgettext_libc=yes,
1415 gt_cv_func_dgettext_libc=no)
1419 if test "$gt_cv_func_ngettext_libc" = "yes" ; then
1420 AC_CHECK_FUNCS(bind_textdomain_codeset)
1424 # If we don't have everything we want, check in libintl
1426 if test "$gt_cv_func_dgettext_libc" != "yes" \
1427 || test "$gt_cv_func_ngettext_libc" != "yes" \
1428 || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then
1430 AC_CHECK_LIB(intl, bindtextdomain,
1431 [AC_CHECK_LIB(intl, ngettext,
1432 [AC_CHECK_LIB(intl, dgettext,
1433 gt_cv_func_dgettext_libintl=yes)])])
1435 if test "$gt_cv_func_dgettext_libintl" != "yes" ; then
1436 AC_MSG_CHECKING([if -liconv is needed to use gettext])
1438 AC_CHECK_LIB(intl, ngettext,
1439 [AC_CHECK_LIB(intl, dcgettext,
1440 [gt_cv_func_dgettext_libintl=yes
1441 libintl_extra_libs=-liconv],
1447 # If we found libintl, then check in it for bind_textdomain_codeset();
1448 # we'll prefer libc if neither have bind_textdomain_codeset(),
1449 # and both have dgettext and ngettext
1451 if test "$gt_cv_func_dgettext_libintl" = "yes" ; then
1452 glib_save_LIBS="$LIBS"
1453 LIBS="$LIBS -lintl $libintl_extra_libs"
1454 unset ac_cv_func_bind_textdomain_codeset
1455 AC_CHECK_FUNCS(bind_textdomain_codeset)
1456 LIBS="$glib_save_LIBS"
1458 if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then
1459 gt_cv_func_dgettext_libc=no
1461 if test "$gt_cv_func_dgettext_libc" = "yes" \
1462 && test "$gt_cv_func_ngettext_libc" = "yes"; then
1463 gt_cv_func_dgettext_libintl=no
1469 if test "$gt_cv_func_dgettext_libc" = "yes" \
1470 || test "$gt_cv_func_dgettext_libintl" = "yes"; then
1471 gt_cv_have_gettext=yes
1474 if test "$gt_cv_func_dgettext_libintl" = "yes"; then
1475 INTLLIBS="-lintl $libintl_extra_libs"
1478 if test "$gt_cv_have_gettext" = "yes"; then
1479 AC_DEFINE(HAVE_GETTEXT,1,
1480 [Define if the GNU gettext() function is already present or preinstalled.])
1481 GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1482 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
1483 if test "$MSGFMT" != "no"; then
1484 glib_save_LIBS="$LIBS"
1485 LIBS="$LIBS $INTLLIBS"
1486 AC_CHECK_FUNCS(dcgettext)
1487 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1488 GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1489 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
1490 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
1491 return _nl_msg_cat_cntr],
1496 dnl On Solaris, if bind_textdomain_codeset is in libc,
1497 dnl GNU format message catalog is always supported,
1498 dnl since both are added to the libc all together.
1499 dnl Hence, we'd like to go with DATADIRNAME=share and
1500 dnl and CATOBJEXT=.gmo in this case.
1501 AC_CHECK_FUNC(bind_textdomain_codeset,
1512 LIBS="$glib_save_LIBS"
1515 gt_cv_have_gettext=no
1520 if test "$gt_cv_have_gettext" = "yes" ; then
1521 AC_DEFINE(ENABLE_NLS, 1,
1522 [always defined to indicate that i18n is enabled])
1525 dnl Test whether we really found GNU xgettext.
1526 if test "$XGETTEXT" != ":"; then
1527 dnl If it is not GNU xgettext we define it as : so that the
1528 dnl Makefiles still can work.
1529 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
1533 [found xgettext program is not GNU xgettext; ignore it])
1538 # We need to process the po/ directory.
1542 [case "$CONFIG_FILES" in *po/Makefile.in*)
1543 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
1546 dnl These rules are solely for the distribution goal. While doing this
1547 dnl we only have to keep exactly one list of the available catalogs
1548 dnl in configure.in.
1549 for lang in $ALL_LINGUAS; do
1550 GMOFILES="$GMOFILES $lang.gmo"
1551 POFILES="$POFILES $lang.po"
1554 dnl Make all variables we use known to autoconf.
1557 AC_SUBST(DATADIRNAME)
1559 AC_SUBST(INSTOBJEXT)
1561 AC_SUBST(PO_IN_DATADIR_TRUE)
1562 AC_SUBST(PO_IN_DATADIR_FALSE)
1567 # AM_GLIB_GNU_GETTEXT
1568 # -------------------
1569 # Do checks necessary for use of gettext. If a suitable implementation
1570 # of gettext is found in either in libintl or in the C library,
1571 # it will set INTLLIBS to the libraries needed for use of gettext
1572 # and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable
1573 # gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST()
1574 # on various variables needed by the Makefile.in.in installed by
1577 glib_DEFUN([GLIB_GNU_GETTEXT],
1578 [AC_REQUIRE([AC_PROG_CC])dnl
1579 AC_REQUIRE([AC_HEADER_STDC])dnl
1584 if test "$gt_cv_have_gettext" = "yes"; then
1585 if test "x$ALL_LINGUAS" = "x"; then
1588 AC_MSG_CHECKING(for catalogs to be installed)
1590 for presentlang in $ALL_LINGUAS; do
1592 if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then
1593 desiredlanguages="$LINGUAS"
1595 desiredlanguages="$ALL_LINGUAS"
1597 for desiredlang in $desiredlanguages; do
1598 # Use the presentlang catalog if desiredlang is
1599 # a. equal to presentlang, or
1600 # b. a variant of presentlang (because in this case,
1601 # presentlang can be used as a fallback for messages
1602 # which are not translated in the desiredlang catalog).
1603 case "$desiredlang" in
1604 "$presentlang"*) useit=yes;;
1607 if test $useit = yes; then
1608 NEW_LINGUAS="$NEW_LINGUAS $presentlang"
1611 LINGUAS=$NEW_LINGUAS
1612 AC_MSG_RESULT($LINGUAS)
1615 dnl Construct list of names of catalog files to be constructed.
1616 if test -n "$LINGUAS"; then
1617 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
1621 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1622 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
1623 dnl Try to locate is.
1625 if test -n "$ac_aux_dir"; then
1626 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1628 if test -z "$MKINSTALLDIRS"; then
1629 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1631 AC_SUBST(MKINSTALLDIRS)
1633 dnl Generate list of files to be processed by xgettext which will
1634 dnl be included in po/Makefile.
1635 test -d po || mkdir po
1636 if test "x$srcdir" != "x."; then
1637 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
1638 posrcprefix="$srcdir/"
1640 posrcprefix="../$srcdir/"
1646 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
1647 < $srcdir/po/POTFILES.in > po/POTFILES
1650 # AM_GLIB_DEFINE_LOCALEDIR(VARIABLE)
1651 # -------------------------------
1652 # Define VARIABLE to the location where catalog files will
1653 # be installed by po/Makefile.
1654 glib_DEFUN([GLIB_DEFINE_LOCALEDIR],
1655 [glib_REQUIRE([GLIB_GNU_GETTEXT])dnl
1656 glib_save_prefix="$prefix"
1657 glib_save_exec_prefix="$exec_prefix"
1658 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1659 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
1660 if test "x$CATOBJEXT" = "x.mo" ; then
1661 localedir=`eval echo "${libdir}/locale"`
1663 localedir=`eval echo "${datadir}/locale"`
1665 prefix="$glib_save_prefix"
1666 exec_prefix="$glib_save_exec_prefix"
1667 AC_DEFINE_UNQUOTED($1, "$localedir",
1668 [Define the location where the catalogs will be installed])
1672 dnl Now the definitions that aclocal will find
1674 ifdef(glib_configure_in,[],[
1675 AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)])
1676 AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)])