Fix CFLAGS/LDFLAGS syntax
[platform/upstream/lrzsz.git] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.3
2
3 dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
4 dnl This Makefile.in is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 dnl AC_REPLACE_GNU_GETOPT
14 AC_DEFUN(AC_REPLACE_GNU_GETOPT,
15 [AC_CHECK_FUNC(getopt_long, , [LIBOBJS="$LIBOBJS getopt1.o getopt.o"])
16 AC_SUBST(LIBOBJS)dnl
17 ])
18
19 dnl
20 dnl taken from taylor uucp
21 AC_DEFUN(LRZSZ_ERRNO_DECL,[
22 AC_MSG_CHECKING(for errno declaration)
23 AC_CACHE_VAL(lrzsz_cv_decl_errno,
24 [AC_TRY_COMPILE([#include <errno.h>], [int i = errno; errno = 1;],
25 lrzsz_cv_decl_errno=yes, lrzsz_cv_decl_errno=no)])
26 AC_MSG_RESULT($lrzsz_cv_decl_errno)
27 if test $lrzsz_cv_decl_errno = yes; then
28   AC_DEFINE([HAVE_ERRNO_DECLARATION])
29 fi
30 ])
31
32 dnl for ease of use
33 AC_DEFUN([LRZSZ_HEADERS_TERM_IO],[
34 AC_CHECK_HEADERS(termios.h sys/termios.h termio.h sys/termio.h sgtty.h)dnl
35 ])
36
37 dnl LRZSZ_TYPE_SPEED_T
38 AC_DEFUN(LRZSZ_TYPE_SPEED_T,[
39 AC_REQUIRE([AC_HEADER_STDC])dnl
40 AC_REQUIRE([LRZSZ_HEADERS_TERM_IO])dnl
41 AC_MSG_CHECKING(for speed_t)
42 AC_CACHE_VAL(ac_cv_type_speed_t,
43 [AC_EGREP_CPP(speed_t, [#include <sys/types.h>
44 #if STDC_HEADERS
45 #include <stdlib.h>
46 #include <stddef.h>
47 #endif
48 #ifdef HAVE_TERMIOS_H
49 #include <termios.h>
50 #else
51 #if defined(HAVE_SYS_TERMIOS_H)
52 #include <sys/termios.h>
53 #else
54 #if defined(HAVE_TERMIO_H)
55 #include <termio.h>
56 #else
57 #if defined(HAVE_SYS_TERMIO_H)
58 #include <sys/termio.h>
59 #else
60 #if defined(HAVE_SGTTY_H)
61 #include <sgtty.h>
62 #else
63 #error neither termio.h nor sgtty.h found. Cannot continue. */
64 #endif
65 #endif
66 #endif
67 #endif
68 #endif
69 ], ac_cv_type_speed_t=yes, ac_cv_type_speed_t=no)])dnl
70 AC_MSG_RESULT($ac_cv_type_speed_t)
71 if test $ac_cv_type_speed_t = no; then
72   AC_DEFINE([speed_t],long)
73 fi
74 ])
75
76 AC_DEFUN(lrzsz_HEADER_SYS_SELECT,
77 [AC_CACHE_CHECK([whether sys/time.h and sys/select.h may both be included],
78   lrzsz_cv_header_sys_select,
79 [AC_TRY_COMPILE([#include <sys/types.h>
80 #include <sys/time.h>
81 #include <sys/select.h>],
82 [struct tm *tp;], lrzsz_cv_header_sys_select=yes, lrzsz_cv_header_sys_select=no)])
83 if test $lrzsz_cv_header_sys_select = no; then
84   AC_DEFINE(SYS_TIME_WITHOUT_SYS_SELECT)
85 fi
86 ])
87
88
89 # Do all the work for Automake.  This macro actually does too much --
90 # some checks are only needed if your package does certain things.
91 # But this isn't really a big deal.
92
93 # serial 1
94
95 dnl Usage:
96 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
97
98 AC_DEFUN(AM_INIT_AUTOMAKE,
99 [AC_REQUIRE([AM_PROG_INSTALL])
100 PACKAGE=[$1]
101 AC_SUBST(PACKAGE)
102 VERSION=[$2]
103 AC_SUBST(VERSION)
104 dnl test to see if srcdir already configured
105 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
106   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
107 fi
108 ifelse([$3],,
109 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
110 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
111 AC_REQUIRE([AM_SANITY_CHECK])
112 AC_REQUIRE([AC_ARG_PROGRAM])
113 dnl FIXME This is truly gross.
114 missing_dir=`cd $ac_aux_dir && pwd`
115 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
116 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
117 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
118 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
119 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
120 AC_REQUIRE([AC_PROG_MAKE_SET])])
121
122
123 # serial 1
124
125 AC_DEFUN(AM_PROG_INSTALL,
126 [AC_REQUIRE([AC_PROG_INSTALL])
127 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
128 AC_SUBST(INSTALL_SCRIPT)dnl
129 ])
130
131 #
132 # Check to make sure that the build environment is sane.
133 #
134
135 AC_DEFUN(AM_SANITY_CHECK,
136 [AC_MSG_CHECKING([whether build environment is sane])
137 # Just in case
138 sleep 1
139 echo timestamp > conftestfile
140 # Do `set' in a subshell so we don't clobber the current shell's
141 # arguments.  Must try -L first in case configure is actually a
142 # symlink; some systems play weird games with the mod time of symlinks
143 # (eg FreeBSD returns the mod time of the symlink's containing
144 # directory).
145 if (
146    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
147    if test "[$]*" = "X"; then
148       # -L didn't work.
149       set X `ls -t $srcdir/configure conftestfile`
150    fi
151    if test "[$]*" != "X $srcdir/configure conftestfile" \
152       && test "[$]*" != "X conftestfile $srcdir/configure"; then
153
154       # If neither matched, then we have a broken ls.  This can happen
155       # if, for instance, CONFIG_SHELL is bash and it inherits a
156       # broken ls alias from the environment.  This has actually
157       # happened.  Such a system could not be considered "sane".
158       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
159 alias in your environment])
160    fi
161
162    test "[$]2" = conftestfile
163    )
164 then
165    # Ok.
166    :
167 else
168    AC_MSG_ERROR([newly created file is older than distributed files!
169 Check your system clock])
170 fi
171 rm -f conftest*
172 AC_MSG_RESULT(yes)])
173
174 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
175 dnl The program must properly implement --version.
176 AC_DEFUN(AM_MISSING_PROG,
177 [AC_MSG_CHECKING(for working $2)
178 # Run test in a subshell; some versions of sh will print an error if
179 # an executable is not found, even if stderr is redirected.
180 # Redirect stdin to placate older versions of autoconf.  Sigh.
181 if ($2 --version) < /dev/null > /dev/null 2>&1; then
182    $1=$2
183    AC_MSG_RESULT(found)
184 else
185    $1="$3/missing $2"
186    AC_MSG_RESULT(missing)
187 fi
188 AC_SUBST($1)])
189
190 # Like AC_CONFIG_HEADER, but automatically create stamp file.
191
192 AC_DEFUN(AM_CONFIG_HEADER,
193 [AC_PREREQ([2.12])
194 AC_CONFIG_HEADER([$1])
195 dnl When config.status generates a header, we must update the stamp-h file.
196 dnl This file resides in the same directory as the config header
197 dnl that is generated.  We must strip everything past the first ":",
198 dnl and everything past the last "/".
199 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
200 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
201 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
202 <<am_indx=1
203 for am_file in <<$1>>; do
204   case " <<$>>CONFIG_HEADERS " in
205   *" <<$>>am_file "*<<)>>
206     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
207     ;;
208   esac
209   am_indx=`expr "<<$>>am_indx" + 1`
210 done<<>>dnl>>)
211 changequote([,]))])
212
213
214 # serial 1
215
216 AC_DEFUN(AM_C_PROTOTYPES,
217 [AC_REQUIRE([AM_PROG_CC_STDC])
218 AC_REQUIRE([AC_PROG_CPP])
219 AC_MSG_CHECKING([for function prototypes])
220 if test "$am_cv_prog_cc_stdc" != no; then
221   AC_MSG_RESULT(yes)
222   AC_DEFINE(PROTOTYPES)
223   U= ANSI2KNR=
224 else
225   AC_MSG_RESULT(no)
226   U=_ ANSI2KNR=./ansi2knr
227   # Ensure some checks needed by ansi2knr itself.
228   AC_HEADER_STDC
229   AC_CHECK_HEADERS(string.h)
230 fi
231 AC_SUBST(U)dnl
232 AC_SUBST(ANSI2KNR)dnl
233 ])
234
235
236 # serial 1
237
238 # @defmac AC_PROG_CC_STDC
239 # @maindex PROG_CC_STDC
240 # @ovindex CC
241 # If the C compiler in not in ANSI C mode by default, try to add an option
242 # to output variable @code{CC} to make it so.  This macro tries various
243 # options that select ANSI C on some system or another.  It considers the
244 # compiler to be in ANSI C mode if it handles function prototypes correctly.
245 #
246 # If you use this macro, you should check after calling it whether the C
247 # compiler has been set to accept ANSI C; if not, the shell variable
248 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
249 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
250 # program @code{ansi2knr}, which comes with Ghostscript.
251 # @end defmac
252
253 AC_DEFUN(AM_PROG_CC_STDC,
254 [AC_REQUIRE([AC_PROG_CC])
255 AC_BEFORE([$0], [AC_C_INLINE])
256 AC_BEFORE([$0], [AC_C_CONST])
257 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
258 dnl a magic option to avoid problems with ANSI preprocessor commands
259 dnl like #elif.
260 dnl FIXME: can't do this because then AC_AIX won't work due to a
261 dnl circular dependency.
262 dnl AC_BEFORE([$0], [AC_PROG_CPP])
263 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
264 AC_CACHE_VAL(am_cv_prog_cc_stdc,
265 [am_cv_prog_cc_stdc=no
266 ac_save_CC="$CC"
267 # Don't try gcc -ansi; that turns off useful extensions and
268 # breaks some systems' header files.
269 # AIX                   -qlanglvl=ansi
270 # Ultrix and OSF/1      -std1
271 # HP-UX                 -Aa -D_HPUX_SOURCE
272 # SVR4                  -Xc -D__EXTENSIONS__
273 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
274 do
275   CC="$ac_save_CC $ac_arg"
276   AC_TRY_COMPILE(
277 [#include <stdarg.h>
278 #include <stdio.h>
279 #include <sys/types.h>
280 #include <sys/stat.h>
281 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
282 struct buf { int x; };
283 FILE * (*rcsopen) (struct buf *, struct stat *, int);
284 static char *e (p, i)
285      char **p;
286      int i;
287 {
288   return p[i];
289 }
290 static char *f (char * (*g) (char **, int), char **p, ...)
291 {
292   char *s;
293   va_list v;
294   va_start (v,p);
295   s = g (p, va_arg (v,int));
296   va_end (v);
297   return s;
298 }
299 int test (int i, double x);
300 struct s1 {int (*f) (int a);};
301 struct s2 {int (*f) (double a);};
302 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
303 int argc;
304 char **argv;
305 ], [
306 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
307 ],
308 [am_cv_prog_cc_stdc="$ac_arg"; break])
309 done
310 CC="$ac_save_CC"
311 ])
312 if test -z "$am_cv_prog_cc_stdc"; then
313   AC_MSG_RESULT([none needed])
314 else
315   AC_MSG_RESULT($am_cv_prog_cc_stdc)
316 fi
317 case "x$am_cv_prog_cc_stdc" in
318   x|xno) ;;
319   *) CC="$CC $am_cv_prog_cc_stdc" ;;
320 esac
321 ])
322
323 # Macro to add for using GNU gettext.
324 # Ulrich Drepper <drepper@cygnus.com>, 1995.
325 #
326 # This file file 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.
330
331 # serial 3
332
333 AC_DEFUN(AM_WITH_NLS,
334   [AC_MSG_CHECKING([whether NLS is requested])
335     dnl Default is enabled NLS
336     AC_ARG_ENABLE(nls,
337       [  --disable-nls           do not use Native Language Support],
338       USE_NLS=$enableval, USE_NLS=yes)
339     AC_MSG_RESULT($USE_NLS)
340     AC_SUBST(USE_NLS)
341
342     USE_INCLUDED_LIBINTL=no
343
344     dnl If we use NLS figure out what method
345     if test "$USE_NLS" = "yes"; then
346       AC_DEFINE(ENABLE_NLS)
347       AC_MSG_CHECKING([whether included gettext is requested])
348       AC_ARG_WITH(included-gettext,
349         [  --with-included-gettext use the GNU gettext library included here],
350         nls_cv_force_use_gnu_gettext=$withval,
351         nls_cv_force_use_gnu_gettext=no)
352       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
353
354       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
355       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
356         dnl User does not insist on using GNU NLS library.  Figure out what
357         dnl to use.  If gettext or catgets are available (in this order) we
358         dnl use this.  Else we have to fall back to GNU NLS library.
359         dnl catgets is only used if permitted by option --with-catgets.
360         nls_cv_header_intl=
361         nls_cv_header_libgt=
362         CATOBJEXT=NONE
363
364         AC_CHECK_HEADER(libintl.h,
365           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
366             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
367                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
368
369            if test "$gt_cv_func_gettext_libc" != "yes"; then
370              AC_CHECK_LIB(intl, bindtextdomain,
371                [AC_CACHE_CHECK([for gettext in libintl],
372                  gt_cv_func_gettext_libintl,
373                  [AC_TRY_LINK([], [return (int) gettext ("")],
374                  gt_cv_func_gettext_libintl=yes,
375                  gt_cv_func_gettext_libintl=no)])])
376            fi
377
378            if test "$gt_cv_func_gettext_libc" = "yes" \
379               || test "$gt_cv_func_gettext_libintl" = "yes"; then
380               AC_DEFINE(HAVE_GETTEXT)
381               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
382                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
383               if test "$MSGFMT" != "no"; then
384                 AC_CHECK_FUNCS(dcgettext)
385                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
386                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
387                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
388                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
389                                return _nl_msg_cat_cntr],
390                   [CATOBJEXT=.gmo
391                    DATADIRNAME=share],
392                   [CATOBJEXT=.mo
393                    DATADIRNAME=lib])
394                 INSTOBJEXT=.mo
395               fi
396             fi
397         ])
398
399         if test "$CATOBJEXT" = "NONE"; then
400           AC_MSG_CHECKING([whether catgets can be used])
401           AC_ARG_WITH(catgets,
402             [  --with-catgets          use catgets functions if available],
403             nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
404           AC_MSG_RESULT($nls_cv_use_catgets)
405
406           if test "$nls_cv_use_catgets" = "yes"; then
407             dnl No gettext in C library.  Try catgets next.
408             AC_CHECK_LIB(i, main)
409             AC_CHECK_FUNC(catgets,
410               [AC_DEFINE(HAVE_CATGETS)
411                INTLOBJS="\$(CATOBJS)"
412                AC_PATH_PROG(GENCAT, gencat, no)dnl
413                if test "$GENCAT" != "no"; then
414                  AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
415                  if test "$GMSGFMT" = "no"; then
416                    AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
417                     [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
418                  fi
419                  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
420                    [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
421                  USE_INCLUDED_LIBINTL=yes
422                  CATOBJEXT=.cat
423                  INSTOBJEXT=.cat
424                  DATADIRNAME=lib
425                  INTLDEPS='$(top_builddir)/intl/libintl.a'
426                  INTLLIBS=$INTLDEPS
427                  LIBS=`echo $LIBS | sed -e 's/-lintl//'`
428                  nls_cv_header_intl=intl/libintl.h
429                  nls_cv_header_libgt=intl/libgettext.h
430                fi])
431           fi
432         fi
433
434         if test "$CATOBJEXT" = "NONE"; then
435           dnl Neither gettext nor catgets in included in the C library.
436           dnl Fall back on GNU gettext library.
437           nls_cv_use_gnu_gettext=yes
438         fi
439       fi
440
441       if test "$nls_cv_use_gnu_gettext" = "yes"; then
442         dnl Mark actions used to generate GNU NLS library.
443         INTLOBJS="\$(GETTOBJS)"
444         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
445           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
446         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
447         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
448           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
449         AC_SUBST(MSGFMT)
450         USE_INCLUDED_LIBINTL=yes
451         CATOBJEXT=.gmo
452         INSTOBJEXT=.mo
453         DATADIRNAME=share
454         INTLDEPS='$(top_builddir)/intl/libintl.a'
455         INTLLIBS=$INTLDEPS
456         LIBS=`echo $LIBS | sed -e 's/-lintl//'`
457         nls_cv_header_intl=intl/libintl.h
458         nls_cv_header_libgt=intl/libgettext.h
459       fi
460
461       dnl Test whether we really found GNU xgettext.
462       if test "$XGETTEXT" != ":"; then
463         dnl If it is no GNU xgettext we define it as : so that the
464         dnl Makefiles still can work.
465         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
466           : ;
467         else
468           AC_MSG_RESULT(
469             [found xgettext programs is not GNU xgettext; ignore it])
470           XGETTEXT=":"
471         fi
472       fi
473
474       # We need to process the po/ directory.
475       POSUB=po
476     else
477       DATADIRNAME=share
478       nls_cv_header_intl=intl/libintl.h
479       nls_cv_header_libgt=intl/libgettext.h
480     fi
481
482     # If this is used in GNU gettext we have to set USE_NLS to `yes'
483     # because some of the sources are only built for this goal.
484     if test "$PACKAGE" = gettext; then
485       USE_NLS=yes
486       USE_INCLUDED_LIBINTL=yes
487     fi
488
489     dnl These rules are solely for the distribution goal.  While doing this
490     dnl we only have to keep exactly one list of the available catalogs
491     dnl in configure.in.
492     for lang in $ALL_LINGUAS; do
493       GMOFILES="$GMOFILES $lang.gmo"
494       POFILES="$POFILES $lang.po"
495     done
496
497     dnl Make all variables we use known to autoconf.
498     AC_SUBST(USE_INCLUDED_LIBINTL)
499     AC_SUBST(CATALOGS)
500     AC_SUBST(CATOBJEXT)
501     AC_SUBST(DATADIRNAME)
502     AC_SUBST(GMOFILES)
503     AC_SUBST(INSTOBJEXT)
504     AC_SUBST(INTLDEPS)
505     AC_SUBST(INTLLIBS)
506     AC_SUBST(INTLOBJS)
507     AC_SUBST(POFILES)
508     AC_SUBST(POSUB)
509   ])
510
511 AC_DEFUN(AM_GNU_GETTEXT,
512   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
513    AC_REQUIRE([AC_PROG_CC])dnl
514    AC_REQUIRE([AC_PROG_RANLIB])dnl
515    AC_REQUIRE([AC_ISC_POSIX])dnl
516    AC_REQUIRE([AC_HEADER_STDC])dnl
517    AC_REQUIRE([AC_C_CONST])dnl
518    AC_REQUIRE([AC_C_INLINE])dnl
519    AC_REQUIRE([AC_TYPE_OFF_T])dnl
520    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
521    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
522    AC_REQUIRE([AC_FUNC_MMAP])dnl
523
524    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
525 unistd.h values.h sys/param.h])
526    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
527 __argz_count __argz_stringify __argz_next])
528
529    if test "${ac_cv_func_stpcpy+set}" != "set"; then
530      AC_CHECK_FUNCS(stpcpy)
531    fi
532    if test "${ac_cv_func_stpcpy}" = "yes"; then
533      AC_DEFINE(HAVE_STPCPY)
534    fi
535
536    AM_LC_MESSAGES
537    AM_WITH_NLS
538
539    if test "x$CATOBJEXT" != "x"; then
540      if test "x$ALL_LINGUAS" = "x"; then
541        LINGUAS=
542      else
543        AC_MSG_CHECKING(for catalogs to be installed)
544        NEW_LINGUAS=
545        for lang in ${LINGUAS=$ALL_LINGUAS}; do
546          case "$ALL_LINGUAS" in
547           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
548          esac
549        done
550        LINGUAS=$NEW_LINGUAS
551        AC_MSG_RESULT($LINGUAS)
552      fi
553
554      dnl Construct list of names of catalog files to be constructed.
555      if test -n "$LINGUAS"; then
556        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
557      fi
558    fi
559
560    dnl The reference to <locale.h> in the installed <libintl.h> file
561    dnl must be resolved because we cannot expect the users of this
562    dnl to define HAVE_LOCALE_H.
563    if test $ac_cv_header_locale_h = yes; then
564      INCLUDE_LOCALE_H="#include <locale.h>"
565    else
566      INCLUDE_LOCALE_H="\
567 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
568    fi
569    AC_SUBST(INCLUDE_LOCALE_H)
570
571    dnl Determine which catalog format we have (if any is needed)
572    dnl For now we know about two different formats:
573    dnl   Linux libc-5 and the normal X/Open format
574    test -d intl || mkdir intl
575    if test "$CATOBJEXT" = ".cat"; then
576      AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
577
578      dnl Transform the SED scripts while copying because some dumb SEDs
579      dnl cannot handle comments.
580      sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
581    fi
582    dnl po2tbl.sed is always needed.
583    sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
584      $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
585
586    dnl In the intl/Makefile.in we have a special dependency which makes
587    dnl only sense for gettext.  We comment this out for non-gettext
588    dnl packages.
589    if test "$PACKAGE" = "gettext"; then
590      GT_NO="#NO#"
591      GT_YES=
592    else
593      GT_NO=
594      GT_YES="#YES#"
595    fi
596    AC_SUBST(GT_NO)
597    AC_SUBST(GT_YES)
598
599    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
600    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
601    dnl Try to locate is.
602    MKINSTALLDIRS=
603    if test -n "$ac_aux_dir"; then
604      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
605    fi
606    if test -z "$MKINSTALLDIRS"; then
607      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
608    fi
609    AC_SUBST(MKINSTALLDIRS)
610
611    dnl *** For now the libtool support in intl/Makefile is not for real.
612    l=
613    AC_SUBST(l)
614
615    dnl Generate list of files to be processed by xgettext which will
616    dnl be included in po/Makefile.
617    test -d po || mkdir po
618    if test "x$srcdir" != "x."; then
619      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
620        posrcprefix="$srcdir/"
621      else
622        posrcprefix="../$srcdir/"
623      fi
624    else
625      posrcprefix="../"
626    fi
627    rm -f po/POTFILES
628    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
629         < $srcdir/po/POTFILES.in > po/POTFILES
630   ])
631
632 # Search path for a program which passes the given test.
633 # Ulrich Drepper <drepper@cygnus.com>, 1996.
634 #
635 # This file file be copied and used freely without restrictions.  It can
636 # be used in projects which are not available under the GNU Public License
637 # but which still want to provide support for the GNU gettext functionality.
638 # Please note that the actual code is *not* freely available.
639
640 # serial 1
641
642 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
643 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
644 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
645 [# Extract the first word of "$2", so it can be a program name with args.
646 set dummy $2; ac_word=[$]2
647 AC_MSG_CHECKING([for $ac_word])
648 AC_CACHE_VAL(ac_cv_path_$1,
649 [case "[$]$1" in
650   /*)
651   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
652   ;;
653   *)
654   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
655   for ac_dir in ifelse([$5], , $PATH, [$5]); do
656     test -z "$ac_dir" && ac_dir=.
657     if test -f $ac_dir/$ac_word; then
658       if [$3]; then
659         ac_cv_path_$1="$ac_dir/$ac_word"
660         break
661       fi
662     fi
663   done
664   IFS="$ac_save_ifs"
665 dnl If no 4th arg is given, leave the cache variable unset,
666 dnl so AC_PATH_PROGS will keep looking.
667 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
668 ])dnl
669   ;;
670 esac])dnl
671 $1="$ac_cv_path_$1"
672 if test -n "[$]$1"; then
673   AC_MSG_RESULT([$]$1)
674 else
675   AC_MSG_RESULT(no)
676 fi
677 AC_SUBST($1)dnl
678 ])
679
680 # Check whether LC_MESSAGES is available in <locale.h>.
681 # Ulrich Drepper <drepper@cygnus.com>, 1995.
682 #
683 # This file file be copied and used freely without restrictions.  It can
684 # be used in projects which are not available under the GNU Public License
685 # but which still want to provide support for the GNU gettext functionality.
686 # Please note that the actual code is *not* freely available.
687
688 # serial 1
689
690 AC_DEFUN(AM_LC_MESSAGES,
691   [if test $ac_cv_header_locale_h = yes; then
692     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
693       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
694        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
695     if test $am_cv_val_LC_MESSAGES = yes; then
696       AC_DEFINE(HAVE_LC_MESSAGES)
697     fi
698   fi])
699