1dnl 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# Macro to add for using GNU gettext.
129# Ulrich Drepper <drepper@cygnus.com>, 1995.
130#
131# This file can be copied and used freely without restrictions.  It can
132# be used in projects which are not available under the GNU Public License
133# but which still want to provide support for the GNU gettext functionality.
134# Please note that the actual code is *not* freely available.
135
136# serial 5
137
138AC_DEFUN(AM_WITH_NLS,
139  [AC_MSG_CHECKING([whether NLS is requested])
140    dnl Default is enabled NLS
141    AC_ARG_ENABLE(nls,
142      [  --disable-nls           do not use Native Language Support],
143      USE_NLS=$enableval, USE_NLS=yes)
144    AC_MSG_RESULT($USE_NLS)
145    AC_SUBST(USE_NLS)
146
147    USE_INCLUDED_LIBINTL=no
148
149    dnl If we use NLS figure out what method
150    if test "$USE_NLS" = "yes"; then
151      AC_DEFINE(ENABLE_NLS)
152      AC_MSG_CHECKING([whether included gettext is requested])
153      AC_ARG_WITH(included-gettext,
154        [  --with-included-gettext use the GNU gettext library included here],
155        nls_cv_force_use_gnu_gettext=$withval,
156        nls_cv_force_use_gnu_gettext=no)
157      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
158
159      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
160      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
161        dnl User does not insist on using GNU NLS library.  Figure out what
162        dnl to use.  If gettext or catgets are available (in this order) we
163        dnl use this.  Else we have to fall back to GNU NLS library.
164	dnl catgets is only used if permitted by option --with-catgets.
165	nls_cv_header_intl=
166	nls_cv_header_libgt=
167	CATOBJEXT=NONE
168
169	AC_CHECK_HEADER(libintl.h,
170	  [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
171	    [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
172	       gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
173
174	   if test "$gt_cv_func_gettext_libc" != "yes"; then
175	     AC_CHECK_LIB(intl, bindtextdomain,
176	       [AC_CACHE_CHECK([for gettext in libintl],
177		 gt_cv_func_gettext_libintl,
178		 [AC_CHECK_LIB(intl, gettext,
179		  gt_cv_func_gettext_libintl=yes,
180		  gt_cv_func_gettext_libintl=no)],
181		 gt_cv_func_gettext_libintl=no)])
182	   fi
183
184	   if test "$gt_cv_func_gettext_libc" = "yes" \
185	      || test "$gt_cv_func_gettext_libintl" = "yes"; then
186	      AC_DEFINE(HAVE_GETTEXT)
187	      AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
188		[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
189	      if test "$MSGFMT" != "no"; then
190		AC_CHECK_FUNCS(dcgettext)
191		AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
192		AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
193		  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
194		AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
195			       return _nl_msg_cat_cntr],
196		  [CATOBJEXT=.gmo
197		   DATADIRNAME=share],
198		  [CATOBJEXT=.mo
199		   DATADIRNAME=lib])
200		INSTOBJEXT=.mo
201	      fi
202	    fi
203	])
204
205        if test "$CATOBJEXT" = "NONE"; then
206	  AC_MSG_CHECKING([whether catgets can be used])
207	  AC_ARG_WITH(catgets,
208	    [  --with-catgets          use catgets functions if available],
209	    nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
210	  AC_MSG_RESULT($nls_cv_use_catgets)
211
212	  if test "$nls_cv_use_catgets" = "yes"; then
213	    dnl No gettext in C library.  Try catgets next.
214	    AC_CHECK_LIB(i, main)
215	    AC_CHECK_FUNC(catgets,
216	      [AC_DEFINE(HAVE_CATGETS)
217	       INTLOBJS="\$(CATOBJS)"
218	       AC_PATH_PROG(GENCAT, gencat, no)dnl
219	       if test "$GENCAT" != "no"; then
220		 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
221		 if test "$GMSGFMT" = "no"; then
222		   AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
223		    [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
224		 fi
225		 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
226		   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
227		 USE_INCLUDED_LIBINTL=yes
228		 CATOBJEXT=.cat
229		 INSTOBJEXT=.cat
230		 DATADIRNAME=lib
231		 INTLDEPS='$(top_builddir)/intl/libintl.a'
232		 INTLLIBS=$INTLDEPS
233		 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
234		 nls_cv_header_intl=intl/libintl.h
235		 nls_cv_header_libgt=intl/libgettext.h
236	       fi])
237	  fi
238        fi
239
240        if test "$CATOBJEXT" = "NONE"; then
241	  dnl Neither gettext nor catgets in included in the C library.
242	  dnl Fall back on GNU gettext library.
243	  nls_cv_use_gnu_gettext=yes
244        fi
245      fi
246
247      if test "$nls_cv_use_gnu_gettext" = "yes"; then
248        dnl Mark actions used to generate GNU NLS library.
249        INTLOBJS="\$(GETTOBJS)"
250        AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
251	  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
252        AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
253        AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
254	  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
255        AC_SUBST(MSGFMT)
256	USE_INCLUDED_LIBINTL=yes
257        CATOBJEXT=.gmo
258        INSTOBJEXT=.mo
259        DATADIRNAME=share
260	INTLDEPS='$(top_builddir)/intl/libintl.a'
261	INTLLIBS=$INTLDEPS
262	LIBS=`echo $LIBS | sed -e 's/-lintl//'`
263        nls_cv_header_intl=intl/libintl.h
264        nls_cv_header_libgt=intl/libgettext.h
265      fi
266
267      dnl Test whether we really found GNU xgettext.
268      if test "$XGETTEXT" != ":"; then
269	dnl If it is no GNU xgettext we define it as : so that the
270	dnl Makefiles still can work.
271	if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
272	  : ;
273	else
274	  AC_MSG_RESULT(
275	    [found xgettext program is not GNU xgettext; ignore it])
276	  XGETTEXT=":"
277	fi
278      fi
279
280      # We need to process the po/ directory.
281      POSUB=po
282    else
283      DATADIRNAME=share
284      nls_cv_header_intl=intl/libintl.h
285      nls_cv_header_libgt=intl/libgettext.h
286    fi
287    AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
288    AC_OUTPUT_COMMANDS(
289     [case "$CONFIG_FILES" in *po/Makefile.in*)
290        sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
291      esac])
292
293
294    # If this is used in GNU gettext we have to set USE_NLS to `yes'
295    # because some of the sources are only built for this goal.
296    if test "$PACKAGE" = gettext; then
297      USE_NLS=yes
298      USE_INCLUDED_LIBINTL=yes
299    fi
300
301    dnl These rules are solely for the distribution goal.  While doing this
302    dnl we only have to keep exactly one list of the available catalogs
303    dnl in configure.in.
304    for lang in $ALL_LINGUAS; do
305      GMOFILES="$GMOFILES $lang.gmo"
306      POFILES="$POFILES $lang.po"
307    done
308
309    dnl Make all variables we use known to autoconf.
310    AC_SUBST(USE_INCLUDED_LIBINTL)
311    AC_SUBST(CATALOGS)
312    AC_SUBST(CATOBJEXT)
313    AC_SUBST(DATADIRNAME)
314    AC_SUBST(GMOFILES)
315    AC_SUBST(INSTOBJEXT)
316    AC_SUBST(INTLDEPS)
317    AC_SUBST(INTLLIBS)
318    AC_SUBST(INTLOBJS)
319    AC_SUBST(POFILES)
320    AC_SUBST(POSUB)
321  ])
322
323AC_DEFUN(AM_GNU_GETTEXT,
324  [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
325   AC_REQUIRE([AC_PROG_CC])dnl
326   AC_REQUIRE([AC_PROG_RANLIB])dnl
327   AC_REQUIRE([AC_ISC_POSIX])dnl
328   AC_REQUIRE([AC_HEADER_STDC])dnl
329   AC_REQUIRE([AC_C_CONST])dnl
330   AC_REQUIRE([AC_C_INLINE])dnl
331   AC_REQUIRE([AC_TYPE_OFF_T])dnl
332   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
333   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
334   AC_REQUIRE([AC_FUNC_MMAP])dnl
335
336   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
337unistd.h sys/param.h])
338   AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
339strdup __argz_count __argz_stringify __argz_next])
340
341   if test "${ac_cv_func_stpcpy+set}" != "set"; then
342     AC_CHECK_FUNCS(stpcpy)
343   fi
344   if test "${ac_cv_func_stpcpy}" = "yes"; then
345     AC_DEFINE(HAVE_STPCPY)
346   fi
347
348   AM_LC_MESSAGES
349   AM_WITH_NLS
350
351   if test "x$CATOBJEXT" != "x"; then
352     if test "x$ALL_LINGUAS" = "x"; then
353       LINGUAS=
354     else
355       AC_MSG_CHECKING(for catalogs to be installed)
356       NEW_LINGUAS=
357       for lang in ${LINGUAS=$ALL_LINGUAS}; do
358         case "$ALL_LINGUAS" in
359          *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
360         esac
361       done
362       LINGUAS=$NEW_LINGUAS
363       AC_MSG_RESULT($LINGUAS)
364     fi
365
366     dnl Construct list of names of catalog files to be constructed.
367     if test -n "$LINGUAS"; then
368       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
369     fi
370   fi
371
372   dnl The reference to <locale.h> in the installed <libintl.h> file
373   dnl must be resolved because we cannot expect the users of this
374   dnl to define HAVE_LOCALE_H.
375   if test $ac_cv_header_locale_h = yes; then
376     INCLUDE_LOCALE_H="#include <locale.h>"
377   else
378     INCLUDE_LOCALE_H="\
379/* The system does not provide the header <locale.h>.  Take care yourself.  */"
380   fi
381   AC_SUBST(INCLUDE_LOCALE_H)
382
383   dnl Determine which catalog format we have (if any is needed)
384   dnl For now we know about two different formats:
385   dnl   Linux libc-5 and the normal X/Open format
386   test -d intl || mkdir intl
387   if test "$CATOBJEXT" = ".cat"; then
388     AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
389
390     dnl Transform the SED scripts while copying because some dumb SEDs
391     dnl cannot handle comments.
392     sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
393   fi
394   dnl po2tbl.sed is always needed.
395   sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
396     $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
397
398   dnl In the intl/Makefile.in we have a special dependency which makes
399   dnl only sense for gettext.  We comment this out for non-gettext
400   dnl packages.
401   if test "$PACKAGE" = "gettext"; then
402     GT_NO="#NO#"
403     GT_YES=
404   else
405     GT_NO=
406     GT_YES="#YES#"
407   fi
408   AC_SUBST(GT_NO)
409   AC_SUBST(GT_YES)
410
411   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
412   dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
413   dnl Try to locate is.
414   MKINSTALLDIRS=
415   if test -n "$ac_aux_dir"; then
416     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
417   fi
418   if test -z "$MKINSTALLDIRS"; then
419     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
420   fi
421   AC_SUBST(MKINSTALLDIRS)
422
423   dnl *** For now the libtool support in intl/Makefile is not for real.
424   l=
425   AC_SUBST(l)
426
427   dnl Generate list of files to be processed by xgettext which will
428   dnl be included in po/Makefile.
429   test -d po || mkdir po
430   if test "x$srcdir" != "x."; then
431     if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
432       posrcprefix="$srcdir/"
433     else
434       posrcprefix="../$srcdir/"
435     fi
436   else
437     posrcprefix="../"
438   fi
439   rm -f po/POTFILES
440   sed -e "/^#/d" -e "/^\$/d" -e "s,.*,	$posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
441	< $srcdir/po/POTFILES.in > po/POTFILES
442  ])
443
444# Search path for a program which passes the given test.
445# Ulrich Drepper <drepper@cygnus.com>, 1996.
446#
447# This file can be copied and used freely without restrictions.  It can
448# be used in projects which are not available under the GNU Public License
449# but which still want to provide support for the GNU gettext functionality.
450# Please note that the actual code is *not* freely available.
451
452# serial 1
453
454dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
455dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
456AC_DEFUN(AM_PATH_PROG_WITH_TEST,
457[# Extract the first word of "$2", so it can be a program name with args.
458set dummy $2; ac_word=[$]2
459AC_MSG_CHECKING([for $ac_word])
460AC_CACHE_VAL(ac_cv_path_$1,
461[case "[$]$1" in
462  /*)
463  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
464  ;;
465  *)
466  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
467  for ac_dir in ifelse([$5], , $PATH, [$5]); do
468    test -z "$ac_dir" && ac_dir=.
469    if test -f $ac_dir/$ac_word; then
470      if [$3]; then
471	ac_cv_path_$1="$ac_dir/$ac_word"
472	break
473      fi
474    fi
475  done
476  IFS="$ac_save_ifs"
477dnl If no 4th arg is given, leave the cache variable unset,
478dnl so AC_PATH_PROGS will keep looking.
479ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
480])dnl
481  ;;
482esac])dnl
483$1="$ac_cv_path_$1"
484if test -n "[$]$1"; then
485  AC_MSG_RESULT([$]$1)
486else
487  AC_MSG_RESULT(no)
488fi
489AC_SUBST($1)dnl
490])
491
492# Check whether LC_MESSAGES is available in <locale.h>.
493# Ulrich Drepper <drepper@cygnus.com>, 1995.
494#
495# This file can be copied and used freely without restrictions.  It can
496# be used in projects which are not available under the GNU Public License
497# but which still want to provide support for the GNU gettext functionality.
498# Please note that the actual code is *not* freely available.
499
500# serial 1
501
502AC_DEFUN(AM_LC_MESSAGES,
503  [if test $ac_cv_header_locale_h = yes; then
504    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
505      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
506       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
507    if test $am_cv_val_LC_MESSAGES = yes; then
508      AC_DEFINE(HAVE_LC_MESSAGES)
509    fi
510  fi])
511
512