1 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
2 ## Copyright (C) 1996-1999 Free Software Foundation, Inc.
3 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2 of the License, or
8 ## (at your option) any later version.
10 ## This program is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 ## As a special exception to the GNU General Public License, if you
20 ## distribute this file as part of a program that contains a
21 ## configuration script generated by Autoconf, you may include it under
22 ## the same distribution terms that you use for the rest of that program.
24 # serial 39 AC_PROG_LIBTOOL
25 AC_DEFUN(AC_PROG_LIBTOOL,
26 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
28 # Save cache, so that ltconfig can load it
31 # Actually configure libtool. ac_aux_dir is where install-sh is found.
32 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
33 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
34 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
35 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
36 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
37 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
38 || AC_MSG_ERROR([libtool configure failed])
40 # Reload cache, that may have been modified by ltconfig
43 # This can be used to rebuild libtool when needed
44 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
46 # Always use our own libtool.
47 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
50 # Redirect the config.log output again, so that the ltconfig log is not
51 # clobbered by the next message.
55 AC_DEFUN(AC_LIBTOOL_SETUP,
57 AC_REQUIRE([AC_ENABLE_SHARED])dnl
58 AC_REQUIRE([AC_ENABLE_STATIC])dnl
59 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
60 AC_REQUIRE([AC_CANONICAL_HOST])dnl
61 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
62 AC_REQUIRE([AC_PROG_RANLIB])dnl
63 AC_REQUIRE([AC_PROG_CC])dnl
64 AC_REQUIRE([AC_PROG_LD])dnl
65 AC_REQUIRE([AC_PROG_NM])dnl
66 AC_REQUIRE([AC_PROG_LN_S])dnl
69 # Check for any special flags to pass to ltconfig.
70 libtool_flags="--cache-file=$cache_file"
71 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
72 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
73 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
74 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
75 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
76 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
77 [libtool_flags="$libtool_flags --enable-dlopen"])
78 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
79 [libtool_flags="$libtool_flags --enable-win32-dll"])
80 AC_ARG_ENABLE(libtool-lock,
81 [ --disable-libtool-lock avoid locking (might break parallel builds)])
82 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
83 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
85 # Some flags need to be propagated to the compiler or linker for good
89 # Find out which ABI we are using.
90 echo '[#]line __oline__ "configure"' > conftest.$ac_ext
91 if AC_TRY_EVAL(ac_compile); then
92 case "`/usr/bin/file conftest.o`" in
108 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
109 SAVE_CFLAGS="$CFLAGS"
110 CFLAGS="$CFLAGS -belf"
111 AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
112 [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
113 if test x"$lt_cv_cc_needs_belf" != x"yes"; then
114 # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
115 CFLAGS="$SAVE_CFLAGS"
119 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
120 [*-*-cygwin* | *-*-mingw*)
121 AC_CHECK_TOOL(DLLTOOL, dlltool, false)
122 AC_CHECK_TOOL(AS, as, false)
123 AC_CHECK_TOOL(OBJDUMP, objdump, false)
129 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
130 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
132 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
133 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
135 # AC_ENABLE_SHARED - implement the --enable-shared flag
136 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
137 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
139 AC_DEFUN(AC_ENABLE_SHARED, [dnl
140 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
141 AC_ARG_ENABLE(shared,
142 changequote(<<, >>)dnl
143 << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
145 [p=${PACKAGE-default}
147 yes) enable_shared=yes ;;
148 no) enable_shared=no ;;
151 # Look at the argument we got. We use all the common list separators.
152 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
153 for pkg in $enableval; do
154 if test "X$pkg" = "X$p"; then
161 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
164 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
165 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
166 AC_ENABLE_SHARED(no)])
168 # AC_ENABLE_STATIC - implement the --enable-static flag
169 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
170 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
172 AC_DEFUN(AC_ENABLE_STATIC, [dnl
173 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
174 AC_ARG_ENABLE(static,
175 changequote(<<, >>)dnl
176 << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
178 [p=${PACKAGE-default}
180 yes) enable_static=yes ;;
181 no) enable_static=no ;;
184 # Look at the argument we got. We use all the common list separators.
185 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
186 for pkg in $enableval; do
187 if test "X$pkg" = "X$p"; then
194 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
197 # AC_DISABLE_STATIC - set the default static flag to --disable-static
198 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
199 AC_ENABLE_STATIC(no)])
202 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
203 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
204 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
206 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
207 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
208 AC_ARG_ENABLE(fast-install,
209 changequote(<<, >>)dnl
210 << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
212 [p=${PACKAGE-default}
214 yes) enable_fast_install=yes ;;
215 no) enable_fast_install=no ;;
217 enable_fast_install=no
218 # Look at the argument we got. We use all the common list separators.
219 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
220 for pkg in $enableval; do
221 if test "X$pkg" = "X$p"; then
222 enable_fast_install=yes
228 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
231 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
232 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
233 AC_ENABLE_FAST_INSTALL(no)])
235 # AC_PROG_LD - find the path to the GNU or non-GNU linker
238 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
239 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
240 AC_REQUIRE([AC_PROG_CC])dnl
241 AC_REQUIRE([AC_CANONICAL_HOST])dnl
242 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
244 if test "$ac_cv_prog_gcc" = yes; then
245 # Check if gcc -print-prog-name=ld gives a path.
246 AC_MSG_CHECKING([for ld used by GCC])
247 ac_prog=`($CC -print-prog-name=ld) 2>&5`
249 # Accept absolute paths.
251 [\\/]* | [A-Za-z]:[\\/]*)
252 re_direlt='/[^/][^/]*/\.\./'
254 # Canonicalize the path of ld
255 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
256 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
257 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
259 test -z "$LD" && LD="$ac_prog"
262 # If it fails, then pretend we aren't using GCC.
266 # If it is relative, then search for the first ld in PATH.
270 elif test "$with_gnu_ld" = yes; then
271 AC_MSG_CHECKING([for GNU ld])
273 AC_MSG_CHECKING([for non-GNU ld])
275 AC_CACHE_VAL(ac_cv_path_LD,
276 [if test -z "$LD"; then
277 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
278 for ac_dir in $PATH; do
279 test -z "$ac_dir" && ac_dir=.
280 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
281 ac_cv_path_LD="$ac_dir/$ac_prog"
282 # Check to see if the program is GNU ld. I'd rather use --version,
283 # but apparently some GNU ld's only accept -v.
284 # Break only if it was the GNU/non-GNU ld that we prefer.
285 if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
286 test "$with_gnu_ld" != no && break
288 test "$with_gnu_ld" != yes && break
294 ac_cv_path_LD="$LD" # Let the user override the test with a path.
297 if test -n "$LD"; then
302 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
307 AC_DEFUN(AC_PROG_LD_GNU,
308 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
309 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
310 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
311 ac_cv_prog_gnu_ld=yes
317 # AC_PROG_NM - find the path to a BSD-compatible name lister
319 [AC_MSG_CHECKING([for BSD-compatible nm])
320 AC_CACHE_VAL(ac_cv_path_NM,
321 [if test -n "$NM"; then
322 # Let the user override the test.
325 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
326 for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
327 test -z "$ac_dir" && ac_dir=.
328 if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
329 # Check to see if the nm accepts a BSD-compat flag.
330 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
331 # nm: unknown option "B" ignored
332 if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
333 ac_cv_path_NM="$ac_dir/nm -B"
335 elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
336 ac_cv_path_NM="$ac_dir/nm -p"
339 ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
340 continue # so that we can try to find one that supports BSD flags
345 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
352 # AC_CHECK_LIBM - check for math library
353 AC_DEFUN(AC_CHECK_LIBM,
354 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
357 *-*-beos* | *-*-cygwin*)
358 # These system don't have libm
361 AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
362 AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
365 AC_CHECK_LIB(m, main, LIBM="-lm")
370 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
371 # the libltdl convenience library, adds --enable-ltdl-convenience to
372 # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
373 # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
374 # to be `${top_builddir}/libltdl'. Make sure you start DIR with
375 # '${top_builddir}/' (note the single quotes!) if your package is not
376 # flat, and, if you're not using automake, define top_builddir as
377 # appropriate in the Makefiles.
378 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
379 case "$enable_ltdl_convenience" in
380 no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
381 "") enable_ltdl_convenience=yes
382 ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
384 LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
387 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
388 # the libltdl installable library, and adds --enable-ltdl-install to
389 # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
390 # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
391 # to be `${top_builddir}/libltdl'. Make sure you start DIR with
392 # '${top_builddir}/' (note the single quotes!) if your package is not
393 # flat, and, if you're not using automake, define top_builddir as
394 # appropriate in the Makefiles.
395 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
396 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
397 AC_CHECK_LIB(ltdl, main,
398 [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
399 [if test x"$enable_ltdl_install" = xno; then
400 AC_MSG_WARN([libltdl not installed, but installation disabled])
402 enable_ltdl_install=yes
405 if test x"$enable_ltdl_install" = x"yes"; then
406 ac_configure_args="$ac_configure_args --enable-ltdl-install"
407 LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
409 ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
415 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
416 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
417 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
418 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
419 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
420 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
421 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
423 dnl This is just to quiet aclocal about the macro not being used
424 if(a,b,[AC_DISABLE_FAST_INSTALL])dnl
426 # Macro to add for using GNU gettext.
427 # Ulrich Drepper <drepper@cygnus.com>, 1995.
429 # Modified to never use included libintl.
430 # Owen Taylor <otaylor@redhat.com>, 12/15/1998
433 # This file can be copied and used freely without restrictions. It can
434 # be used in projects which are not available under the GNU Public License
435 # but which still want to provide support for the GNU gettext functionality.
436 # Please note that the actual code is *not* freely available.
440 AC_DEFUN(AM_GTK_WITH_NLS,
441 [AC_MSG_CHECKING([whether NLS is requested])
442 dnl Default is enabled NLS
444 [ --disable-nls do not use Native Language Support],
445 USE_NLS=$enableval, USE_NLS=yes)
446 AC_MSG_RESULT($USE_NLS)
449 USE_INCLUDED_LIBINTL=no
451 dnl If we use NLS figure out what method
452 if test "$USE_NLS" = "yes"; then
453 # AC_DEFINE(ENABLE_NLS)
454 # AC_MSG_CHECKING([whether included gettext is requested])
455 # AC_ARG_WITH(included-gettext,
456 # [ --with-included-gettext use the GNU gettext library included here],
457 # nls_cv_force_use_gnu_gettext=$withval,
458 # nls_cv_force_use_gnu_gettext=no)
459 # AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
460 nls_cv_force_use_gnu_gettext="no"
462 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
463 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
464 dnl User does not insist on using GNU NLS library. Figure out what
465 dnl to use. If gettext or catgets are available (in this order) we
466 dnl use this. Else we have to fall back to GNU NLS library.
467 dnl catgets is only used if permitted by option --with-catgets.
472 AC_CHECK_HEADER(libintl.h,
473 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
474 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
475 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
477 if test "$gt_cv_func_gettext_libc" != "yes"; then
478 AC_CHECK_LIB(intl, bindtextdomain,
479 [AC_CACHE_CHECK([for gettext in libintl],
480 gt_cv_func_gettext_libintl,
481 [AC_CHECK_LIB(intl, gettext,
482 gt_cv_func_gettext_libintl=yes,
483 gt_cv_func_gettext_libintl=no)],
484 gt_cv_func_gettext_libintl=no)])
487 if test "$gt_cv_func_gettext_libc" = "yes" \
488 || test "$gt_cv_func_gettext_libintl" = "yes"; then
489 AC_DEFINE(HAVE_GETTEXT)
490 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
491 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
492 if test "$MSGFMT" != "no"; then
493 AC_CHECK_FUNCS(dcgettext)
494 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
495 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
496 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
497 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
498 return _nl_msg_cat_cntr],
507 # Added by Martin Baulig 12/15/98 for libc5 systems
508 if test "$gt_cv_func_gettext_libc" != "yes" \
509 && test "$gt_cv_func_gettext_libintl" = "yes"; then
511 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
515 if test "$CATOBJEXT" = "NONE"; then
516 AC_MSG_CHECKING([whether catgets can be used])
518 [ --with-catgets use catgets functions if available],
519 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
520 AC_MSG_RESULT($nls_cv_use_catgets)
522 if test "$nls_cv_use_catgets" = "yes"; then
523 dnl No gettext in C library. Try catgets next.
524 AC_CHECK_LIB(i, main)
525 AC_CHECK_FUNC(catgets,
526 [AC_DEFINE(HAVE_CATGETS)
527 INTLOBJS="\$(CATOBJS)"
528 AC_PATH_PROG(GENCAT, gencat, no)dnl
529 # if test "$GENCAT" != "no"; then
530 # AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
531 # if test "$GMSGFMT" = "no"; then
532 # AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
533 # [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
535 # AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
536 # [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
537 # USE_INCLUDED_LIBINTL=yes
541 # INTLDEPS='$(top_builddir)/intl/libintl.a'
543 # LIBS=`echo $LIBS | sed -e 's/-lintl//'`
544 # nls_cv_header_intl=intl/libintl.h
545 # nls_cv_header_libgt=intl/libgettext.h
551 if test "$CATOBJEXT" = "NONE"; then
552 dnl Neither gettext nor catgets in included in the C library.
553 dnl Fall back on GNU gettext library.
554 nls_cv_use_gnu_gettext=yes
558 if test "$nls_cv_use_gnu_gettext" != "yes"; then
559 AC_DEFINE(ENABLE_NLS)
561 # Unset this variable since we use the non-zero value as a flag.
563 # dnl Mark actions used to generate GNU NLS library.
564 # INTLOBJS="\$(GETTOBJS)"
565 # AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
566 # [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
567 # AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
568 # AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
569 # [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
571 # USE_INCLUDED_LIBINTL=yes
575 # INTLDEPS='$(top_builddir)/intl/libintl.a'
577 # LIBS=`echo $LIBS | sed -e 's/-lintl//'`
578 # nls_cv_header_intl=intl/libintl.h
579 # nls_cv_header_libgt=intl/libgettext.h
582 dnl Test whether we really found GNU xgettext.
583 if test "$XGETTEXT" != ":"; then
584 dnl If it is no GNU xgettext we define it as : so that the
585 dnl Makefiles still can work.
586 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
590 [found xgettext program is not GNU xgettext; ignore it])
595 # We need to process the po/ directory.
599 nls_cv_header_intl=intl/libintl.h
600 nls_cv_header_libgt=intl/libgettext.h
602 AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
604 [case "$CONFIG_FILES" in *po/Makefile.in*)
605 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
609 # # If this is used in GNU gettext we have to set USE_NLS to `yes'
610 # # because some of the sources are only built for this goal.
611 # if test "$PACKAGE" = gettext; then
613 # USE_INCLUDED_LIBINTL=yes
616 dnl These rules are solely for the distribution goal. While doing this
617 dnl we only have to keep exactly one list of the available catalogs
619 for lang in $ALL_LINGUAS; do
620 GMOFILES="$GMOFILES $lang.gmo"
621 POFILES="$POFILES $lang.po"
624 dnl Make all variables we use known to autoconf.
625 AC_SUBST(USE_INCLUDED_LIBINTL)
628 AC_SUBST(DATADIRNAME)
638 AC_DEFUN(AM_GTK_GNU_GETTEXT,
639 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
640 AC_REQUIRE([AC_PROG_CC])dnl
641 AC_REQUIRE([AC_PROG_RANLIB])dnl
642 AC_REQUIRE([AC_ISC_POSIX])dnl
643 AC_REQUIRE([AC_HEADER_STDC])dnl
644 AC_REQUIRE([AC_C_CONST])dnl
645 AC_REQUIRE([AC_C_INLINE])dnl
646 AC_REQUIRE([AC_TYPE_OFF_T])dnl
647 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
648 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
649 AC_REQUIRE([AC_FUNC_MMAP])dnl
651 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
652 unistd.h sys/param.h])
653 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
654 strdup __argz_count __argz_stringify __argz_next])
656 if test "${ac_cv_func_stpcpy+set}" != "set"; then
657 AC_CHECK_FUNCS(stpcpy)
659 if test "${ac_cv_func_stpcpy}" = "yes"; then
660 AC_DEFINE(HAVE_STPCPY)
666 if test "x$CATOBJEXT" != "x"; then
667 if test "x$ALL_LINGUAS" = "x"; then
670 AC_MSG_CHECKING(for catalogs to be installed)
672 for lang in ${LINGUAS=$ALL_LINGUAS}; do
673 case "$ALL_LINGUAS" in
674 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
678 AC_MSG_RESULT($LINGUAS)
681 dnl Construct list of names of catalog files to be constructed.
682 if test -n "$LINGUAS"; then
683 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
687 dnl The reference to <locale.h> in the installed <libintl.h> file
688 dnl must be resolved because we cannot expect the users of this
689 dnl to define HAVE_LOCALE_H.
690 if test $ac_cv_header_locale_h = yes; then
691 INCLUDE_LOCALE_H="#include <locale.h>"
694 /* The system does not provide the header <locale.h>. Take care yourself. */"
696 AC_SUBST(INCLUDE_LOCALE_H)
698 dnl Determine which catalog format we have (if any is needed)
699 dnl For now we know about two different formats:
700 dnl Linux libc-5 and the normal X/Open format
701 test -d intl || mkdir intl
702 if test "$CATOBJEXT" = ".cat"; then
703 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
705 dnl Transform the SED scripts while copying because some dumb SEDs
706 dnl cannot handle comments.
707 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
709 dnl po2tbl.sed is always needed.
710 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
711 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
713 dnl In the intl/Makefile.in we have a special dependency which makes
714 dnl only sense for gettext. We comment this out for non-gettext
716 if test "$PACKAGE" = "gettext"; then
726 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
727 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
728 dnl Try to locate is.
730 if test -n "$ac_aux_dir"; then
731 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
733 if test -z "$MKINSTALLDIRS"; then
734 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
736 AC_SUBST(MKINSTALLDIRS)
738 dnl *** For now the libtool support in intl/Makefile is not for real.
742 dnl Generate list of files to be processed by xgettext which will
743 dnl be included in po/Makefile.
744 test -d po || mkdir po
745 if test "x$srcdir" != "x."; then
746 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
747 posrcprefix="$srcdir/"
749 posrcprefix="../$srcdir/"
755 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
756 < $srcdir/po/POTFILES.in > po/POTFILES