* Makefile.am (DISTCLEANFILES): Change cgen-opc.h to cgen-desc.h.
[platform/upstream/binutils.git] / gas / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4
2
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file 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 GAS_CHECK_DECL_NEEDED(name, typedefname, typedef, headers)
14 AC_DEFUN(GAS_CHECK_DECL_NEEDED,[
15 AC_MSG_CHECKING(whether declaration is required for $1)
16 AC_CACHE_VAL(gas_cv_decl_needed_$1,
17 AC_TRY_LINK([$4],
18 [
19 typedef $3;
20 $2 x;
21 x = ($2) $1;
22 ], gas_cv_decl_needed_$1=no, gas_cv_decl_needed_$1=yes))dnl
23 AC_MSG_RESULT($gas_cv_decl_needed_$1)
24 test $gas_cv_decl_needed_$1 = no || {
25  ifelse(index($1,[$]),-1,
26     [AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]))],
27     [gas_decl_name_upcase=`echo $1 | tr '[a-z]' '[A-Z]'`
28      AC_DEFINE_UNQUOTED(NEED_DECLARATION_$gas_decl_name_upcase)])
29 }
30 ])dnl
31 dnl
32 dnl Some non-ANSI preprocessors botch requoting inside strings.  That's bad
33 dnl enough, but on some of those systems, the assert macro relies on requoting
34 dnl working properly!
35 dnl GAS_WORKING_ASSERT
36 AC_DEFUN(GAS_WORKING_ASSERT,
37 [AC_MSG_CHECKING([for working assert macro])
38 AC_CACHE_VAL(gas_cv_assert_ok,
39 AC_TRY_LINK([#include <assert.h>
40 #include <stdio.h>], [
41 /* check for requoting problems */
42 static int a, b, c, d;
43 static char *s;
44 assert (!strcmp(s, "foo bar baz quux"));
45 /* check for newline handling */
46 assert (a == b
47         || c == d);
48 ], gas_cv_assert_ok=yes, gas_cv_assert_ok=no))dnl
49 AC_MSG_RESULT($gas_cv_assert_ok)
50 test $gas_cv_assert_ok = yes || AC_DEFINE(BROKEN_ASSERT)
51 ])dnl
52 dnl
53 dnl Since many Bourne shell implementations lack subroutines, use this
54 dnl hack to simplify the code in configure.in.
55 dnl GAS_UNIQ(listvar)
56 AC_DEFUN(GAS_UNIQ,
57 [_gas_uniq_list="[$]$1"
58 _gas_uniq_newlist=""
59 dnl Protect against empty input list.
60 for _gas_uniq_i in _gas_uniq_dummy [$]_gas_uniq_list ; do
61   case [$]_gas_uniq_i in
62   _gas_uniq_dummy) ;;
63   *) case " [$]_gas_uniq_newlist " in
64        *" [$]_gas_uniq_i "*) ;;
65        *) _gas_uniq_newlist="[$]_gas_uniq_newlist [$]_gas_uniq_i" ;;
66      esac ;;
67   esac
68 done
69 $1=[$]_gas_uniq_newlist
70 ])dnl
71
72 # Do all the work for Automake.  This macro actually does too much --
73 # some checks are only needed if your package does certain things.
74 # But this isn't really a big deal.
75
76 # serial 1
77
78 dnl Usage:
79 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
80
81 AC_DEFUN(AM_INIT_AUTOMAKE,
82 [AC_REQUIRE([AC_PROG_INSTALL])
83 PACKAGE=[$1]
84 AC_SUBST(PACKAGE)
85 VERSION=[$2]
86 AC_SUBST(VERSION)
87 dnl test to see if srcdir already configured
88 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
89   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
90 fi
91 ifelse([$3],,
92 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
93 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
94 AC_REQUIRE([AM_SANITY_CHECK])
95 AC_REQUIRE([AC_ARG_PROGRAM])
96 dnl FIXME This is truly gross.
97 missing_dir=`cd $ac_aux_dir && pwd`
98 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
99 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
100 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
101 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
102 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
103 AC_REQUIRE([AC_PROG_MAKE_SET])])
104
105 #
106 # Check to make sure that the build environment is sane.
107 #
108
109 AC_DEFUN(AM_SANITY_CHECK,
110 [AC_MSG_CHECKING([whether build environment is sane])
111 # Just in case
112 sleep 1
113 echo timestamp > conftestfile
114 # Do `set' in a subshell so we don't clobber the current shell's
115 # arguments.  Must try -L first in case configure is actually a
116 # symlink; some systems play weird games with the mod time of symlinks
117 # (eg FreeBSD returns the mod time of the symlink's containing
118 # directory).
119 if (
120    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
121    if test "[$]*" = "X"; then
122       # -L didn't work.
123       set X `ls -t $srcdir/configure conftestfile`
124    fi
125    if test "[$]*" != "X $srcdir/configure conftestfile" \
126       && test "[$]*" != "X conftestfile $srcdir/configure"; then
127
128       # If neither matched, then we have a broken ls.  This can happen
129       # if, for instance, CONFIG_SHELL is bash and it inherits a
130       # broken ls alias from the environment.  This has actually
131       # happened.  Such a system could not be considered "sane".
132       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
133 alias in your environment])
134    fi
135
136    test "[$]2" = conftestfile
137    )
138 then
139    # Ok.
140    :
141 else
142    AC_MSG_ERROR([newly created file is older than distributed files!
143 Check your system clock])
144 fi
145 rm -f conftest*
146 AC_MSG_RESULT(yes)])
147
148 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
149 dnl The program must properly implement --version.
150 AC_DEFUN(AM_MISSING_PROG,
151 [AC_MSG_CHECKING(for working $2)
152 # Run test in a subshell; some versions of sh will print an error if
153 # an executable is not found, even if stderr is redirected.
154 # Redirect stdin to placate older versions of autoconf.  Sigh.
155 if ($2 --version) < /dev/null > /dev/null 2>&1; then
156    $1=$2
157    AC_MSG_RESULT(found)
158 else
159    $1="$3/missing $2"
160    AC_MSG_RESULT(missing)
161 fi
162 AC_SUBST($1)])
163
164
165 # serial 25 AM_PROG_LIBTOOL
166 AC_DEFUN(AM_PROG_LIBTOOL,
167 [AC_REQUIRE([AM_ENABLE_SHARED])dnl
168 AC_REQUIRE([AM_ENABLE_STATIC])dnl
169 AC_REQUIRE([AC_CANONICAL_HOST])dnl
170 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
171 AC_REQUIRE([AC_PROG_RANLIB])dnl
172 AC_REQUIRE([AC_PROG_CC])dnl
173 AC_REQUIRE([AM_PROG_LD])dnl
174 AC_REQUIRE([AM_PROG_NM])dnl
175 AC_REQUIRE([AC_PROG_LN_S])dnl
176 dnl
177 # Always use our own libtool.
178 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
179 AC_SUBST(LIBTOOL)dnl
180
181 # Check for any special flags to pass to ltconfig.
182 libtool_flags=
183 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
184 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
185 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
186 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
187 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
188
189 # Some flags need to be propagated to the compiler or linker for good
190 # libtool support.
191 case "$host" in
192 *-*-irix6*)
193   # Find out which ABI we are using.
194   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
195   if AC_TRY_EVAL(ac_compile); then
196     case "`/usr/bin/file conftest.o`" in
197     *32-bit*)
198       LD="${LD-ld} -32"
199       ;;
200     *N32*)
201       LD="${LD-ld} -n32"
202       ;;
203     *64-bit*)
204       LD="${LD-ld} -64"
205       ;;
206     esac
207   fi
208   rm -rf conftest*
209   ;;
210
211 *-*-sco3.2v5*)
212   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
213   CFLAGS="$CFLAGS -belf"
214   ;;
215
216 *-*-cygwin*)
217   AM_SYS_LIBTOOL_CYGWIN
218   ;;
219
220 esac
221
222 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
223 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
224 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
225 DLLTOOL="$DLLTOOL" AS="$AS" \
226 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
227 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
228 || AC_MSG_ERROR([libtool configure failed])
229
230 # Redirect the config.log output again, so that the ltconfig log is not
231 # clobbered by the next message.
232 exec 5>>./config.log
233 ])
234
235 # AM_ENABLE_SHARED - implement the --enable-shared flag
236 # Usage: AM_ENABLE_SHARED[(DEFAULT)]
237 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
238 #   `yes'.
239 AC_DEFUN(AM_ENABLE_SHARED,
240 [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
241 AC_ARG_ENABLE(shared,
242 changequote(<<, >>)dnl
243 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT],
244 changequote([, ])dnl
245 [p=${PACKAGE-default}
246 case "$enableval" in
247 yes) enable_shared=yes ;;
248 no) enable_shared=no ;;
249 *)
250   enable_shared=no
251   # Look at the argument we got.  We use all the common list separators.
252   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
253   for pkg in $enableval; do
254     if test "X$pkg" = "X$p"; then
255       enable_shared=yes
256     fi
257   done
258   IFS="$ac_save_ifs"
259   ;;
260 esac],
261 enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
262 ])
263
264 # AM_DISABLE_SHARED - set the default shared flag to --disable-shared
265 AC_DEFUN(AM_DISABLE_SHARED,
266 [AM_ENABLE_SHARED(no)])
267
268 # AM_DISABLE_STATIC - set the default static flag to --disable-static
269 AC_DEFUN(AM_DISABLE_STATIC,
270 [AM_ENABLE_STATIC(no)])
271
272 # AM_ENABLE_STATIC - implement the --enable-static flag
273 # Usage: AM_ENABLE_STATIC[(DEFAULT)]
274 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
275 #   `yes'.
276 AC_DEFUN(AM_ENABLE_STATIC,
277 [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
278 AC_ARG_ENABLE(static,
279 changequote(<<, >>)dnl
280 <<  --enable-static[=PKGS]  build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT],
281 changequote([, ])dnl
282 [p=${PACKAGE-default}
283 case "$enableval" in
284 yes) enable_static=yes ;;
285 no) enable_static=no ;;
286 *)
287   enable_static=no
288   # Look at the argument we got.  We use all the common list separators.
289   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
290   for pkg in $enableval; do
291     if test "X$pkg" = "X$p"; then
292       enable_static=yes
293     fi
294   done
295   IFS="$ac_save_ifs"
296   ;;
297 esac],
298 enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
299 ])
300
301
302 # AM_PROG_LD - find the path to the GNU or non-GNU linker
303 AC_DEFUN(AM_PROG_LD,
304 [AC_ARG_WITH(gnu-ld,
305 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
306 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
307 AC_REQUIRE([AC_PROG_CC])
308 ac_prog=ld
309 if test "$ac_cv_prog_gcc" = yes; then
310   # Check if gcc -print-prog-name=ld gives a path.
311   AC_MSG_CHECKING([for ld used by GCC])
312   ac_prog=`($CC -print-prog-name=ld) 2>&5`
313   case "$ac_prog" in
314   # Accept absolute paths.
315 changequote(,)dnl
316   /* | [A-Za-z]:\\*)
317 changequote([,])dnl
318     test -z "$LD" && LD="$ac_prog"
319     ;;
320   "")
321     # If it fails, then pretend we aren't using GCC.
322     ac_prog=ld
323     ;;
324   *)
325     # If it is relative, then search for the first ld in PATH.
326     with_gnu_ld=unknown
327     ;;
328   esac
329 elif test "$with_gnu_ld" = yes; then
330   AC_MSG_CHECKING([for GNU ld])
331 else
332   AC_MSG_CHECKING([for non-GNU ld])
333 fi
334 AC_CACHE_VAL(ac_cv_path_LD,
335 [if test -z "$LD"; then
336   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
337   for ac_dir in $PATH; do
338     test -z "$ac_dir" && ac_dir=.
339     if test -f "$ac_dir/$ac_prog"; then
340       ac_cv_path_LD="$ac_dir/$ac_prog"
341       # Check to see if the program is GNU ld.  I'd rather use --version,
342       # but apparently some GNU ld's only accept -v.
343       # Break only if it was the GNU/non-GNU ld that we prefer.
344       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
345         test "$with_gnu_ld" != no && break
346       else
347         test "$with_gnu_ld" != yes && break
348       fi
349     fi
350   done
351   IFS="$ac_save_ifs"
352 else
353   ac_cv_path_LD="$LD" # Let the user override the test with a path.
354 fi])
355 LD="$ac_cv_path_LD"
356 if test -n "$LD"; then
357   AC_MSG_RESULT($LD)
358 else
359   AC_MSG_RESULT(no)
360 fi
361 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
362 AC_SUBST(LD)
363 AM_PROG_LD_GNU
364 ])
365
366 AC_DEFUN(AM_PROG_LD_GNU,
367 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
368 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
369 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
370   ac_cv_prog_gnu_ld=yes
371 else
372   ac_cv_prog_gnu_ld=no
373 fi])
374 ])
375
376 # AM_PROG_NM - find the path to a BSD-compatible name lister
377 AC_DEFUN(AM_PROG_NM,
378 [AC_MSG_CHECKING([for BSD-compatible nm])
379 AC_CACHE_VAL(ac_cv_path_NM,
380 [if test -n "$NM"; then
381   # Let the user override the test.
382   ac_cv_path_NM="$NM"
383 else
384   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
385   for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
386     test -z "$ac_dir" && ac_dir=.
387     if test -f $ac_dir/nm; then
388       # Check to see if the nm accepts a BSD-compat flag.
389       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
390       #   nm: unknown option "B" ignored
391       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
392         ac_cv_path_NM="$ac_dir/nm -B"
393       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
394         ac_cv_path_NM="$ac_dir/nm -p"
395       else
396         ac_cv_path_NM="$ac_dir/nm"
397       fi
398       break
399     fi
400   done
401   IFS="$ac_save_ifs"
402   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
403 fi])
404 NM="$ac_cv_path_NM"
405 AC_MSG_RESULT([$NM])
406 AC_SUBST(NM)
407 ])
408
409 # AM_SYS_LIBTOOL_CYGWIN - find tools needed on cygwin
410 AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN,
411 [AC_CHECK_TOOL(DLLTOOL, dlltool, false)
412 AC_CHECK_TOOL(AS, as, false)
413 ])
414
415 # Like AC_CONFIG_HEADER, but automatically create stamp file.
416
417 AC_DEFUN(AM_CONFIG_HEADER,
418 [AC_PREREQ([2.12])
419 AC_CONFIG_HEADER([$1])
420 dnl When config.status generates a header, we must update the stamp-h file.
421 dnl This file resides in the same directory as the config header
422 dnl that is generated.  We must strip everything past the first ":",
423 dnl and everything past the last "/".
424 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
425 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
426 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
427 <<am_indx=1
428 for am_file in <<$1>>; do
429   case " <<$>>CONFIG_HEADERS " in
430   *" <<$>>am_file "*<<)>>
431     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
432     ;;
433   esac
434   am_indx=`expr "<<$>>am_indx" + 1`
435 done<<>>dnl>>)
436 changequote([,]))])
437
438
439 dnl AM_PROG_LEX
440 dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
441 AC_DEFUN(AM_PROG_LEX,
442 [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
443 AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
444 AC_PROG_LEX
445 AC_DECL_YYTEXT])
446
447 # This file is derived from `gettext.m4'.  The difference is that the
448 # included macros assume Cygnus-style source and build trees.
449
450 # Macro to add for using GNU gettext.
451 # Ulrich Drepper <drepper@cygnus.com>, 1995.
452 #
453 # This file file be copied and used freely without restrictions.  It can
454 # be used in projects which are not available under the GNU Public License
455 # but which still want to provide support for the GNU gettext functionality.
456 # Please note that the actual code is *not* freely available.
457
458 # serial 3
459
460 AC_DEFUN(CY_WITH_NLS,
461   [AC_MSG_CHECKING([whether NLS is requested])
462     dnl Default is enabled NLS
463     AC_ARG_ENABLE(nls,
464       [  --disable-nls           do not use Native Language Support],
465       USE_NLS=$enableval, USE_NLS=yes)
466     AC_MSG_RESULT($USE_NLS)
467     AC_SUBST(USE_NLS)
468
469     USE_INCLUDED_LIBINTL=no
470
471     dnl If we use NLS figure out what method
472     if test "$USE_NLS" = "yes"; then
473       AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested])
474       AC_MSG_CHECKING([whether included gettext is requested])
475       AC_ARG_WITH(included-gettext,
476         [  --with-included-gettext use the GNU gettext library included here],
477         nls_cv_force_use_gnu_gettext=$withval,
478         nls_cv_force_use_gnu_gettext=no)
479       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
480
481       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
482       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
483         dnl User does not insist on using GNU NLS library.  Figure out what
484         dnl to use.  If gettext or catgets are available (in this order) we
485         dnl use this.  Else we have to fall back to GNU NLS library.
486         dnl catgets is only used if permitted by option --with-catgets.
487         nls_cv_header_intl=
488         nls_cv_header_libgt=
489         CATOBJEXT=NONE
490
491         AC_CHECK_HEADER(libintl.h,
492           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
493             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
494                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
495
496            if test "$gt_cv_func_gettext_libc" != "yes"; then
497              AC_CHECK_LIB(intl, bindtextdomain,
498                [AC_CACHE_CHECK([for gettext in libintl],
499                  gt_cv_func_gettext_libintl,
500                  [AC_TRY_LINK([], [return (int) gettext ("")],
501                  gt_cv_func_gettext_libintl=yes,
502                  gt_cv_func_gettext_libintl=no)])])
503            fi
504
505            if test "$gt_cv_func_gettext_libc" = "yes" \
506               || test "$gt_cv_func_gettext_libintl" = "yes"; then
507               AC_DEFINE(HAVE_GETTEXT, 1,
508                         [Define as 1 if you have gettext and don't want to use GNU gettext.])
509               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
510                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
511               if test "$MSGFMT" != "no"; then
512                 AC_CHECK_FUNCS(dcgettext)
513                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
514                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
515                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
516                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
517                                return _nl_msg_cat_cntr],
518                   [CATOBJEXT=.gmo
519                    DATADIRNAME=share],
520                   [CATOBJEXT=.mo
521                    DATADIRNAME=lib])
522                 INSTOBJEXT=.mo
523               fi
524             fi
525         ])
526
527         dnl In the standard gettext, we would now check for catgets.
528         dnl However, we never want to use catgets for our releases.
529
530         if test "$CATOBJEXT" = "NONE"; then
531           dnl Neither gettext nor catgets in included in the C library.
532           dnl Fall back on GNU gettext library.
533           nls_cv_use_gnu_gettext=yes
534         fi
535       fi
536
537       if test "$nls_cv_use_gnu_gettext" = "yes"; then
538         dnl Mark actions used to generate GNU NLS library.
539         INTLOBJS="\$(GETTOBJS)"
540         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
541           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
542         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
543         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
544           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
545         AC_SUBST(MSGFMT)
546         USE_INCLUDED_LIBINTL=yes
547         CATOBJEXT=.gmo
548         INSTOBJEXT=.mo
549         DATADIRNAME=share
550         INTLDEPS='$(top_builddir)/../intl/libintl.a'
551         INTLLIBS=$INTLDEPS
552         LIBS=`echo $LIBS | sed -e 's/-lintl//'`
553         nls_cv_header_intl=libintl.h
554         nls_cv_header_libgt=libgettext.h
555       fi
556
557       dnl Test whether we really found GNU xgettext.
558       if test "$XGETTEXT" != ":"; then
559         dnl If it is no GNU xgettext we define it as : so that the
560         dnl Makefiles still can work.
561         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
562           : ;
563         else
564           AC_MSG_RESULT(
565             [found xgettext programs is not GNU xgettext; ignore it])
566           XGETTEXT=":"
567         fi
568       fi
569
570       # We need to process the po/ directory.
571       POSUB=po
572     else
573       DATADIRNAME=share
574       nls_cv_header_intl=libintl.h
575       nls_cv_header_libgt=libgettext.h
576     fi
577
578     # If this is used in GNU gettext we have to set USE_NLS to `yes'
579     # because some of the sources are only built for this goal.
580     if test "$PACKAGE" = gettext; then
581       USE_NLS=yes
582       USE_INCLUDED_LIBINTL=yes
583     fi
584
585     dnl These rules are solely for the distribution goal.  While doing this
586     dnl we only have to keep exactly one list of the available catalogs
587     dnl in configure.in.
588     for lang in $ALL_LINGUAS; do
589       GMOFILES="$GMOFILES $lang.gmo"
590       POFILES="$POFILES $lang.po"
591     done
592
593     dnl Make all variables we use known to autoconf.
594     AC_SUBST(USE_INCLUDED_LIBINTL)
595     AC_SUBST(CATALOGS)
596     AC_SUBST(CATOBJEXT)
597     AC_SUBST(DATADIRNAME)
598     AC_SUBST(GMOFILES)
599     AC_SUBST(INSTOBJEXT)
600     AC_SUBST(INTLDEPS)
601     AC_SUBST(INTLLIBS)
602     AC_SUBST(INTLOBJS)
603     AC_SUBST(POFILES)
604     AC_SUBST(POSUB)
605   ])
606
607 AC_DEFUN(CY_GNU_GETTEXT,
608   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
609    AC_REQUIRE([AC_PROG_CC])dnl
610    AC_REQUIRE([AC_PROG_RANLIB])dnl
611    AC_REQUIRE([AC_ISC_POSIX])dnl
612    AC_REQUIRE([AC_HEADER_STDC])dnl
613    AC_REQUIRE([AC_C_CONST])dnl
614    AC_REQUIRE([AC_C_INLINE])dnl
615    AC_REQUIRE([AC_TYPE_OFF_T])dnl
616    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
617    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
618    AC_REQUIRE([AC_FUNC_MMAP])dnl
619
620    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
621 unistd.h values.h sys/param.h])
622    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
623 __argz_count __argz_stringify __argz_next])
624
625    if test "${ac_cv_func_stpcpy+set}" != "set"; then
626      AC_CHECK_FUNCS(stpcpy)
627    fi
628    if test "${ac_cv_func_stpcpy}" = "yes"; then
629      AC_DEFINE(HAVE_STPCPY, 1, [Define if you have the stpcpy function])
630    fi
631
632    AM_LC_MESSAGES
633    CY_WITH_NLS
634
635    if test "x$CATOBJEXT" != "x"; then
636      if test "x$ALL_LINGUAS" = "x"; then
637        LINGUAS=
638      else
639        AC_MSG_CHECKING(for catalogs to be installed)
640        NEW_LINGUAS=
641        for lang in ${LINGUAS=$ALL_LINGUAS}; do
642          case "$ALL_LINGUAS" in
643           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
644          esac
645        done
646        LINGUAS=$NEW_LINGUAS
647        AC_MSG_RESULT($LINGUAS)
648      fi
649
650      dnl Construct list of names of catalog files to be constructed.
651      if test -n "$LINGUAS"; then
652        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
653      fi
654    fi
655
656    dnl The reference to <locale.h> in the installed <libintl.h> file
657    dnl must be resolved because we cannot expect the users of this
658    dnl to define HAVE_LOCALE_H.
659    if test $ac_cv_header_locale_h = yes; then
660      INCLUDE_LOCALE_H="#include <locale.h>"
661    else
662      INCLUDE_LOCALE_H="\
663 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
664    fi
665    AC_SUBST(INCLUDE_LOCALE_H)
666
667    dnl Determine which catalog format we have (if any is needed)
668    dnl For now we know about two different formats:
669    dnl   Linux libc-5 and the normal X/Open format
670    if test -f $srcdir/po2tbl.sed.in; then
671       if test "$CATOBJEXT" = ".cat"; then
672          AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
673
674          dnl Transform the SED scripts while copying because some dumb SEDs
675          dnl cannot handle comments.
676          sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
677       fi
678       dnl po2tbl.sed is always needed.
679       sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
680          $srcdir/po2tbl.sed.in > po2tbl.sed
681    fi
682
683    dnl In the intl/Makefile.in we have a special dependency which makes
684    dnl only sense for gettext.  We comment this out for non-gettext
685    dnl packages.
686    if test "$PACKAGE" = "gettext"; then
687      GT_NO="#NO#"
688      GT_YES=
689    else
690      GT_NO=
691      GT_YES="#YES#"
692    fi
693    AC_SUBST(GT_NO)
694    AC_SUBST(GT_YES)
695
696    MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
697    AC_SUBST(MKINSTALLDIRS)
698
699    dnl *** For now the libtool support in intl/Makefile is not for real.
700    l=
701    AC_SUBST(l)
702
703    dnl Generate list of files to be processed by xgettext which will
704    dnl be included in po/Makefile.  But only do this if the po directory
705    dnl exists in srcdir.
706    if test -d $srcdir/po; then
707       test -d po || mkdir po
708       if test "x$srcdir" != "x."; then
709          if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
710             posrcprefix="$srcdir/"
711          else
712             posrcprefix="../$srcdir/"
713          fi
714       else
715          posrcprefix="../"
716       fi
717       rm -f po/POTFILES
718       sed -e "/^#/d" -e "/^\$/d" -e "s,.*,      $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
719          < $srcdir/po/POTFILES.in > po/POTFILES
720    fi
721   ])
722
723 # Search path for a program which passes the given test.
724 # Ulrich Drepper <drepper@cygnus.com>, 1996.
725 #
726 # This file file be copied and used freely without restrictions.  It can
727 # be used in projects which are not available under the GNU Public License
728 # but which still want to provide support for the GNU gettext functionality.
729 # Please note that the actual code is *not* freely available.
730
731 # serial 1
732
733 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
734 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
735 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
736 [# Extract the first word of "$2", so it can be a program name with args.
737 set dummy $2; ac_word=[$]2
738 AC_MSG_CHECKING([for $ac_word])
739 AC_CACHE_VAL(ac_cv_path_$1,
740 [case "[$]$1" in
741   /*)
742   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
743   ;;
744   *)
745   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
746   for ac_dir in ifelse([$5], , $PATH, [$5]); do
747     test -z "$ac_dir" && ac_dir=.
748     if test -f $ac_dir/$ac_word; then
749       if [$3]; then
750         ac_cv_path_$1="$ac_dir/$ac_word"
751         break
752       fi
753     fi
754   done
755   IFS="$ac_save_ifs"
756 dnl If no 4th arg is given, leave the cache variable unset,
757 dnl so AC_PATH_PROGS will keep looking.
758 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
759 ])dnl
760   ;;
761 esac])dnl
762 $1="$ac_cv_path_$1"
763 if test -n "[$]$1"; then
764   AC_MSG_RESULT([$]$1)
765 else
766   AC_MSG_RESULT(no)
767 fi
768 AC_SUBST($1)dnl
769 ])
770
771 # Check whether LC_MESSAGES is available in <locale.h>.
772 # Ulrich Drepper <drepper@cygnus.com>, 1995.
773 #
774 # This file file be copied and used freely without restrictions.  It can
775 # be used in projects which are not available under the GNU Public License
776 # but which still want to provide support for the GNU gettext functionality.
777 # Please note that the actual code is *not* freely available.
778
779 # serial 1
780
781 AC_DEFUN(AM_LC_MESSAGES,
782   [if test $ac_cv_header_locale_h = yes; then
783     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
784       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
785        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
786     if test $am_cv_val_LC_MESSAGES = yes; then
787       AC_DEFINE(HAVE_LC_MESSAGES, 1,
788                 [Define if your locale.h file contains LC_MESSAGES.])
789     fi
790   fi])
791
792 # Add --enable-maintainer-mode option to configure.
793 # From Jim Meyering
794
795 # serial 1
796
797 AC_DEFUN(AM_MAINTAINER_MODE,
798 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
799   dnl maintainer-mode is disabled by default
800   AC_ARG_ENABLE(maintainer-mode,
801 [  --enable-maintainer-mode enable make rules and dependencies not useful
802                           (and sometimes confusing) to the casual installer],
803       USE_MAINTAINER_MODE=$enableval,
804       USE_MAINTAINER_MODE=no)
805   AC_MSG_RESULT($USE_MAINTAINER_MODE)
806   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
807   MAINT=$MAINTAINER_MODE_TRUE
808   AC_SUBST(MAINT)dnl
809 ]
810 )
811
812 # Define a conditional.
813
814 AC_DEFUN(AM_CONDITIONAL,
815 [AC_SUBST($1_TRUE)
816 AC_SUBST($1_FALSE)
817 if $2; then
818   $1_TRUE=
819   $1_FALSE='#'
820 else
821   $1_TRUE='#'
822   $1_FALSE=
823 fi])
824