This commit was generated by cvs2svn to track changes on a CVS vendor
[platform/upstream/binutils.git] / bfd / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.2e
2
3 dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
4 dnl This Makefile.in 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 i[345]86-*-msdos* | i[345]86-*-go32* | i[345]86-*-mingw32* | *-*-cygwin32* | *-*-windows)
19 changequote([,])dnl
20   AC_DEFINE(USE_BINARY_FOPEN) ;;
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   bfd_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
77   AC_DEFINE_UNQUOTED($bfd_tr_decl)
78 fi
79 ])dnl
80
81 # Do all the work for Automake.  This macro actually does too much --
82 # some checks are only needed if your package does certain things.
83 # But this isn't really a big deal.
84
85 # serial 1
86
87 dnl Usage:
88 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
89
90 AC_DEFUN(AM_INIT_AUTOMAKE,
91 [AC_REQUIRE([AM_PROG_INSTALL])
92 PACKAGE=[$1]
93 AC_SUBST(PACKAGE)
94 VERSION=[$2]
95 AC_SUBST(VERSION)
96 dnl test to see if srcdir already configured
97 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
98   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
99 fi
100 ifelse([$3],,
101 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
102 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
103 AC_REQUIRE([AM_SANITY_CHECK])
104 AC_REQUIRE([AC_ARG_PROGRAM])
105 dnl FIXME This is truly gross.
106 missing_dir=`cd $ac_aux_dir && pwd`
107 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
108 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
109 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
110 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
111 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
112 AC_REQUIRE([AC_PROG_MAKE_SET])])
113
114
115 # serial 1
116
117 AC_DEFUN(AM_PROG_INSTALL,
118 [AC_REQUIRE([AC_PROG_INSTALL])
119 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
120 AC_SUBST(INSTALL_SCRIPT)dnl
121 ])
122
123 #
124 # Check to make sure that the build environment is sane.
125 #
126
127 AC_DEFUN(AM_SANITY_CHECK,
128 [AC_MSG_CHECKING([whether build environment is sane])
129 # Just in case
130 sleep 1
131 echo timestamp > conftestfile
132 # Do `set' in a subshell so we don't clobber the current shell's
133 # arguments.  Must try -L first in case configure is actually a
134 # symlink; some systems play weird games with the mod time of symlinks
135 # (eg FreeBSD returns the mod time of the symlink's containing
136 # directory).
137 if (
138    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
139    if test "[$]*" = "X"; then
140       # -L didn't work.
141       set X `ls -t $srcdir/configure conftestfile`
142    fi
143    if test "[$]*" != "X $srcdir/configure conftestfile" \
144       && test "[$]*" != "X conftestfile $srcdir/configure"; then
145
146       # If neither matched, then we have a broken ls.  This can happen
147       # if, for instance, CONFIG_SHELL is bash and it inherits a
148       # broken ls alias from the environment.  This has actually
149       # happened.  Such a system could not be considered "sane".
150       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
151 alias in your environment])
152    fi
153
154    test "[$]2" = conftestfile
155    )
156 then
157    # Ok.
158    :
159 else
160    AC_MSG_ERROR([newly created file is older than distributed files!
161 Check your system clock])
162 fi
163 rm -f conftest*
164 AC_MSG_RESULT(yes)])
165
166 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
167 dnl The program must properly implement --version.
168 AC_DEFUN(AM_MISSING_PROG,
169 [AC_MSG_CHECKING(for working $2)
170 # Run test in a subshell; some versions of sh will print an error if
171 # an executable is not found, even if stderr is redirected.
172 # Redirect stdin to placate older versions of autoconf.  Sigh.
173 if ($2 --version) < /dev/null > /dev/null 2>&1; then
174    $1=$2
175    AC_MSG_RESULT(found)
176 else
177    $1="$3/missing $2"
178    AC_MSG_RESULT(missing)
179 fi
180 AC_SUBST($1)])
181
182
183 # serial 24 AM_PROG_LIBTOOL
184 AC_DEFUN(AM_PROG_LIBTOOL,
185 [AC_REQUIRE([AM_ENABLE_SHARED])dnl
186 AC_REQUIRE([AM_ENABLE_STATIC])dnl
187 AC_REQUIRE([AC_CANONICAL_HOST])dnl
188 AC_REQUIRE([AC_PROG_RANLIB])dnl
189 AC_REQUIRE([AC_PROG_CC])dnl
190 AC_REQUIRE([AM_PROG_LD])dnl
191 AC_REQUIRE([AM_PROG_NM])dnl
192 AC_REQUIRE([AC_PROG_LN_S])dnl
193 dnl
194 # Always use our own libtool.
195 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
196 AC_SUBST(LIBTOOL)dnl
197
198 # Check for any special flags to pass to ltconfig.
199 libtool_flags=
200 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
201 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
202 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
203 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
204 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
205
206 # Some flags need to be propagated to the compiler or linker for good
207 # libtool support.
208 case "$host" in
209 *-*-irix6*)
210   # Find out which ABI we are using.
211   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
212   if AC_TRY_EVAL(ac_compile); then
213     case "`/usr/bin/file conftest.o`" in
214     *32-bit*)
215       LD="${LD-ld} -32"
216       ;;
217     *N32*)
218       LD="${LD-ld} -n32"
219       ;;
220     *64-bit*)
221       LD="${LD-ld} -64"
222       ;;
223     esac
224   fi
225   rm -rf conftest*
226   ;;
227
228 *-*-sco3.2v5*)
229   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
230   CFLAGS="$CFLAGS -belf"
231   ;;
232 esac
233
234 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
235 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
236 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
237 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
238 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
239 || AC_MSG_ERROR([libtool configure failed])
240 ])
241
242 # AM_ENABLE_SHARED - implement the --enable-shared flag
243 # Usage: AM_ENABLE_SHARED[(DEFAULT)]
244 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
245 #   `yes'.
246 AC_DEFUN(AM_ENABLE_SHARED,
247 [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
248 AC_ARG_ENABLE(shared,
249 changequote(<<, >>)dnl
250 <<  --enable-shared         build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT]
251 changequote([, ])dnl
252 [  --enable-shared=PKGS    only build shared libraries if the current package
253                           appears as an element in the PKGS list],
254 [p=${PACKAGE-default}
255 case "$enableval" in
256 yes) enable_shared=yes ;;
257 no) enable_shared=no ;;
258 *)
259   enable_shared=no
260   # Look at the argument we got.  We use all the common list separators.
261   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
262   for pkg in $enableval; do
263     if test "X$pkg" = "X$p"; then
264       enable_shared=yes
265     fi
266   done
267   IFS="$ac_save_ifs"
268   ;;
269 esac],
270 enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
271 ])
272
273 # AM_DISABLE_SHARED - set the default shared flag to --disable-shared
274 AC_DEFUN(AM_DISABLE_SHARED,
275 [AM_ENABLE_SHARED(no)])
276
277 # AM_DISABLE_STATIC - set the default static flag to --disable-static
278 AC_DEFUN(AM_DISABLE_STATIC,
279 [AM_ENABLE_STATIC(no)])
280
281 # AM_ENABLE_STATIC - implement the --enable-static flag
282 # Usage: AM_ENABLE_STATIC[(DEFAULT)]
283 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
284 #   `yes'.
285 AC_DEFUN(AM_ENABLE_STATIC,
286 [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
287 AC_ARG_ENABLE(static,
288 changequote(<<, >>)dnl
289 <<  --enable-static         build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT]
290 changequote([, ])dnl
291 [  --enable-static=PKGS    only build shared libraries if the current package
292                           appears as an element in the PKGS list],
293 [p=${PACKAGE-default}
294 case "$enableval" in
295 yes) enable_static=yes ;;
296 no) enable_static=no ;;
297 *)
298   enable_static=no
299   # Look at the argument we got.  We use all the common list separators.
300   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
301   for pkg in $enableval; do
302     if test "X$pkg" = "X$p"; then
303       enable_static=yes
304     fi
305   done
306   IFS="$ac_save_ifs"
307   ;;
308 esac],
309 enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
310 ])
311
312
313 # AM_PROG_LD - find the path to the GNU or non-GNU linker
314 AC_DEFUN(AM_PROG_LD,
315 [AC_ARG_WITH(gnu-ld,
316 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
317 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
318 AC_REQUIRE([AC_PROG_CC])
319 ac_prog=ld
320 if test "$ac_cv_prog_gcc" = yes; then
321   # Check if gcc -print-prog-name=ld gives a path.
322   AC_MSG_CHECKING([for ld used by GCC])
323   ac_prog=`($CC -print-prog-name=ld) 2>&5`
324   case "$ac_prog" in
325   # Accept absolute paths.
326   /* | [A-Za-z]:\\*)
327     test -z "$LD" && LD="$ac_prog"
328     ;;
329   "")
330     # If it fails, then pretend we aren't using GCC.
331     ac_prog=ld
332     ;;
333   *)
334     # If it is relative, then search for the first ld in PATH.
335     with_gnu_ld=unknown
336     ;;
337   esac
338 elif test "$with_gnu_ld" = yes; then
339   AC_MSG_CHECKING([for GNU ld])
340 else
341   AC_MSG_CHECKING([for non-GNU ld])
342 fi
343 AC_CACHE_VAL(ac_cv_path_LD,
344 [if test -z "$LD"; then
345   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
346   for ac_dir in $PATH; do
347     test -z "$ac_dir" && ac_dir=.
348     if test -f "$ac_dir/$ac_prog"; then
349       ac_cv_path_LD="$ac_dir/$ac_prog"
350       # Check to see if the program is GNU ld.  I'd rather use --version,
351       # but apparently some GNU ld's only accept -v.
352       # Break only if it was the GNU/non-GNU ld that we prefer.
353       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
354         test "$with_gnu_ld" != no && break
355       else
356         test "$with_gnu_ld" != yes && break
357       fi
358     fi
359   done
360   IFS="$ac_save_ifs"
361 else
362   ac_cv_path_LD="$LD" # Let the user override the test with a path.
363 fi])
364 LD="$ac_cv_path_LD"
365 if test -n "$LD"; then
366   AC_MSG_RESULT($LD)
367 else
368   AC_MSG_RESULT(no)
369 fi
370 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
371 AC_SUBST(LD)
372 AM_PROG_LD_GNU
373 ])
374
375 AC_DEFUN(AM_PROG_LD_GNU,
376 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
377 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
378 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
379   ac_cv_prog_gnu_ld=yes
380 else
381   ac_cv_prog_gnu_ld=no
382 fi])
383 ])
384
385 # AM_PROG_NM - find the path to a BSD-compatible name lister
386 AC_DEFUN(AM_PROG_NM,
387 [AC_MSG_CHECKING([for BSD-compatible nm])
388 AC_CACHE_VAL(ac_cv_path_NM,
389 [case "$NM" in
390 /* | [A-Za-z]:\\*)
391   ac_cv_path_NM="$NM" # Let the user override the test with a path.
392   ;;
393 *)
394   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
395   for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
396     test -z "$ac_dir" && ac_dir=.
397     if test -f $ac_dir/nm; then
398       # Check to see if the nm accepts a BSD-compat flag.
399       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
400       #   nm: unknown option "B" ignored
401       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
402         ac_cv_path_NM="$ac_dir/nm -B"
403       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
404         ac_cv_path_NM="$ac_dir/nm -p"
405       else
406         ac_cv_path_NM="$ac_dir/nm"
407       fi
408       break
409     fi
410   done
411   IFS="$ac_save_ifs"
412   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
413   ;;
414 esac])
415 NM="$ac_cv_path_NM"
416 AC_MSG_RESULT([$NM])
417 AC_SUBST(NM)
418 ])
419
420 # Like AC_CONFIG_HEADER, but automatically create stamp file.
421
422 AC_DEFUN(AM_CONFIG_HEADER,
423 [AC_PREREQ([2.12])
424 AC_CONFIG_HEADER([$1])
425 dnl When config.status generates a header, we must update the stamp-h file.
426 dnl This file resides in the same directory as the config header
427 dnl that is generated.  We must strip everything past the first ":",
428 dnl and everything past the last "/".
429 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
430 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
431 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
432 <<am_indx=1
433 for am_file in <<$1>>; do
434   case " <<$>>CONFIG_HEADERS " in
435   *" <<$>>am_file "*<<)>>
436     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
437     ;;
438   esac
439   am_indx=`expr "<<$>>am_indx" + 1`
440 done<<>>dnl>>)
441 changequote([,]))])
442
443 # Add --enable-maintainer-mode option to configure.
444 # From Jim Meyering
445
446 # serial 1
447
448 AC_DEFUN(AM_MAINTAINER_MODE,
449 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
450   dnl maintainer-mode is disabled by default
451   AC_ARG_ENABLE(maintainer-mode,
452 [  --enable-maintainer-mode enable make rules and dependencies not useful
453                           (and sometimes confusing) to the casual installer],
454       USE_MAINTAINER_MODE=$enableval,
455       USE_MAINTAINER_MODE=no)
456   AC_MSG_RESULT($USE_MAINTAINER_MODE)
457   if test $USE_MAINTAINER_MODE = yes; then
458     MAINT=
459   else
460     MAINT='#M#'
461   fi
462   AC_SUBST(MAINT)dnl
463 ]
464 )
465
466 # Check to see if we're running under Cygwin32, without using
467 # AC_CANONICAL_*.  If so, set output variable CYGWIN32 to "yes".
468 # Otherwise set it to "no".
469
470 dnl AM_CYGWIN32()
471 AC_DEFUN(AM_CYGWIN32,
472 [AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32,
473 [AC_TRY_COMPILE(,[return __CYGWIN32__;],
474 am_cv_cygwin32=yes, am_cv_cygwin32=no)
475 rm -f conftest*])
476 CYGWIN32=
477 test "$am_cv_cygwin32" = yes && CYGWIN32=yes])
478
479 # Check to see if we're running under Win32, without using
480 # AC_CANONICAL_*.  If so, set output variable EXEEXT to ".exe".
481 # Otherwise set it to "".
482
483 dnl AM_EXEEXT()
484 dnl This knows we add .exe if we're building in the Cygwin32
485 dnl environment. But if we're not, then it compiles a test program
486 dnl to see if there is a suffix for executables.
487 AC_DEFUN(AM_EXEEXT,
488 [AC_REQUIRE([AM_CYGWIN32])
489 AC_REQUIRE([AM_MINGW32])
490 AC_MSG_CHECKING([for executable suffix])
491 AC_CACHE_VAL(am_cv_exeext,
492 [if test "$CYGWIN32" = yes || test "$MINGW32" = yes; then
493 am_cv_exeext=.exe
494 else
495 cat > am_c_test.c << 'EOF'
496 int main() {
497 /* Nothing needed here */
498 }
499 EOF
500 ${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5
501 am_cv_exeext=`echo am_c_test.* | grep -v am_c_test.c | sed -e s/am_c_test//`
502 rm -f am_c_test*])
503 test x"${am_cv_exeext}" = x && am_cv_exeext=no
504 fi
505 EXEEXT=""
506 test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext}
507 AC_MSG_RESULT(${am_cv_exeext})
508 AC_SUBST(EXEEXT)])
509
510 # Check to see if we're running under Mingw, without using
511 # AC_CANONICAL_*.  If so, set output variable MINGW32 to "yes".
512 # Otherwise set it to "no".
513
514 dnl AM_MINGW32()
515 AC_DEFUN(AM_MINGW32,
516 [AC_CACHE_CHECK(for Mingw32 environment, am_cv_mingw32,
517 [AC_TRY_COMPILE(,[return __MINGW32__;],
518 am_cv_mingw32=yes, am_cv_mingw32=no)
519 rm -f conftest*])
520 MINGW32=
521 test "$am_cv_mingw32" = yes && MINGW32=yes])
522