1 # codeset.m4 serial AM1 (gettext-0.10.40)
2 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
3 dnl This file is free software, distributed under the terms of the GNU
4 dnl General Public License. As a special exception to the GNU General
5 dnl Public License, this file may be distributed as part of a program
6 dnl that contains a configuration script generated by Autoconf, under
7 dnl the same distribution terms as the rest of that program.
11 AC_DEFUN([AM_LANGINFO_CODESET],
13 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
14 [AC_TRY_LINK([#include <langinfo.h>],
15 [char* cs = nl_langinfo(CODESET);],
16 am_cv_langinfo_codeset=yes,
17 am_cv_langinfo_codeset=no)
19 if test $am_cv_langinfo_codeset = yes; then
20 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
21 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
24 # gettext.m4 serial 17 (gettext-0.11.5)
25 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
26 dnl This file is free software, distributed under the terms of the GNU
27 dnl General Public License. As a special exception to the GNU General
28 dnl Public License, this file may be distributed as part of a program
29 dnl that contains a configuration script generated by Autoconf, under
30 dnl the same distribution terms as the rest of that program.
32 dnl This file can can be used in projects which are not available under
33 dnl the GNU General Public License or the GNU Library General Public
34 dnl License but which still want to provide support for the GNU gettext
36 dnl Please note that the actual code of the GNU gettext library is covered
37 dnl by the GNU Library General Public License, and the rest of the GNU
38 dnl gettext package package is covered by the GNU General Public License.
39 dnl They are *not* in the public domain.
42 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
43 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2002.
45 dnl Macro to add for using GNU gettext.
47 dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
48 dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
49 dnl default (if it is not specified or empty) is 'no-libtool'.
50 dnl INTLSYMBOL should be 'external' for packages with no intl directory,
51 dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory.
52 dnl If INTLSYMBOL is 'use-libtool', then a libtool library
53 dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
54 dnl depending on --{enable,disable}-{shared,static} and on the presence of
55 dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
56 dnl $(top_builddir)/intl/libintl.a will be created.
57 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
58 dnl implementations (in libc or libintl) without the ngettext() function
59 dnl will be ignored. If NEEDSYMBOL is specified and is
60 dnl 'need-formatstring-macros', then GNU gettext implementations that don't
61 dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
62 dnl INTLDIR is used to find the intl libraries. If empty,
63 dnl the value `$(top_builddir)/intl/' is used.
65 dnl The result of the configuration is one of three cases:
66 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
68 dnl Catalog format: GNU --> install in $(datadir)
69 dnl Catalog extension: .mo after installation, .gmo in source tree
70 dnl 2) GNU gettext has been found in the system's C library.
71 dnl Catalog format: GNU --> install in $(datadir)
72 dnl Catalog extension: .mo after installation, .gmo in source tree
73 dnl 3) No internationalization, always use English msgid.
74 dnl Catalog format: none
75 dnl Catalog extension: none
76 dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
77 dnl The use of .gmo is historical (it was needed to avoid overwriting the
78 dnl GNU format catalogs when building on a platform with an X/Open gettext),
79 dnl but we keep it in order not to force irrelevant filename changes on the
82 AC_DEFUN([AM_GNU_GETTEXT],
84 dnl Argument checking.
85 ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
86 [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
88 ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
89 [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
91 define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
92 define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
94 AC_REQUIRE([AM_PO_SUBDIRS])dnl
95 ifelse(gt_included_intl, yes, [
96 AC_REQUIRE([AM_INTL_SUBDIR])dnl
99 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
100 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
101 AC_REQUIRE([AC_LIB_RPATH])
103 dnl Sometimes libintl requires libiconv, so first search for libiconv.
104 dnl Ideally we would do this search only after the
105 dnl if test "$USE_NLS" = "yes"; then
106 dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then
107 dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
108 dnl the configure script would need to contain the same shell code
109 dnl again, outside any 'if'. There are two solutions:
110 dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
111 dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
112 dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
113 dnl documented, we avoid it.
114 ifelse(gt_included_intl, yes, , [
115 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
118 AC_MSG_CHECKING([whether NLS is requested])
119 dnl Default is enabled NLS
121 [ --disable-nls do not use Native Language Support],
122 USE_NLS=$enableval, USE_NLS=yes)
123 AC_MSG_RESULT($USE_NLS)
126 ifelse(gt_included_intl, yes, [
127 BUILD_INCLUDED_LIBINTL=no
128 USE_INCLUDED_LIBINTL=no
134 dnl If we use NLS figure out what method
135 if test "$USE_NLS" = "yes"; then
136 gt_use_preinstalled_gnugettext=no
137 ifelse(gt_included_intl, yes, [
138 AC_MSG_CHECKING([whether included gettext is requested])
139 AC_ARG_WITH(included-gettext,
140 [ --with-included-gettext use the GNU gettext library included here],
141 nls_cv_force_use_gnu_gettext=$withval,
142 nls_cv_force_use_gnu_gettext=no)
143 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
145 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
146 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
148 dnl User does not insist on using GNU NLS library. Figure out what
149 dnl to use. If GNU gettext is available we use this. Else we have
150 dnl to fall back to GNU NLS library.
152 dnl Add a version number to the cache macros.
153 define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
154 define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
155 define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
157 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
158 [AC_TRY_LINK([#include <libintl.h>
159 ]ifelse([$2], [need-formatstring-macros],
160 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
161 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
164 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
166 ], [])[extern int _nl_msg_cat_cntr;
167 extern int *_nl_domain_bindings;],
168 [bindtextdomain ("", "");
169 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
170 gt_cv_func_gnugettext_libc=yes,
171 gt_cv_func_gnugettext_libc=no)])
173 if test "$gt_cv_func_gnugettext_libc" != "yes"; then
174 dnl Sometimes libintl requires libiconv, so first search for libiconv.
175 ifelse(gt_included_intl, yes, , [
178 dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
179 dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
180 dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
181 dnl even if libiconv doesn't exist.
182 AC_LIB_LINKFLAGS_BODY([intl])
183 AC_CACHE_CHECK([for GNU gettext in libintl],
184 gt_cv_func_gnugettext_libintl,
185 [gt_save_CPPFLAGS="$CPPFLAGS"
186 CPPFLAGS="$CPPFLAGS $INCINTL"
188 LIBS="$LIBS $LIBINTL"
189 dnl Now see whether libintl exists and does not depend on libiconv.
190 AC_TRY_LINK([#include <libintl.h>
191 ]ifelse([$2], [need-formatstring-macros],
192 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
193 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
196 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
198 ], [])[extern int _nl_msg_cat_cntr;
203 const char *_nl_expand_alias ();],
204 [bindtextdomain ("", "");
205 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
206 gt_cv_func_gnugettext_libintl=yes,
207 gt_cv_func_gnugettext_libintl=no)
208 dnl Now see whether libintl exists and depends on libiconv.
209 if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
210 LIBS="$LIBS $LIBICONV"
211 AC_TRY_LINK([#include <libintl.h>
212 ]ifelse([$2], [need-formatstring-macros],
213 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
214 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
217 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
219 ], [])[extern int _nl_msg_cat_cntr;
224 const char *_nl_expand_alias ();],
225 [bindtextdomain ("", "");
226 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
227 [LIBINTL="$LIBINTL $LIBICONV"
228 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
229 gt_cv_func_gnugettext_libintl=yes
232 CPPFLAGS="$gt_save_CPPFLAGS"
233 LIBS="$gt_save_LIBS"])
236 dnl If an already present or preinstalled GNU gettext() is found,
237 dnl use it. But if this macro is used in GNU gettext, and GNU
238 dnl gettext is already preinstalled in libintl, we update this
239 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
240 if test "$gt_cv_func_gnugettext_libc" = "yes" \
241 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
242 && test "$PACKAGE" != gettext; }; then
243 gt_use_preinstalled_gnugettext=yes
245 dnl Reset the values set by searching for libintl.
251 ifelse(gt_included_intl, yes, [
252 if test "$gt_use_preinstalled_gnugettext" != "yes"; then
253 dnl GNU gettext is not found in the C library.
254 dnl Fall back on included GNU gettext library.
255 nls_cv_use_gnu_gettext=yes
259 if test "$nls_cv_use_gnu_gettext" = "yes"; then
260 dnl Mark actions used to generate GNU NLS library.
261 INTLOBJS="\$(GETTOBJS)"
262 BUILD_INCLUDED_LIBINTL=yes
263 USE_INCLUDED_LIBINTL=yes
264 LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
265 LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
266 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
269 if test "$gt_use_preinstalled_gnugettext" = "yes" \
270 || test "$nls_cv_use_gnu_gettext" = "yes"; then
271 dnl Mark actions to use GNU gettext tools.
276 if test "$gt_use_preinstalled_gnugettext" = "yes" \
277 || test "$nls_cv_use_gnu_gettext" = "yes"; then
278 AC_DEFINE(ENABLE_NLS, 1,
279 [Define to 1 if translation of program messages to the user's native language
286 if test "$USE_NLS" = "yes"; then
288 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
289 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
290 AC_MSG_CHECKING([how to link with libintl])
291 AC_MSG_RESULT([$LIBINTL])
292 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
295 dnl For backward compatibility. Some packages may be using this.
296 AC_DEFINE(HAVE_GETTEXT, 1,
297 [Define if the GNU gettext() function is already present or preinstalled.])
298 AC_DEFINE(HAVE_DCGETTEXT, 1,
299 [Define if the GNU dcgettext() function is already present or preinstalled.])
302 dnl We need to process the po/ directory.
306 ifelse(gt_included_intl, yes, [
307 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
308 dnl to 'yes' because some of the testsuite requires it.
309 if test "$PACKAGE" = gettext; then
310 BUILD_INCLUDED_LIBINTL=yes
313 dnl Make all variables we use known to autoconf.
314 AC_SUBST(BUILD_INCLUDED_LIBINTL)
315 AC_SUBST(USE_INCLUDED_LIBINTL)
319 dnl For backward compatibility. Some configure.ins may be using this.
323 dnl For backward compatibility. Some Makefiles may be using this.
325 AC_SUBST(DATADIRNAME)
327 dnl For backward compatibility. Some Makefiles may be using this.
331 dnl For backward compatibility. Some Makefiles may be using this.
335 dnl Enable libtool support if the surrounding package wishes it.
336 INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
337 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
340 dnl For backward compatibility. Some Makefiles may be using this.
344 dnl Make all documented variables known to autoconf.
351 dnl Checks for all prerequisites of the po subdirectory,
352 dnl except for USE_NLS.
353 AC_DEFUN([AM_PO_SUBDIRS],
355 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
356 AC_REQUIRE([AC_PROG_INSTALL])dnl
357 AC_REQUIRE([AM_MKINSTALLDIRS])dnl
359 dnl Perform the following tests also if --disable-nls has been given,
360 dnl because they are needed for "make dist" to work.
362 dnl Search for GNU msgfmt in the PATH.
363 dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
364 dnl The second test excludes FreeBSD msgfmt.
365 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
366 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
367 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
369 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
371 dnl Search for GNU xgettext 0.11 or newer in the PATH.
372 dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
373 dnl The second test excludes FreeBSD xgettext.
374 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
375 [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
376 (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
378 dnl Remove leftover from FreeBSD xgettext call.
381 dnl Search for GNU msgmerge 0.11 or newer in the PATH.
382 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
383 [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
385 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
386 dnl Test whether we really found GNU msgfmt.
387 if test "$GMSGFMT" != ":"; then
388 dnl If it is no GNU msgfmt we define it as : so that the
389 dnl Makefiles still can work.
390 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
391 (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
394 GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
396 [found $GMSGFMT program is not GNU msgfmt; ignore it])
401 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
402 dnl Test whether we really found GNU xgettext.
403 if test "$XGETTEXT" != ":"; then
404 dnl If it is no GNU xgettext we define it as : so that the
405 dnl Makefiles still can work.
406 if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
407 (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
411 [found xgettext program is not GNU xgettext; ignore it])
414 dnl Remove leftover from FreeBSD xgettext call.
419 for ac_file in $CONFIG_FILES; do
420 # Support "outfile[:infile[:infile...]]"
422 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
424 # PO directories have a Makefile.in generated from Makefile.in.in.
425 case "$ac_file" in */Makefile.in)
426 # Adjust a relative srcdir.
427 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
428 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
429 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
430 # In autoconf-2.13 it is called $ac_given_srcdir.
431 # In autoconf-2.50 it is called $srcdir.
432 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
433 case "$ac_given_srcdir" in
434 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
435 /*) top_srcdir="$ac_given_srcdir" ;;
436 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
438 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
439 rm -f "$ac_dir/POTFILES"
440 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
441 cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
442 # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
443 # on $ac_dir but don't depend on user-specified configuration
445 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
446 # The LINGUAS file contains the set of available languages.
447 if test -n "$ALL_LINGUAS"; then
448 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
450 ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
451 # Hide the ALL_LINGUAS assigment from automake.
452 eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
454 case "$ac_given_srcdir" in
456 *) srcdirpre='$(srcdir)/' ;;
462 for lang in $ALL_LINGUAS; do
463 POFILES="$POFILES $srcdirpre$lang.po"
464 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
465 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
466 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
468 # CATALOGS depends on both $ac_dir and the user's LINGUAS
469 # environment variable.
471 if test -n "$ALL_LINGUAS"; then
472 for presentlang in $ALL_LINGUAS; do
474 if test "%UNSET%" != "$LINGUAS"; then
475 desiredlanguages="$LINGUAS"
477 desiredlanguages="$ALL_LINGUAS"
479 for desiredlang in $desiredlanguages; do
480 # Use the presentlang catalog if desiredlang is
481 # a. equal to presentlang, or
482 # b. a variant of presentlang (because in this case,
483 # presentlang can be used as a fallback for messages
484 # which are not translated in the desiredlang catalog).
485 case "$desiredlang" in
486 "$presentlang"*) useit=yes;;
489 if test $useit = yes; then
490 INST_LINGUAS="$INST_LINGUAS $presentlang"
495 if test -n "$INST_LINGUAS"; then
496 for lang in $INST_LINGUAS; do
497 CATALOGS="$CATALOGS $lang.gmo"
500 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
501 sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
502 for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
503 if test -f "$f"; then
505 *.orig | *.bak | *~) ;;
506 *) cat "$f" >> "$ac_dir/Makefile" ;;
514 [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
515 # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
517 eval 'ALL_LINGUAS''="$ALL_LINGUAS"'
518 # Capture the value of LINGUAS because we need it to compute CATALOGS.
519 LINGUAS="${LINGUAS-%UNSET%}"
524 dnl Checks for all prerequisites of the intl subdirectory,
525 dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
526 dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
527 AC_DEFUN([AM_INTL_SUBDIR],
529 AC_REQUIRE([AC_PROG_INSTALL])dnl
530 AC_REQUIRE([AM_MKINSTALLDIRS])dnl
531 AC_REQUIRE([AC_PROG_CC])dnl
532 AC_REQUIRE([AC_CANONICAL_HOST])dnl
533 AC_REQUIRE([AC_PROG_RANLIB])dnl
534 AC_REQUIRE([AC_ISC_POSIX])dnl
535 AC_REQUIRE([AC_HEADER_STDC])dnl
536 AC_REQUIRE([AC_C_CONST])dnl
537 AC_REQUIRE([AC_C_INLINE])dnl
538 AC_REQUIRE([AC_TYPE_OFF_T])dnl
539 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
540 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
541 AC_REQUIRE([AC_FUNC_MMAP])dnl
542 AC_REQUIRE([jm_GLIBC21])dnl
543 AC_REQUIRE([gt_INTDIV0])dnl
544 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
545 AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
546 AC_REQUIRE([gt_INTTYPES_PRI])dnl
548 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
549 stdlib.h string.h unistd.h sys/param.h])
550 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
551 geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
552 strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
556 if test $ac_cv_header_locale_h = yes; then
560 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
561 dnl because plural.y uses bison specific features. It requires at least
562 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
564 dnl bison is only needed for the maintainer (who touches plural.y). But in
565 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
566 dnl the rule in general Makefile. Now, some people carelessly touch the
567 dnl files or have a broken "make" program, hence the plural.c rule will
568 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
569 dnl present or too old.
570 AC_CHECK_PROGS([INTLBISON], [bison])
571 if test -z "$INTLBISON"; then
574 dnl Found it, now check the version.
575 AC_MSG_CHECKING([version of bison])
576 changequote(<<,>>)dnl
577 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
578 case $ac_prog_version in
579 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
580 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
582 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
583 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
585 AC_MSG_RESULT([$ac_prog_version])
587 if test $ac_verc_fail = yes; then
593 AC_DEFUN([AM_MKINSTALLDIRS],
595 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
596 dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
597 dnl Try to locate is.
599 if test -n "$ac_aux_dir"; then
600 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
602 if test -z "$MKINSTALLDIRS"; then
603 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
605 AC_SUBST(MKINSTALLDIRS)
609 dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
610 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
611 # glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
612 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
613 dnl This file is free software, distributed under the terms of the GNU
614 dnl General Public License. As a special exception to the GNU General
615 dnl Public License, this file may be distributed as part of a program
616 dnl that contains a configuration script generated by Autoconf, under
617 dnl the same distribution terms as the rest of that program.
619 # Test for the GNU C Library, version 2.1 or newer.
622 AC_DEFUN([jm_GLIBC21],
624 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
625 ac_cv_gnu_library_2_1,
626 [AC_EGREP_CPP([Lucky GNU user],
628 #include <features.h>
629 #ifdef __GNU_LIBRARY__
630 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
635 ac_cv_gnu_library_2_1=yes,
636 ac_cv_gnu_library_2_1=no)
640 GLIBC21="$ac_cv_gnu_library_2_1"
643 # iconv.m4 serial AM4 (gettext-0.11.3)
644 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
645 dnl This file is free software, distributed under the terms of the GNU
646 dnl General Public License. As a special exception to the GNU General
647 dnl Public License, this file may be distributed as part of a program
648 dnl that contains a configuration script generated by Autoconf, under
649 dnl the same distribution terms as the rest of that program.
651 dnl From Bruno Haible.
653 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
655 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
656 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
657 AC_REQUIRE([AC_LIB_RPATH])
659 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
661 AC_LIB_LINKFLAGS_BODY([iconv])
664 AC_DEFUN([AM_ICONV_LINK],
666 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
667 dnl those with the standalone portable GNU libiconv installed).
669 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
671 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
673 dnl Add $INCICONV to CPPFLAGS before performing the following checks,
674 dnl because if the user has installed libiconv and not disabled its use
675 dnl via --without-libiconv-prefix, he wants to use it. The first
676 dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
677 am_save_CPPFLAGS="$CPPFLAGS"
678 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
680 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
681 am_cv_func_iconv="no, consider installing GNU libiconv"
683 AC_TRY_LINK([#include <stdlib.h>
685 [iconv_t cd = iconv_open("","");
686 iconv(cd,NULL,NULL,NULL,NULL);
688 am_cv_func_iconv=yes)
689 if test "$am_cv_func_iconv" != yes; then
691 LIBS="$LIBS $LIBICONV"
692 AC_TRY_LINK([#include <stdlib.h>
694 [iconv_t cd = iconv_open("","");
695 iconv(cd,NULL,NULL,NULL,NULL);
698 am_cv_func_iconv=yes)
702 if test "$am_cv_func_iconv" = yes; then
703 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
705 if test "$am_cv_lib_iconv" = yes; then
706 AC_MSG_CHECKING([how to link with libiconv])
707 AC_MSG_RESULT([$LIBICONV])
709 dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
711 CPPFLAGS="$am_save_CPPFLAGS"
722 if test "$am_cv_func_iconv" = yes; then
723 AC_MSG_CHECKING([for iconv declaration])
724 AC_CACHE_VAL(am_cv_proto_iconv, [
732 #if defined(__STDC__) || defined(__cplusplus)
733 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
737 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
738 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
739 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
740 AC_MSG_RESULT([$]{ac_t:-
741 }[$]am_cv_proto_iconv)
742 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
743 [Define as const if the declaration of iconv() needs const.])
746 # intdiv0.m4 serial 1 (gettext-0.11.3)
747 dnl Copyright (C) 2002 Free Software Foundation, Inc.
748 dnl This file is free software, distributed under the terms of the GNU
749 dnl General Public License. As a special exception to the GNU General
750 dnl Public License, this file may be distributed as part of a program
751 dnl that contains a configuration script generated by Autoconf, under
752 dnl the same distribution terms as the rest of that program.
754 dnl From Bruno Haible.
756 AC_DEFUN([gt_INTDIV0],
758 AC_REQUIRE([AC_PROG_CC])dnl
759 AC_REQUIRE([AC_CANONICAL_HOST])dnl
761 AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
762 gt_cv_int_divbyzero_sigfpe,
770 sigfpe_handler (int sig)
772 sigfpe_handler (sig) int sig;
775 /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
776 exit (sig != SIGFPE);
786 signal (SIGFPE, sigfpe_handler);
787 /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
788 #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
789 signal (SIGTRAP, sigfpe_handler);
791 /* Linux/SPARC yields signal SIGILL. */
792 #if defined (__sparc__) && defined (__linux__)
793 signal (SIGILL, sigfpe_handler);
800 ], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
802 # Guess based on the CPU.
804 alpha* | i[34567]86 | m68k | s390*)
805 gt_cv_int_divbyzero_sigfpe="guessing yes";;
807 gt_cv_int_divbyzero_sigfpe="guessing no";;
811 case "$gt_cv_int_divbyzero_sigfpe" in
815 AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
816 [Define if integer division by zero raises signal SIGFPE.])
818 # inttypes.m4 serial 1 (gettext-0.11.4)
819 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
820 dnl This file is free software, distributed under the terms of the GNU
821 dnl General Public License. As a special exception to the GNU General
822 dnl Public License, this file may be distributed as part of a program
823 dnl that contains a configuration script generated by Autoconf, under
824 dnl the same distribution terms as the rest of that program.
826 dnl From Paul Eggert.
828 # Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
831 AC_DEFUN([gt_HEADER_INTTYPES_H],
833 AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h,
836 [#include <sys/types.h>
837 #include <inttypes.h>],
838 [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no)
840 if test $gt_cv_header_inttypes_h = yes; then
841 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
842 [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
845 # inttypes_h.m4 serial 4 (gettext-0.11.4)
846 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
847 dnl This file is free software, distributed under the terms of the GNU
848 dnl General Public License. As a special exception to the GNU General
849 dnl Public License, this file may be distributed as part of a program
850 dnl that contains a configuration script generated by Autoconf, under
851 dnl the same distribution terms as the rest of that program.
853 dnl From Paul Eggert.
855 # Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
856 # doesn't clash with <sys/types.h>, and declares uintmax_t.
858 AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
860 AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
862 [#include <sys/types.h>
863 #include <inttypes.h>],
864 [uintmax_t i = (uintmax_t) -1;],
865 jm_ac_cv_header_inttypes_h=yes,
866 jm_ac_cv_header_inttypes_h=no)])
867 if test $jm_ac_cv_header_inttypes_h = yes; then
868 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
869 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
870 and declares uintmax_t. ])
873 # inttypes-pri.m4 serial 1 (gettext-0.11.4)
874 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
875 dnl This file is free software, distributed under the terms of the GNU
876 dnl General Public License. As a special exception to the GNU General
877 dnl Public License, this file may be distributed as part of a program
878 dnl that contains a configuration script generated by Autoconf, under
879 dnl the same distribution terms as the rest of that program.
881 dnl From Bruno Haible.
883 # Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
884 # macros to non-string values. This is the case on AIX 4.3.3.
886 AC_DEFUN([gt_INTTYPES_PRI],
888 AC_REQUIRE([gt_HEADER_INTTYPES_H])
889 if test $gt_cv_header_inttypes_h = yes; then
890 AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
891 gt_cv_inttypes_pri_broken,
893 AC_TRY_COMPILE([#include <inttypes.h>
897 ], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
900 if test "$gt_cv_inttypes_pri_broken" = yes; then
901 AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
902 [Define if <inttypes.h> exists and defines unusable PRI* macros.])
905 # isc-posix.m4 serial 2 (gettext-0.11.2)
906 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
907 dnl This file is free software, distributed under the terms of the GNU
908 dnl General Public License. As a special exception to the GNU General
909 dnl Public License, this file may be distributed as part of a program
910 dnl that contains a configuration script generated by Autoconf, under
911 dnl the same distribution terms as the rest of that program.
913 # This file is not needed with autoconf-2.53 and newer. Remove it in 2005.
915 # This test replaces the one in autoconf.
916 # Currently this macro should have the same name as the autoconf macro
917 # because gettext's gettext.m4 (distributed in the automake package)
918 # still uses it. Otherwise, the use in gettext.m4 makes autoheader
919 # give these diagnostics:
920 # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
921 # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
923 undefine([AC_ISC_POSIX])
925 AC_DEFUN([AC_ISC_POSIX],
927 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
928 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
931 # lcmessage.m4 serial 3 (gettext-0.11.3)
932 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
933 dnl This file is free software, distributed under the terms of the GNU
934 dnl General Public License. As a special exception to the GNU General
935 dnl Public License, this file may be distributed as part of a program
936 dnl that contains a configuration script generated by Autoconf, under
937 dnl the same distribution terms as the rest of that program.
939 dnl This file can can be used in projects which are not available under
940 dnl the GNU General Public License or the GNU Library General Public
941 dnl License but which still want to provide support for the GNU gettext
943 dnl Please note that the actual code of the GNU gettext library is covered
944 dnl by the GNU Library General Public License, and the rest of the GNU
945 dnl gettext package package is covered by the GNU General Public License.
946 dnl They are *not* in the public domain.
949 dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
951 # Check whether LC_MESSAGES is available in <locale.h>.
953 AC_DEFUN([AM_LC_MESSAGES],
955 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
956 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
957 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
958 if test $am_cv_val_LC_MESSAGES = yes; then
959 AC_DEFINE(HAVE_LC_MESSAGES, 1,
960 [Define if your <locale.h> file defines LC_MESSAGES.])
963 # lib-ld.m4 serial 1 (gettext-0.11)
964 dnl Copyright (C) 1996-2002 Free Software Foundation, Inc.
965 dnl This file is free software, distributed under the terms of the GNU
966 dnl General Public License. As a special exception to the GNU General
967 dnl Public License, this file may be distributed as part of a program
968 dnl that contains a configuration script generated by Autoconf, under
969 dnl the same distribution terms as the rest of that program.
971 dnl Subroutines of libtool.m4,
972 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
975 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
976 AC_DEFUN([AC_LIB_PROG_LD_GNU],
977 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
978 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
979 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
980 acl_cv_prog_gnu_ld=yes
982 acl_cv_prog_gnu_ld=no
984 with_gnu_ld=$acl_cv_prog_gnu_ld
987 dnl From libtool-1.4. Sets the variable LD.
988 AC_DEFUN([AC_LIB_PROG_LD],
990 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
991 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
992 AC_REQUIRE([AC_PROG_CC])dnl
993 AC_REQUIRE([AC_CANONICAL_HOST])dnl
995 if test "$GCC" = yes; then
996 # Check if gcc -print-prog-name=ld gives a path.
997 AC_MSG_CHECKING([for ld used by GCC])
1000 # gcc leaves a trailing carriage return which upsets mingw
1001 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
1003 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
1006 # Accept absolute paths.
1007 [[\\/]* | [A-Za-z]:[\\/]*)]
1008 [re_direlt='/[^/][^/]*/\.\./']
1009 # Canonicalize the path of ld
1010 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
1011 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
1012 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
1014 test -z "$LD" && LD="$ac_prog"
1017 # If it fails, then pretend we aren't using GCC.
1021 # If it is relative, then search for the first ld in PATH.
1025 elif test "$with_gnu_ld" = yes; then
1026 AC_MSG_CHECKING([for GNU ld])
1028 AC_MSG_CHECKING([for non-GNU ld])
1030 AC_CACHE_VAL(acl_cv_path_LD,
1031 [if test -z "$LD"; then
1032 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1033 for ac_dir in $PATH; do
1034 test -z "$ac_dir" && ac_dir=.
1035 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
1036 acl_cv_path_LD="$ac_dir/$ac_prog"
1037 # Check to see if the program is GNU ld. I'd rather use --version,
1038 # but apparently some GNU ld's only accept -v.
1039 # Break only if it was the GNU/non-GNU ld that we prefer.
1040 if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
1041 test "$with_gnu_ld" != no && break
1043 test "$with_gnu_ld" != yes && break
1049 acl_cv_path_LD="$LD" # Let the user override the test with a path.
1051 LD="$acl_cv_path_LD"
1052 if test -n "$LD"; then
1057 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
1060 # lib-link.m4 serial 3 (gettext-0.11.3)
1061 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
1062 dnl This file is free software, distributed under the terms of the GNU
1063 dnl General Public License. As a special exception to the GNU General
1064 dnl Public License, this file may be distributed as part of a program
1065 dnl that contains a configuration script generated by Autoconf, under
1066 dnl the same distribution terms as the rest of that program.
1068 dnl From Bruno Haible.
1070 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
1071 dnl the libraries corresponding to explicit and implicit dependencies.
1072 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
1073 dnl augments the CPPFLAGS variable.
1074 AC_DEFUN([AC_LIB_LINKFLAGS],
1076 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1077 AC_REQUIRE([AC_LIB_RPATH])
1078 define([Name],[translit([$1],[./-], [___])])
1079 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1080 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1081 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
1082 AC_LIB_LINKFLAGS_BODY([$1], [$2])
1083 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
1084 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
1085 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
1087 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
1088 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
1089 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
1090 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1092 AC_SUBST([LTLIB]NAME)
1093 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
1094 dnl results of this search when this library appears as a dependency.
1100 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
1101 dnl searches for libname and the libraries corresponding to explicit and
1102 dnl implicit dependencies, together with the specified include files and
1103 dnl the ability to compile and link the specified testcode. If found, it
1104 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
1105 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
1106 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
1107 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
1108 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
1110 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1111 AC_REQUIRE([AC_LIB_RPATH])
1112 define([Name],[translit([$1],[./-], [___])])
1113 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1114 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1116 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
1118 AC_LIB_LINKFLAGS_BODY([$1], [$2])
1120 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
1121 dnl because if the user has installed lib[]Name and not disabled its use
1122 dnl via --without-lib[]Name-prefix, he wants to use it.
1123 ac_save_CPPFLAGS="$CPPFLAGS"
1124 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1126 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
1127 ac_save_LIBS="$LIBS"
1128 LIBS="$LIBS $LIB[]NAME"
1129 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
1130 LIBS="$ac_save_LIBS"
1132 if test "$ac_cv_lib[]Name" = yes; then
1134 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
1135 AC_MSG_CHECKING([how to link with lib[]$1])
1136 AC_MSG_RESULT([$LIB[]NAME])
1139 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
1140 dnl $INC[]NAME either.
1141 CPPFLAGS="$ac_save_CPPFLAGS"
1145 AC_SUBST([HAVE_LIB]NAME)
1147 AC_SUBST([LTLIB]NAME)
1152 dnl Determine the platform dependent parameters needed to use rpath:
1153 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
1154 dnl hardcode_direct, hardcode_minus_L,
1155 dnl sys_lib_search_path_spec, sys_lib_dlsearch_path_spec.
1156 AC_DEFUN([AC_LIB_RPATH],
1158 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
1159 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
1160 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
1161 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
1162 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
1163 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
1164 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
1170 libext="$acl_cv_libext"
1171 shlibext="$acl_cv_shlibext"
1172 hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
1173 hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
1174 hardcode_direct="$acl_cv_hardcode_direct"
1175 hardcode_minus_L="$acl_cv_hardcode_minus_L"
1176 sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec"
1177 sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec"
1178 dnl Determine whether the user wants rpath handling at all.
1179 AC_ARG_ENABLE(rpath,
1180 [ --disable-rpath do not hardcode runtime library paths],
1181 :, enable_rpath=yes)
1184 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
1185 dnl the libraries corresponding to explicit and implicit dependencies.
1186 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
1187 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
1189 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1190 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1191 dnl By default, look in $includedir and $libdir.
1193 AC_LIB_WITH_FINAL_PREFIX([
1194 eval additional_includedir=\"$includedir\"
1195 eval additional_libdir=\"$libdir\"
1197 AC_ARG_WITH([lib$1-prefix],
1198 [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
1199 --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
1201 if test "X$withval" = "Xno"; then
1204 if test "X$withval" = "X"; then
1205 AC_LIB_WITH_FINAL_PREFIX([
1206 eval additional_includedir=\"$includedir\"
1207 eval additional_libdir=\"$libdir\"
1210 additional_includedir="$withval/include"
1211 additional_libdir="$withval/lib"
1215 dnl Search the library and its dependencies in $additional_libdir and
1216 dnl $LDFLAGS. Using breadth-first-seach.
1222 names_already_handled=
1223 names_next_round='$1 $2'
1224 while test -n "$names_next_round"; do
1225 names_this_round="$names_next_round"
1227 for name in $names_this_round; do
1229 for n in $names_already_handled; do
1230 if test "$n" = "$name"; then
1235 if test -z "$already_handled"; then
1236 names_already_handled="$names_already_handled $name"
1237 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
1238 dnl or AC_LIB_HAVE_LINKFLAGS call.
1239 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
1240 eval value=\"\$HAVE_LIB$uppername\"
1241 if test -n "$value"; then
1242 if test "$value" = yes; then
1243 eval value=\"\$LIB$uppername\"
1244 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
1245 eval value=\"\$LTLIB$uppername\"
1246 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
1248 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
1249 dnl that this library doesn't exist. So just drop it.
1253 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
1254 dnl and the already constructed $LIBNAME/$LTLIBNAME.
1259 if test $use_additional = yes; then
1260 if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
1261 found_dir="$additional_libdir"
1262 found_so="$additional_libdir/lib$name.$shlibext"
1263 if test -f "$additional_libdir/lib$name.la"; then
1264 found_la="$additional_libdir/lib$name.la"
1267 if test -f "$additional_libdir/lib$name.$libext"; then
1268 found_dir="$additional_libdir"
1269 found_a="$additional_libdir/lib$name.$libext"
1270 if test -f "$additional_libdir/lib$name.la"; then
1271 found_la="$additional_libdir/lib$name.la"
1276 if test "X$found_dir" = "X"; then
1277 for x in $LDFLAGS $LTLIB[]NAME; do
1278 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1281 dir=`echo "X$x" | sed -e 's/^X-L//'`
1282 if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
1284 found_so="$dir/lib$name.$shlibext"
1285 if test -f "$dir/lib$name.la"; then
1286 found_la="$dir/lib$name.la"
1289 if test -f "$dir/lib$name.$libext"; then
1291 found_a="$dir/lib$name.$libext"
1292 if test -f "$dir/lib$name.la"; then
1293 found_la="$dir/lib$name.la"
1299 if test "X$found_dir" != "X"; then
1304 if test "X$found_dir" != "X"; then
1305 dnl Found the library.
1306 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
1307 if test "X$found_so" != "X"; then
1308 dnl Linking with a shared library. We attempt to hardcode its
1309 dnl directory into the executable's runpath, unless it's the
1310 dnl standard /usr/lib.
1311 if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
1312 dnl No hardcoding is needed.
1313 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1315 dnl Use an explicit option to hardcode DIR into the resulting
1317 dnl Potentially add DIR to ltrpathdirs.
1318 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1320 for x in $ltrpathdirs; do
1321 if test "X$x" = "X$found_dir"; then
1326 if test -z "$haveit"; then
1327 ltrpathdirs="$ltrpathdirs $found_dir"
1329 dnl The hardcoding into $LIBNAME is system dependent.
1330 if test "$hardcode_direct" = yes; then
1331 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
1332 dnl resulting binary.
1333 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1335 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
1336 dnl Use an explicit option to hardcode DIR into the resulting
1338 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1339 dnl Potentially add DIR to rpathdirs.
1340 dnl The rpathdirs will be appended to $LIBNAME at the end.
1342 for x in $rpathdirs; do
1343 if test "X$x" = "X$found_dir"; then
1348 if test -z "$haveit"; then
1349 rpathdirs="$rpathdirs $found_dir"
1352 dnl Rely on "-L$found_dir".
1353 dnl But don't add it if it's already contained in the LDFLAGS
1354 dnl or the already constructed $LIBNAME
1356 for x in $LDFLAGS $LIB[]NAME; do
1357 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1358 if test "X$x" = "X-L$found_dir"; then
1363 if test -z "$haveit"; then
1364 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
1366 if test "$hardcode_minus_L" != no; then
1367 dnl FIXME: Not sure whether we should use
1368 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1370 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
1372 dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
1373 dnl here, because this doesn't fit in flags passed to the
1374 dnl compiler. So give up. No hardcoding. This affects only
1375 dnl very old systems.
1376 dnl FIXME: Not sure whether we should use
1377 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
1379 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1385 if test "X$found_a" != "X"; then
1386 dnl Linking with a static library.
1387 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
1389 dnl We shouldn't come here, but anyway it's good to have a
1391 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
1394 dnl Assume the include files are nearby.
1395 additional_includedir=
1396 case "$found_dir" in
1398 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
1399 additional_includedir="$basedir/include"
1402 if test "X$additional_includedir" != "X"; then
1403 dnl Potentially add $additional_includedir to $INCNAME.
1404 dnl But don't add it
1405 dnl 1. if it's the standard /usr/include,
1406 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
1407 dnl 3. if it's already present in $CPPFLAGS or the already
1408 dnl constructed $INCNAME,
1409 dnl 4. if it doesn't exist as a directory.
1410 if test "X$additional_includedir" != "X/usr/include"; then
1412 if test "X$additional_includedir" = "X/usr/local/include"; then
1413 if test -n "$GCC"; then
1415 linux*) haveit=yes;;
1419 if test -z "$haveit"; then
1420 for x in $CPPFLAGS $INC[]NAME; do
1421 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1422 if test "X$x" = "X-I$additional_includedir"; then
1427 if test -z "$haveit"; then
1428 if test -d "$additional_includedir"; then
1429 dnl Really add $additional_includedir to $INCNAME.
1430 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
1436 dnl Look for dependencies.
1437 if test -n "$found_la"; then
1438 dnl Read the .la file. It defines the variables
1439 dnl dlname, library_names, old_library, dependency_libs, current,
1440 dnl age, revision, installed, dlopen, dlpreopen, libdir.
1441 save_libdir="$libdir"
1443 */* | *\\*) . "$found_la" ;;
1444 *) . "./$found_la" ;;
1446 libdir="$save_libdir"
1447 dnl We use only dependency_libs.
1448 for dep in $dependency_libs; do
1451 additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
1452 dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
1453 dnl But don't add it
1454 dnl 1. if it's the standard /usr/lib,
1455 dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
1456 dnl 3. if it's already present in $LDFLAGS or the already
1457 dnl constructed $LIBNAME,
1458 dnl 4. if it doesn't exist as a directory.
1459 if test "X$additional_libdir" != "X/usr/lib"; then
1461 if test "X$additional_libdir" = "X/usr/local/lib"; then
1462 if test -n "$GCC"; then
1464 linux*) haveit=yes;;
1468 if test -z "$haveit"; then
1470 for x in $LDFLAGS $LIB[]NAME; do
1471 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1472 if test "X$x" = "X-L$additional_libdir"; then
1477 if test -z "$haveit"; then
1478 if test -d "$additional_libdir"; then
1479 dnl Really add $additional_libdir to $LIBNAME.
1480 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
1484 for x in $LDFLAGS $LTLIB[]NAME; do
1485 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1486 if test "X$x" = "X-L$additional_libdir"; then
1491 if test -z "$haveit"; then
1492 if test -d "$additional_libdir"; then
1493 dnl Really add $additional_libdir to $LTLIBNAME.
1494 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
1501 dir=`echo "X$dep" | sed -e 's/^X-R//'`
1502 if test "$enable_rpath" != no; then
1503 dnl Potentially add DIR to rpathdirs.
1504 dnl The rpathdirs will be appended to $LIBNAME at the end.
1506 for x in $rpathdirs; do
1507 if test "X$x" = "X$dir"; then
1512 if test -z "$haveit"; then
1513 rpathdirs="$rpathdirs $dir"
1515 dnl Potentially add DIR to ltrpathdirs.
1516 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
1518 for x in $ltrpathdirs; do
1519 if test "X$x" = "X$dir"; then
1524 if test -z "$haveit"; then
1525 ltrpathdirs="$ltrpathdirs $dir"
1530 dnl Handle this in the next round.
1531 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
1534 dnl Handle this in the next round. Throw away the .la's
1535 dnl directory; it is already contained in a preceding -L
1537 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
1540 dnl Most likely an immediate library name.
1541 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
1542 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
1548 dnl Didn't find the library; assume it is in the system directories
1549 dnl known to the linker and runtime loader. (All the system
1550 dnl directories known to the linker should also be known to the
1551 dnl runtime loader, otherwise the system is severely misconfigured.)
1552 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
1553 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
1559 if test "X$rpathdirs" != "X"; then
1560 if test -n "$hardcode_libdir_separator"; then
1561 dnl Weird platform: only the last -rpath option counts, the user must
1562 dnl pass all path elements in one option. We can arrange that for a
1563 dnl single library, but not when more than one $LIBNAMEs are used.
1565 for found_dir in $rpathdirs; do
1566 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
1568 dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
1569 acl_save_libdir="$libdir"
1571 eval flag=\"$hardcode_libdir_flag_spec\"
1572 libdir="$acl_save_libdir"
1573 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1575 dnl The -rpath options are cumulative.
1576 for found_dir in $rpathdirs; do
1577 acl_save_libdir="$libdir"
1579 eval flag=\"$hardcode_libdir_flag_spec\"
1580 libdir="$acl_save_libdir"
1581 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1585 if test "X$ltrpathdirs" != "X"; then
1586 dnl When using libtool, the option that works for both libraries and
1587 dnl executables is -R. The -R options are cumulative.
1588 for found_dir in $ltrpathdirs; do
1589 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
1594 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
1595 dnl unless already present in VAR.
1596 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
1597 dnl contains two or three consecutive elements that belong together.
1598 AC_DEFUN([AC_LIB_APPENDTOVAR],
1600 for element in [$2]; do
1603 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1604 if test "X$x" = "X$element"; then
1609 if test -z "$haveit"; then
1610 [$1]="${[$1]}${[$1]:+ }$element"
1614 # lib-prefix.m4 serial 1 (gettext-0.11)
1615 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
1616 dnl This file is free software, distributed under the terms of the GNU
1617 dnl General Public License. As a special exception to the GNU General
1618 dnl Public License, this file may be distributed as part of a program
1619 dnl that contains a configuration script generated by Autoconf, under
1620 dnl the same distribution terms as the rest of that program.
1622 dnl From Bruno Haible.
1624 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
1625 dnl to access previously installed libraries. The basic assumption is that
1626 dnl a user will want packages to use other packages he previously installed
1627 dnl with the same --prefix option.
1628 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
1629 dnl libraries, but is otherwise very convenient.
1630 AC_DEFUN([AC_LIB_PREFIX],
1632 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
1633 AC_REQUIRE([AC_PROG_CC])
1634 AC_REQUIRE([AC_CANONICAL_HOST])
1635 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1636 dnl By default, look in $includedir and $libdir.
1638 AC_LIB_WITH_FINAL_PREFIX([
1639 eval additional_includedir=\"$includedir\"
1640 eval additional_libdir=\"$libdir\"
1642 AC_ARG_WITH([lib-prefix],
1643 [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
1644 --without-lib-prefix don't search for libraries in includedir and libdir],
1646 if test "X$withval" = "Xno"; then
1649 if test "X$withval" = "X"; then
1650 AC_LIB_WITH_FINAL_PREFIX([
1651 eval additional_includedir=\"$includedir\"
1652 eval additional_libdir=\"$libdir\"
1655 additional_includedir="$withval/include"
1656 additional_libdir="$withval/lib"
1660 if test $use_additional = yes; then
1661 dnl Potentially add $additional_includedir to $CPPFLAGS.
1662 dnl But don't add it
1663 dnl 1. if it's the standard /usr/include,
1664 dnl 2. if it's already present in $CPPFLAGS,
1665 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
1666 dnl 4. if it doesn't exist as a directory.
1667 if test "X$additional_includedir" != "X/usr/include"; then
1669 for x in $CPPFLAGS; do
1670 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1671 if test "X$x" = "X-I$additional_includedir"; then
1676 if test -z "$haveit"; then
1677 if test "X$additional_includedir" = "X/usr/local/include"; then
1678 if test -n "$GCC"; then
1680 linux*) haveit=yes;;
1684 if test -z "$haveit"; then
1685 if test -d "$additional_includedir"; then
1686 dnl Really add $additional_includedir to $CPPFLAGS.
1687 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
1692 dnl Potentially add $additional_libdir to $LDFLAGS.
1693 dnl But don't add it
1694 dnl 1. if it's the standard /usr/lib,
1695 dnl 2. if it's already present in $LDFLAGS,
1696 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
1697 dnl 4. if it doesn't exist as a directory.
1698 if test "X$additional_libdir" != "X/usr/lib"; then
1700 for x in $LDFLAGS; do
1701 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1702 if test "X$x" = "X-L$additional_libdir"; then
1707 if test -z "$haveit"; then
1708 if test "X$additional_libdir" = "X/usr/local/lib"; then
1709 if test -n "$GCC"; then
1711 linux*) haveit=yes;;
1715 if test -z "$haveit"; then
1716 if test -d "$additional_libdir"; then
1717 dnl Really add $additional_libdir to $LDFLAGS.
1718 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
1726 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
1727 dnl acl_final_exec_prefix, containing the values to which $prefix and
1728 dnl $exec_prefix will expand at the end of the configure script.
1729 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
1731 dnl Unfortunately, prefix and exec_prefix get only finally determined
1732 dnl at the end of configure.
1733 if test "X$prefix" = "XNONE"; then
1734 acl_final_prefix="$ac_default_prefix"
1736 acl_final_prefix="$prefix"
1738 if test "X$exec_prefix" = "XNONE"; then
1739 acl_final_exec_prefix='${prefix}'
1741 acl_final_exec_prefix="$exec_prefix"
1743 acl_save_prefix="$prefix"
1744 prefix="$acl_final_prefix"
1745 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
1746 prefix="$acl_save_prefix"
1749 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
1750 dnl variables prefix and exec_prefix bound to the values they will have
1751 dnl at the end of the configure script.
1752 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
1754 acl_save_prefix="$prefix"
1755 prefix="$acl_final_prefix"
1756 acl_save_exec_prefix="$exec_prefix"
1757 exec_prefix="$acl_final_exec_prefix"
1759 exec_prefix="$acl_save_exec_prefix"
1760 prefix="$acl_save_prefix"
1762 # progtest.m4 serial 2 (gettext-0.10.40)
1763 dnl Copyright (C) 1996-2002 Free Software Foundation, Inc.
1764 dnl This file is free software, distributed under the terms of the GNU
1765 dnl General Public License. As a special exception to the GNU General
1766 dnl Public License, this file may be distributed as part of a program
1767 dnl that contains a configuration script generated by Autoconf, under
1768 dnl the same distribution terms as the rest of that program.
1770 dnl This file can can be used in projects which are not available under
1771 dnl the GNU General Public License or the GNU Library General Public
1772 dnl License but which still want to provide support for the GNU gettext
1774 dnl Please note that the actual code of the GNU gettext library is covered
1775 dnl by the GNU Library General Public License, and the rest of the GNU
1776 dnl gettext package package is covered by the GNU General Public License.
1777 dnl They are *not* in the public domain.
1780 dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
1782 # Search path for a program which passes the given test.
1784 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1785 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1786 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
1787 [# Extract the first word of "$2", so it can be a program name with args.
1788 set dummy $2; ac_word=[$]2
1789 AC_MSG_CHECKING([for $ac_word])
1790 AC_CACHE_VAL(ac_cv_path_$1,
1793 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1796 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1797 for ac_dir in ifelse([$5], , $PATH, [$5]); do
1798 test -z "$ac_dir" && ac_dir=.
1799 if test -f $ac_dir/$ac_word; then
1801 ac_cv_path_$1="$ac_dir/$ac_word"
1807 dnl If no 4th arg is given, leave the cache variable unset,
1808 dnl so AC_PATH_PROGS will keep looking.
1809 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1814 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
1815 AC_MSG_RESULT([$]$1)
1821 # stdint_h.m4 serial 2 (gettext-0.11.4)
1822 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
1823 dnl This file is free software, distributed under the terms of the GNU
1824 dnl General Public License. As a special exception to the GNU General
1825 dnl Public License, this file may be distributed as part of a program
1826 dnl that contains a configuration script generated by Autoconf, under
1827 dnl the same distribution terms as the rest of that program.
1829 dnl From Paul Eggert.
1831 # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
1832 # doesn't clash with <sys/types.h>, and declares uintmax_t.
1834 AC_DEFUN([jm_AC_HEADER_STDINT_H],
1836 AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
1838 [#include <sys/types.h>
1839 #include <stdint.h>],
1840 [uintmax_t i = (uintmax_t) -1;],
1841 jm_ac_cv_header_stdint_h=yes,
1842 jm_ac_cv_header_stdint_h=no)])
1843 if test $jm_ac_cv_header_stdint_h = yes; then
1844 AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
1845 [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
1846 and declares uintmax_t. ])
1849 # uintmax_t.m4 serial 6 (gettext-0.11)
1850 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
1851 dnl This file is free software, distributed under the terms of the GNU
1852 dnl General Public License. As a special exception to the GNU General
1853 dnl Public License, this file may be distributed as part of a program
1854 dnl that contains a configuration script generated by Autoconf, under
1855 dnl the same distribution terms as the rest of that program.
1857 dnl From Paul Eggert.
1861 # Define uintmax_t to `unsigned long' or `unsigned long long'
1862 # if <inttypes.h> does not exist.
1864 AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
1866 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
1867 AC_REQUIRE([jm_AC_HEADER_STDINT_H])
1868 if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
1869 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
1870 test $ac_cv_type_unsigned_long_long = yes \
1871 && ac_type='unsigned long long' \
1872 || ac_type='unsigned long'
1873 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
1874 [Define to unsigned long or unsigned long long
1875 if <inttypes.h> and <stdint.h> don't define.])
1878 # ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40)
1879 dnl Copyright (C) 1999-2002 Free Software Foundation, Inc.
1880 dnl This file is free software, distributed under the terms of the GNU
1881 dnl General Public License. As a special exception to the GNU General
1882 dnl Public License, this file may be distributed as part of a program
1883 dnl that contains a configuration script generated by Autoconf, under
1884 dnl the same distribution terms as the rest of that program.
1886 dnl From Paul Eggert.
1888 AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
1890 AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
1891 [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
1892 [unsigned long long ullmax = (unsigned long long) -1;
1893 return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
1894 ac_cv_type_unsigned_long_long=yes,
1895 ac_cv_type_unsigned_long_long=no)])
1896 if test $ac_cv_type_unsigned_long_long = yes; then
1897 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
1898 [Define if you have the unsigned long long type.])