1 diff -urN grep-2.5e.org/acinclude.m4 grep-2.5e/acinclude.m4
2 --- grep-2.5e.org/acinclude.m4 Wed Mar 7 05:55:50 2001
3 +++ grep-2.5e/acinclude.m4 Tue May 8 09:36:33 2001
5 [the number of pending output bytes on stream `fp'])
8 -# Macro to add for using GNU gettext.
9 -# Ulrich Drepper <drepper@cygnus.com>, 1995.
11 -# This file can be copied and used freely without restrictions. It can
12 -# be used in projects which are not available under the GNU Public License
13 -# but which still want to provide support for the GNU gettext functionality.
14 -# Please note that the actual code is *not* freely available.
18 -AC_DEFUN(AM_WITH_NLS,
19 - [AC_MSG_CHECKING([whether NLS is requested])
20 - dnl Default is enabled NLS
22 - [ --disable-nls do not use Native Language Support],
23 - USE_NLS=$enableval, USE_NLS=yes)
24 - AC_MSG_RESULT($USE_NLS)
27 - USE_INCLUDED_LIBINTL=no
29 - dnl If we use NLS figure out what method
30 - if test "$USE_NLS" = "yes"; then
31 - AC_DEFINE(ENABLE_NLS)
32 - AC_MSG_CHECKING([whether included gettext is requested])
33 - AC_ARG_WITH(included-gettext,
34 - [ --with-included-gettext use the GNU gettext library included here],
35 - nls_cv_force_use_gnu_gettext=$withval,
36 - nls_cv_force_use_gnu_gettext=no)
37 - AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
39 - nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
40 - if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
41 - dnl User does not insist on using GNU NLS library. Figure out what
42 - dnl to use. If gettext or catgets are available (in this order) we
43 - dnl use this. Else we have to fall back to GNU NLS library.
44 - dnl catgets is only used if permitted by option --with-catgets.
46 - nls_cv_header_libgt=
49 - AC_CHECK_HEADER(libintl.h,
50 - [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
51 - [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
52 - gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
54 - if test "$gt_cv_func_gettext_libc" != "yes"; then
55 - AC_CHECK_LIB(intl, bindtextdomain,
56 - [AC_CACHE_CHECK([for gettext in libintl],
57 - gt_cv_func_gettext_libintl,
58 - [AC_CHECK_LIB(intl, gettext,
59 - gt_cv_func_gettext_libintl=yes,
60 - gt_cv_func_gettext_libintl=no)],
61 - gt_cv_func_gettext_libintl=no)])
63 - if test "$gt_cv_func_gettext_libintl" = yes; then
69 - if test "$gt_cv_func_gettext_libc" = "yes" \
70 - || test "$gt_cv_func_gettext_libintl" = "yes"; then
71 - AC_DEFINE(HAVE_GETTEXT)
72 - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
73 - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
74 - if test "$MSGFMT" != "no"; then
75 - AC_CHECK_FUNCS(dcgettext)
76 - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
77 - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
78 - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
79 - AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
80 - return _nl_msg_cat_cntr],
90 - if test "$CATOBJEXT" = "NONE"; then
91 - AC_MSG_CHECKING([whether catgets can be used])
92 - AC_ARG_WITH(catgets,
93 - [ --with-catgets use catgets functions if available],
94 - nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
95 - AC_MSG_RESULT($nls_cv_use_catgets)
97 - if test "$nls_cv_use_catgets" = "yes"; then
98 - dnl No gettext in C library. Try catgets next.
99 - AC_CHECK_LIB(i, main)
100 - AC_CHECK_FUNC(catgets,
101 - [AC_DEFINE(HAVE_CATGETS)
102 - INTLOBJS="\$(CATOBJS)"
103 - AC_PATH_PROG(GENCAT, gencat, no)dnl
104 - if test "$GENCAT" != "no"; then
105 - AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
106 - if test "$GMSGFMT" = "no"; then
107 - AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
108 - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
110 - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
111 - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
112 - USE_INCLUDED_LIBINTL=yes
116 - INTLDEPS='$(top_builddir)/intl/libintl.a'
118 - LIBS=`echo $LIBS | sed -e 's/-lintl//'`
119 - nls_cv_header_intl=intl/libintl.h
120 - nls_cv_header_libgt=intl/libgettext.h
125 - if test "$CATOBJEXT" = "NONE"; then
126 - dnl Neither gettext nor catgets in included in the C library.
127 - dnl Fall back on GNU gettext library.
128 - nls_cv_use_gnu_gettext=yes
132 - if test "$nls_cv_use_gnu_gettext" = "yes"; then
133 - dnl Mark actions used to generate GNU NLS library.
134 - INTLOBJS="\$(GETTOBJS)"
135 - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
136 - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
137 - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
138 - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
139 - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
141 - USE_INCLUDED_LIBINTL=yes
145 - INTLDEPS='$(top_builddir)/intl/libintl.a'
147 - LIBS=`echo $LIBS | sed -e 's/-lintl//'`
148 - nls_cv_header_intl=intl/libintl.h
149 - nls_cv_header_libgt=intl/libgettext.h
152 - dnl Test whether we really found GNU xgettext.
153 - if test "$XGETTEXT" != ":"; then
154 - dnl If it is no GNU xgettext we define it as : so that the
155 - dnl Makefiles still can work.
156 - if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
160 - [found xgettext program is not GNU xgettext; ignore it])
165 - # We need to process the po/ directory.
169 - nls_cv_header_intl=intl/libintl.h
170 - nls_cv_header_libgt=intl/libgettext.h
172 - if test -z "$nsl_cv_header_intl"; then
173 - # Clean out junk possibly left behind by a previous configuration.
174 - rm -f intl/libintl.h
176 - AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
177 - AC_OUTPUT_COMMANDS(
178 - [case "$CONFIG_FILES" in *po/Makefile.in*)
179 - sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
183 - # If this is used in GNU gettext we have to set USE_NLS to `yes'
184 - # because some of the sources are only built for this goal.
185 - if test "$PACKAGE" = gettext; then
187 - USE_INCLUDED_LIBINTL=yes
190 - dnl These rules are solely for the distribution goal. While doing this
191 - dnl we only have to keep exactly one list of the available catalogs
192 - dnl in configure.in.
193 - for lang in $ALL_LINGUAS; do
194 - GMOFILES="$GMOFILES $lang.gmo"
195 - POFILES="$POFILES $lang.po"
198 - dnl Make all variables we use known to autoconf.
199 - AC_SUBST(USE_INCLUDED_LIBINTL)
201 - AC_SUBST(CATOBJEXT)
202 - AC_SUBST(DATADIRNAME)
204 - AC_SUBST(INSTOBJEXT)
212 -AC_DEFUN(AM_GNU_GETTEXT,
213 - [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
214 - AC_REQUIRE([AC_PROG_CC])dnl
215 - AC_REQUIRE([AC_PROG_RANLIB])dnl
216 - AC_REQUIRE([AC_ISC_POSIX])dnl
217 - AC_REQUIRE([AC_HEADER_STDC])dnl
218 - AC_REQUIRE([AC_C_CONST])dnl
219 - AC_REQUIRE([AC_C_INLINE])dnl
220 - AC_REQUIRE([AC_TYPE_OFF_T])dnl
221 - AC_REQUIRE([AC_TYPE_SIZE_T])dnl
222 - AC_REQUIRE([AC_FUNC_ALLOCA])dnl
223 - AC_REQUIRE([AC_FUNC_MMAP])dnl
225 - AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
226 -unistd.h sys/param.h])
227 - AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
228 -strdup __argz_count __argz_stringify __argz_next])
230 - if test "${ac_cv_func_stpcpy+set}" != "set"; then
231 - AC_CHECK_FUNCS(stpcpy)
233 - if test "${ac_cv_func_stpcpy}" = "yes"; then
234 - AC_DEFINE(HAVE_STPCPY)
240 - if test "x$CATOBJEXT" != "x"; then
241 - if test "x$ALL_LINGUAS" = "x"; then
244 - AC_MSG_CHECKING(for catalogs to be installed)
246 - for lang in ${LINGUAS=$ALL_LINGUAS}; do
247 - case "$ALL_LINGUAS" in
248 - *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
251 - LINGUAS=$NEW_LINGUAS
252 - AC_MSG_RESULT($LINGUAS)
255 - dnl Construct list of names of catalog files to be constructed.
256 - if test -n "$LINGUAS"; then
257 - for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
261 - dnl The reference to <locale.h> in the installed <libintl.h> file
262 - dnl must be resolved because we cannot expect the users of this
263 - dnl to define HAVE_LOCALE_H.
264 - if test $ac_cv_header_locale_h = yes; then
265 - INCLUDE_LOCALE_H="#include <locale.h>"
267 - INCLUDE_LOCALE_H="\
268 -/* The system does not provide the header <locale.h>. Take care yourself. */"
270 - AC_SUBST(INCLUDE_LOCALE_H)
272 - dnl Determine which catalog format we have (if any is needed)
273 - dnl For now we know about two different formats:
274 - dnl Linux libc-5 and the normal X/Open format
275 - test -d intl || mkdir intl
276 - if test "$CATOBJEXT" = ".cat"; then
277 - AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
279 - dnl Transform the SED scripts while copying because some dumb SEDs
280 - dnl cannot handle comments.
281 - sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
283 - dnl po2tbl.sed is always needed.
284 - sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
285 - $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
287 - dnl In the intl/Makefile.in we have a special dependency which makes
288 - dnl only sense for gettext. We comment this out for non-gettext
290 - if test "$PACKAGE" = "gettext"; then
300 - dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
301 - dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
302 - dnl Try to locate is.
304 - if test -n "$ac_aux_dir"; then
305 - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
307 - if test -z "$MKINSTALLDIRS"; then
308 - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
310 - AC_SUBST(MKINSTALLDIRS)
312 - dnl *** For now the libtool support in intl/Makefile is not for real.
316 - dnl Generate list of files to be processed by xgettext which will
317 - dnl be included in po/Makefile.
318 - test -d po || mkdir po
319 - if test "x$srcdir" != "x."; then
321 - if test "x`echo $srcdir | sed -e 's@^[A-z]:@@' -e 's@/.*@@'`" = "x"; then
322 - posrcprefix="$srcdir/"
324 - posrcprefix="../$srcdir/"
326 - changequote([, ])dnl
331 - sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
332 - < $srcdir/po/POTFILES.in > po/POTFILES
334 dnl From Gordon Matzigkeit.
335 dnl Test for the GNU C Library.
336 dnl FIXME: this should migrate into libit.
341 -# Like AC_CONFIG_HEADER, but automatically create stamp file.
343 -AC_DEFUN(AM_CONFIG_HEADER,
345 -AC_CONFIG_HEADER([$1])
346 -dnl When config.status generates a header, we must update the stamp-h file.
347 -dnl This file resides in the same directory as the config header
348 -dnl that is generated. We must strip everything past the first ":",
349 -dnl and everything past the last "/".
350 -AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
351 -ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
352 -<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
354 -for am_file in <<$1>>; do
355 - case " <<$>>CONFIG_HEADERS " in
356 - *" <<$>>am_file "*<<)>>
357 - echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
360 - am_indx=`expr "<<$>>am_indx" + 1`
363 -# Do all the work for Automake. This macro actually does too much --
364 -# some checks are only needed if your package does certain things.
365 -# But this isn't really a big deal.
370 -dnl AM_INIT_AUTOMAKE(package,version, [no-define])
372 -AC_DEFUN(AM_INIT_AUTOMAKE,
373 -[AC_REQUIRE([AC_PROG_INSTALL])
378 -dnl test to see if srcdir already configured
379 -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
380 - AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
383 -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
384 -AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
385 -AC_REQUIRE([AM_SANITY_CHECK])
386 -AC_REQUIRE([AC_ARG_PROGRAM])
387 -dnl FIXME This is truly gross.
388 -missing_dir=`cd $ac_aux_dir && pwd`
389 -AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
390 -AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
391 -AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
392 -AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
393 -AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
394 -AC_REQUIRE([AC_PROG_MAKE_SET])])
395 -## --------------------------------------------------------- ##
396 -## Use AC_PROG_INSTALL, supplementing it with INSTALL_SCRIPT ##
398 -## From Franc,ois Pinard ##
399 -## --------------------------------------------------------- ##
403 -AC_DEFUN(AM_PROG_INSTALL,
404 -[AC_REQUIRE([AC_PROG_INSTALL])
405 -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
406 -AC_SUBST(INSTALL_SCRIPT)dnl
410 dnl From Paul Eggert.
416 -# Check whether LC_MESSAGES is available in <locale.h>.
417 -# Ulrich Drepper <drepper@cygnus.com>, 1995.
419 -# This file can be copied and used freely without restrictions. It can
420 -# be used in projects which are not available under the GNU Public License
421 -# but which still want to provide support for the GNU gettext functionality.
422 -# Please note that the actual code is *not* freely available.
426 -AC_DEFUN(AM_LC_MESSAGES,
427 - [if test $ac_cv_header_locale_h = yes; then
428 - AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
429 - [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
430 - am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
431 - if test $am_cv_val_LC_MESSAGES = yes; then
432 - AC_DEFINE(HAVE_LC_MESSAGES)
437 dnl From Jim Meyering.
438 dnl Determine whether malloc accepts 0 as its argument.