]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gas/aclocal.m4
19990502 sourceware import
[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 25 AM_PROG_LIBTOOL
164 AC_DEFUN(AM_PROG_LIBTOOL,
165 [AC_REQUIRE([AM_ENABLE_SHARED])dnl
166 AC_REQUIRE([AM_ENABLE_STATIC])dnl
167 AC_REQUIRE([AC_CANONICAL_HOST])dnl
168 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
169 AC_REQUIRE([AC_PROG_RANLIB])dnl
170 AC_REQUIRE([AC_PROG_CC])dnl
171 AC_REQUIRE([AM_PROG_LD])dnl
172 AC_REQUIRE([AM_PROG_NM])dnl
173 AC_REQUIRE([AC_PROG_LN_S])dnl
174 dnl
175 # Always use our own libtool.
176 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
177 AC_SUBST(LIBTOOL)dnl
178
179 # Check for any special flags to pass to ltconfig.
180 libtool_flags=
181 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
182 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
183 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
184 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
185 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
186
187 # Some flags need to be propagated to the compiler or linker for good
188 # libtool support.
189 case "$host" in
190 *-*-irix6*)
191 # Find out which ABI we are using.
192 echo '[#]line __oline__ "configure"' > conftest.$ac_ext
193 if AC_TRY_EVAL(ac_compile); then
194 case "`/usr/bin/file conftest.o`" in
195 *32-bit*)
196 LD="${LD-ld} -32"
197 ;;
198 *N32*)
199 LD="${LD-ld} -n32"
200 ;;
201 *64-bit*)
202 LD="${LD-ld} -64"
203 ;;
204 esac
205 fi
206 rm -rf conftest*
207 ;;
208
209 *-*-sco3.2v5*)
210 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
211 CFLAGS="$CFLAGS -belf"
212 ;;
213
214 *-*-cygwin*)
215 AM_SYS_LIBTOOL_CYGWIN
216 ;;
217
218 esac
219
220 # Actually configure libtool. ac_aux_dir is where install-sh is found.
221 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
222 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
223 DLLTOOL="$DLLTOOL" AS="$AS" \
224 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
225 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
226 || AC_MSG_ERROR([libtool configure failed])
227
228 # Redirect the config.log output again, so that the ltconfig log is not
229 # clobbered by the next message.
230 exec 5>>./config.log
231 ])
232
233 # AM_ENABLE_SHARED - implement the --enable-shared flag
234 # Usage: AM_ENABLE_SHARED[(DEFAULT)]
235 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
236 # `yes'.
237 AC_DEFUN(AM_ENABLE_SHARED,
238 [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
239 AC_ARG_ENABLE(shared,
240 changequote(<<, >>)dnl
241 << --enable-shared[=PKGS] build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT],
242 changequote([, ])dnl
243 [p=${PACKAGE-default}
244 case "$enableval" in
245 yes) enable_shared=yes ;;
246 no) enable_shared=no ;;
247 *)
248 enable_shared=no
249 # Look at the argument we got. We use all the common list separators.
250 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
251 for pkg in $enableval; do
252 if test "X$pkg" = "X$p"; then
253 enable_shared=yes
254 fi
255 done
256 IFS="$ac_save_ifs"
257 ;;
258 esac],
259 enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
260 ])
261
262 # AM_DISABLE_SHARED - set the default shared flag to --disable-shared
263 AC_DEFUN(AM_DISABLE_SHARED,
264 [AM_ENABLE_SHARED(no)])
265
266 # AM_DISABLE_STATIC - set the default static flag to --disable-static
267 AC_DEFUN(AM_DISABLE_STATIC,
268 [AM_ENABLE_STATIC(no)])
269
270 # AM_ENABLE_STATIC - implement the --enable-static flag
271 # Usage: AM_ENABLE_STATIC[(DEFAULT)]
272 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
273 # `yes'.
274 AC_DEFUN(AM_ENABLE_STATIC,
275 [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
276 AC_ARG_ENABLE(static,
277 changequote(<<, >>)dnl
278 << --enable-static[=PKGS] build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT],
279 changequote([, ])dnl
280 [p=${PACKAGE-default}
281 case "$enableval" in
282 yes) enable_static=yes ;;
283 no) enable_static=no ;;
284 *)
285 enable_static=no
286 # Look at the argument we got. We use all the common list separators.
287 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
288 for pkg in $enableval; do
289 if test "X$pkg" = "X$p"; then
290 enable_static=yes
291 fi
292 done
293 IFS="$ac_save_ifs"
294 ;;
295 esac],
296 enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
297 ])
298
299
300 # AM_PROG_LD - find the path to the GNU or non-GNU linker
301 AC_DEFUN(AM_PROG_LD,
302 [AC_ARG_WITH(gnu-ld,
303 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
304 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
305 AC_REQUIRE([AC_PROG_CC])
306 ac_prog=ld
307 if test "$ac_cv_prog_gcc" = yes; then
308 # Check if gcc -print-prog-name=ld gives a path.
309 AC_MSG_CHECKING([for ld used by GCC])
310 ac_prog=`($CC -print-prog-name=ld) 2>&5`
311 case "$ac_prog" in
312 # Accept absolute paths.
313 changequote(,)dnl
314 /* | [A-Za-z]:\\*)
315 changequote([,])dnl
316 test -z "$LD" && LD="$ac_prog"
317 ;;
318 "")
319 # If it fails, then pretend we aren't using GCC.
320 ac_prog=ld
321 ;;
322 *)
323 # If it is relative, then search for the first ld in PATH.
324 with_gnu_ld=unknown
325 ;;
326 esac
327 elif test "$with_gnu_ld" = yes; then
328 AC_MSG_CHECKING([for GNU ld])
329 else
330 AC_MSG_CHECKING([for non-GNU ld])
331 fi
332 AC_CACHE_VAL(ac_cv_path_LD,
333 [if test -z "$LD"; then
334 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
335 for ac_dir in $PATH; do
336 test -z "$ac_dir" && ac_dir=.
337 if test -f "$ac_dir/$ac_prog"; then
338 ac_cv_path_LD="$ac_dir/$ac_prog"
339 # Check to see if the program is GNU ld. I'd rather use --version,
340 # but apparently some GNU ld's only accept -v.
341 # Break only if it was the GNU/non-GNU ld that we prefer.
342 if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
343 test "$with_gnu_ld" != no && break
344 else
345 test "$with_gnu_ld" != yes && break
346 fi
347 fi
348 done
349 IFS="$ac_save_ifs"
350 else
351 ac_cv_path_LD="$LD" # Let the user override the test with a path.
352 fi])
353 LD="$ac_cv_path_LD"
354 if test -n "$LD"; then
355 AC_MSG_RESULT($LD)
356 else
357 AC_MSG_RESULT(no)
358 fi
359 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
360 AC_SUBST(LD)
361 AM_PROG_LD_GNU
362 ])
363
364 AC_DEFUN(AM_PROG_LD_GNU,
365 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
366 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
367 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
368 ac_cv_prog_gnu_ld=yes
369 else
370 ac_cv_prog_gnu_ld=no
371 fi])
372 ])
373
374 # AM_PROG_NM - find the path to a BSD-compatible name lister
375 AC_DEFUN(AM_PROG_NM,
376 [AC_MSG_CHECKING([for BSD-compatible nm])
377 AC_CACHE_VAL(ac_cv_path_NM,
378 [if test -n "$NM"; then
379 # Let the user override the test.
380 ac_cv_path_NM="$NM"
381 else
382 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
383 for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
384 test -z "$ac_dir" && ac_dir=.
385 if test -f $ac_dir/nm; then
386 # Check to see if the nm accepts a BSD-compat flag.
387 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
388 # nm: unknown option "B" ignored
389 if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
390 ac_cv_path_NM="$ac_dir/nm -B"
391 elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
392 ac_cv_path_NM="$ac_dir/nm -p"
393 else
394 ac_cv_path_NM="$ac_dir/nm"
395 fi
396 break
397 fi
398 done
399 IFS="$ac_save_ifs"
400 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
401 fi])
402 NM="$ac_cv_path_NM"
403 AC_MSG_RESULT([$NM])
404 AC_SUBST(NM)
405 ])
406
407 # AM_SYS_LIBTOOL_CYGWIN - find tools needed on cygwin
408 AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN,
409 [AC_CHECK_TOOL(DLLTOOL, dlltool, false)
410 AC_CHECK_TOOL(AS, as, false)
411 ])
412
413 # Like AC_CONFIG_HEADER, but automatically create stamp file.
414
415 AC_DEFUN(AM_CONFIG_HEADER,
416 [AC_PREREQ([2.12])
417 AC_CONFIG_HEADER([$1])
418 dnl When config.status generates a header, we must update the stamp-h file.
419 dnl This file resides in the same directory as the config header
420 dnl that is generated. We must strip everything past the first ":",
421 dnl and everything past the last "/".
422 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
423 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
424 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
425 <<am_indx=1
426 for am_file in <<$1>>; do
427 case " <<$>>CONFIG_HEADERS " in
428 *" <<$>>am_file "*<<)>>
429 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
430 ;;
431 esac
432 am_indx=`expr "<<$>>am_indx" + 1`
433 done<<>>dnl>>)
434 changequote([,]))])
435
436
437 dnl AM_PROG_LEX
438 dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
439 AC_DEFUN(AM_PROG_LEX,
440 [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
441 AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
442 AC_PROG_LEX
443 AC_DECL_YYTEXT])
444
445 # This file is derived from `gettext.m4'. The difference is that the
446 # included macros assume Cygnus-style source and build trees.
447
448 # Macro to add for using GNU gettext.
449 # Ulrich Drepper <drepper@cygnus.com>, 1995.
450 #
451 # This file file be copied and used freely without restrictions. It can
452 # be used in projects which are not available under the GNU Public License
453 # but which still want to provide support for the GNU gettext functionality.
454 # Please note that the actual code is *not* freely available.
455
456 # serial 3
457
458 AC_DEFUN(CY_WITH_NLS,
459 [AC_MSG_CHECKING([whether NLS is requested])
460 dnl Default is enabled NLS
461 AC_ARG_ENABLE(nls,
462 [ --disable-nls do not use Native Language Support],
463 USE_NLS=$enableval, USE_NLS=yes)
464 AC_MSG_RESULT($USE_NLS)
465 AC_SUBST(USE_NLS)
466
467 USE_INCLUDED_LIBINTL=no
468
469 dnl If we use NLS figure out what method
470 if test "$USE_NLS" = "yes"; then
471 AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested])
472 AC_MSG_CHECKING([whether included gettext is requested])
473 AC_ARG_WITH(included-gettext,
474 [ --with-included-gettext use the GNU gettext library included here],
475 nls_cv_force_use_gnu_gettext=$withval,
476 nls_cv_force_use_gnu_gettext=no)
477 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
478
479 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
480 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
481 dnl User does not insist on using GNU NLS library. Figure out what
482 dnl to use. If gettext or catgets are available (in this order) we
483 dnl use this. Else we have to fall back to GNU NLS library.
484 dnl catgets is only used if permitted by option --with-catgets.
485 nls_cv_header_intl=
486 nls_cv_header_libgt=
487 CATOBJEXT=NONE
488
489 AC_CHECK_HEADER(libintl.h,
490 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
491 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
492 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
493
494 if test "$gt_cv_func_gettext_libc" != "yes"; then
495 AC_CHECK_LIB(intl, bindtextdomain,
496 [AC_CACHE_CHECK([for gettext in libintl],
497 gt_cv_func_gettext_libintl,
498 [AC_TRY_LINK([], [return (int) gettext ("")],
499 gt_cv_func_gettext_libintl=yes,
500 gt_cv_func_gettext_libintl=no)])])
501 fi
502
503 if test "$gt_cv_func_gettext_libc" = "yes" \
504 || test "$gt_cv_func_gettext_libintl" = "yes"; then
505 AC_DEFINE(HAVE_GETTEXT, 1,
506 [Define as 1 if you have gettext and don't want to use GNU gettext.])
507 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
508 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
509 if test "$MSGFMT" != "no"; then
510 AC_CHECK_FUNCS(dcgettext)
511 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
512 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
513 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
514 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
515 return _nl_msg_cat_cntr],
516 [CATOBJEXT=.gmo
517 DATADIRNAME=share],
518 [CATOBJEXT=.mo
519 DATADIRNAME=lib])
520 INSTOBJEXT=.mo
521 fi
522 fi
523 ])
524
525 dnl In the standard gettext, we would now check for catgets.
526 dnl However, we never want to use catgets for our releases.
527
528 if test "$CATOBJEXT" = "NONE"; then
529 dnl Neither gettext nor catgets in included in the C library.
530 dnl Fall back on GNU gettext library.
531 nls_cv_use_gnu_gettext=yes
532 fi
533 fi
534
535 if test "$nls_cv_use_gnu_gettext" = "yes"; then
536 dnl Mark actions used to generate GNU NLS library.
537 INTLOBJS="\$(GETTOBJS)"
538 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
539 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
540 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
541 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
542 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
543 AC_SUBST(MSGFMT)
544 USE_INCLUDED_LIBINTL=yes
545 CATOBJEXT=.gmo
546 INSTOBJEXT=.mo
547 DATADIRNAME=share
548 INTLDEPS='$(top_builddir)/../intl/libintl.a'
549 INTLLIBS=$INTLDEPS
550 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
551 nls_cv_header_intl=libintl.h
552 nls_cv_header_libgt=libgettext.h
553 fi
554
555 dnl Test whether we really found GNU xgettext.
556 if test "$XGETTEXT" != ":"; then
557 dnl If it is no GNU xgettext we define it as : so that the
558 dnl Makefiles still can work.
559 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
560 : ;
561 else
562 AC_MSG_RESULT(
563 [found xgettext programs is not GNU xgettext; ignore it])
564 XGETTEXT=":"
565 fi
566 fi
567
568 # We need to process the po/ directory.
569 POSUB=po
570 else
571 DATADIRNAME=share
572 nls_cv_header_intl=libintl.h
573 nls_cv_header_libgt=libgettext.h
574 fi
575
576 # If this is used in GNU gettext we have to set USE_NLS to `yes'
577 # because some of the sources are only built for this goal.
578 if test "$PACKAGE" = gettext; then
579 USE_NLS=yes
580 USE_INCLUDED_LIBINTL=yes
581 fi
582
583 dnl These rules are solely for the distribution goal. While doing this
584 dnl we only have to keep exactly one list of the available catalogs
585 dnl in configure.in.
586 for lang in $ALL_LINGUAS; do
587 GMOFILES="$GMOFILES $lang.gmo"
588 POFILES="$POFILES $lang.po"
589 done
590
591 dnl Make all variables we use known to autoconf.
592 AC_SUBST(USE_INCLUDED_LIBINTL)
593 AC_SUBST(CATALOGS)
594 AC_SUBST(CATOBJEXT)
595 AC_SUBST(DATADIRNAME)
596 AC_SUBST(GMOFILES)
597 AC_SUBST(INSTOBJEXT)
598 AC_SUBST(INTLDEPS)
599 AC_SUBST(INTLLIBS)
600 AC_SUBST(INTLOBJS)
601 AC_SUBST(POFILES)
602 AC_SUBST(POSUB)
603 ])
604
605 AC_DEFUN(CY_GNU_GETTEXT,
606 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
607 AC_REQUIRE([AC_PROG_CC])dnl
608 AC_REQUIRE([AC_PROG_RANLIB])dnl
609 AC_REQUIRE([AC_ISC_POSIX])dnl
610 AC_REQUIRE([AC_HEADER_STDC])dnl
611 AC_REQUIRE([AC_C_CONST])dnl
612 AC_REQUIRE([AC_C_INLINE])dnl
613 AC_REQUIRE([AC_TYPE_OFF_T])dnl
614 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
615 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
616 AC_REQUIRE([AC_FUNC_MMAP])dnl
617
618 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
619 unistd.h values.h sys/param.h])
620 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
621 __argz_count __argz_stringify __argz_next])
622
623 if test "${ac_cv_func_stpcpy+set}" != "set"; then
624 AC_CHECK_FUNCS(stpcpy)
625 fi
626 if test "${ac_cv_func_stpcpy}" = "yes"; then
627 AC_DEFINE(HAVE_STPCPY, 1, [Define if you have the stpcpy function])
628 fi
629
630 AM_LC_MESSAGES
631 CY_WITH_NLS
632
633 if test "x$CATOBJEXT" != "x"; then
634 if test "x$ALL_LINGUAS" = "x"; then
635 LINGUAS=
636 else
637 AC_MSG_CHECKING(for catalogs to be installed)
638 NEW_LINGUAS=
639 for lang in ${LINGUAS=$ALL_LINGUAS}; do
640 case "$ALL_LINGUAS" in
641 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
642 esac
643 done
644 LINGUAS=$NEW_LINGUAS
645 AC_MSG_RESULT($LINGUAS)
646 fi
647
648 dnl Construct list of names of catalog files to be constructed.
649 if test -n "$LINGUAS"; then
650 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
651 fi
652 fi
653
654 dnl The reference to <locale.h> in the installed <libintl.h> file
655 dnl must be resolved because we cannot expect the users of this
656 dnl to define HAVE_LOCALE_H.
657 if test $ac_cv_header_locale_h = yes; then
658 INCLUDE_LOCALE_H="#include <locale.h>"
659 else
660 INCLUDE_LOCALE_H="\
661 /* The system does not provide the header <locale.h>. Take care yourself. */"
662 fi
663 AC_SUBST(INCLUDE_LOCALE_H)
664
665 dnl Determine which catalog format we have (if any is needed)
666 dnl For now we know about two different formats:
667 dnl Linux libc-5 and the normal X/Open format
668 if test -f $srcdir/po2tbl.sed.in; then
669 if test "$CATOBJEXT" = ".cat"; then
670 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
671
672 dnl Transform the SED scripts while copying because some dumb SEDs
673 dnl cannot handle comments.
674 sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
675 fi
676 dnl po2tbl.sed is always needed.
677 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
678 $srcdir/po2tbl.sed.in > po2tbl.sed
679 fi
680
681 dnl In the intl/Makefile.in we have a special dependency which makes
682 dnl only sense for gettext. We comment this out for non-gettext
683 dnl packages.
684 if test "$PACKAGE" = "gettext"; then
685 GT_NO="#NO#"
686 GT_YES=
687 else
688 GT_NO=
689 GT_YES="#YES#"
690 fi
691 AC_SUBST(GT_NO)
692 AC_SUBST(GT_YES)
693
694 MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
695 AC_SUBST(MKINSTALLDIRS)
696
697 dnl *** For now the libtool support in intl/Makefile is not for real.
698 l=
699 AC_SUBST(l)
700
701 dnl Generate list of files to be processed by xgettext which will
702 dnl be included in po/Makefile. But only do this if the po directory
703 dnl exists in srcdir.
704 if test -d $srcdir/po; then
705 test -d po || mkdir po
706 if test "x$srcdir" != "x."; then
707 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
708 posrcprefix="$srcdir/"
709 else
710 posrcprefix="../$srcdir/"
711 fi
712 else
713 posrcprefix="../"
714 fi
715 rm -f po/POTFILES
716 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
717 < $srcdir/po/POTFILES.in > po/POTFILES
718 fi
719 ])
720
721 # Search path for a program which passes the given test.
722 # Ulrich Drepper <drepper@cygnus.com>, 1996.
723 #
724 # This file file be copied and used freely without restrictions. It can
725 # be used in projects which are not available under the GNU Public License
726 # but which still want to provide support for the GNU gettext functionality.
727 # Please note that the actual code is *not* freely available.
728
729 # serial 1
730
731 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
732 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
733 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
734 [# Extract the first word of "$2", so it can be a program name with args.
735 set dummy $2; ac_word=[$]2
736 AC_MSG_CHECKING([for $ac_word])
737 AC_CACHE_VAL(ac_cv_path_$1,
738 [case "[$]$1" in
739 /*)
740 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
741 ;;
742 *)
743 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
744 for ac_dir in ifelse([$5], , $PATH, [$5]); do
745 test -z "$ac_dir" && ac_dir=.
746 if test -f $ac_dir/$ac_word; then
747 if [$3]; then
748 ac_cv_path_$1="$ac_dir/$ac_word"
749 break
750 fi
751 fi
752 done
753 IFS="$ac_save_ifs"
754 dnl If no 4th arg is given, leave the cache variable unset,
755 dnl so AC_PATH_PROGS will keep looking.
756 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
757 ])dnl
758 ;;
759 esac])dnl
760 $1="$ac_cv_path_$1"
761 if test -n "[$]$1"; then
762 AC_MSG_RESULT([$]$1)
763 else
764 AC_MSG_RESULT(no)
765 fi
766 AC_SUBST($1)dnl
767 ])
768
769 # Check whether LC_MESSAGES is available in <locale.h>.
770 # Ulrich Drepper <drepper@cygnus.com>, 1995.
771 #
772 # This file file be copied and used freely without restrictions. It can
773 # be used in projects which are not available under the GNU Public License
774 # but which still want to provide support for the GNU gettext functionality.
775 # Please note that the actual code is *not* freely available.
776
777 # serial 1
778
779 AC_DEFUN(AM_LC_MESSAGES,
780 [if test $ac_cv_header_locale_h = yes; then
781 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
782 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
783 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
784 if test $am_cv_val_LC_MESSAGES = yes; then
785 AC_DEFINE(HAVE_LC_MESSAGES, 1,
786 [Define if your locale.h file contains LC_MESSAGES.])
787 fi
788 fi])
789
790 # Add --enable-maintainer-mode option to configure.
791 # From Jim Meyering
792
793 # serial 1
794
795 AC_DEFUN(AM_MAINTAINER_MODE,
796 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
797 dnl maintainer-mode is disabled by default
798 AC_ARG_ENABLE(maintainer-mode,
799 [ --enable-maintainer-mode enable make rules and dependencies not useful
800 (and sometimes confusing) to the casual installer],
801 USE_MAINTAINER_MODE=$enableval,
802 USE_MAINTAINER_MODE=no)
803 AC_MSG_RESULT($USE_MAINTAINER_MODE)
804 AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
805 MAINT=$MAINTAINER_MODE_TRUE
806 AC_SUBST(MAINT)dnl
807 ]
808 )
809
810 # Define a conditional.
811
812 AC_DEFUN(AM_CONDITIONAL,
813 [AC_SUBST($1_TRUE)
814 AC_SUBST($1_FALSE)
815 if $2; then
816 $1_TRUE=
817 $1_FALSE='#'
818 else
819 $1_TRUE='#'
820 $1_FALSE=
821 fi])
822