- New function Buf_Append(), which is given a pointer to a string to
[dragonfly.git] / contrib / gcc / aclocal.m4
1 dnl See whether we can include both string.h and strings.h.
2 AC_DEFUN(GCC_HEADER_STRING,
3 [AC_CACHE_CHECK([whether string.h and strings.h may both be included],
4   gcc_cv_header_string,
5 [AC_TRY_COMPILE([#include <string.h>
6 #include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
7 if test $gcc_cv_header_string = yes; then
8   AC_DEFINE(STRING_WITH_STRINGS)
9 fi
10 ])
11
12 dnl See whether we need a declaration for a function.
13 dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
14 AC_DEFUN(GCC_NEED_DECLARATION,
15 [AC_MSG_CHECKING([whether $1 must be declared])
16 AC_CACHE_VAL(gcc_cv_decl_needed_$1,
17 [AC_TRY_COMPILE([
18 #include <stdio.h>
19 #ifdef STRING_WITH_STRINGS
20 # include <string.h>
21 # include <strings.h>
22 #else
23 # ifdef HAVE_STRING_H
24 #  include <string.h>
25 # else
26 #  ifdef HAVE_STRINGS_H
27 #   include <strings.h>
28 #  endif
29 # endif
30 #endif
31 #ifdef HAVE_STDLIB_H
32 #include <stdlib.h>
33 #endif
34 #ifdef HAVE_UNISTD_H
35 #include <unistd.h>
36 #endif
37 #ifndef HAVE_RINDEX
38 #define rindex strrchr
39 #endif
40 #ifndef HAVE_INDEX
41 #define index strchr
42 #endif
43 $2],
44 [char *(*pfn) = (char *(*)) $1],
45 eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")])
46 if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then
47   AC_MSG_RESULT(yes)
48   gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
49   AC_DEFINE_UNQUOTED($gcc_tr_decl)
50 else
51   AC_MSG_RESULT(no)
52 fi
53 ])dnl
54
55 dnl Check multiple functions to see whether each needs a declaration.
56 dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
57 AC_DEFUN(GCC_NEED_DECLARATIONS,
58 [for ac_func in $1
59 do
60 GCC_NEED_DECLARATION($ac_func, $2)
61 done
62 ])
63
64 dnl Check if we have vprintf and possibly _doprnt.
65 dnl Note autoconf checks for vprintf even though we care about vfprintf.
66 AC_DEFUN(GCC_FUNC_VFPRINTF_DOPRNT,
67 [AC_FUNC_VPRINTF
68 vfprintf=
69 doprint=
70 if test $ac_cv_func_vprintf != yes ; then
71   vfprintf=vfprintf.o
72   if test $ac_cv_func__doprnt != yes ; then
73     doprint=doprint.o
74   fi
75 fi
76 AC_SUBST(vfprintf)
77 AC_SUBST(doprint)
78 ])    
79
80 dnl See if the printf functions in libc support %p in format strings.
81 AC_DEFUN(GCC_FUNC_PRINTF_PTR,
82 [AC_CACHE_CHECK(whether the printf functions support %p,
83   gcc_cv_func_printf_ptr,
84 [AC_TRY_RUN([#include <stdio.h>
85
86 main()
87 {
88   char buf[64];
89   char *p = buf, *q = NULL;
90   sprintf(buf, "%p", p);
91   sscanf(buf, "%p", &q);
92   exit (p != q);
93 }], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
94         gcc_cv_func_printf_ptr=no)
95 rm -f core core.* *.core])
96 if test $gcc_cv_func_printf_ptr = yes ; then
97   AC_DEFINE(HAVE_PRINTF_PTR)
98 fi
99 ])
100
101 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
102 AC_DEFUN(GCC_PROG_LN_S,
103 [AC_MSG_CHECKING(whether ln -s works)
104 AC_CACHE_VAL(gcc_cv_prog_LN_S,
105 [rm -f conftestdata_t
106 echo >conftestdata_f
107 if ln -s conftestdata_f conftestdata_t 2>/dev/null
108 then
109   gcc_cv_prog_LN_S="ln -s"
110 else
111   if ln conftestdata_f conftestdata_t 2>/dev/null
112   then
113     gcc_cv_prog_LN_S=ln
114   else
115     gcc_cv_prog_LN_S=cp
116   fi
117 fi
118 rm -f conftestdata_f conftestdata_t
119 ])dnl
120 LN_S="$gcc_cv_prog_LN_S"
121 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
122   AC_MSG_RESULT(yes)
123 else
124   if test "$gcc_cv_prog_LN_S" = "ln"; then
125     AC_MSG_RESULT([no, using ln])
126   else
127     AC_MSG_RESULT([no, and neither does ln, so using cp])
128   fi
129 fi
130 AC_SUBST(LN_S)dnl
131 ])
132
133 dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
134 AC_DEFUN(GCC_PROG_LN,
135 [AC_MSG_CHECKING(whether ln works)
136 AC_CACHE_VAL(gcc_cv_prog_LN,
137 [rm -f conftestdata_t
138 echo >conftestdata_f
139 if ln conftestdata_f conftestdata_t 2>/dev/null
140 then
141   gcc_cv_prog_LN="ln"
142 else
143   if ln -s conftestdata_f conftestdata_t 2>/dev/null
144   then
145     gcc_cv_prog_LN="ln -s"
146   else
147     gcc_cv_prog_LN=cp
148   fi
149 fi
150 rm -f conftestdata_f conftestdata_t
151 ])dnl
152 LN="$gcc_cv_prog_LN"
153 if test "$gcc_cv_prog_LN" = "ln"; then
154   AC_MSG_RESULT(yes)
155 else
156   if test "$gcc_cv_prog_LN" = "ln -s"; then
157     AC_MSG_RESULT([no, using ln -s])
158   else
159     AC_MSG_RESULT([no, and neither does ln -s, so using cp])
160   fi
161 fi
162 AC_SUBST(LN)dnl
163 ])
164
165 dnl See whether the stage1 host compiler accepts the volatile keyword.
166 AC_DEFUN(GCC_C_VOLATILE,
167 [AC_CACHE_CHECK([for volatile], gcc_cv_c_volatile,
168 [AC_TRY_COMPILE(, [volatile int foo;],
169         gcc_cv_c_volatile=yes, gcc_cv_c_volatile=no)])
170 if test $gcc_cv_c_volatile = yes ; then
171   AC_DEFINE(HAVE_VOLATILE)
172 fi
173 ])
174
175 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
176 dnl of the usual 2.
177 AC_DEFUN(GCC_FUNC_MKDIR_TAKES_ONE_ARG,
178 [AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
179 [AC_TRY_COMPILE([
180 #include <sys/types.h>
181 #ifdef HAVE_SYS_STAT_H
182 # include <sys/stat.h>
183 #endif
184 #ifdef HAVE_UNISTD_H
185 # include <unistd.h>
186 #endif
187 #ifdef HAVE_DIRECT_H
188 # include <direct.h>
189 #endif], [mkdir ("foo", 0);], 
190         gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
191 if test $gcc_cv_mkdir_takes_one_arg = yes ; then
192   AC_DEFINE(MKDIR_TAKES_ONE_ARG)
193 fi
194 ])
195
196 AC_DEFUN(EGCS_PROG_INSTALL,
197 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
198 # Find a good install program.  We prefer a C program (faster),
199 # so one script is as good as another.  But avoid the broken or
200 # incompatible versions:
201 # SysV /etc/install, /usr/sbin/install
202 # SunOS /usr/etc/install
203 # IRIX /sbin/install
204 # AIX /bin/install
205 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
206 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
207 # ./install, which can be erroneously created by make from ./install.sh.
208 AC_MSG_CHECKING(for a BSD compatible install)
209 if test -z "$INSTALL"; then
210 AC_CACHE_VAL(ac_cv_path_install,
211 [  IFS="${IFS=  }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
212   for ac_dir in $PATH; do
213     # Account for people who put trailing slashes in PATH elements.
214     case "$ac_dir/" in
215     /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
216     *)
217       # OSF1 and SCO ODT 3.0 have their own names for install.
218       for ac_prog in ginstall scoinst install; do
219         if test -f $ac_dir/$ac_prog; then
220           if test $ac_prog = install &&
221             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
222             # AIX install.  It has an incompatible calling convention.
223             # OSF/1 installbsd also uses dspmsg, but is usable.
224             :
225           else
226             ac_cv_path_install="$ac_dir/$ac_prog -c"
227             break 2
228           fi
229         fi
230       done
231       ;;
232     esac
233   done
234   IFS="$ac_save_IFS"
235 ])dnl
236   if test "${ac_cv_path_install+set}" = set; then
237     INSTALL="$ac_cv_path_install"
238   else
239     # As a last resort, use the slow shell script.  We don't cache a
240     # path for INSTALL within a source directory, because that will
241     # break other packages using the cache if that directory is
242     # removed, or if the path is relative.
243     INSTALL="$ac_install_sh"
244   fi
245 fi
246 dnl We do special magic for INSTALL instead of AC_SUBST, to get
247 dnl relative paths right.
248 AC_MSG_RESULT($INSTALL)
249 AC_SUBST(INSTALL)dnl
250
251 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
252 # It thinks the first close brace ends the variable substitution.
253 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
254 AC_SUBST(INSTALL_PROGRAM)dnl
255
256 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
257 AC_SUBST(INSTALL_DATA)dnl
258 ])
259
260 #serial 1
261 dnl This test replaces the one in autoconf.
262 dnl Currently this macro should have the same name as the autoconf macro
263 dnl because gettext's gettext.m4 (distributed in the automake package)
264 dnl still uses it.  Otherwise, the use in gettext.m4 makes autoheader
265 dnl give these diagnostics:
266 dnl   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
267 dnl   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
268
269 undefine([AC_ISC_POSIX])
270 AC_DEFUN(AC_ISC_POSIX,
271   [
272     dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
273     AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
274   ]
275 )
276
277 # Macro to add for using GNU gettext.
278 # Ulrich Drepper <drepper@cygnus.com>, 1995.
279 #
280 # This file can be copied and used freely without restrictions.  It can
281 # be used in projects which are not available under the GNU Public License
282 # but which still want to provide support for the GNU gettext functionality.
283 # Please note that the actual code is *not* freely available.
284
285 # serial 5
286
287 AC_DEFUN(AM_WITH_NLS,
288   [AC_MSG_CHECKING([whether NLS is requested])
289     dnl Default is enabled NLS
290     AC_ARG_ENABLE(nls,
291       [  --disable-nls           do not use Native Language Support],
292       USE_NLS=$enableval, USE_NLS=yes)
293     AC_MSG_RESULT($USE_NLS)
294     AC_SUBST(USE_NLS)
295
296     USE_INCLUDED_LIBINTL=no
297
298     dnl If we use NLS figure out what method
299     if test "$USE_NLS" = "yes"; then
300       AC_DEFINE(ENABLE_NLS)
301       AC_MSG_CHECKING([whether included gettext is requested])
302       AC_ARG_WITH(included-gettext,
303         [  --with-included-gettext use the GNU gettext library included here],
304         nls_cv_force_use_gnu_gettext=$withval,
305         nls_cv_force_use_gnu_gettext=no)
306       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
307
308       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
309       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
310         dnl User does not insist on using GNU NLS library.  Figure out what
311         dnl to use.  If gettext or catgets are available (in this order) we
312         dnl use this.  Else we have to fall back to GNU NLS library.
313         dnl catgets is only used if permitted by option --with-catgets.
314         nls_cv_header_intl=
315         nls_cv_header_libgt=
316         CATOBJEXT=NONE
317
318         AC_CHECK_HEADER(libintl.h,
319           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
320             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
321                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
322
323            if test "$gt_cv_func_gettext_libc" != "yes"; then
324              AC_CHECK_LIB(intl, bindtextdomain,
325                [AC_CACHE_CHECK([for gettext in libintl],
326                  gt_cv_func_gettext_libintl,
327                  [AC_CHECK_LIB(intl, gettext,
328                   gt_cv_func_gettext_libintl=yes,
329                   gt_cv_func_gettext_libintl=no)],
330                  gt_cv_func_gettext_libintl=no)])
331            fi
332
333            if test "$gt_cv_func_gettext_libc" = "yes" \
334               || test "$gt_cv_func_gettext_libintl" = "yes"; then
335               AC_DEFINE(HAVE_GETTEXT)
336               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
337                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
338               if test "$MSGFMT" != "no"; then
339                 AC_CHECK_FUNCS(dcgettext)
340                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
341                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
342                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
343                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
344                                return _nl_msg_cat_cntr],
345                   [CATOBJEXT=.gmo
346                    DATADIRNAME=share],
347                   [CATOBJEXT=.mo
348                    DATADIRNAME=lib])
349                 INSTOBJEXT=.mo
350               fi
351             fi
352         ])
353
354         if test "$CATOBJEXT" = "NONE"; then
355           AC_MSG_CHECKING([whether catgets can be used])
356           AC_ARG_WITH(catgets,
357             [  --with-catgets          use catgets functions if available],
358             nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
359           AC_MSG_RESULT($nls_cv_use_catgets)
360
361           if test "$nls_cv_use_catgets" = "yes"; then
362             dnl No gettext in C library.  Try catgets next.
363             AC_CHECK_LIB(i, main)
364             AC_CHECK_FUNC(catgets,
365               [AC_DEFINE(HAVE_CATGETS)
366                INTLOBJS="\$(CATOBJS)"
367                AC_PATH_PROG(GENCAT, gencat, no)dnl
368                if test "$GENCAT" != "no"; then
369                  AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
370                  if test "$GMSGFMT" = "no"; then
371                    AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
372                     [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
373                  fi
374                  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
375                    [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
376                  USE_INCLUDED_LIBINTL=yes
377                  CATOBJEXT=.cat
378                  INSTOBJEXT=.cat
379                  DATADIRNAME=lib
380                  INTLDEPS='$(top_builddir)/intl/libintl.a'
381                  INTLLIBS=$INTLDEPS
382                  LIBS=`echo $LIBS | sed -e 's/-lintl//'`
383                  nls_cv_header_intl=intl/libintl.h
384                  nls_cv_header_libgt=intl/libgettext.h
385                fi])
386           fi
387         fi
388
389         if test "$CATOBJEXT" = "NONE"; then
390           dnl Neither gettext nor catgets in included in the C library.
391           dnl Fall back on GNU gettext library.
392           nls_cv_use_gnu_gettext=yes
393         fi
394       fi
395
396       if test "$nls_cv_use_gnu_gettext" = "yes"; then
397         dnl Mark actions used to generate GNU NLS library.
398         INTLOBJS="\$(GETTOBJS)"
399         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
400           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
401         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
402         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
403           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
404         AC_SUBST(MSGFMT)
405         USE_INCLUDED_LIBINTL=yes
406         CATOBJEXT=.gmo
407         INSTOBJEXT=.mo
408         DATADIRNAME=share
409         INTLDEPS='$(top_builddir)/intl/libintl.a'
410         INTLLIBS=$INTLDEPS
411         LIBS=`echo $LIBS | sed -e 's/-lintl//'`
412         nls_cv_header_intl=intl/libintl.h
413         nls_cv_header_libgt=intl/libgettext.h
414       fi
415
416       dnl Test whether we really found GNU xgettext.
417       if test "$XGETTEXT" != ":"; then
418         dnl If it is no GNU xgettext we define it as : so that the
419         dnl Makefiles still can work.
420         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
421           : ;
422         else
423           AC_MSG_RESULT(
424             [found xgettext program is not GNU xgettext; ignore it])
425           XGETTEXT=":"
426         fi
427       fi
428
429       # We need to process the po/ directory.
430       POSUB=po
431     else
432       DATADIRNAME=share
433       nls_cv_header_intl=intl/libintl.h
434       nls_cv_header_libgt=intl/libgettext.h
435     fi
436     AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
437     AC_OUTPUT_COMMANDS(
438      [case "$CONFIG_FILES" in *po/Makefile.in*)
439         sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
440       esac])
441
442
443     # If this is used in GNU gettext we have to set USE_NLS to `yes'
444     # because some of the sources are only built for this goal.
445     if test "$PACKAGE" = gettext; then
446       USE_NLS=yes
447       USE_INCLUDED_LIBINTL=yes
448     fi
449
450     dnl These rules are solely for the distribution goal.  While doing this
451     dnl we only have to keep exactly one list of the available catalogs
452     dnl in configure.in.
453     for lang in $ALL_LINGUAS; do
454       GMOFILES="$GMOFILES $lang.gmo"
455       POFILES="$POFILES $lang.po"
456     done
457
458     dnl Make all variables we use known to autoconf.
459     AC_SUBST(USE_INCLUDED_LIBINTL)
460     AC_SUBST(CATALOGS)
461     AC_SUBST(CATOBJEXT)
462     AC_SUBST(DATADIRNAME)
463     AC_SUBST(GMOFILES)
464     AC_SUBST(INSTOBJEXT)
465     AC_SUBST(INTLDEPS)
466     AC_SUBST(INTLLIBS)
467     AC_SUBST(INTLOBJS)
468     AC_SUBST(POFILES)
469     AC_SUBST(POSUB)
470   ])
471
472 AC_DEFUN(AM_GNU_GETTEXT,
473   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
474    AC_REQUIRE([AC_PROG_CC])dnl
475    AC_REQUIRE([AC_PROG_RANLIB])dnl
476    AC_REQUIRE([AC_ISC_POSIX])dnl
477    AC_REQUIRE([AC_HEADER_STDC])dnl
478    AC_REQUIRE([AC_C_CONST])dnl
479    AC_REQUIRE([AC_C_INLINE])dnl
480    AC_REQUIRE([AC_TYPE_OFF_T])dnl
481    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
482    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
483    AC_REQUIRE([AC_FUNC_MMAP])dnl
484
485    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
486 unistd.h sys/param.h])
487    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
488 strdup __argz_count __argz_stringify __argz_next])
489
490    if test "${ac_cv_func_stpcpy+set}" != "set"; then
491      AC_CHECK_FUNCS(stpcpy)
492    fi
493    if test "${ac_cv_func_stpcpy}" = "yes"; then
494      AC_DEFINE(HAVE_STPCPY)
495    fi
496
497    AM_LC_MESSAGES
498    AM_WITH_NLS
499
500    if test "x$CATOBJEXT" != "x"; then
501      if test "x$ALL_LINGUAS" = "x"; then
502        LINGUAS=
503      else
504        AC_MSG_CHECKING(for catalogs to be installed)
505        NEW_LINGUAS=
506        for lang in ${LINGUAS=$ALL_LINGUAS}; do
507          case "$ALL_LINGUAS" in
508           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
509          esac
510        done
511        LINGUAS=$NEW_LINGUAS
512        AC_MSG_RESULT($LINGUAS)
513      fi
514
515      dnl Construct list of names of catalog files to be constructed.
516      if test -n "$LINGUAS"; then
517        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
518      fi
519    fi
520
521    dnl The reference to <locale.h> in the installed <libintl.h> file
522    dnl must be resolved because we cannot expect the users of this
523    dnl to define HAVE_LOCALE_H.
524    if test $ac_cv_header_locale_h = yes; then
525      INCLUDE_LOCALE_H="#include <locale.h>"
526    else
527      INCLUDE_LOCALE_H="\
528 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
529    fi
530    AC_SUBST(INCLUDE_LOCALE_H)
531
532    dnl Determine which catalog format we have (if any is needed)
533    dnl For now we know about two different formats:
534    dnl   Linux libc-5 and the normal X/Open format
535    test -d intl || mkdir intl
536    if test "$CATOBJEXT" = ".cat"; then
537      AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
538
539      dnl Transform the SED scripts while copying because some dumb SEDs
540      dnl cannot handle comments.
541      sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
542    fi
543    dnl po2tbl.sed is always needed.
544    sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
545      $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
546
547    dnl In the intl/Makefile.in we have a special dependency which makes
548    dnl only sense for gettext.  We comment this out for non-gettext
549    dnl packages.
550    if test "$PACKAGE" = "gettext"; then
551      GT_NO="#NO#"
552      GT_YES=
553    else
554      GT_NO=
555      GT_YES="#YES#"
556    fi
557    AC_SUBST(GT_NO)
558    AC_SUBST(GT_YES)
559
560    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
561    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
562    dnl Try to locate is.
563    MKINSTALLDIRS=
564    if test -n "$ac_aux_dir"; then
565      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
566    fi
567    if test -z "$MKINSTALLDIRS"; then
568      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
569    fi
570    AC_SUBST(MKINSTALLDIRS)
571
572    dnl *** For now the libtool support in intl/Makefile is not for real.
573    l=
574    AC_SUBST(l)
575
576    dnl Generate list of files to be processed by xgettext which will
577    dnl be included in po/Makefile.
578    test -d po || mkdir po
579    if test "x$srcdir" != "x."; then
580      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
581        posrcprefix="$srcdir/"
582      else
583        posrcprefix="../$srcdir/"
584      fi
585    else
586      posrcprefix="../"
587    fi
588    rm -f po/POTFILES
589    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
590         < $srcdir/po/POTFILES.in > po/POTFILES
591   ])
592
593 # Check whether LC_MESSAGES is available in <locale.h>.
594 # Ulrich Drepper <drepper@cygnus.com>, 1995.
595 #
596 # This file can be copied and used freely without restrictions.  It can
597 # be used in projects which are not available under the GNU Public License
598 # but which still want to provide support for the GNU gettext functionality.
599 # Please note that the actual code is *not* freely available.
600
601 # serial 1
602
603 AC_DEFUN(AM_LC_MESSAGES,
604   [if test $ac_cv_header_locale_h = yes; then
605     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
606       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
607        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
608     if test $am_cv_val_LC_MESSAGES = yes; then
609       AC_DEFINE(HAVE_LC_MESSAGES)
610     fi
611   fi])
612
613 # Search path for a program which passes the given test.
614 # Ulrich Drepper <drepper@cygnus.com>, 1996.
615 #
616 # This file can be copied and used freely without restrictions.  It can
617 # be used in projects which are not available under the GNU Public License
618 # but which still want to provide support for the GNU gettext functionality.
619 # Please note that the actual code is *not* freely available.
620
621 # serial 1
622
623 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
624 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
625 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
626 [# Extract the first word of "$2", so it can be a program name with args.
627 set dummy $2; ac_word=[$]2
628 AC_MSG_CHECKING([for $ac_word])
629 AC_CACHE_VAL(ac_cv_path_$1,
630 [case "[$]$1" in
631   /*)
632   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
633   ;;
634   *)
635   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
636   for ac_dir in ifelse([$5], , $PATH, [$5]); do
637     test -z "$ac_dir" && ac_dir=.
638     if test -f $ac_dir/$ac_word; then
639       if [$3]; then
640         ac_cv_path_$1="$ac_dir/$ac_word"
641         break
642       fi
643     fi
644   done
645   IFS="$ac_save_ifs"
646 dnl If no 4th arg is given, leave the cache variable unset,
647 dnl so AC_PATH_PROGS will keep looking.
648 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
649 ])dnl
650   ;;
651 esac])dnl
652 $1="$ac_cv_path_$1"
653 if test -n "[$]$1"; then
654   AC_MSG_RESULT([$]$1)
655 else
656   AC_MSG_RESULT(no)
657 fi
658 AC_SUBST($1)dnl
659 ])