* Makefile.am (ALL_EMULATIONS): Add ecrisaout.o, ecriself.o,
[binutils.git] / gas / aclocal.m4
blob2ae06cf088a4e21a032b19e6e5acd4f9b7d357d0
1 dnl aclocal.m4 generated automatically by aclocal 1.4
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.
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.
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],
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 if test $gas_cv_decl_needed_$1 = yes; then
25  AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
26            [Define if $1 is not declared in system header files.])
28 ])dnl
29 dnl
30 dnl Some non-ANSI preprocessors botch requoting inside strings.  That's bad
31 dnl enough, but on some of those systems, the assert macro relies on requoting
32 dnl working properly!
33 dnl GAS_WORKING_ASSERT
34 AC_DEFUN(GAS_WORKING_ASSERT,
35 [AC_MSG_CHECKING([for working assert macro])
36 AC_CACHE_VAL(gas_cv_assert_ok,
37 AC_TRY_LINK([#include <assert.h>
38 #include <stdio.h>], [
39 /* check for requoting problems */
40 static int a, b, c, d;
41 static char *s;
42 assert (!strcmp(s, "foo bar baz quux"));
43 /* check for newline handling */
44 assert (a == b
45         || c == d);
46 ], gas_cv_assert_ok=yes, gas_cv_assert_ok=no))dnl
47 AC_MSG_RESULT($gas_cv_assert_ok)
48 test $gas_cv_assert_ok = yes || AC_DEFINE(BROKEN_ASSERT, 1, [assert broken?])
49 ])dnl
50 dnl
51 dnl Since many Bourne shell implementations lack subroutines, use this
52 dnl hack to simplify the code in configure.in.
53 dnl GAS_UNIQ(listvar)
54 AC_DEFUN(GAS_UNIQ,
55 [_gas_uniq_list="[$]$1"
56 _gas_uniq_newlist=""
57 dnl Protect against empty input list.
58 for _gas_uniq_i in _gas_uniq_dummy [$]_gas_uniq_list ; do
59   case [$]_gas_uniq_i in
60   _gas_uniq_dummy) ;;
61   *) case " [$]_gas_uniq_newlist " in
62        *" [$]_gas_uniq_i "*) ;;
63        *) _gas_uniq_newlist="[$]_gas_uniq_newlist [$]_gas_uniq_i" ;;
64      esac ;;
65   esac
66 done
67 $1=[$]_gas_uniq_newlist
68 ])dnl
70 # Do all the work for Automake.  This macro actually does too much --
71 # some checks are only needed if your package does certain things.
72 # But this isn't really a big deal.
74 # serial 1
76 dnl Usage:
77 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
79 AC_DEFUN(AM_INIT_AUTOMAKE,
80 [AC_REQUIRE([AC_PROG_INSTALL])
81 PACKAGE=[$1]
82 AC_SUBST(PACKAGE)
83 VERSION=[$2]
84 AC_SUBST(VERSION)
85 dnl test to see if srcdir already configured
86 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
87   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
89 ifelse([$3],,
90 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
91 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
92 AC_REQUIRE([AM_SANITY_CHECK])
93 AC_REQUIRE([AC_ARG_PROGRAM])
94 dnl FIXME This is truly gross.
95 missing_dir=`cd $ac_aux_dir && pwd`
96 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
97 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
98 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
99 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
100 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
101 AC_REQUIRE([AC_PROG_MAKE_SET])])
104 # Check to make sure that the build environment is sane.
107 AC_DEFUN(AM_SANITY_CHECK,
108 [AC_MSG_CHECKING([whether build environment is sane])
109 # Just in case
110 sleep 1
111 echo timestamp > conftestfile
112 # Do `set' in a subshell so we don't clobber the current shell's
113 # arguments.  Must try -L first in case configure is actually a
114 # symlink; some systems play weird games with the mod time of symlinks
115 # (eg FreeBSD returns the mod time of the symlink's containing
116 # directory).
117 if (
118    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
119    if test "[$]*" = "X"; then
120       # -L didn't work.
121       set X `ls -t $srcdir/configure conftestfile`
122    fi
123    if test "[$]*" != "X $srcdir/configure conftestfile" \
124       && test "[$]*" != "X conftestfile $srcdir/configure"; then
126       # If neither matched, then we have a broken ls.  This can happen
127       # if, for instance, CONFIG_SHELL is bash and it inherits a
128       # broken ls alias from the environment.  This has actually
129       # happened.  Such a system could not be considered "sane".
130       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
131 alias in your environment])
132    fi
134    test "[$]2" = conftestfile
135    )
136 then
137    # Ok.
138    :
139 else
140    AC_MSG_ERROR([newly created file is older than distributed files!
141 Check your system clock])
143 rm -f conftest*
144 AC_MSG_RESULT(yes)])
146 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
147 dnl The program must properly implement --version.
148 AC_DEFUN(AM_MISSING_PROG,
149 [AC_MSG_CHECKING(for working $2)
150 # Run test in a subshell; some versions of sh will print an error if
151 # an executable is not found, even if stderr is redirected.
152 # Redirect stdin to placate older versions of autoconf.  Sigh.
153 if ($2 --version) < /dev/null > /dev/null 2>&1; then
154    $1=$2
155    AC_MSG_RESULT(found)
156 else
157    $1="$3/missing $2"
158    AC_MSG_RESULT(missing)
160 AC_SUBST($1)])
163 # serial 40 AC_PROG_LIBTOOL
164 AC_DEFUN(AC_PROG_LIBTOOL,
165 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
167 # Save cache, so that ltconfig can load it
168 AC_CACHE_SAVE
170 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
171 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
172 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
173 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
174 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
175 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
176 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
177 || AC_MSG_ERROR([libtool configure failed])
179 # Reload cache, that may have been modified by ltconfig
180 AC_CACHE_LOAD
182 # This can be used to rebuild libtool when needed
183 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
185 # Always use our own libtool.
186 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
187 AC_SUBST(LIBTOOL)dnl
189 # Redirect the config.log output again, so that the ltconfig log is not
190 # clobbered by the next message.
191 exec 5>>./config.log
194 AC_DEFUN(AC_LIBTOOL_SETUP,
195 [AC_PREREQ(2.13)dnl
196 AC_REQUIRE([AC_ENABLE_SHARED])dnl
197 AC_REQUIRE([AC_ENABLE_STATIC])dnl
198 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
199 AC_REQUIRE([AC_CANONICAL_HOST])dnl
200 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
201 AC_REQUIRE([AC_PROG_RANLIB])dnl
202 AC_REQUIRE([AC_PROG_CC])dnl
203 AC_REQUIRE([AC_PROG_LD])dnl
204 AC_REQUIRE([AC_PROG_NM])dnl
205 AC_REQUIRE([AC_PROG_LN_S])dnl
208 # Check for any special flags to pass to ltconfig.
209 libtool_flags="--cache-file=$cache_file"
210 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
211 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
212 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
213 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
214 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
215 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
216 [libtool_flags="$libtool_flags --enable-dlopen"])
217 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
218 [libtool_flags="$libtool_flags --enable-win32-dll"])
219 AC_ARG_ENABLE(libtool-lock,
220   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
221 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
222 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
224 # Some flags need to be propagated to the compiler or linker for good
225 # libtool support.
226 case "$host" in
227 *-*-irix6*)
228   # Find out which ABI we are using.
229   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
230   if AC_TRY_EVAL(ac_compile); then
231     case "`/usr/bin/file conftest.o`" in
232     *32-bit*)
233       LD="${LD-ld} -32"
234       ;;
235     *N32*)
236       LD="${LD-ld} -n32"
237       ;;
238     *64-bit*)
239       LD="${LD-ld} -64"
240       ;;
241     esac
242   fi
243   rm -rf conftest*
244   ;;
246 *-*-sco3.2v5*)
247   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
248   SAVE_CFLAGS="$CFLAGS"
249   CFLAGS="$CFLAGS -belf"
250   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
251     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
252   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
253     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
254     CFLAGS="$SAVE_CFLAGS"
255   fi
256   ;;
258 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
259 [*-*-cygwin* | *-*-mingw*)
260   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
261   AC_CHECK_TOOL(AS, as, false)
262   AC_CHECK_TOOL(OBJDUMP, objdump, false)
263   ;;
265 esac
268 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
269 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
271 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
272 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
274 # AC_ENABLE_SHARED - implement the --enable-shared flag
275 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
276 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
277 #   `yes'.
278 AC_DEFUN(AC_ENABLE_SHARED, [dnl
279 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
280 AC_ARG_ENABLE(shared,
281 changequote(<<, >>)dnl
282 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
283 changequote([, ])dnl
284 [p=${PACKAGE-default}
285 case "$enableval" in
286 yes) enable_shared=yes ;;
287 no) enable_shared=no ;;
289   enable_shared=no
290   # Look at the argument we got.  We use all the common list separators.
291   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
292   for pkg in $enableval; do
293     if test "X$pkg" = "X$p"; then
294       enable_shared=yes
295     fi
296   done
297   IFS="$ac_save_ifs"
298   ;;
299 esac],
300 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
303 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
304 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
305 AC_ENABLE_SHARED(no)])
307 # AC_ENABLE_STATIC - implement the --enable-static flag
308 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
309 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
310 #   `yes'.
311 AC_DEFUN(AC_ENABLE_STATIC, [dnl
312 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
313 AC_ARG_ENABLE(static,
314 changequote(<<, >>)dnl
315 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
316 changequote([, ])dnl
317 [p=${PACKAGE-default}
318 case "$enableval" in
319 yes) enable_static=yes ;;
320 no) enable_static=no ;;
322   enable_static=no
323   # Look at the argument we got.  We use all the common list separators.
324   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
325   for pkg in $enableval; do
326     if test "X$pkg" = "X$p"; then
327       enable_static=yes
328     fi
329   done
330   IFS="$ac_save_ifs"
331   ;;
332 esac],
333 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
336 # AC_DISABLE_STATIC - set the default static flag to --disable-static
337 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
338 AC_ENABLE_STATIC(no)])
341 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
342 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
343 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
344 #   `yes'.
345 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
346 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
347 AC_ARG_ENABLE(fast-install,
348 changequote(<<, >>)dnl
349 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
350 changequote([, ])dnl
351 [p=${PACKAGE-default}
352 case "$enableval" in
353 yes) enable_fast_install=yes ;;
354 no) enable_fast_install=no ;;
356   enable_fast_install=no
357   # Look at the argument we got.  We use all the common list separators.
358   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
359   for pkg in $enableval; do
360     if test "X$pkg" = "X$p"; then
361       enable_fast_install=yes
362     fi
363   done
364   IFS="$ac_save_ifs"
365   ;;
366 esac],
367 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
370 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
371 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
372 AC_ENABLE_FAST_INSTALL(no)])
374 # AC_PROG_LD - find the path to the GNU or non-GNU linker
375 AC_DEFUN(AC_PROG_LD,
376 [AC_ARG_WITH(gnu-ld,
377 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
378 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
379 AC_REQUIRE([AC_PROG_CC])dnl
380 AC_REQUIRE([AC_CANONICAL_HOST])dnl
381 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
382 ac_prog=ld
383 if test "$ac_cv_prog_gcc" = yes; then
384   # Check if gcc -print-prog-name=ld gives a path.
385   AC_MSG_CHECKING([for ld used by GCC])
386   ac_prog=`($CC -print-prog-name=ld) 2>&5`
387   case "$ac_prog" in
388     # Accept absolute paths.
389 changequote(,)dnl
390     [\\/]* | [A-Za-z]:[\\/]*)
391       re_direlt='/[^/][^/]*/\.\./'
392 changequote([,])dnl
393       # Canonicalize the path of ld
394       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
395       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
396         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
397       done
398       test -z "$LD" && LD="$ac_prog"
399       ;;
400   "")
401     # If it fails, then pretend we aren't using GCC.
402     ac_prog=ld
403     ;;
404   *)
405     # If it is relative, then search for the first ld in PATH.
406     with_gnu_ld=unknown
407     ;;
408   esac
409 elif test "$with_gnu_ld" = yes; then
410   AC_MSG_CHECKING([for GNU ld])
411 else
412   AC_MSG_CHECKING([for non-GNU ld])
414 AC_CACHE_VAL(ac_cv_path_LD,
415 [if test -z "$LD"; then
416   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
417   for ac_dir in $PATH; do
418     test -z "$ac_dir" && ac_dir=.
419     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
420       ac_cv_path_LD="$ac_dir/$ac_prog"
421       # Check to see if the program is GNU ld.  I'd rather use --version,
422       # but apparently some GNU ld's only accept -v.
423       # Break only if it was the GNU/non-GNU ld that we prefer.
424       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
425         test "$with_gnu_ld" != no && break
426       else
427         test "$with_gnu_ld" != yes && break
428       fi
429     fi
430   done
431   IFS="$ac_save_ifs"
432 else
433   ac_cv_path_LD="$LD" # Let the user override the test with a path.
434 fi])
435 LD="$ac_cv_path_LD"
436 if test -n "$LD"; then
437   AC_MSG_RESULT($LD)
438 else
439   AC_MSG_RESULT(no)
441 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
442 AC_PROG_LD_GNU
445 AC_DEFUN(AC_PROG_LD_GNU,
446 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
447 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
448 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
449   ac_cv_prog_gnu_ld=yes
450 else
451   ac_cv_prog_gnu_ld=no
452 fi])
455 # AC_PROG_NM - find the path to a BSD-compatible name lister
456 AC_DEFUN(AC_PROG_NM,
457 [AC_MSG_CHECKING([for BSD-compatible nm])
458 AC_CACHE_VAL(ac_cv_path_NM,
459 [if test -n "$NM"; then
460   # Let the user override the test.
461   ac_cv_path_NM="$NM"
462 else
463   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
464   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
465     test -z "$ac_dir" && ac_dir=.
466     if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
467       # Check to see if the nm accepts a BSD-compat flag.
468       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
469       #   nm: unknown option "B" ignored
470       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
471         ac_cv_path_NM="$ac_dir/nm -B"
472         break
473       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
474         ac_cv_path_NM="$ac_dir/nm -p"
475         break
476       else
477         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
478         continue # so that we can try to find one that supports BSD flags
479       fi
480     fi
481   done
482   IFS="$ac_save_ifs"
483   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
484 fi])
485 NM="$ac_cv_path_NM"
486 AC_MSG_RESULT([$NM])
489 # AC_CHECK_LIBM - check for math library
490 AC_DEFUN(AC_CHECK_LIBM,
491 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
492 LIBM=
493 case "$host" in
494 *-*-beos* | *-*-cygwin*)
495   # These system don't have libm
496   ;;
497 *-ncr-sysv4.3*)
498   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
499   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
500   ;;
502   AC_CHECK_LIB(m, main, LIBM="-lm")
503   ;;
504 esac
507 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
508 # the libltdl convenience library, adds --enable-ltdl-convenience to
509 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
510 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
511 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
512 # '${top_builddir}/' (note the single quotes!) if your package is not
513 # flat, and, if you're not using automake, define top_builddir as
514 # appropriate in the Makefiles.
515 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
516   case "$enable_ltdl_convenience" in
517   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
518   "") enable_ltdl_convenience=yes
519       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
520   esac
521   LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
522   INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
525 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
526 # the libltdl installable library, and adds --enable-ltdl-install to
527 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
528 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
529 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
530 # '${top_builddir}/' (note the single quotes!) if your package is not
531 # flat, and, if you're not using automake, define top_builddir as
532 # appropriate in the Makefiles.
533 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
534 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
535   AC_CHECK_LIB(ltdl, main,
536   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
537   [if test x"$enable_ltdl_install" = xno; then
538      AC_MSG_WARN([libltdl not installed, but installation disabled])
539    else
540      enable_ltdl_install=yes
541    fi
542   ])
543   if test x"$enable_ltdl_install" = x"yes"; then
544     ac_configure_args="$ac_configure_args --enable-ltdl-install"
545     LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
546     INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
547   else
548     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
549     LIBLTDL="-lltdl"
550     INCLTDL=
551   fi
554 dnl old names
555 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
556 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
557 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
558 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
559 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
560 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
561 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
563 dnl This is just to silence aclocal about the macro not being used
564 ifelse([AC_DISABLE_FAST_INSTALL])dnl
566 # Like AC_CONFIG_HEADER, but automatically create stamp file.
568 AC_DEFUN(AM_CONFIG_HEADER,
569 [AC_PREREQ([2.12])
570 AC_CONFIG_HEADER([$1])
571 dnl When config.status generates a header, we must update the stamp-h file.
572 dnl This file resides in the same directory as the config header
573 dnl that is generated.  We must strip everything past the first ":",
574 dnl and everything past the last "/".
575 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
576 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
577 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
578 <<am_indx=1
579 for am_file in <<$1>>; do
580   case " <<$>>CONFIG_HEADERS " in
581   *" <<$>>am_file "*<<)>>
582     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
583     ;;
584   esac
585   am_indx=`expr "<<$>>am_indx" + 1`
586 done<<>>dnl>>)
587 changequote([,]))])
590 dnl AM_PROG_LEX
591 dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
592 AC_DEFUN(AM_PROG_LEX,
593 [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
594 AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
595 AC_PROG_LEX
596 AC_DECL_YYTEXT])
598 # This file is derived from `gettext.m4'.  The difference is that the
599 # included macros assume Cygnus-style source and build trees.
601 # Macro to add for using GNU gettext.
602 # Ulrich Drepper <drepper@cygnus.com>, 1995.
604 # This file file be copied and used freely without restrictions.  It can
605 # be used in projects which are not available under the GNU Public License
606 # but which still want to provide support for the GNU gettext functionality.
607 # Please note that the actual code is *not* freely available.
609 # serial 3
611 AC_DEFUN(CY_WITH_NLS,
612   [AC_MSG_CHECKING([whether NLS is requested])
613     dnl Default is enabled NLS
614     AC_ARG_ENABLE(nls,
615       [  --disable-nls           do not use Native Language Support],
616       USE_NLS=$enableval, USE_NLS=yes)
617     AC_MSG_RESULT($USE_NLS)
618     AC_SUBST(USE_NLS)
620     USE_INCLUDED_LIBINTL=no
622     dnl If we use NLS figure out what method
623     if test "$USE_NLS" = "yes"; then
624       AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested])
625       AC_MSG_CHECKING([whether included gettext is requested])
626       AC_ARG_WITH(included-gettext,
627         [  --with-included-gettext use the GNU gettext library included here],
628         nls_cv_force_use_gnu_gettext=$withval,
629         nls_cv_force_use_gnu_gettext=no)
630       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
632       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
633       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
634         dnl User does not insist on using GNU NLS library.  Figure out what
635         dnl to use.  If gettext or catgets are available (in this order) we
636         dnl use this.  Else we have to fall back to GNU NLS library.
637         dnl catgets is only used if permitted by option --with-catgets.
638         nls_cv_header_intl=
639         nls_cv_header_libgt=
640         CATOBJEXT=NONE
642         AC_CHECK_HEADER(libintl.h,
643           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
644             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
645                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
647            if test "$gt_cv_func_gettext_libc" != "yes"; then
648              AC_CHECK_LIB(intl, bindtextdomain,
649                [AC_CACHE_CHECK([for gettext in libintl],
650                  gt_cv_func_gettext_libintl,
651                  [AC_TRY_LINK([], [return (int) gettext ("")],
652                  gt_cv_func_gettext_libintl=yes,
653                  gt_cv_func_gettext_libintl=no)])])
654            fi
656            if test "$gt_cv_func_gettext_libc" = "yes" \
657               || test "$gt_cv_func_gettext_libintl" = "yes"; then
658               AC_DEFINE(HAVE_GETTEXT, 1,
659                         [Define as 1 if you have gettext and don't want to use GNU gettext.])
660               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
661                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
662               if test "$MSGFMT" != "no"; then
663                 AC_CHECK_FUNCS(dcgettext)
664                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
665                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
666                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
667                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
668                                return _nl_msg_cat_cntr],
669                   [CATOBJEXT=.gmo
670                    DATADIRNAME=share],
671                   [CATOBJEXT=.mo
672                    DATADIRNAME=lib])
673                 INSTOBJEXT=.mo
674               fi
675             fi
676         ])
678         dnl In the standard gettext, we would now check for catgets.
679         dnl However, we never want to use catgets for our releases.
681         if test "$CATOBJEXT" = "NONE"; then
682           dnl Neither gettext nor catgets in included in the C library.
683           dnl Fall back on GNU gettext library.
684           nls_cv_use_gnu_gettext=yes
685         fi
686       fi
688       if test "$nls_cv_use_gnu_gettext" = "yes"; then
689         dnl Mark actions used to generate GNU NLS library.
690         INTLOBJS="\$(GETTOBJS)"
691         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
692           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
693         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
694         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
695           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
696         AC_SUBST(MSGFMT)
697         USE_INCLUDED_LIBINTL=yes
698         CATOBJEXT=.gmo
699         INSTOBJEXT=.mo
700         DATADIRNAME=share
701         INTLDEPS='$(top_builddir)/../intl/libintl.a'
702         INTLLIBS=$INTLDEPS
703         LIBS=`echo $LIBS | sed -e 's/-lintl//'`
704         nls_cv_header_intl=libintl.h
705         nls_cv_header_libgt=libgettext.h
706       fi
708       dnl Test whether we really found GNU xgettext.
709       if test "$XGETTEXT" != ":"; then
710         dnl If it is no GNU xgettext we define it as : so that the
711         dnl Makefiles still can work.
712         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
713           : ;
714         else
715           AC_MSG_RESULT(
716             [found xgettext programs is not GNU xgettext; ignore it])
717           XGETTEXT=":"
718         fi
719       fi
721       # We need to process the po/ directory.
722       POSUB=po
723     else
724       DATADIRNAME=share
725       nls_cv_header_intl=libintl.h
726       nls_cv_header_libgt=libgettext.h
727     fi
729     # If this is used in GNU gettext we have to set USE_NLS to `yes'
730     # because some of the sources are only built for this goal.
731     if test "$PACKAGE" = gettext; then
732       USE_NLS=yes
733       USE_INCLUDED_LIBINTL=yes
734     fi
736     dnl These rules are solely for the distribution goal.  While doing this
737     dnl we only have to keep exactly one list of the available catalogs
738     dnl in configure.in.
739     for lang in $ALL_LINGUAS; do
740       GMOFILES="$GMOFILES $lang.gmo"
741       POFILES="$POFILES $lang.po"
742     done
744     dnl Make all variables we use known to autoconf.
745     AC_SUBST(USE_INCLUDED_LIBINTL)
746     AC_SUBST(CATALOGS)
747     AC_SUBST(CATOBJEXT)
748     AC_SUBST(DATADIRNAME)
749     AC_SUBST(GMOFILES)
750     AC_SUBST(INSTOBJEXT)
751     AC_SUBST(INTLDEPS)
752     AC_SUBST(INTLLIBS)
753     AC_SUBST(INTLOBJS)
754     AC_SUBST(POFILES)
755     AC_SUBST(POSUB)
756   ])
758 AC_DEFUN(CY_GNU_GETTEXT,
759   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
760    AC_REQUIRE([AC_PROG_CC])dnl
761    AC_REQUIRE([AC_PROG_RANLIB])dnl
762    AC_REQUIRE([AC_ISC_POSIX])dnl
763    AC_REQUIRE([AC_HEADER_STDC])dnl
764    AC_REQUIRE([AC_C_CONST])dnl
765    AC_REQUIRE([AC_C_INLINE])dnl
766    AC_REQUIRE([AC_TYPE_OFF_T])dnl
767    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
768    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
769    AC_REQUIRE([AC_FUNC_MMAP])dnl
771    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
772 unistd.h values.h sys/param.h])
773    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
774 __argz_count __argz_stringify __argz_next])
776    if test "${ac_cv_func_stpcpy+set}" != "set"; then
777      AC_CHECK_FUNCS(stpcpy)
778    fi
779    if test "${ac_cv_func_stpcpy}" = "yes"; then
780      AC_DEFINE(HAVE_STPCPY, 1, [Define if you have the stpcpy function])
781    fi
783    AM_LC_MESSAGES
784    CY_WITH_NLS
786    if test "x$CATOBJEXT" != "x"; then
787      if test "x$ALL_LINGUAS" = "x"; then
788        LINGUAS=
789      else
790        AC_MSG_CHECKING(for catalogs to be installed)
791        NEW_LINGUAS=
792        for lang in ${LINGUAS=$ALL_LINGUAS}; do
793          case "$ALL_LINGUAS" in
794           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
795          esac
796        done
797        LINGUAS=$NEW_LINGUAS
798        AC_MSG_RESULT($LINGUAS)
799      fi
801      dnl Construct list of names of catalog files to be constructed.
802      if test -n "$LINGUAS"; then
803        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
804      fi
805    fi
807    dnl The reference to <locale.h> in the installed <libintl.h> file
808    dnl must be resolved because we cannot expect the users of this
809    dnl to define HAVE_LOCALE_H.
810    if test $ac_cv_header_locale_h = yes; then
811      INCLUDE_LOCALE_H="#include <locale.h>"
812    else
813      INCLUDE_LOCALE_H="\
814 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
815    fi
816    AC_SUBST(INCLUDE_LOCALE_H)
818    dnl Determine which catalog format we have (if any is needed)
819    dnl For now we know about two different formats:
820    dnl   Linux libc-5 and the normal X/Open format
821    if test -f $srcdir/po2tbl.sed.in; then
822       if test "$CATOBJEXT" = ".cat"; then
823          AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
825          dnl Transform the SED scripts while copying because some dumb SEDs
826          dnl cannot handle comments.
827          sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
828       fi
829       dnl po2tbl.sed is always needed.
830       sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
831          $srcdir/po2tbl.sed.in > po2tbl.sed
832    fi
834    dnl In the intl/Makefile.in we have a special dependency which makes
835    dnl only sense for gettext.  We comment this out for non-gettext
836    dnl packages.
837    if test "$PACKAGE" = "gettext"; then
838      GT_NO="#NO#"
839      GT_YES=
840    else
841      GT_NO=
842      GT_YES="#YES#"
843    fi
844    AC_SUBST(GT_NO)
845    AC_SUBST(GT_YES)
847    MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
848    AC_SUBST(MKINSTALLDIRS)
850    dnl *** For now the libtool support in intl/Makefile is not for real.
851    l=
852    AC_SUBST(l)
854    dnl Generate list of files to be processed by xgettext which will
855    dnl be included in po/Makefile.  But only do this if the po directory
856    dnl exists in srcdir.
857    if test -d $srcdir/po; then
858       test -d po || mkdir po
859       if test "x$srcdir" != "x."; then
860          if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
861             posrcprefix="$srcdir/"
862          else
863             posrcprefix="../$srcdir/"
864          fi
865       else
866          posrcprefix="../"
867       fi
868       rm -f po/POTFILES
869       sed -e "/^#/d" -e "/^\$/d" -e "s,.*,      $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
870          < $srcdir/po/POTFILES.in > po/POTFILES
871    fi
872   ])
874 # Search path for a program which passes the given test.
875 # Ulrich Drepper <drepper@cygnus.com>, 1996.
877 # This file file be copied and used freely without restrictions.  It can
878 # be used in projects which are not available under the GNU Public License
879 # but which still want to provide support for the GNU gettext functionality.
880 # Please note that the actual code is *not* freely available.
882 # serial 1
884 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
885 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
886 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
887 [# Extract the first word of "$2", so it can be a program name with args.
888 set dummy $2; ac_word=[$]2
889 AC_MSG_CHECKING([for $ac_word])
890 AC_CACHE_VAL(ac_cv_path_$1,
891 [case "[$]$1" in
892   /*)
893   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
894   ;;
895   *)
896   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
897   for ac_dir in ifelse([$5], , $PATH, [$5]); do
898     test -z "$ac_dir" && ac_dir=.
899     if test -f $ac_dir/$ac_word; then
900       if [$3]; then
901         ac_cv_path_$1="$ac_dir/$ac_word"
902         break
903       fi
904     fi
905   done
906   IFS="$ac_save_ifs"
907 dnl If no 4th arg is given, leave the cache variable unset,
908 dnl so AC_PATH_PROGS will keep looking.
909 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
910 ])dnl
911   ;;
912 esac])dnl
913 $1="$ac_cv_path_$1"
914 if test -n "[$]$1"; then
915   AC_MSG_RESULT([$]$1)
916 else
917   AC_MSG_RESULT(no)
919 AC_SUBST($1)dnl
922 # Check whether LC_MESSAGES is available in <locale.h>.
923 # Ulrich Drepper <drepper@cygnus.com>, 1995.
925 # This file file be copied and used freely without restrictions.  It can
926 # be used in projects which are not available under the GNU Public License
927 # but which still want to provide support for the GNU gettext functionality.
928 # Please note that the actual code is *not* freely available.
930 # serial 1
932 AC_DEFUN(AM_LC_MESSAGES,
933   [if test $ac_cv_header_locale_h = yes; then
934     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
935       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
936        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
937     if test $am_cv_val_LC_MESSAGES = yes; then
938       AC_DEFINE(HAVE_LC_MESSAGES, 1,
939                 [Define if your locale.h file contains LC_MESSAGES.])
940     fi
941   fi])
943 # Add --enable-maintainer-mode option to configure.
944 # From Jim Meyering
946 # serial 1
948 AC_DEFUN(AM_MAINTAINER_MODE,
949 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
950   dnl maintainer-mode is disabled by default
951   AC_ARG_ENABLE(maintainer-mode,
952 [  --enable-maintainer-mode enable make rules and dependencies not useful
953                           (and sometimes confusing) to the casual installer],
954       USE_MAINTAINER_MODE=$enableval,
955       USE_MAINTAINER_MODE=no)
956   AC_MSG_RESULT($USE_MAINTAINER_MODE)
957   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
958   MAINT=$MAINTAINER_MODE_TRUE
959   AC_SUBST(MAINT)dnl
963 # Define a conditional.
965 AC_DEFUN(AM_CONDITIONAL,
966 [AC_SUBST($1_TRUE)
967 AC_SUBST($1_FALSE)
968 if $2; then
969   $1_TRUE=
970   $1_FALSE='#'
971 else
972   $1_TRUE='#'
973   $1_FALSE=
974 fi])