1 --- smurf-0.52.1/acinclude.m4~ Wed May 2 23:44:50 2001
2 +++ smurf-0.52.1/acinclude.m4 Mon May 14 03:12:15 2001
7 -# Macro to add for using GNU gettext.
8 -# Ulrich Drepper <drepper@cygnus.com>, 1995.
10 -# This file can be copied and used freely without restrictions. It can
11 -# be used in projects which are not available under the GNU Public License
12 -# but which still want to provide support for the GNU gettext functionality.
13 -# Please note that the actual code is *not* freely available.
17 -AC_DEFUN(AM_WITH_NLS,
18 - [AC_MSG_CHECKING([whether NLS is requested])
19 - dnl Default is enabled NLS
21 - [ --disable-nls do not use Native Language Support],
22 - USE_NLS=$enableval, USE_NLS=yes)
23 - AC_MSG_RESULT($USE_NLS)
26 - USE_INCLUDED_LIBINTL=no
28 - dnl If we use NLS figure out what method
29 - if test "$USE_NLS" = "yes"; then
30 - AC_DEFINE(ENABLE_NLS)
31 - AC_MSG_CHECKING([whether included gettext is requested])
32 - AC_ARG_WITH(included-gettext,
33 - [ --with-included-gettext use the GNU gettext library included here],
34 - nls_cv_force_use_gnu_gettext=$withval,
35 - nls_cv_force_use_gnu_gettext=no)
36 - AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
38 - nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
39 - if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
40 - dnl User does not insist on using GNU NLS library. Figure out what
41 - dnl to use. If gettext or catgets are available (in this order) we
42 - dnl use this. Else we have to fall back to GNU NLS library.
43 - dnl catgets is only used if permitted by option --with-catgets.
45 - nls_cv_header_libgt=
48 - AC_CHECK_HEADER(libintl.h,
49 - [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
50 - [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
51 - gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
53 - if test "$gt_cv_func_gettext_libc" != "yes"; then
54 - AC_CHECK_LIB(intl, bindtextdomain,
55 - [AC_CACHE_CHECK([for gettext in libintl],
56 - gt_cv_func_gettext_libintl,
57 - [AC_CHECK_LIB(intl, gettext,
58 - gt_cv_func_gettext_libintl=yes,
59 - gt_cv_func_gettext_libintl=no)],
60 - gt_cv_func_gettext_libintl=no)])
63 - if test "$gt_cv_func_gettext_libc" = "yes" \
64 - || test "$gt_cv_func_gettext_libintl" = "yes"; then
65 - AC_DEFINE(HAVE_GETTEXT)
66 - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
67 - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
68 - if test "$MSGFMT" != "no"; then
69 - AC_CHECK_FUNCS(dcgettext)
70 - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
71 - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
72 - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
73 - AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
74 - return _nl_msg_cat_cntr],
84 - if test "$CATOBJEXT" = "NONE"; then
85 - AC_MSG_CHECKING([whether catgets can be used])
86 - AC_ARG_WITH(catgets,
87 - [ --with-catgets use catgets functions if available],
88 - nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
89 - AC_MSG_RESULT($nls_cv_use_catgets)
91 - if test "$nls_cv_use_catgets" = "yes"; then
92 - dnl No gettext in C library. Try catgets next.
93 - AC_CHECK_LIB(i, main)
94 - AC_CHECK_FUNC(catgets,
95 - [AC_DEFINE(HAVE_CATGETS)
96 - INTLOBJS="\$(CATOBJS)"
97 - AC_PATH_PROG(GENCAT, gencat, no)dnl
98 - if test "$GENCAT" != "no"; then
99 - AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
100 - if test "$GMSGFMT" = "no"; then
101 - AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
102 - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
104 - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
105 - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
106 - USE_INCLUDED_LIBINTL=yes
110 - INTLDEPS='$(top_builddir)/intl/libintl.a'
112 - LIBS=`echo $LIBS | sed -e 's/-lintl//'`
113 - nls_cv_header_intl=intl/libintl.h
114 - nls_cv_header_libgt=intl/libgettext.h
119 - if test "$CATOBJEXT" = "NONE"; then
120 - dnl Neither gettext nor catgets in included in the C library.
121 - dnl Fall back on GNU gettext library.
122 - nls_cv_use_gnu_gettext=yes
126 - if test "$nls_cv_use_gnu_gettext" = "yes"; then
127 - dnl Mark actions used to generate GNU NLS library.
128 - INTLOBJS="\$(GETTOBJS)"
129 - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
130 - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
131 - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
132 - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
133 - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
135 - USE_INCLUDED_LIBINTL=yes
139 - INTLDEPS='$(top_builddir)/intl/libintl.a'
141 - LIBS=`echo $LIBS | sed -e 's/-lintl//'`
142 - nls_cv_header_intl=intl/libintl.h
143 - nls_cv_header_libgt=intl/libgettext.h
146 - dnl Test whether we really found GNU xgettext.
147 - if test "$XGETTEXT" != ":"; then
148 - dnl If it is no GNU xgettext we define it as : so that the
149 - dnl Makefiles still can work.
150 - if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
154 - [found xgettext program is not GNU xgettext; ignore it])
159 - # We need to process the po/ directory.
163 - nls_cv_header_intl=intl/libintl.h
164 - nls_cv_header_libgt=intl/libgettext.h
166 - AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
167 - AC_OUTPUT_COMMANDS(
168 - [case "$CONFIG_FILES" in *po/Makefile.in*)
169 - sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
173 - # If this is used in GNU gettext we have to set USE_NLS to `yes'
174 - # because some of the sources are only built for this goal.
175 - if test "$PACKAGE" = gettext; then
177 - USE_INCLUDED_LIBINTL=yes
180 - dnl These rules are solely for the distribution goal. While doing this
181 - dnl we only have to keep exactly one list of the available catalogs
182 - dnl in configure.in.
183 - for lang in $ALL_LINGUAS; do
184 - GMOFILES="$GMOFILES $lang.gmo"
185 - POFILES="$POFILES $lang.po"
188 - dnl Make all variables we use known to autoconf.
189 - AC_SUBST(USE_INCLUDED_LIBINTL)
191 - AC_SUBST(CATOBJEXT)
192 - AC_SUBST(DATADIRNAME)
194 - AC_SUBST(INSTOBJEXT)
202 -AC_DEFUN(AM_GNU_GETTEXT,
203 - [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
204 - AC_REQUIRE([AC_PROG_CC])dnl
205 - AC_REQUIRE([AC_PROG_RANLIB])dnl
206 - AC_REQUIRE([AC_ISC_POSIX])dnl
207 - AC_REQUIRE([AC_HEADER_STDC])dnl
208 - AC_REQUIRE([AC_C_CONST])dnl
209 - AC_REQUIRE([AC_C_INLINE])dnl
210 - AC_REQUIRE([AC_TYPE_OFF_T])dnl
211 - AC_REQUIRE([AC_TYPE_SIZE_T])dnl
212 - AC_REQUIRE([AC_FUNC_ALLOCA])dnl
213 - AC_REQUIRE([AC_FUNC_MMAP])dnl
215 - AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
216 -unistd.h sys/param.h])
217 - AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
218 -strdup __argz_count __argz_stringify __argz_next])
220 - if test "${ac_cv_func_stpcpy+set}" != "set"; then
221 - AC_CHECK_FUNCS(stpcpy)
223 - if test "${ac_cv_func_stpcpy}" = "yes"; then
224 - AC_DEFINE(HAVE_STPCPY)
230 - if test "x$CATOBJEXT" != "x"; then
231 - if test "x$ALL_LINGUAS" = "x"; then
234 - AC_MSG_CHECKING(for catalogs to be installed)
236 - for lang in ${LINGUAS=$ALL_LINGUAS}; do
237 - case "$ALL_LINGUAS" in
238 - *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
241 - LINGUAS=$NEW_LINGUAS
242 - AC_MSG_RESULT($LINGUAS)
245 - dnl Construct list of names of catalog files to be constructed.
246 - if test -n "$LINGUAS"; then
247 - for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
251 - dnl The reference to <locale.h> in the installed <libintl.h> file
252 - dnl must be resolved because we cannot expect the users of this
253 - dnl to define HAVE_LOCALE_H.
254 - if test $ac_cv_header_locale_h = yes; then
255 - INCLUDE_LOCALE_H="#include <locale.h>"
257 - INCLUDE_LOCALE_H="\
258 -/* The system does not provide the header <locale.h>. Take care yourself. */"
260 - AC_SUBST(INCLUDE_LOCALE_H)
262 - dnl Determine which catalog format we have (if any is needed)
263 - dnl For now we know about two different formats:
264 - dnl Linux libc-5 and the normal X/Open format
265 - test -d intl || mkdir intl
266 - if test "$CATOBJEXT" = ".cat"; then
267 - AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
269 - dnl Transform the SED scripts while copying because some dumb SEDs
270 - dnl cannot handle comments.
271 - sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
273 - dnl po2tbl.sed is always needed.
274 - sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
275 - $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
277 - dnl In the intl/Makefile.in we have a special dependency which makes
278 - dnl only sense for gettext. We comment this out for non-gettext
280 - if test "$PACKAGE" = "gettext"; then
290 - dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
291 - dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
292 - dnl Try to locate is.
294 - if test -n "$ac_aux_dir"; then
295 - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
297 - if test -z "$MKINSTALLDIRS"; then
298 - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
300 - AC_SUBST(MKINSTALLDIRS)
302 - dnl *** For now the libtool support in intl/Makefile is not for real.
306 - dnl Generate list of files to be processed by xgettext which will
307 - dnl be included in po/Makefile.
308 - test -d po || mkdir po
309 - if test "x$srcdir" != "x."; then
310 - if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
311 - posrcprefix="$srcdir/"
313 - posrcprefix="../$srcdir/"
319 - sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
320 - < $srcdir/po/POTFILES.in > po/POTFILES
323 -# Check whether LC_MESSAGES is available in <locale.h>.
324 -# Ulrich Drepper <drepper@cygnus.com>, 1995.
326 -# This file can be copied and used freely without restrictions. It can
327 -# be used in projects which are not available under the GNU Public License
328 -# but which still want to provide support for the GNU gettext functionality.
329 -# Please note that the actual code is *not* freely available.
333 -AC_DEFUN(AM_LC_MESSAGES,
334 - [if test $ac_cv_header_locale_h = yes; then
335 - AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
336 - [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
337 - am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
338 - if test $am_cv_val_LC_MESSAGES = yes; then
339 - AC_DEFINE(HAVE_LC_MESSAGES)
343 -# Search path for a program which passes the given test.
344 -# Ulrich Drepper <drepper@cygnus.com>, 1996.
346 -# This file can be copied and used freely without restrictions. It can
347 -# be used in projects which are not available under the GNU Public License
348 -# but which still want to provide support for the GNU gettext functionality.
349 -# Please note that the actual code is *not* freely available.
353 -dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
354 -dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
355 -AC_DEFUN(AM_PATH_PROG_WITH_TEST,
356 -[# Extract the first word of "$2", so it can be a program name with args.
357 -set dummy $2; ac_word=[$]2
358 -AC_MSG_CHECKING([for $ac_word])
359 -AC_CACHE_VAL(ac_cv_path_$1,
362 - ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
365 - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
366 - for ac_dir in ifelse([$5], , $PATH, [$5]); do
367 - test -z "$ac_dir" && ac_dir=.
368 - if test -f $ac_dir/$ac_word; then
370 - ac_cv_path_$1="$ac_dir/$ac_word"
376 -dnl If no 4th arg is given, leave the cache variable unset,
377 -dnl so AC_PATH_PROGS will keep looking.
378 -ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
383 -if test -n "[$]$1"; then
384 - AC_MSG_RESULT([$]$1)