aclocal.m4 revision 60484
1dnl aclocal.m4 generated automatically by aclocal 1.4
2
3dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
14AC_DEFUN(BFD_BINARY_FOPEN,
15[AC_REQUIRE([AC_CANONICAL_SYSTEM])
16case "${host}" in
17changequote(,)dnl
18*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
19changequote([,])dnl
20  AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
21esac])dnl
22
23dnl Get a default for CC_FOR_BUILD to put into Makefile.
24AC_DEFUN(BFD_CC_FOR_BUILD,
25[# Put a plausible default for CC_FOR_BUILD in Makefile.
26if 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
32fi
33AC_SUBST(CC_FOR_BUILD)
34# Also set EXEEXT_FOR_BUILD.
35if test "x$cross_compiling" = "xno"; then
36  EXEEXT_FOR_BUILD='$(EXEEXT)'
37else
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}
53fi
54AC_SUBST(EXEEXT_FOR_BUILD)])dnl
55
56dnl See whether we need a declaration for a function.
57AC_DEFUN(BFD_NEED_DECLARATION,
58[AC_MSG_CHECKING([whether $1 must be declared])
59AC_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],
76bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
77AC_MSG_RESULT($bfd_cv_decl_needed_$1)
78if 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.])
81fi
82])dnl
83
84dnl Check for existence of a type $1 in sys/procfs.h
85
86AC_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)
99])
100
101
102dnl Check for existence of member $2 in type $1 in sys/procfs.h
103
104AC_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)
117])
118
119
120
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.
124
125# serial 1
126
127dnl Usage:
128dnl AM_INIT_AUTOMAKE(package,version, [no-define])
129
130AC_DEFUN(AM_INIT_AUTOMAKE,
131[AC_REQUIRE([AC_PROG_INSTALL])
132PACKAGE=[$1]
133AC_SUBST(PACKAGE)
134VERSION=[$2]
135AC_SUBST(VERSION)
136dnl test to see if srcdir already configured
137if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
138  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
139fi
140ifelse([$3],,
141AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
142AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
143AC_REQUIRE([AM_SANITY_CHECK])
144AC_REQUIRE([AC_ARG_PROGRAM])
145dnl FIXME This is truly gross.
146missing_dir=`cd $ac_aux_dir && pwd`
147AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
148AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
149AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
150AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
151AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
152AC_REQUIRE([AC_PROG_MAKE_SET])])
153
154#
155# Check to make sure that the build environment is sane.
156#
157
158AC_DEFUN(AM_SANITY_CHECK,
159[AC_MSG_CHECKING([whether build environment is sane])
160# Just in case
161sleep 1
162echo 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).
168if (
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
176
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
182alias in your environment])
183   fi
184
185   test "[$]2" = conftestfile
186   )
187then
188   # Ok.
189   :
190else
191   AC_MSG_ERROR([newly created file is older than distributed files!
192Check your system clock])
193fi
194rm -f conftest*
195AC_MSG_RESULT(yes)])
196
197dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
198dnl The program must properly implement --version.
199AC_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.
204if ($2 --version) < /dev/null > /dev/null 2>&1; then
205   $1=$2
206   AC_MSG_RESULT(found)
207else
208   $1="$3/missing $2"
209   AC_MSG_RESULT(missing)
210fi
211AC_SUBST($1)])
212
213
214# serial 40 AC_PROG_LIBTOOL
215AC_DEFUN(AC_PROG_LIBTOOL,
216[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
217
218# Save cache, so that ltconfig can load it
219AC_CACHE_SAVE
220
221# Actually configure libtool.  ac_aux_dir is where install-sh is found.
222CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
223LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
224LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
225DLLTOOL="$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])
229
230# Reload cache, that may have been modified by ltconfig
231AC_CACHE_LOAD
232
233# This can be used to rebuild libtool when needed
234LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
235
236# Always use our own libtool.
237LIBTOOL='$(SHELL) $(top_builddir)/libtool'
238AC_SUBST(LIBTOOL)dnl
239
240# Redirect the config.log output again, so that the ltconfig log is not
241# clobbered by the next message.
242exec 5>>./config.log
243])
244
245AC_DEFUN(AC_LIBTOOL_SETUP,
246[AC_PREREQ(2.13)dnl
247AC_REQUIRE([AC_ENABLE_SHARED])dnl
248AC_REQUIRE([AC_ENABLE_STATIC])dnl
249AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
250AC_REQUIRE([AC_CANONICAL_HOST])dnl
251AC_REQUIRE([AC_CANONICAL_BUILD])dnl
252AC_REQUIRE([AC_PROG_RANLIB])dnl
253AC_REQUIRE([AC_PROG_CC])dnl
254AC_REQUIRE([AC_PROG_LD])dnl
255AC_REQUIRE([AC_PROG_NM])dnl
256AC_REQUIRE([AC_PROG_LN_S])dnl
257dnl
258
259case "$target" in
260NONE) lt_target="$host" ;;
261*) lt_target="$target" ;;
262esac
263
264# Check for any special flags to pass to ltconfig.
265libtool_flags="--cache-file=$cache_file"
266test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
267test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
268test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
269test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
270test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
271ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
272[libtool_flags="$libtool_flags --enable-dlopen"])
273ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
274[libtool_flags="$libtool_flags --enable-win32-dll"])
275AC_ARG_ENABLE(libtool-lock,
276  [  --disable-libtool-lock  avoid locking (might break parallel builds)])
277test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
278test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
279
280# Some flags need to be propagated to the compiler or linker for good
281# libtool support.
282case "$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  ;;
301
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  ;;
313
314ifdef([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  ;;
320])
321esac
322])
323
324# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
325AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
326
327# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
328AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
329
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'.
334AC_DEFUN(AC_ENABLE_SHARED, [dnl
335define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
336AC_ARG_ENABLE(shared,
337changequote(<<, >>)dnl
338<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
339changequote([, ])dnl
340[p=${PACKAGE-default}
341case "$enableval" in
342yes) enable_shared=yes ;;
343no) enable_shared=no ;;
344*)
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  ;;
355esac],
356enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
357])
358
359# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
360AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
361AC_ENABLE_SHARED(no)])
362
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'.
367AC_DEFUN(AC_ENABLE_STATIC, [dnl
368define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
369AC_ARG_ENABLE(static,
370changequote(<<, >>)dnl
371<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
372changequote([, ])dnl
373[p=${PACKAGE-default}
374case "$enableval" in
375yes) enable_static=yes ;;
376no) enable_static=no ;;
377*)
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  ;;
388esac],
389enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
390])
391
392# AC_DISABLE_STATIC - set the default static flag to --disable-static
393AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
394AC_ENABLE_STATIC(no)])
395
396
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'.
401AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
402define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
403AC_ARG_ENABLE(fast-install,
404changequote(<<, >>)dnl
405<<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
406changequote([, ])dnl
407[p=${PACKAGE-default}
408case "$enableval" in
409yes) enable_fast_install=yes ;;
410no) enable_fast_install=no ;;
411*)
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  ;;
422esac],
423enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
424])
425
426# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
427AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
428AC_ENABLE_FAST_INSTALL(no)])
429
430# AC_PROG_LD - find the path to the GNU or non-GNU linker
431AC_DEFUN(AC_PROG_LD,
432[AC_ARG_WITH(gnu-ld,
433[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
434test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
435AC_REQUIRE([AC_PROG_CC])dnl
436AC_REQUIRE([AC_CANONICAL_HOST])dnl
437AC_REQUIRE([AC_CANONICAL_BUILD])dnl
438ac_prog=ld
439if 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.
445changequote(,)dnl
446    [\\/]* | [A-Za-z]:[\\/]*)
447      re_direlt='/[^/][^/]*/\.\./'
448changequote([,])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
465elif test "$with_gnu_ld" = yes; then
466  AC_MSG_CHECKING([for GNU ld])
467else
468  AC_MSG_CHECKING([for non-GNU ld])
469fi
470AC_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"
488else
489  ac_cv_path_LD="$LD" # Let the user override the test with a path.
490fi])
491LD="$ac_cv_path_LD"
492if test -n "$LD"; then
493  AC_MSG_RESULT($LD)
494else
495  AC_MSG_RESULT(no)
496fi
497test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
498AC_PROG_LD_GNU
499])
500
501AC_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.
504if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
505  ac_cv_prog_gnu_ld=yes
506else
507  ac_cv_prog_gnu_ld=no
508fi])
509])
510
511# AC_PROG_NM - find the path to a BSD-compatible name lister
512AC_DEFUN(AC_PROG_NM,
513[AC_MSG_CHECKING([for BSD-compatible nm])
514AC_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"
518else
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
540fi])
541NM="$ac_cv_path_NM"
542AC_MSG_RESULT([$NM])
543])
544
545# AC_CHECK_LIBM - check for math library
546AC_DEFUN(AC_CHECK_LIBM,
547[AC_REQUIRE([AC_CANONICAL_HOST])dnl
548LIBM=
549case "$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  ;;
557*)
558  AC_CHECK_LIB(m, main, LIBM="-lm")
559  ;;
560esac
561])
562
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.
571AC_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'])
579])
580
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.
590AC_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
608])
609
610dnl old names
611AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
612AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
613AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
614AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
615AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
616AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
617AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
618
619dnl This is just to silence aclocal about the macro not being used
620ifelse([AC_DISABLE_FAST_INSTALL])dnl
621
622# Like AC_CONFIG_HEADER, but automatically create stamp file.
623
624AC_DEFUN(AM_CONFIG_HEADER,
625[AC_PREREQ([2.12])
626AC_CONFIG_HEADER([$1])
627dnl When config.status generates a header, we must update the stamp-h file.
628dnl This file resides in the same directory as the config header
629dnl that is generated.  We must strip everything past the first ":",
630dnl and everything past the last "/".
631AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
632ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
633<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
634<<am_indx=1
635for 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`
642done<<>>dnl>>)
643changequote([,]))])
644
645# Add --enable-maintainer-mode option to configure.
646# From Jim Meyering
647
648# serial 1
649
650AC_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
662]
663)
664
665# Define a conditional.
666
667AC_DEFUN(AM_CONDITIONAL,
668[AC_SUBST($1_TRUE)
669AC_SUBST($1_FALSE)
670if $2; then
671  $1_TRUE=
672  $1_FALSE='#'
673else
674  $1_TRUE='#'
675  $1_FALSE=
676fi])
677
678# This file is derived from `gettext.m4'.  The difference is that the
679# included macros assume Cygnus-style source and build trees.
680
681# Macro to add for using GNU gettext.
682# Ulrich Drepper <drepper@cygnus.com>, 1995.
683#
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.
688
689# serial 3
690
691AC_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)
699
700    USE_INCLUDED_LIBINTL=no
701
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)
711
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
721
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)])
726
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
735
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	])
757
758	dnl In the standard gettext, we would now check for catgets.
759        dnl However, we never want to use catgets for our releases.
760
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
767
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
787
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
800
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
808
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
815
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
823
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  ])
837
838AC_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
850
851   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
852unistd.h values.h sys/param.h])
853   AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
854__argz_count __argz_stringify __argz_next])
855
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
862
863   AM_LC_MESSAGES
864   CY_WITH_NLS
865
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
880
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
886
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)
897
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)
904
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
913
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)
926
927   MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
928   AC_SUBST(MKINSTALLDIRS)
929
930   dnl *** For now the libtool support in intl/Makefile is not for real.
931   l=
932   AC_SUBST(l)
933
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  ])
953
954# Search path for a program which passes the given test.
955# Ulrich Drepper <drepper@cygnus.com>, 1996.
956#
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.
961
962# serial 1
963
964dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
965dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
966AC_DEFUN(AM_PATH_PROG_WITH_TEST,
967[# Extract the first word of "$2", so it can be a program name with args.
968set dummy $2; ac_word=[$]2
969AC_MSG_CHECKING([for $ac_word])
970AC_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"
987dnl If no 4th arg is given, leave the cache variable unset,
988dnl so AC_PATH_PROGS will keep looking.
989ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
990])dnl
991  ;;
992esac])dnl
993$1="$ac_cv_path_$1"
994if test -n "[$]$1"; then
995  AC_MSG_RESULT([$]$1)
996else
997  AC_MSG_RESULT(no)
998fi
999AC_SUBST($1)dnl
1000])
1001
1002# Check whether LC_MESSAGES is available in <locale.h>.
1003# Ulrich Drepper <drepper@cygnus.com>, 1995.
1004#
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.
1009
1010# serial 1
1011
1012AC_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])
1022
1023