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