import gdb-1999-06-21 snapshot
[external/binutils.git] / intl / 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 # Like AC_CONFIG_HEADER, but automatically create stamp file.
14
15 AC_DEFUN(AM_CONFIG_HEADER,
16 [AC_PREREQ([2.12])
17 AC_CONFIG_HEADER([$1])
18 dnl When config.status generates a header, we must update the stamp-h file.
19 dnl This file resides in the same directory as the config header
20 dnl that is generated.  We must strip everything past the first ":",
21 dnl and everything past the last "/".
22 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
23 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
24 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
25 <<am_indx=1
26 for am_file in <<$1>>; do
27   case " <<$>>CONFIG_HEADERS " in
28   *" <<$>>am_file "*<<)>>
29     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
30     ;;
31   esac
32   am_indx=`expr "<<$>>am_indx" + 1`
33 done<<>>dnl>>)
34 changequote([,]))])
35
36
37 # serial 1
38
39 AC_DEFUN(AM_PROG_INSTALL,
40 [AC_REQUIRE([AC_PROG_INSTALL])
41 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
42 AC_SUBST(INSTALL_SCRIPT)dnl
43 ])
44
45 # This file is derived from `gettext.m4'.  The difference is that the
46 # included macros assume Cygnus-style source and build trees.
47
48 # Macro to add for using GNU gettext.
49 # Ulrich Drepper <drepper@cygnus.com>, 1995.
50 #
51 # This file file be copied and used freely without restrictions.  It can
52 # be used in projects which are not available under the GNU Public License
53 # but which still want to provide support for the GNU gettext functionality.
54 # Please note that the actual code is *not* freely available.
55
56 # serial 3
57
58 AC_DEFUN(CY_WITH_NLS,
59   [AC_MSG_CHECKING([whether NLS is requested])
60     dnl Default is enabled NLS
61     AC_ARG_ENABLE(nls,
62       [  --disable-nls           do not use Native Language Support],
63       USE_NLS=$enableval, USE_NLS=yes)
64     AC_MSG_RESULT($USE_NLS)
65     AC_SUBST(USE_NLS)
66
67     USE_INCLUDED_LIBINTL=no
68
69     dnl If we use NLS figure out what method
70     if test "$USE_NLS" = "yes"; then
71       AC_DEFINE(ENABLE_NLS)
72       AC_MSG_CHECKING([whether included gettext is requested])
73       AC_ARG_WITH(included-gettext,
74         [  --with-included-gettext use the GNU gettext library included here],
75         nls_cv_force_use_gnu_gettext=$withval,
76         nls_cv_force_use_gnu_gettext=no)
77       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
78
79       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
80       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
81         dnl User does not insist on using GNU NLS library.  Figure out what
82         dnl to use.  If gettext or catgets are available (in this order) we
83         dnl use this.  Else we have to fall back to GNU NLS library.
84         dnl catgets is only used if permitted by option --with-catgets.
85         nls_cv_header_intl=
86         nls_cv_header_libgt=
87         CATOBJEXT=NONE
88
89         AC_CHECK_HEADER(libintl.h,
90           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
91             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
92                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
93
94            if test "$gt_cv_func_gettext_libc" != "yes"; then
95              AC_CHECK_LIB(intl, bindtextdomain,
96                [AC_CACHE_CHECK([for gettext in libintl],
97                  gt_cv_func_gettext_libintl,
98                  [AC_TRY_LINK([], [return (int) gettext ("")],
99                  gt_cv_func_gettext_libintl=yes,
100                  gt_cv_func_gettext_libintl=no)])])
101            fi
102
103            if test "$gt_cv_func_gettext_libc" = "yes" \
104               || test "$gt_cv_func_gettext_libintl" = "yes"; then
105               AC_DEFINE(HAVE_GETTEXT)
106               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
107                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
108               if test "$MSGFMT" != "no"; then
109                 AC_CHECK_FUNCS(dcgettext)
110                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
111                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
112                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
113                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
114                                return _nl_msg_cat_cntr],
115                   [CATOBJEXT=.gmo
116                    DATADIRNAME=share],
117                   [CATOBJEXT=.mo
118                    DATADIRNAME=lib])
119                 INSTOBJEXT=.mo
120               fi
121             fi
122         ])
123
124         dnl In the standard gettext, we would now check for catgets.
125         dnl However, we never want to use catgets for our releases.
126
127         if test "$CATOBJEXT" = "NONE"; then
128           dnl Neither gettext nor catgets in included in the C library.
129           dnl Fall back on GNU gettext library.
130           nls_cv_use_gnu_gettext=yes
131         fi
132       fi
133
134       if test "$nls_cv_use_gnu_gettext" = "yes"; then
135         dnl Mark actions used to generate GNU NLS library.
136         INTLOBJS="\$(GETTOBJS)"
137         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
138           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
139         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
140         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
141           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
142         AC_SUBST(MSGFMT)
143         USE_INCLUDED_LIBINTL=yes
144         CATOBJEXT=.gmo
145         INSTOBJEXT=.mo
146         DATADIRNAME=share
147         INTLDEPS='$(top_builddir)/../intl/libintl.a'
148         INTLLIBS=$INTLDEPS
149         LIBS=`echo $LIBS | sed -e 's/-lintl//'`
150         nls_cv_header_intl=libintl.h
151         nls_cv_header_libgt=libgettext.h
152       fi
153
154       dnl Test whether we really found GNU xgettext.
155       if test "$XGETTEXT" != ":"; then
156         dnl If it is no GNU xgettext we define it as : so that the
157         dnl Makefiles still can work.
158         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
159           : ;
160         else
161           AC_MSG_RESULT(
162             [found xgettext programs is not GNU xgettext; ignore it])
163           XGETTEXT=":"
164         fi
165       fi
166
167       # We need to process the po/ directory.
168       POSUB=po
169     else
170       DATADIRNAME=share
171       nls_cv_header_intl=libintl.h
172       nls_cv_header_libgt=libgettext.h
173     fi
174
175     # If this is used in GNU gettext we have to set USE_NLS to `yes'
176     # because some of the sources are only built for this goal.
177     if test "$PACKAGE" = gettext; then
178       USE_NLS=yes
179       USE_INCLUDED_LIBINTL=yes
180     fi
181
182     dnl These rules are solely for the distribution goal.  While doing this
183     dnl we only have to keep exactly one list of the available catalogs
184     dnl in configure.in.
185     for lang in $ALL_LINGUAS; do
186       GMOFILES="$GMOFILES $lang.gmo"
187       POFILES="$POFILES $lang.po"
188     done
189
190     dnl Make all variables we use known to autoconf.
191     AC_SUBST(USE_INCLUDED_LIBINTL)
192     AC_SUBST(CATALOGS)
193     AC_SUBST(CATOBJEXT)
194     AC_SUBST(DATADIRNAME)
195     AC_SUBST(GMOFILES)
196     AC_SUBST(INSTOBJEXT)
197     AC_SUBST(INTLDEPS)
198     AC_SUBST(INTLLIBS)
199     AC_SUBST(INTLOBJS)
200     AC_SUBST(POFILES)
201     AC_SUBST(POSUB)
202   ])
203
204 AC_DEFUN(CY_GNU_GETTEXT,
205   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
206    AC_REQUIRE([AC_PROG_CC])dnl
207    AC_REQUIRE([AC_PROG_RANLIB])dnl
208    AC_REQUIRE([AC_ISC_POSIX])dnl
209    AC_REQUIRE([AC_HEADER_STDC])dnl
210    AC_REQUIRE([AC_C_CONST])dnl
211    AC_REQUIRE([AC_C_INLINE])dnl
212    AC_REQUIRE([AC_TYPE_OFF_T])dnl
213    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
214    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
215    AC_REQUIRE([AC_FUNC_MMAP])dnl
216
217    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
218 unistd.h values.h sys/param.h])
219    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
220 __argz_count __argz_stringify __argz_next])
221
222    if test "${ac_cv_func_stpcpy+set}" != "set"; then
223      AC_CHECK_FUNCS(stpcpy)
224    fi
225    if test "${ac_cv_func_stpcpy}" = "yes"; then
226      AC_DEFINE(HAVE_STPCPY)
227    fi
228
229    AM_LC_MESSAGES
230    CY_WITH_NLS
231
232    if test "x$CATOBJEXT" != "x"; then
233      if test "x$ALL_LINGUAS" = "x"; then
234        LINGUAS=
235      else
236        AC_MSG_CHECKING(for catalogs to be installed)
237        NEW_LINGUAS=
238        for lang in ${LINGUAS=$ALL_LINGUAS}; do
239          case "$ALL_LINGUAS" in
240           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
241          esac
242        done
243        LINGUAS=$NEW_LINGUAS
244        AC_MSG_RESULT($LINGUAS)
245      fi
246
247      dnl Construct list of names of catalog files to be constructed.
248      if test -n "$LINGUAS"; then
249        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
250      fi
251    fi
252
253    dnl The reference to <locale.h> in the installed <libintl.h> file
254    dnl must be resolved because we cannot expect the users of this
255    dnl to define HAVE_LOCALE_H.
256    if test $ac_cv_header_locale_h = yes; then
257      INCLUDE_LOCALE_H="#include <locale.h>"
258    else
259      INCLUDE_LOCALE_H="\
260 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
261    fi
262    AC_SUBST(INCLUDE_LOCALE_H)
263
264    dnl Determine which catalog format we have (if any is needed)
265    dnl For now we know about two different formats:
266    dnl   Linux libc-5 and the normal X/Open format
267    if test -f $srcdir/po2tbl.sed.in; then
268       if test "$CATOBJEXT" = ".cat"; then
269          AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
270
271          dnl Transform the SED scripts while copying because some dumb SEDs
272          dnl cannot handle comments.
273          sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
274       fi
275       dnl po2tbl.sed is always needed.
276       sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
277          $srcdir/po2tbl.sed.in > po2tbl.sed
278    fi
279
280    dnl In the intl/Makefile.in we have a special dependency which makes
281    dnl only sense for gettext.  We comment this out for non-gettext
282    dnl packages.
283    if test "$PACKAGE" = "gettext"; then
284      GT_NO="#NO#"
285      GT_YES=
286    else
287      GT_NO=
288      GT_YES="#YES#"
289    fi
290    AC_SUBST(GT_NO)
291    AC_SUBST(GT_YES)
292
293    MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
294    AC_SUBST(MKINSTALLDIRS)
295
296    dnl *** For now the libtool support in intl/Makefile is not for real.
297    l=
298    AC_SUBST(l)
299
300    dnl Generate list of files to be processed by xgettext which will
301    dnl be included in po/Makefile.  But only do this if the po directory
302    dnl exists in srcdir.
303    if test -d $srcdir/po; then
304       test -d po || mkdir po
305       if test "x$srcdir" != "x."; then
306          if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
307             posrcprefix="$srcdir/"
308          else
309             posrcprefix="../$srcdir/"
310          fi
311       else
312          posrcprefix="../"
313       fi
314       rm -f po/POTFILES
315       sed -e "/^#/d" -e "/^\$/d" -e "s,.*,      $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
316          < $srcdir/po/POTFILES.in > po/POTFILES
317    fi
318   ])
319
320 # Search path for a program which passes the given test.
321 # Ulrich Drepper <drepper@cygnus.com>, 1996.
322 #
323 # This file file be copied and used freely without restrictions.  It can
324 # be used in projects which are not available under the GNU Public License
325 # but which still want to provide support for the GNU gettext functionality.
326 # Please note that the actual code is *not* freely available.
327
328 # serial 1
329
330 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
331 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
332 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
333 [# Extract the first word of "$2", so it can be a program name with args.
334 set dummy $2; ac_word=[$]2
335 AC_MSG_CHECKING([for $ac_word])
336 AC_CACHE_VAL(ac_cv_path_$1,
337 [case "[$]$1" in
338   /*)
339   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
340   ;;
341   *)
342   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
343   for ac_dir in ifelse([$5], , $PATH, [$5]); do
344     test -z "$ac_dir" && ac_dir=.
345     if test -f $ac_dir/$ac_word; then
346       if [$3]; then
347         ac_cv_path_$1="$ac_dir/$ac_word"
348         break
349       fi
350     fi
351   done
352   IFS="$ac_save_ifs"
353 dnl If no 4th arg is given, leave the cache variable unset,
354 dnl so AC_PATH_PROGS will keep looking.
355 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
356 ])dnl
357   ;;
358 esac])dnl
359 $1="$ac_cv_path_$1"
360 if test -n "[$]$1"; then
361   AC_MSG_RESULT([$]$1)
362 else
363   AC_MSG_RESULT(no)
364 fi
365 AC_SUBST($1)dnl
366 ])
367
368 # Check whether LC_MESSAGES is available in <locale.h>.
369 # Ulrich Drepper <drepper@cygnus.com>, 1995.
370 #
371 # This file file be copied and used freely without restrictions.  It can
372 # be used in projects which are not available under the GNU Public License
373 # but which still want to provide support for the GNU gettext functionality.
374 # Please note that the actual code is *not* freely available.
375
376 # serial 1
377
378 AC_DEFUN(AM_LC_MESSAGES,
379   [if test $ac_cv_header_locale_h = yes; then
380     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
381       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
382        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
383     if test $am_cv_val_LC_MESSAGES = yes; then
384       AC_DEFINE(HAVE_LC_MESSAGES)
385     fi
386   fi])
387