1 dnl --------------------------------------------------------- ##
2 dnl The following definitions are from gettext-0.10.27. ##
3 dnl --------------------------------------------------------- ##
5 # Macro to add for using GNU gettext.
6 # Ulrich Drepper <drepper@cygnus.com>, 1995.
11 [AC_MSG_CHECKING([whether NLS is requested])
12 dnl Default is enabled NLS
14 [ --disable-nls do not use Native Language Support],
15 USE_NLS=$enableval, USE_NLS=yes)
16 AC_MSG_RESULT($USE_NLS)
19 USE_INCLUDED_LIBINTL=no
21 dnl If we use NLS figure out what method
22 if test "$USE_NLS" = "yes"; then
24 AC_MSG_CHECKING([whether included gettext is requested])
25 AC_ARG_WITH(included-gettext,
26 [ --with-included-gettext use the GNU gettext library included here],
27 nls_cv_force_use_gnu_gettext=$withval,
28 nls_cv_force_use_gnu_gettext=no)
29 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
31 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
32 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
33 dnl User does not insist on using GNU NLS library. Figure out what
34 dnl to use. If gettext or catgets are available (in this order) we
35 dnl use this. Else we have to fall back to GNU NLS library.
36 dnl catgets is only used if permitted by option --with-catgets.
41 AC_CHECK_HEADER(libintl.h,
42 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
43 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
44 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
46 if test "$gt_cv_func_gettext_libc" != "yes"; then
47 AC_CHECK_LIB(intl, bindtextdomain,
48 [AC_CACHE_CHECK([for gettext in libintl],
49 gt_cv_func_gettext_libintl,
50 [AC_TRY_LINK([], [return (int) gettext ("")],
51 gt_cv_func_gettext_libintl=yes,
52 gt_cv_func_gettext_libintl=no)])])
55 if test "$gt_cv_func_gettext_libc" = "yes" \
56 || test "$gt_cv_func_gettext_libintl" = "yes"; then
57 AC_DEFINE(HAVE_GETTEXT)
58 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
59 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
60 if test "$MSGFMT" != "no"; then
61 AC_CHECK_FUNCS(dcgettext)
62 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
63 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
64 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
65 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
66 return _nl_msg_cat_cntr],
76 if test "$CATOBJEXT" = "NONE"; then
77 AC_MSG_CHECKING([whether catgets can be used])
79 [ --with-catgets use catgets functions if available],
80 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
81 AC_MSG_RESULT($nls_cv_use_catgets)
83 if test "$nls_cv_use_catgets" = "yes"; then
84 dnl No gettext in C library. Try catgets next.
86 AC_CHECK_FUNC(catgets,
87 [AC_DEFINE(HAVE_CATGETS)
88 INTLOBJS="\$(CATOBJS)"
89 AC_PATH_PROG(GENCAT, gencat, no)dnl
90 if test "$GENCAT" != "no"; then
91 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
92 if test "$GMSGFMT" = "no"; then
93 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
94 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
96 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
97 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
98 USE_INCLUDED_LIBINTL=yes
102 INTLDEPS="../intl/libintl.a"
104 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
105 nls_cv_header_intl=intl/libintl.h
106 nls_cv_header_libgt=intl/libgettext.h
111 if test "$CATOBJEXT" = "NONE"; then
112 dnl Neither gettext nor catgets in included in the C library.
113 dnl Fall back on GNU gettext library.
114 nls_cv_use_gnu_gettext=yes
118 if test "$nls_cv_use_gnu_gettext" = "yes"; then
119 dnl Mark actions used to generate GNU NLS library.
120 INTLOBJS="\$(GETTOBJS)"
121 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
122 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
123 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
124 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
125 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
127 USE_INCLUDED_LIBINTL=yes
131 INTLDEPS="../intl/libintl.a"
133 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
134 nls_cv_header_intl=intl/libintl.h
135 nls_cv_header_libgt=intl/libgettext.h
138 dnl Test whether we really found GNU xgettext.
139 if test "$XGETTEXT" != ":"; then
140 dnl If it is no GNU xgettext we define it as : so that the
141 dnl Makefiles still can work.
142 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
146 [found xgettext programs is not GNU xgettext; ignore it])
151 # We need to process the po/ directory.
155 nls_cv_header_intl=intl/libintl.h
156 nls_cv_header_libgt=intl/libgettext.h
159 # If this is used in GNU gettext we have to set USE_NLS to `yes'
160 # because some of the sources are only built for this goal.
161 if test "$PACKAGE" = gettext; then
163 USE_INCLUDED_LIBINTL=yes
166 dnl These rules are solely for the distribution goal. While doing this
167 dnl we only have to keep exactly one list of the available catalogs
169 for lang in $ALL_LINGUAS; do
170 GMOFILES="$GMOFILES $lang.gmo"
171 POFILES="$POFILES $lang.po"
174 dnl Make all variables we use known to autoconf.
175 AC_SUBST(USE_INCLUDED_LIBINTL)
178 AC_SUBST(DATADIRNAME)
188 AC_DEFUN(AM_GNU_GETTEXT,
189 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
190 AC_REQUIRE([AC_PROG_CC])dnl
191 AC_REQUIRE([AC_ISC_POSIX])dnl
192 AC_REQUIRE([AC_HEADER_STDC])dnl
193 AC_REQUIRE([AC_C_CONST])dnl
194 AC_REQUIRE([AC_C_INLINE])dnl
195 AC_REQUIRE([AC_TYPE_OFF_T])dnl
196 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
197 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
198 AC_REQUIRE([AC_FUNC_MMAP])dnl
200 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
202 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
203 __argz_count __argz_stringify __argz_next])
205 if test "${ac_cv_func_stpcpy+set}" != "set"; then
206 AC_CHECK_FUNCS(stpcpy)
208 if test "${ac_cv_func_stpcpy}" = "yes"; then
209 AC_DEFINE(HAVE_STPCPY)
215 if test "x$CATOBJEXT" != "x"; then
216 if test "x$ALL_LINGUAS" = "x"; then
219 AC_MSG_CHECKING(for catalogs to be installed)
221 for lang in ${LINGUAS=$ALL_LINGUAS}; do
222 case "$ALL_LINGUAS" in
223 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
227 AC_MSG_RESULT($LINGUAS)
230 dnl Construct list of names of catalog files to be constructed.
231 if test -n "$LINGUAS"; then
232 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
236 dnl Determine which catalog format we have (if any is needed)
237 dnl For now we know about two different formats:
238 dnl Linux libc-5 and the normal X/Open format
239 test -d intl || mkdir intl
240 if test "$CATOBJEXT" = ".cat"; then
241 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
243 dnl Transform the SED scripts while copying because some dumb SEDs
244 dnl cannot handle comments.
245 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
247 dnl po2tbl.sed is always needed.
248 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
249 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
251 dnl In the intl/Makefile.in we have a special dependency which makes
252 dnl only sense for gettext. We comment this out for non-gettext
254 if test "$PACKAGE" = "gettext"; then
264 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
265 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
266 dnl Try to locate is.
268 if test $ac_aux_dir; then
269 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
271 if test -z $MKINSTALLDIRS; then
272 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
274 AC_SUBST(MKINSTALLDIRS)
276 dnl Configure the intl/Makefile for shared libs.
277 if test "${enable_shared+set}" = set; then
284 dnl Generate list of files to be processed by xgettext which will
285 dnl be included in po/Makefile.
286 test -d po || mkdir po
287 if test "x$srcdir" != "x."; then
288 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
289 posrcprefix="$srcdir/"
291 posrcprefix="../$srcdir/"
296 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
297 < $srcdir/po/POTFILES.in > po/POTFILES
300 # Search path for a program which passes the given test.
301 # Ulrich Drepper <drepper@cygnus.com>, 1996.
305 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
306 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
307 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
308 [# Extract the first word of "$2", so it can be a program name with args.
309 set dummy $2; ac_word=[$]2
310 AC_MSG_CHECKING([for $ac_word])
311 AC_CACHE_VAL(ac_cv_path_$1,
314 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
317 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
318 for ac_dir in ifelse([$5], , $PATH, [$5]); do
319 test -z "$ac_dir" && ac_dir=.
320 if test -f $ac_dir/$ac_word; then
322 ac_cv_path_$1="$ac_dir/$ac_word"
328 dnl If no 4th arg is given, leave the cache variable unset,
329 dnl so AC_PATH_PROGS will keep looking.
330 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
335 if test -n "[$]$1"; then
343 # Check whether LC_MESSAGES is available in <locale.h>.
344 # Ulrich Drepper <drepper@cygnus.com>, 1995.
348 AC_DEFUN(AM_LC_MESSAGES,
349 [if test $ac_cv_header_locale_h = yes; then
350 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
351 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
352 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
353 if test $am_cv_val_LC_MESSAGES = yes; then
354 AC_DEFINE(HAVE_LC_MESSAGES)
358 dnl Check longest integer in digits.
360 AC_DEFUN([BLP_INT_DIGITS],
362 AC_MSG_CHECKING(number of digits in LONG_MIN (incl. sign))
363 AC_CACHE_VAL(blp_int_digits,
364 [AC_TRY_RUN([#include <stdio.h>
371 sprintf(s, "%ld", LONG_MAX);
373 sprintf(s, "%ld", LONG_MIN);
374 if(strlen(s)>len) len=strlen(s);
375 sprintf(s, "%lu", ULONG_MAX);
376 if(strlen(s)>len) len=strlen(s);
380 eval "blp_int_digits=19",
381 eval "blp_int_digits=$?"
382 if test "$blp_int_digits" -lt 11; then
385 eval "blp_int_digits=19")
387 AC_DEFINE_UNQUOTED(INT_DIGITS, $blp_int_digits)
388 AC_MSG_RESULT($blp_int_digits)
391 dnl Check quality of this machine's sprintf implementation.
393 AC_DEFUN([BLP_IS_SPRINTF_GOOD],
395 AC_MSG_CHECKING(if sprintf returns a char count)
396 AC_CACHE_VAL(blp_is_sprintf_good,
397 [AC_TRY_RUN([#include <stdio.h>
402 exit((int)sprintf(s, "abcdefg")!=7);
405 eval "blp_is_sprintf_good=yes",
406 eval "blp_is_sprintf_good=no",
407 eval "blp_is_sprintf_good=no")
409 if test "$blp_is_sprintf_good" = yes; then
410 AC_DEFINE(HAVE_GOOD_SPRINTF)
417 dnl Check for proper random number generator.
419 AC_DEFUN([BLP_RANDOM],
421 AC_MSG_CHECKING(random number generator)
422 AC_CACHE_VAL(blp_random_good,
423 AC_TRY_COMPILE([#include <stdlib.h>], [int x=RAND_MAX;],
424 blp_random_good=yes, blp_random_good=no))
425 if test "$blp_random_good" = yes; then
426 AC_DEFINE(HAVE_GOOD_RANDOM)
433 dnl aclocal.m4 ends here