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