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