OSDN Git Service

* config/i386/sol2.h (PREFERRED_DEBUGGING_TYPE): Use stabs.
[pf3gnuchains/gcc-fork.git] / 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 Check whether long double is supported.  This differs from the
176 dnl built-in autoconf test in that it works for cross compiles.
177 AC_DEFUN(AC_GCC_C_LONG_DOUBLE,
178 [AC_CACHE_CHECK(for long double, gcc_cv_c_long_double,
179 [if test "$GCC" = yes; then
180   gcc_cv_c_long_double=yes
181 else
182 AC_TRY_COMPILE(,
183 [/* The Stardent Vistra knows sizeof(long double), but does not support it.  */
184 long double foo = 0.0;
185 /* On Ultrix 4.3 cc, long double is 4 and double is 8.  */
186 switch (0) case 0: case (sizeof(long double) >= sizeof(double)):;],
187 gcc_cv_c_long_double=yes, gcc_cv_c_long_double=no)
188 fi])
189 if test $gcc_cv_c_long_double = yes; then
190   AC_DEFINE(HAVE_LONG_DOUBLE)
191 fi
192 ])
193
194 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
195 dnl of the usual 2.
196 AC_DEFUN(GCC_FUNC_MKDIR_TAKES_ONE_ARG,
197 [AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
198 [AC_TRY_COMPILE([
199 #include <sys/types.h>
200 #ifdef HAVE_SYS_STAT_H
201 # include <sys/stat.h>
202 #endif
203 #ifdef HAVE_UNISTD_H
204 # include <unistd.h>
205 #endif
206 #ifdef HAVE_DIRECT_H
207 # include <direct.h>
208 #endif], [mkdir ("foo", 0);], 
209         gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
210 if test $gcc_cv_mkdir_takes_one_arg = yes ; then
211   AC_DEFINE(MKDIR_TAKES_ONE_ARG)
212 fi
213 ])
214
215 AC_DEFUN(EGCS_PROG_INSTALL,
216 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
217 # Find a good install program.  We prefer a C program (faster),
218 # so one script is as good as another.  But avoid the broken or
219 # incompatible versions:
220 # SysV /etc/install, /usr/sbin/install
221 # SunOS /usr/etc/install
222 # IRIX /sbin/install
223 # AIX /bin/install
224 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
225 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
226 # ./install, which can be erroneously created by make from ./install.sh.
227 AC_MSG_CHECKING(for a BSD compatible install)
228 if test -z "$INSTALL"; then
229 AC_CACHE_VAL(ac_cv_path_install,
230 [  IFS="${IFS=  }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
231   for ac_dir in $PATH; do
232     # Account for people who put trailing slashes in PATH elements.
233     case "$ac_dir/" in
234     /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
235     *)
236       # OSF1 and SCO ODT 3.0 have their own names for install.
237       for ac_prog in ginstall scoinst install; do
238         if test -f $ac_dir/$ac_prog; then
239           if test $ac_prog = install &&
240             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
241             # AIX install.  It has an incompatible calling convention.
242             # OSF/1 installbsd also uses dspmsg, but is usable.
243             :
244           else
245             ac_cv_path_install="$ac_dir/$ac_prog -c"
246             break 2
247           fi
248         fi
249       done
250       ;;
251     esac
252   done
253   IFS="$ac_save_IFS"
254 ])dnl
255   if test "${ac_cv_path_install+set}" = set; then
256     INSTALL="$ac_cv_path_install"
257   else
258     # As a last resort, use the slow shell script.  We don't cache a
259     # path for INSTALL within a source directory, because that will
260     # break other packages using the cache if that directory is
261     # removed, or if the path is relative.
262     INSTALL="$ac_install_sh"
263   fi
264 fi
265 dnl We do special magic for INSTALL instead of AC_SUBST, to get
266 dnl relative paths right.
267 AC_MSG_RESULT($INSTALL)
268 AC_SUBST(INSTALL)dnl
269
270 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
271 # It thinks the first close brace ends the variable substitution.
272 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
273 AC_SUBST(INSTALL_PROGRAM)dnl
274
275 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
276 AC_SUBST(INSTALL_DATA)dnl
277 ])
278
279 #serial 1
280 dnl This test replaces the one in autoconf.
281 dnl Currently this macro should have the same name as the autoconf macro
282 dnl because gettext's gettext.m4 (distributed in the automake package)
283 dnl still uses it.  Otherwise, the use in gettext.m4 makes autoheader
284 dnl give these diagnostics:
285 dnl   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
286 dnl   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
287
288 undefine([AC_ISC_POSIX])
289 AC_DEFUN(AC_ISC_POSIX,
290   [
291     dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
292     AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
293   ]
294 )
295
296 # Macro to add for using GNU gettext.
297 # Ulrich Drepper <drepper@cygnus.com>, 1995.
298 #
299 # This file can be copied and used freely without restrictions.  It can
300 # be used in projects which are not available under the GNU Public License
301 # but which still want to provide support for the GNU gettext functionality.
302 # Please note that the actual code is *not* freely available.
303
304 # serial 5
305
306 AC_DEFUN(AM_WITH_NLS,
307   [AC_MSG_CHECKING([whether NLS is requested])
308     dnl Default is enabled NLS
309     AC_ARG_ENABLE(nls,
310       [  --disable-nls           do not use Native Language Support],
311       USE_NLS=$enableval, USE_NLS=yes)
312     AC_MSG_RESULT($USE_NLS)
313     AC_SUBST(USE_NLS)
314
315     USE_INCLUDED_LIBINTL=no
316
317     dnl If we use NLS figure out what method
318     if test "$USE_NLS" = "yes"; then
319       AC_DEFINE(ENABLE_NLS)
320       AC_MSG_CHECKING([whether included gettext is requested])
321       AC_ARG_WITH(included-gettext,
322         [  --with-included-gettext use the GNU gettext library included here],
323         nls_cv_force_use_gnu_gettext=$withval,
324         nls_cv_force_use_gnu_gettext=no)
325       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
326
327       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
328       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
329         dnl User does not insist on using GNU NLS library.  Figure out what
330         dnl to use.  If gettext or catgets are available (in this order) we
331         dnl use this.  Else we have to fall back to GNU NLS library.
332         dnl catgets is only used if permitted by option --with-catgets.
333         nls_cv_header_intl=
334         nls_cv_header_libgt=
335         CATOBJEXT=NONE
336
337         AC_CHECK_HEADER(libintl.h,
338           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
339             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
340                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
341
342            if test "$gt_cv_func_gettext_libc" != "yes"; then
343              AC_CHECK_LIB(intl, bindtextdomain,
344                [AC_CACHE_CHECK([for gettext in libintl],
345                  gt_cv_func_gettext_libintl,
346                  [AC_CHECK_LIB(intl, gettext,
347                   gt_cv_func_gettext_libintl=yes,
348                   gt_cv_func_gettext_libintl=no)],
349                  gt_cv_func_gettext_libintl=no)])
350            fi
351
352            if test "$gt_cv_func_gettext_libc" = "yes" \
353               || test "$gt_cv_func_gettext_libintl" = "yes"; then
354               AC_DEFINE(HAVE_GETTEXT)
355               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
356                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
357               if test "$MSGFMT" != "no"; then
358                 AC_CHECK_FUNCS(dcgettext)
359                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
360                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
361                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
362                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
363                                return _nl_msg_cat_cntr],
364                   [CATOBJEXT=.gmo
365                    DATADIRNAME=share],
366                   [CATOBJEXT=.mo
367                    DATADIRNAME=lib])
368                 INSTOBJEXT=.mo
369               fi
370             fi
371         ])
372
373         if test "$CATOBJEXT" = "NONE"; then
374           AC_MSG_CHECKING([whether catgets can be used])
375           AC_ARG_WITH(catgets,
376             [  --with-catgets          use catgets functions if available],
377             nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
378           AC_MSG_RESULT($nls_cv_use_catgets)
379
380           if test "$nls_cv_use_catgets" = "yes"; then
381             dnl No gettext in C library.  Try catgets next.
382             AC_CHECK_LIB(i, main)
383             AC_CHECK_FUNC(catgets,
384               [AC_DEFINE(HAVE_CATGETS)
385                INTLOBJS="\$(CATOBJS)"
386                AC_PATH_PROG(GENCAT, gencat, no)dnl
387                if test "$GENCAT" != "no"; then
388                  AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
389                  if test "$GMSGFMT" = "no"; then
390                    AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
391                     [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
392                  fi
393                  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
394                    [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
395                  USE_INCLUDED_LIBINTL=yes
396                  CATOBJEXT=.cat
397                  INSTOBJEXT=.cat
398                  DATADIRNAME=lib
399                  INTLDEPS='$(top_builddir)/intl/libintl.a'
400                  INTLLIBS=$INTLDEPS
401                  LIBS=`echo $LIBS | sed -e 's/-lintl//'`
402                  nls_cv_header_intl=intl/libintl.h
403                  nls_cv_header_libgt=intl/libgettext.h
404                fi])
405           fi
406         fi
407
408         if test "$CATOBJEXT" = "NONE"; then
409           dnl Neither gettext nor catgets in included in the C library.
410           dnl Fall back on GNU gettext library.
411           nls_cv_use_gnu_gettext=yes
412         fi
413       fi
414
415       if test "$nls_cv_use_gnu_gettext" = "yes"; then
416         dnl Mark actions used to generate GNU NLS library.
417         INTLOBJS="\$(GETTOBJS)"
418         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
419           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
420         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
421         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
422           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
423         AC_SUBST(MSGFMT)
424         USE_INCLUDED_LIBINTL=yes
425         CATOBJEXT=.gmo
426         INSTOBJEXT=.mo
427         DATADIRNAME=share
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
435       dnl Test whether we really found GNU xgettext.
436       if test "$XGETTEXT" != ":"; then
437         dnl If it is no GNU xgettext we define it as : so that the
438         dnl Makefiles still can work.
439         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
440           : ;
441         else
442           AC_MSG_RESULT(
443             [found xgettext program is not GNU xgettext; ignore it])
444           XGETTEXT=":"
445         fi
446       fi
447
448       # We need to process the po/ directory.
449       POSUB=po
450     else
451       DATADIRNAME=share
452       nls_cv_header_intl=intl/libintl.h
453       nls_cv_header_libgt=intl/libgettext.h
454     fi
455     AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
456     AC_OUTPUT_COMMANDS(
457      [case "$CONFIG_FILES" in *po/Makefile.in*)
458         sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
459       esac])
460
461
462     # If this is used in GNU gettext we have to set USE_NLS to `yes'
463     # because some of the sources are only built for this goal.
464     if test "$PACKAGE" = gettext; then
465       USE_NLS=yes
466       USE_INCLUDED_LIBINTL=yes
467     fi
468
469     dnl These rules are solely for the distribution goal.  While doing this
470     dnl we only have to keep exactly one list of the available catalogs
471     dnl in configure.in.
472     for lang in $ALL_LINGUAS; do
473       GMOFILES="$GMOFILES $lang.gmo"
474       POFILES="$POFILES $lang.po"
475     done
476
477     dnl Make all variables we use known to autoconf.
478     AC_SUBST(USE_INCLUDED_LIBINTL)
479     AC_SUBST(CATALOGS)
480     AC_SUBST(CATOBJEXT)
481     AC_SUBST(DATADIRNAME)
482     AC_SUBST(GMOFILES)
483     AC_SUBST(INSTOBJEXT)
484     AC_SUBST(INTLDEPS)
485     AC_SUBST(INTLLIBS)
486     AC_SUBST(INTLOBJS)
487     AC_SUBST(POFILES)
488     AC_SUBST(POSUB)
489   ])
490
491 AC_DEFUN(AM_GNU_GETTEXT,
492   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
493    AC_REQUIRE([AC_PROG_CC])dnl
494    AC_REQUIRE([AC_PROG_RANLIB])dnl
495    AC_REQUIRE([AC_ISC_POSIX])dnl
496    AC_REQUIRE([AC_HEADER_STDC])dnl
497    AC_REQUIRE([AC_C_CONST])dnl
498    AC_REQUIRE([AC_C_INLINE])dnl
499    AC_REQUIRE([AC_TYPE_OFF_T])dnl
500    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
501    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
502    AC_REQUIRE([AC_FUNC_MMAP])dnl
503
504    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
505 unistd.h sys/param.h])
506    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
507 strdup __argz_count __argz_stringify __argz_next])
508
509    if test "${ac_cv_func_stpcpy+set}" != "set"; then
510      AC_CHECK_FUNCS(stpcpy)
511    fi
512    if test "${ac_cv_func_stpcpy}" = "yes"; then
513      AC_DEFINE(HAVE_STPCPY)
514    fi
515
516    AM_LC_MESSAGES
517    AM_WITH_NLS
518
519    if test "x$CATOBJEXT" != "x"; then
520      if test "x$ALL_LINGUAS" = "x"; then
521        LINGUAS=
522      else
523        AC_MSG_CHECKING(for catalogs to be installed)
524        NEW_LINGUAS=
525        for lang in ${LINGUAS=$ALL_LINGUAS}; do
526          case "$ALL_LINGUAS" in
527           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
528          esac
529        done
530        LINGUAS=$NEW_LINGUAS
531        AC_MSG_RESULT($LINGUAS)
532      fi
533
534      dnl Construct list of names of catalog files to be constructed.
535      if test -n "$LINGUAS"; then
536        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
537      fi
538    fi
539
540    dnl The reference to <locale.h> in the installed <libintl.h> file
541    dnl must be resolved because we cannot expect the users of this
542    dnl to define HAVE_LOCALE_H.
543    if test $ac_cv_header_locale_h = yes; then
544      INCLUDE_LOCALE_H="#include <locale.h>"
545    else
546      INCLUDE_LOCALE_H="\
547 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
548    fi
549    AC_SUBST(INCLUDE_LOCALE_H)
550
551    dnl Determine which catalog format we have (if any is needed)
552    dnl For now we know about two different formats:
553    dnl   Linux libc-5 and the normal X/Open format
554    test -d intl || mkdir intl
555    if test "$CATOBJEXT" = ".cat"; then
556      AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
557
558      dnl Transform the SED scripts while copying because some dumb SEDs
559      dnl cannot handle comments.
560      sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
561    fi
562    dnl po2tbl.sed is always needed.
563    sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
564      $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
565
566    dnl In the intl/Makefile.in we have a special dependency which makes
567    dnl only sense for gettext.  We comment this out for non-gettext
568    dnl packages.
569    if test "$PACKAGE" = "gettext"; then
570      GT_NO="#NO#"
571      GT_YES=
572    else
573      GT_NO=
574      GT_YES="#YES#"
575    fi
576    AC_SUBST(GT_NO)
577    AC_SUBST(GT_YES)
578
579    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
580    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
581    dnl Try to locate is.
582    MKINSTALLDIRS=
583    if test -n "$ac_aux_dir"; then
584      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
585    fi
586    if test -z "$MKINSTALLDIRS"; then
587      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
588    fi
589    AC_SUBST(MKINSTALLDIRS)
590
591    dnl *** For now the libtool support in intl/Makefile is not for real.
592    l=
593    AC_SUBST(l)
594
595    dnl Generate list of files to be processed by xgettext which will
596    dnl be included in po/Makefile.
597    test -d po || mkdir po
598    if test "x$srcdir" != "x."; then
599      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
600        posrcprefix="$srcdir/"
601      else
602        posrcprefix="../$srcdir/"
603      fi
604    else
605      posrcprefix="../"
606    fi
607    rm -f po/POTFILES
608    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
609         < $srcdir/po/POTFILES.in > po/POTFILES
610   ])
611
612 # Check whether LC_MESSAGES is available in <locale.h>.
613 # Ulrich Drepper <drepper@cygnus.com>, 1995.
614 #
615 # This file can be copied and used freely without restrictions.  It can
616 # be used in projects which are not available under the GNU Public License
617 # but which still want to provide support for the GNU gettext functionality.
618 # Please note that the actual code is *not* freely available.
619
620 # serial 1
621
622 AC_DEFUN(AM_LC_MESSAGES,
623   [if test $ac_cv_header_locale_h = yes; then
624     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
625       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
626        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
627     if test $am_cv_val_LC_MESSAGES = yes; then
628       AC_DEFINE(HAVE_LC_MESSAGES)
629     fi
630   fi])
631
632 # Search path for a program which passes the given test.
633 # Ulrich Drepper <drepper@cygnus.com>, 1996.
634 #
635 # This file can 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 ])