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