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