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