blob: efced8455912cf53bcc18bfd061cfea7d8ccef66 [file] [log] [blame]
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00001dnl aclocal.m4 generated automatically by aclocal 1.4
2
3dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13# Do all the work for Automake. This macro actually does too much --
14# some checks are only needed if your package does certain things.
15# But this isn't really a big deal.
16
17# serial 1
18
19dnl Usage:
20dnl AM_INIT_AUTOMAKE(package,version, [no-define])
21
22AC_DEFUN(AM_INIT_AUTOMAKE,
23[AC_REQUIRE([AC_PROG_INSTALL])
24PACKAGE=[$1]
25AC_SUBST(PACKAGE)
26VERSION=[$2]
27AC_SUBST(VERSION)
28dnl test to see if srcdir already configured
29if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
30 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
31fi
32ifelse([$3],,
33AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
34AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
35AC_REQUIRE([AM_SANITY_CHECK])
36AC_REQUIRE([AC_ARG_PROGRAM])
37dnl FIXME This is truly gross.
38missing_dir=`cd $ac_aux_dir && pwd`
39AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
40AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
41AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
42AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
43AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
44AC_REQUIRE([AC_PROG_MAKE_SET])])
45
46#
47# Check to make sure that the build environment is sane.
48#
49
50AC_DEFUN(AM_SANITY_CHECK,
51[AC_MSG_CHECKING([whether build environment is sane])
52# Just in case
53sleep 1
54echo timestamp > conftestfile
55# Do `set' in a subshell so we don't clobber the current shell's
56# arguments. Must try -L first in case configure is actually a
57# symlink; some systems play weird games with the mod time of symlinks
58# (eg FreeBSD returns the mod time of the symlink's containing
59# directory).
60if (
61 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
62 if test "[$]*" = "X"; then
63 # -L didn't work.
64 set X `ls -t $srcdir/configure conftestfile`
65 fi
66 if test "[$]*" != "X $srcdir/configure conftestfile" \
67 && test "[$]*" != "X conftestfile $srcdir/configure"; then
68
69 # If neither matched, then we have a broken ls. This can happen
70 # if, for instance, CONFIG_SHELL is bash and it inherits a
71 # broken ls alias from the environment. This has actually
72 # happened. Such a system could not be considered "sane".
73 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
74alias in your environment])
75 fi
76
77 test "[$]2" = conftestfile
78 )
79then
80 # Ok.
81 :
82else
83 AC_MSG_ERROR([newly created file is older than distributed files!
84Check your system clock])
85fi
86rm -f conftest*
87AC_MSG_RESULT(yes)])
88
89dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
90dnl The program must properly implement --version.
91AC_DEFUN(AM_MISSING_PROG,
92[AC_MSG_CHECKING(for working $2)
93# Run test in a subshell; some versions of sh will print an error if
94# an executable is not found, even if stderr is redirected.
95# Redirect stdin to placate older versions of autoconf. Sigh.
96if ($2 --version) < /dev/null > /dev/null 2>&1; then
97 $1=$2
98 AC_MSG_RESULT(found)
99else
100 $1="$3/missing $2"
101 AC_MSG_RESULT(missing)
102fi
103AC_SUBST($1)])
104
105# Like AC_CONFIG_HEADER, but automatically create stamp file.
106
107AC_DEFUN(AM_CONFIG_HEADER,
108[AC_PREREQ([2.12])
109AC_CONFIG_HEADER([$1])
110dnl When config.status generates a header, we must update the stamp-h file.
111dnl This file resides in the same directory as the config header
112dnl that is generated. We must strip everything past the first ":",
113dnl and everything past the last "/".
114AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
115ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
116<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
117<<am_indx=1
118for am_file in <<$1>>; do
119 case " <<$>>CONFIG_HEADERS " in
120 *" <<$>>am_file "*<<)>>
121 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
122 ;;
123 esac
124 am_indx=`expr "<<$>>am_indx" + 1`
125done<<>>dnl>>)
126changequote([,]))])
127
128# Configure paths for GLIB
129# Owen Taylor 97-11-3
130
131dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
132dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or
133dnl gthread is specified in MODULES, pass to glib-config
134dnl
135AC_DEFUN(AM_PATH_GLIB,
136[dnl
137dnl Get the cflags and libraries from the glib-config script
138dnl
139AC_ARG_WITH(glib-prefix,[ --with-glib-prefix=PFX Prefix where GLIB is installed (optional)],
140 glib_config_prefix="$withval", glib_config_prefix="")
141AC_ARG_WITH(glib-exec-prefix,[ --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)],
142 glib_config_exec_prefix="$withval", glib_config_exec_prefix="")
143AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and run a test GLIB program],
144 , enable_glibtest=yes)
145
146 if test x$glib_config_exec_prefix != x ; then
147 glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
148 if test x${GLIB_CONFIG+set} != xset ; then
149 GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
150 fi
151 fi
152 if test x$glib_config_prefix != x ; then
153 glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
154 if test x${GLIB_CONFIG+set} != xset ; then
155 GLIB_CONFIG=$glib_config_prefix/bin/glib-config
156 fi
157 fi
158
159 for module in . $4
160 do
161 case "$module" in
162 gmodule)
163 glib_config_args="$glib_config_args gmodule"
164 ;;
165 gthread)
166 glib_config_args="$glib_config_args gthread"
167 ;;
168 esac
169 done
170
171 AC_PATH_PROG(GLIB_CONFIG, glib-config, no)
172 min_glib_version=ifelse([$1], ,0.99.7,$1)
173 AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
174 no_glib=""
175 if test "$GLIB_CONFIG" = "no" ; then
176 no_glib=yes
177 else
178 GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
179 GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
180 glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
181 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
182 glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
183 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
184 glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
185 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
186 if test "x$enable_glibtest" = "xyes" ; then
187 ac_save_CFLAGS="$CFLAGS"
188 ac_save_LIBS="$LIBS"
189 CFLAGS="$CFLAGS $GLIB_CFLAGS"
190 LIBS="$GLIB_LIBS $LIBS"
191dnl
192dnl Now check if the installed GLIB is sufficiently new. (Also sanity
193dnl checks the results of glib-config to some extent
194dnl
195 rm -f conf.glibtest
196 AC_TRY_RUN([
197#include <glib.h>
198#include <stdio.h>
199#include <stdlib.h>
200
201int
202main ()
203{
204 int major, minor, micro;
205 char *tmp_version;
206
207 system ("touch conf.glibtest");
208
209 /* HP/UX 9 (%@#!) writes to sscanf strings */
210 tmp_version = g_strdup("$min_glib_version");
211 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
212 printf("%s, bad version string\n", "$min_glib_version");
213 exit(1);
214 }
215
216 if ((glib_major_version != $glib_config_major_version) ||
217 (glib_minor_version != $glib_config_minor_version) ||
218 (glib_micro_version != $glib_config_micro_version))
219 {
220 printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
221 $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
222 glib_major_version, glib_minor_version, glib_micro_version);
223 printf ("*** was found! If glib-config was correct, then it is best\n");
224 printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
225 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
226 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
227 printf("*** required on your system.\n");
228 printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n");
229 printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n");
230 printf("*** before re-running configure\n");
231 }
232 else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
233 (glib_minor_version != GLIB_MINOR_VERSION) ||
234 (glib_micro_version != GLIB_MICRO_VERSION))
235 {
236 printf("*** GLIB header files (version %d.%d.%d) do not match\n",
237 GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
238 printf("*** library (version %d.%d.%d)\n",
239 glib_major_version, glib_minor_version, glib_micro_version);
240 }
241 else
242 {
243 if ((glib_major_version > major) ||
244 ((glib_major_version == major) && (glib_minor_version > minor)) ||
245 ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
246 {
247 return 0;
248 }
249 else
250 {
251 printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
252 glib_major_version, glib_minor_version, glib_micro_version);
253 printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
254 major, minor, micro);
255 printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
256 printf("***\n");
257 printf("*** If you have already installed a sufficiently new version, this error\n");
258 printf("*** probably means that the wrong copy of the glib-config shell script is\n");
259 printf("*** being found. The easiest way to fix this is to remove the old version\n");
260 printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n");
261 printf("*** correct copy of glib-config. (In this case, you will have to\n");
262 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
263 printf("*** so that the correct libraries are found at run-time))\n");
264 }
265 }
266 return 1;
267}
268],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
269 CFLAGS="$ac_save_CFLAGS"
270 LIBS="$ac_save_LIBS"
271 fi
272 fi
273 if test "x$no_glib" = x ; then
274 AC_MSG_RESULT(yes)
275 ifelse([$2], , :, [$2])
276 else
277 AC_MSG_RESULT(no)
278 if test "$GLIB_CONFIG" = "no" ; then
279 echo "*** The glib-config script installed by GLIB could not be found"
280 echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
281 echo "*** your path, or set the GLIB_CONFIG environment variable to the"
282 echo "*** full path to glib-config."
283 else
284 if test -f conf.glibtest ; then
285 :
286 else
287 echo "*** Could not run GLIB test program, checking why..."
288 CFLAGS="$CFLAGS $GLIB_CFLAGS"
289 LIBS="$LIBS $GLIB_LIBS"
290 AC_TRY_LINK([
291#include <glib.h>
292#include <stdio.h>
293], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
294 [ echo "*** The test program compiled, but did not run. This usually means"
295 echo "*** that the run-time linker is not finding GLIB or finding the wrong"
296 echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
297 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
298 echo "*** to the installed location Also, make sure you have run ldconfig if that"
299 echo "*** is required on your system"
300 echo "***"
301 echo "*** If you have an old version installed, it is best to remove it, although"
302 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
303 echo "***"
304 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
305 echo "*** came with the system with the command"
306 echo "***"
307 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
308 [ echo "*** The test program failed to compile or link. See the file config.log for the"
309 echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
310 echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
311 echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ])
312 CFLAGS="$ac_save_CFLAGS"
313 LIBS="$ac_save_LIBS"
314 fi
315 fi
316 GLIB_CFLAGS=""
317 GLIB_LIBS=""
318 ifelse([$3], , :, [$3])
319 fi
320 AC_SUBST(GLIB_CFLAGS)
321 AC_SUBST(GLIB_LIBS)
322 rm -f conf.glibtest
323])
324
325# Macro to add for using GNU gettext.
326# Ulrich Drepper <drepper@cygnus.com>, 1995.
327#
328# This file can be copied and used freely without restrictions. It can
329# be used in projects which are not available under the GNU Public License
330# but which still want to provide support for the GNU gettext functionality.
331# Please note that the actual code is *not* freely available.
332
333# serial 5
334
335AC_DEFUN(AM_WITH_NLS,
336 [AC_MSG_CHECKING([whether NLS is requested])
337 dnl Default is enabled NLS
338 AC_ARG_ENABLE(nls,
339 [ --disable-nls do not use Native Language Support],
340 USE_NLS=$enableval, USE_NLS=yes)
341 AC_MSG_RESULT($USE_NLS)
342 AC_SUBST(USE_NLS)
343
344 USE_INCLUDED_LIBINTL=no
345
346 dnl If we use NLS figure out what method
347 if test "$USE_NLS" = "yes"; then
348 AC_DEFINE(ENABLE_NLS)
349 AC_MSG_CHECKING([whether included gettext is requested])
350 AC_ARG_WITH(included-gettext,
351 [ --with-included-gettext use the GNU gettext library included here],
352 nls_cv_force_use_gnu_gettext=$withval,
353 nls_cv_force_use_gnu_gettext=no)
354 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
355
356 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
357 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
358 dnl User does not insist on using GNU NLS library. Figure out what
359 dnl to use. If gettext or catgets are available (in this order) we
360 dnl use this. Else we have to fall back to GNU NLS library.
361 dnl catgets is only used if permitted by option --with-catgets.
362 nls_cv_header_intl=
363 nls_cv_header_libgt=
364 CATOBJEXT=NONE
365
366 AC_CHECK_HEADER(libintl.h,
367 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
368 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
369 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
370
371 if test "$gt_cv_func_gettext_libc" != "yes"; then
372 AC_CHECK_LIB(intl, bindtextdomain,
373 [AC_CACHE_CHECK([for gettext in libintl],
374 gt_cv_func_gettext_libintl,
375 [AC_CHECK_LIB(intl, gettext,
376 gt_cv_func_gettext_libintl=yes,
377 gt_cv_func_gettext_libintl=no)],
378 gt_cv_func_gettext_libintl=no)])
379 fi
380
381 if test "$gt_cv_func_gettext_libc" = "yes" \
382 || test "$gt_cv_func_gettext_libintl" = "yes"; then
383 AC_DEFINE(HAVE_GETTEXT)
384 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
385 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
386 if test "$MSGFMT" != "no"; then
387 AC_CHECK_FUNCS(dcgettext)
388 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
389 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
390 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
391 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
392 return _nl_msg_cat_cntr],
393 [CATOBJEXT=.gmo
394 DATADIRNAME=share],
395 [CATOBJEXT=.mo
396 DATADIRNAME=lib])
397 INSTOBJEXT=.mo
398 fi
399 fi
400 ])
401
402 if test "$CATOBJEXT" = "NONE"; then
403 AC_MSG_CHECKING([whether catgets can be used])
404 AC_ARG_WITH(catgets,
405 [ --with-catgets use catgets functions if available],
406 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
407 AC_MSG_RESULT($nls_cv_use_catgets)
408
409 if test "$nls_cv_use_catgets" = "yes"; then
410 dnl No gettext in C library. Try catgets next.
411 AC_CHECK_LIB(i, main)
412 AC_CHECK_FUNC(catgets,
413 [AC_DEFINE(HAVE_CATGETS)
414 INTLOBJS="\$(CATOBJS)"
415 AC_PATH_PROG(GENCAT, gencat, no)dnl
416 if test "$GENCAT" != "no"; then
417 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
418 if test "$GMSGFMT" = "no"; then
419 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
420 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
421 fi
422 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
423 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
424 USE_INCLUDED_LIBINTL=yes
425 CATOBJEXT=.cat
426 INSTOBJEXT=.cat
427 DATADIRNAME=lib
428 INTLDEPS='$(top_builddir)/intl/libintl.a'
429 INTLLIBS=$INTLDEPS
430 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
431 nls_cv_header_intl=intl/libintl.h
432 nls_cv_header_libgt=intl/libgettext.h
433 fi])
434 fi
435 fi
436
437 if test "$CATOBJEXT" = "NONE"; then
438 dnl Neither gettext nor catgets in included in the C library.
439 dnl Fall back on GNU gettext library.
440 nls_cv_use_gnu_gettext=yes
441 fi
442 fi
443
444 if test "$nls_cv_use_gnu_gettext" = "yes"; then
445 dnl Mark actions used to generate GNU NLS library.
446 INTLOBJS="\$(GETTOBJS)"
447 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
448 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
449 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
450 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
451 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
452 AC_SUBST(MSGFMT)
453 USE_INCLUDED_LIBINTL=yes
454 CATOBJEXT=.gmo
455 INSTOBJEXT=.mo
456 DATADIRNAME=share
457 INTLDEPS='$(top_builddir)/intl/libintl.a'
458 INTLLIBS=$INTLDEPS
459 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
460 nls_cv_header_intl=intl/libintl.h
461 nls_cv_header_libgt=intl/libgettext.h
462 fi
463
464 dnl Test whether we really found GNU xgettext.
465 if test "$XGETTEXT" != ":"; then
466 dnl If it is no GNU xgettext we define it as : so that the
467 dnl Makefiles still can work.
468 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
469 : ;
470 else
471 AC_MSG_RESULT(
472 [found xgettext program is not GNU xgettext; ignore it])
473 XGETTEXT=":"
474 fi
475 fi
476
477 # We need to process the po/ directory.
478 POSUB=po
479 else
480 DATADIRNAME=share
481 nls_cv_header_intl=intl/libintl.h
482 nls_cv_header_libgt=intl/libgettext.h
483 fi
484 AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
485 AC_OUTPUT_COMMANDS(
486 [case "$CONFIG_FILES" in *po/Makefile.in*)
487 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
488 esac])
489
490
491 # If this is used in GNU gettext we have to set USE_NLS to `yes'
492 # because some of the sources are only built for this goal.
493 if test "$PACKAGE" = gettext; then
494 USE_NLS=yes
495 USE_INCLUDED_LIBINTL=yes
496 fi
497
498 dnl These rules are solely for the distribution goal. While doing this
499 dnl we only have to keep exactly one list of the available catalogs
500 dnl in configure.in.
501 for lang in $ALL_LINGUAS; do
502 GMOFILES="$GMOFILES $lang.gmo"
503 POFILES="$POFILES $lang.po"
504 done
505
506 dnl Make all variables we use known to autoconf.
507 AC_SUBST(USE_INCLUDED_LIBINTL)
508 AC_SUBST(CATALOGS)
509 AC_SUBST(CATOBJEXT)
510 AC_SUBST(DATADIRNAME)
511 AC_SUBST(GMOFILES)
512 AC_SUBST(INSTOBJEXT)
513 AC_SUBST(INTLDEPS)
514 AC_SUBST(INTLLIBS)
515 AC_SUBST(INTLOBJS)
516 AC_SUBST(POFILES)
517 AC_SUBST(POSUB)
518 ])
519
520AC_DEFUN(AM_GNU_GETTEXT,
521 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
522 AC_REQUIRE([AC_PROG_CC])dnl
523 AC_REQUIRE([AC_PROG_RANLIB])dnl
524 AC_REQUIRE([AC_ISC_POSIX])dnl
525 AC_REQUIRE([AC_HEADER_STDC])dnl
526 AC_REQUIRE([AC_C_CONST])dnl
527 AC_REQUIRE([AC_C_INLINE])dnl
528 AC_REQUIRE([AC_TYPE_OFF_T])dnl
529 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
530 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
531 AC_REQUIRE([AC_FUNC_MMAP])dnl
532
533 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
534unistd.h sys/param.h])
535 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
536strdup __argz_count __argz_stringify __argz_next])
537
538 if test "${ac_cv_func_stpcpy+set}" != "set"; then
539 AC_CHECK_FUNCS(stpcpy)
540 fi
541 if test "${ac_cv_func_stpcpy}" = "yes"; then
542 AC_DEFINE(HAVE_STPCPY)
543 fi
544
545 AM_LC_MESSAGES
546 AM_WITH_NLS
547
548 if test "x$CATOBJEXT" != "x"; then
549 if test "x$ALL_LINGUAS" = "x"; then
550 LINGUAS=
551 else
552 AC_MSG_CHECKING(for catalogs to be installed)
553 NEW_LINGUAS=
554 for lang in ${LINGUAS=$ALL_LINGUAS}; do
555 case "$ALL_LINGUAS" in
556 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
557 esac
558 done
559 LINGUAS=$NEW_LINGUAS
560 AC_MSG_RESULT($LINGUAS)
561 fi
562
563 dnl Construct list of names of catalog files to be constructed.
564 if test -n "$LINGUAS"; then
565 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
566 fi
567 fi
568
569 dnl The reference to <locale.h> in the installed <libintl.h> file
570 dnl must be resolved because we cannot expect the users of this
571 dnl to define HAVE_LOCALE_H.
572 if test $ac_cv_header_locale_h = yes; then
573 INCLUDE_LOCALE_H="#include <locale.h>"
574 else
575 INCLUDE_LOCALE_H="\
576/* The system does not provide the header <locale.h>. Take care yourself. */"
577 fi
578 AC_SUBST(INCLUDE_LOCALE_H)
579
580 dnl Determine which catalog format we have (if any is needed)
581 dnl For now we know about two different formats:
582 dnl Linux libc-5 and the normal X/Open format
583 test -d intl || mkdir intl
584 if test "$CATOBJEXT" = ".cat"; then
585 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
586
587 dnl Transform the SED scripts while copying because some dumb SEDs
588 dnl cannot handle comments.
589 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
590 fi
591 dnl po2tbl.sed is always needed.
592 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
593 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
594
595 dnl In the intl/Makefile.in we have a special dependency which makes
596 dnl only sense for gettext. We comment this out for non-gettext
597 dnl packages.
598 if test "$PACKAGE" = "gettext"; then
599 GT_NO="#NO#"
600 GT_YES=
601 else
602 GT_NO=
603 GT_YES="#YES#"
604 fi
605 AC_SUBST(GT_NO)
606 AC_SUBST(GT_YES)
607
608 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
609 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
610 dnl Try to locate is.
611 MKINSTALLDIRS=
612 if test -n "$ac_aux_dir"; then
613 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
614 fi
615 if test -z "$MKINSTALLDIRS"; then
616 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
617 fi
618 AC_SUBST(MKINSTALLDIRS)
619
620 dnl *** For now the libtool support in intl/Makefile is not for real.
621 l=
622 AC_SUBST(l)
623
624 dnl Generate list of files to be processed by xgettext which will
625 dnl be included in po/Makefile.
626 test -d po || mkdir po
627 if test "x$srcdir" != "x."; then
628 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
629 posrcprefix="$srcdir/"
630 else
631 posrcprefix="../$srcdir/"
632 fi
633 else
634 posrcprefix="../"
635 fi
636 rm -f po/POTFILES
637 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
638 < $srcdir/po/POTFILES.in > po/POTFILES
639 ])
640
641# Search path for a program which passes the given test.
642# Ulrich Drepper <drepper@cygnus.com>, 1996.
643#
644# This file can be copied and used freely without restrictions. It can
645# be used in projects which are not available under the GNU Public License
646# but which still want to provide support for the GNU gettext functionality.
647# Please note that the actual code is *not* freely available.
648
649# serial 1
650
651dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
652dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
653AC_DEFUN(AM_PATH_PROG_WITH_TEST,
654[# Extract the first word of "$2", so it can be a program name with args.
655set dummy $2; ac_word=[$]2
656AC_MSG_CHECKING([for $ac_word])
657AC_CACHE_VAL(ac_cv_path_$1,
658[case "[$]$1" in
659 /*)
660 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
661 ;;
662 *)
663 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
664 for ac_dir in ifelse([$5], , $PATH, [$5]); do
665 test -z "$ac_dir" && ac_dir=.
666 if test -f $ac_dir/$ac_word; then
667 if [$3]; then
668 ac_cv_path_$1="$ac_dir/$ac_word"
669 break
670 fi
671 fi
672 done
673 IFS="$ac_save_ifs"
674dnl If no 4th arg is given, leave the cache variable unset,
675dnl so AC_PATH_PROGS will keep looking.
676ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
677])dnl
678 ;;
679esac])dnl
680$1="$ac_cv_path_$1"
681if test -n "[$]$1"; then
682 AC_MSG_RESULT([$]$1)
683else
684 AC_MSG_RESULT(no)
685fi
686AC_SUBST($1)dnl
687])
688
689# Check whether LC_MESSAGES is available in <locale.h>.
690# Ulrich Drepper <drepper@cygnus.com>, 1995.
691#
692# This file can be copied and used freely without restrictions. It can
693# be used in projects which are not available under the GNU Public License
694# but which still want to provide support for the GNU gettext functionality.
695# Please note that the actual code is *not* freely available.
696
697# serial 1
698
699AC_DEFUN(AM_LC_MESSAGES,
700 [if test $ac_cv_header_locale_h = yes; then
701 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
702 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
703 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
704 if test $am_cv_val_LC_MESSAGES = yes; then
705 AC_DEFINE(HAVE_LC_MESSAGES)
706 fi
707 fi])
708