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