2003-09-18 H.J. Lu <hongjiu.lu@intel.com>
[binutils.git] / bfd / aclocal.m4
blob9d27670a0f18a0c380c3bd837019a3865e2014bd
1 dnl aclocal.m4 generated automatically by aclocal 1.4-p6
3 dnl Copyright (C) 1994, 1995-8, 1999, 2001 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.
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.
13 sinclude(../config/accross.m4)
15 dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
16 AC_DEFUN(BFD_BINARY_FOPEN,
17 [AC_REQUIRE([AC_CANONICAL_SYSTEM])
18 case "${host}" in
19 changequote(,)dnl
20 *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
21 changequote([,])dnl
22   AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
23 esac])dnl
25 dnl Get a default for CC_FOR_BUILD to put into Makefile.
26 AC_DEFUN(BFD_CC_FOR_BUILD,
27 [# Put a plausible default for CC_FOR_BUILD in Makefile.
28 if test -z "$CC_FOR_BUILD"; then
29   if test "x$cross_compiling" = "xno"; then
30     CC_FOR_BUILD='$(CC)'
31   else
32     CC_FOR_BUILD=gcc
33   fi
35 AC_SUBST(CC_FOR_BUILD)
36 # Also set EXEEXT_FOR_BUILD.
37 if test "x$cross_compiling" = "xno"; then
38   EXEEXT_FOR_BUILD='$(EXEEXT)'
39 else
40   AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
41     [rm -f conftest*
42      echo 'int main () { return 0; }' > conftest.c
43      bfd_cv_build_exeext=
44      ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
45      for file in conftest.*; do
46        case $file in
47        *.c | *.o | *.obj | *.ilk | *.pdb) ;;
48        *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
49        esac
50      done
51      rm -f conftest*
52      test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
53   EXEEXT_FOR_BUILD=""
54   test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
56 AC_SUBST(EXEEXT_FOR_BUILD)])dnl
58 dnl See whether we need a declaration for a function.
59 AC_DEFUN(BFD_NEED_DECLARATION,
60 [AC_MSG_CHECKING([whether $1 must be declared])
61 AC_CACHE_VAL(bfd_cv_decl_needed_$1,
62 [AC_TRY_COMPILE([
63 #include <stdio.h>
64 #ifdef HAVE_STRING_H
65 #include <string.h>
66 #else
67 #ifdef HAVE_STRINGS_H
68 #include <strings.h>
69 #endif
70 #endif
71 #ifdef HAVE_STDLIB_H
72 #include <stdlib.h>
73 #endif
74 #ifdef HAVE_UNISTD_H
75 #include <unistd.h>
76 #endif],
77 [char *(*pfn) = (char *(*)) $1],
78 bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
79 AC_MSG_RESULT($bfd_cv_decl_needed_$1)
80 if test $bfd_cv_decl_needed_$1 = yes; then
81   AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
82             [Define if $1 is not declared in system header files.])
84 ])dnl
86 dnl Check for existence of a type $1 in sys/procfs.h
88 AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
89 [AC_MSG_CHECKING([for $1 in sys/procfs.h])
90  AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
91    [AC_TRY_COMPILE([
92 #define _SYSCALL32
93 #include <sys/procfs.h>],
94       [$1 avar],
95       bfd_cv_have_sys_procfs_type_$1=yes,
96       bfd_cv_have_sys_procfs_type_$1=no
97    )])
98  if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
99    AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
100              [Define if <sys/procfs.h> has $1.])
101  fi
102  AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
106 dnl Check for existence of member $2 in type $1 in sys/procfs.h
108 AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
109 [AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
110  AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
111    [AC_TRY_COMPILE([
112 #define _SYSCALL32
113 #include <sys/procfs.h>],
114       [$1 avar; void* aref = (void*) &avar.$2],
115       bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
116       bfd_cv_have_sys_procfs_type_member_$1_$2=no
117    )])
118  if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
119    AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
120              [Define if <sys/procfs.h> has $1.$2.])
121  fi
122  AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
125 sinclude(../libtool.m4)
126 dnl The lines below arrange for aclocal not to bring libtool.m4
127 dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
128 dnl to add a definition of LIBTOOL to Makefile.in.
129 ifelse(yes,no,[
130 AC_DEFUN([AM_PROG_LIBTOOL],)
131 AC_DEFUN([AM_DISABLE_SHARED],)
132 AC_SUBST(LIBTOOL)
135 sinclude(../gettext.m4)
136 ifelse(yes,no,[
137 AC_DEFUN([CY_WITH_NLS],)
138 AC_SUBST(INTLLIBS)
141 AC_DEFUN([AM_INSTALL_LIBBFD],
142 [AC_MSG_CHECKING([whether to install libbfd])
143   AC_ARG_ENABLE(install-libbfd,
144 [  --enable-install-libbfd controls installation of libbfd and related headers],
145       install_libbfd_p=$enableval,
146       if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then
147         install_libbfd_p=yes
148       else
149         install_libbfd_p=no
150       fi)
151   AC_MSG_RESULT($install_libbfd_p)
152   AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes)
153   # libbfd.a is a host library containing target dependent code
154   bfdlibdir='$(libdir)'
155   bfdincludedir='$(includedir)'
156   if test "${host}" != "${target}"; then
157     bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib'
158     bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include'
159   fi
160   AC_SUBST(bfdlibdir)
161   AC_SUBST(bfdincludedir)
165 # Define a conditional.
167 AC_DEFUN([AM_CONDITIONAL],
168 [AC_SUBST($1_TRUE)
169 AC_SUBST($1_FALSE)
170 if $2; then
171   $1_TRUE=
172   $1_FALSE='#'
173 else
174   $1_TRUE='#'
175   $1_FALSE=
176 fi])
178 # isc-posix.m4 serial 2 (gettext-0.11.2)
179 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
180 dnl This file is free software, distributed under the terms of the GNU
181 dnl General Public License.  As a special exception to the GNU General
182 dnl Public License, this file may be distributed as part of a program
183 dnl that contains a configuration script generated by Autoconf, under
184 dnl the same distribution terms as the rest of that program.
186 # This file is not needed with autoconf-2.53 and newer.  Remove it in 2005.
188 # This test replaces the one in autoconf.
189 # Currently this macro should have the same name as the autoconf macro
190 # because gettext's gettext.m4 (distributed in the automake package)
191 # still uses it.  Otherwise, the use in gettext.m4 makes autoheader
192 # give these diagnostics:
193 #   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
194 #   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
196 undefine([AC_ISC_POSIX])
198 AC_DEFUN([AC_ISC_POSIX],
199   [
200     dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
201     AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
202   ]
205 # Do all the work for Automake.  This macro actually does too much --
206 # some checks are only needed if your package does certain things.
207 # But this isn't really a big deal.
209 # serial 1
211 dnl Usage:
212 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
214 AC_DEFUN([AM_INIT_AUTOMAKE],
215 [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
216 AC_REQUIRE([AC_PROG_INSTALL])
217 PACKAGE=[$1]
218 AC_SUBST(PACKAGE)
219 VERSION=[$2]
220 AC_SUBST(VERSION)
221 dnl test to see if srcdir already configured
222 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
223   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
225 ifelse([$3],,
226 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
227 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
228 AC_REQUIRE([AM_SANITY_CHECK])
229 AC_REQUIRE([AC_ARG_PROGRAM])
230 dnl FIXME This is truly gross.
231 missing_dir=`cd $ac_aux_dir && pwd`
232 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir)
233 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
234 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir)
235 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
236 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
237 AC_REQUIRE([AC_PROG_MAKE_SET])])
239 # Copyright 2002  Free Software Foundation, Inc.
241 # This program is free software; you can redistribute it and/or modify
242 # it under the terms of the GNU General Public License as published by
243 # the Free Software Foundation; either version 2, or (at your option)
244 # any later version.
246 # This program is distributed in the hope that it will be useful,
247 # but WITHOUT ANY WARRANTY; without even the implied warranty of
248 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
249 # GNU General Public License for more details.
251 # You should have received a copy of the GNU General Public License
252 # along with this program; if not, write to the Free Software
253 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
255 # AM_AUTOMAKE_VERSION(VERSION)
256 # ----------------------------
257 # Automake X.Y traces this macro to ensure aclocal.m4 has been
258 # generated from the m4 files accompanying Automake X.Y.
259 AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"])
261 # AM_SET_CURRENT_AUTOMAKE_VERSION
262 # -------------------------------
263 # Call AM_AUTOMAKE_VERSION so it can be traced.
264 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
265 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
266          [AM_AUTOMAKE_VERSION([1.4-p6])])
269 # Check to make sure that the build environment is sane.
272 AC_DEFUN([AM_SANITY_CHECK],
273 [AC_MSG_CHECKING([whether build environment is sane])
274 # Just in case
275 sleep 1
276 echo timestamp > conftestfile
277 # Do `set' in a subshell so we don't clobber the current shell's
278 # arguments.  Must try -L first in case configure is actually a
279 # symlink; some systems play weird games with the mod time of symlinks
280 # (eg FreeBSD returns the mod time of the symlink's containing
281 # directory).
282 if (
283    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
284    if test "[$]*" = "X"; then
285       # -L didn't work.
286       set X `ls -t $srcdir/configure conftestfile`
287    fi
288    if test "[$]*" != "X $srcdir/configure conftestfile" \
289       && test "[$]*" != "X conftestfile $srcdir/configure"; then
291       # If neither matched, then we have a broken ls.  This can happen
292       # if, for instance, CONFIG_SHELL is bash and it inherits a
293       # broken ls alias from the environment.  This has actually
294       # happened.  Such a system could not be considered "sane".
295       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
296 alias in your environment])
297    fi
299    test "[$]2" = conftestfile
300    )
301 then
302    # Ok.
303    :
304 else
305    AC_MSG_ERROR([newly created file is older than distributed files!
306 Check your system clock])
308 rm -f conftest*
309 AC_MSG_RESULT(yes)])
311 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
312 dnl The program must properly implement --version.
313 AC_DEFUN([AM_MISSING_PROG],
314 [AC_MSG_CHECKING(for working $2)
315 # Run test in a subshell; some versions of sh will print an error if
316 # an executable is not found, even if stderr is redirected.
317 # Redirect stdin to placate older versions of autoconf.  Sigh.
318 if ($2 --version) < /dev/null > /dev/null 2>&1; then
319    $1=$2
320    AC_MSG_RESULT(found)
321 else
322    $1="$3/missing $2"
323    AC_MSG_RESULT(missing)
325 AC_SUBST($1)])
327 # Like AC_CONFIG_HEADER, but automatically create stamp file.
329 AC_DEFUN([AM_CONFIG_HEADER],
330 [AC_PREREQ([2.12])
331 AC_CONFIG_HEADER([$1])
332 dnl When config.status generates a header, we must update the stamp-h file.
333 dnl This file resides in the same directory as the config header
334 dnl that is generated.  We must strip everything past the first ":",
335 dnl and everything past the last "/".
336 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
337 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
338 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
339 <<am_indx=1
340 for am_file in <<$1>>; do
341   case " <<$>>CONFIG_HEADERS " in
342   *" <<$>>am_file "*<<)>>
343     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
344     ;;
345   esac
346   am_indx=`expr "<<$>>am_indx" + 1`
347 done<<>>dnl>>)
348 changequote([,]))])
350 # Add --enable-maintainer-mode option to configure.
351 # From Jim Meyering
353 # serial 1
355 AC_DEFUN([AM_MAINTAINER_MODE],
356 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
357   dnl maintainer-mode is disabled by default
358   AC_ARG_ENABLE(maintainer-mode,
359 [  --enable-maintainer-mode enable make rules and dependencies not useful
360                           (and sometimes confusing) to the casual installer],
361       USE_MAINTAINER_MODE=$enableval,
362       USE_MAINTAINER_MODE=no)
363   AC_MSG_RESULT($USE_MAINTAINER_MODE)
364   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
365   MAINT=$MAINTAINER_MODE_TRUE
366   AC_SUBST(MAINT)dnl