1 dnl Process this file with autoconf to produce a configure script.
10 BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${srcdir}/../bfd/configure.in`
12 AM_INIT_AUTOMAKE(binutils, ${BFD_VERSION})
16 AC_ARG_ENABLE(targets,
17 [ --enable-targets alternative target configurations],
18 [case "${enableval}" in
19 yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
21 no) enable_targets= ;;
22 *) enable_targets=$enableval ;;
24 AC_ARG_ENABLE(commonbfdlib,
25 [ --enable-commonbfdlib build shared BFD/opcodes/libiberty library],
26 [case "${enableval}" in
27 yes) commonbfdlib=true ;;
28 no) commonbfdlib=false ;;
29 *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
32 build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
35 [ --enable-werror treat compile warnings as errors],
36 [case "${enableval}" in
37 yes | y) ERROR_ON_WARNING="yes" ;;
38 no | n) ERROR_ON_WARNING="no" ;;
39 *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
42 # Enable -Werror by default, suppressing it only for --disable-werror
43 # or --disable-build-warnings.
44 if test "${ERROR_ON_WARNING}" != no
46 build_warnings="$build_warnings -Werror"
49 AC_ARG_ENABLE(build-warnings,
50 [ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
51 [case "${enableval}" in
53 no) build_warnings="-w";;
54 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
55 build_warnings="${build_warnings} ${t}";;
56 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
57 build_warnings="${t} ${build_warnings}";;
58 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
60 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
61 echo "Setting warning flags = $build_warnings" 6>&1
64 if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
65 WARN_CFLAGS="${build_warnings}"
69 AM_CONFIG_HEADER(config.h:config.in)
71 if test -z "$target" ; then
72 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
74 if test -z "$host" ; then
75 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
83 ALL_LINGUAS="fr tr ja es sv da zh_CN ru ro"
88 if test -n "$EXEEXT"; then
89 AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
90 [Does the platform use an executable suffix?])
92 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
93 [Suffix used for executables, if any.])
95 # host-specific stuff:
99 . ${srcdir}/../bfd/configure.host
109 DEMANGLER_NAME=c++filt
111 *-*-go32* | *-*-msdos*)
112 DEMANGLER_NAME=cxxfilt
114 AC_SUBST(DEMANGLER_NAME)
116 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
119 AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll)
121 # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
122 # needs to be defined for it
123 AC_MSG_CHECKING([for fopen64])
124 AC_CACHE_VAL(bu_cv_have_fopen64,
125 [AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
126 bu_cv_have_fopen64=yes,
127 [saved_CPPFLAGS=$CPPFLAGS
128 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
129 AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
130 bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
131 bu_cv_have_fopen64=no)
132 CPPFLAGS=$saved_CPPFLAGS])])
133 AC_MSG_RESULT($bu_cv_have_fopen64)
134 if test "$bu_cv_have_fopen64" != no; then
135 AC_DEFINE([HAVE_FOPEN64], 1,
136 [Is fopen64 available?])
138 AC_MSG_CHECKING([for stat64])
139 AC_CACHE_VAL(bu_cv_have_stat64,
140 [AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
141 bu_cv_have_stat64=yes,
142 [saved_CPPFLAGS=$CPPFLAGS
143 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
144 AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
145 bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE",
146 bu_cv_have_stat64=no)
147 CPPFLAGS=$saved_CPPFLAGS])])
148 AC_MSG_RESULT($bu_cv_have_stat64)
149 if test "$bu_cv_have_stat64" != no; then
150 AC_DEFINE([HAVE_STAT64], 1,
151 [Is stat64 available?])
153 if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \
154 || test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then
155 AC_DEFINE([_LARGEFILE64_SOURCE], 1,
157 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
160 # Some systems have frexp only in -lm, not in -lc.
161 AC_SEARCH_LIBS(frexp, m)
163 AC_MSG_CHECKING(for time_t in time.h)
164 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
165 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
166 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
167 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
168 if test $bu_cv_decl_time_t_time_h = yes; then
169 AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
170 [Is the type time_t defined in <time.h>?])
173 AC_MSG_CHECKING(for time_t in sys/types.h)
174 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
175 [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
176 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
177 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
178 if test $bu_cv_decl_time_t_types_h = yes; then
179 AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
180 [Is the type time_t defined in <sys/types.h>?])
183 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
184 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
185 [AC_TRY_COMPILE([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);],
186 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
187 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
188 if test $bu_cv_decl_getopt_unistd_h = yes; then
189 AC_DEFINE([HAVE_DECL_GETOPT], 1,
190 [Is the prototype for getopt in <unistd.h> in the expected format?])
193 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
195 AC_MSG_CHECKING([for utime.h])
196 AC_CACHE_VAL(bu_cv_header_utime_h,
197 [AC_TRY_COMPILE([#include <sys/types.h>
203 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
204 AC_MSG_RESULT($bu_cv_header_utime_h)
205 if test $bu_cv_header_utime_h = yes; then
206 AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
209 BFD_NEED_DECLARATION(fprintf)
210 BFD_NEED_DECLARATION(strstr)
211 BFD_NEED_DECLARATION(sbrk)
212 BFD_NEED_DECLARATION(getenv)
213 BFD_NEED_DECLARATION(environ)
217 # target-specific stuff:
219 # Canonicalize the secondary target names.
220 if test -n "$enable_targets"; then
221 for targ in `echo $enable_targets | sed 's/,/ /g'`
223 result=`$ac_config_sub $targ 2>/dev/null`
224 if test -n "$result"; then
225 canon_targets="$canon_targets $result"
227 # Allow targets that config.sub doesn't recognize, like "all".
228 canon_targets="$canon_targets $targ"
244 for targ in $target $canon_targets
246 if test "x$targ" = "xall"; then
248 BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
249 BUILD_SRCONV='$(SRCONV_PROG)'
250 NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
254 i[3-7]86*-*-netware*)
256 BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
257 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
260 BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
261 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
264 BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
265 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
268 BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
269 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
273 *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
277 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
278 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM"
279 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
281 arm-*-pe* | arm-*-wince)
282 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
283 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
284 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
287 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
288 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
289 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
291 arm*-* | xscale-* | strongarm-* | d10v-*)
292 OBJDUMP_DEFS="-DDISASSEMBLER_NEEDS_RELOCS"
295 i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
297 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
298 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
299 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
300 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
305 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
306 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
313 OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
315 powerpc*-*-pe* | powerpc*-*-cygwin*)
316 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
317 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
318 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
321 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
322 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
323 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
326 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
327 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
328 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
331 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
332 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
333 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
336 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
337 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
343 if test "${with_windres+set}" = set; then
344 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
347 AC_SUBST(NLMCONV_DEFS)
348 AC_SUBST(BUILD_NLMCONV)
349 AC_SUBST(BUILD_SRCONV)
350 AC_SUBST(BUILD_DLLTOOL)
351 AC_SUBST(DLLTOOL_DEFS)
352 AC_SUBST(BUILD_WINDRES)
353 AC_SUBST(BUILD_DLLWRAP)
355 AC_SUBST(OBJDUMP_DEFS)
357 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
360 . $srcdir/../bfd/config.bfd
361 if test "x$targ_underscore" = "xyes"; then
366 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
367 [Define to 1 if user symbol names have a leading underscore, 0 if not.])
370 for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
372 # Canonicalize the secondary target names.
373 result=`$ac_config_sub $targ_alias 2>/dev/null`
374 if test -n "$result"; then
380 . ${srcdir}/configure.tgt
383 EMULATION_VECTOR=$targ_emul_vector
387 AC_SUBST(EMULATION_VECTOR)
389 AC_OUTPUT(Makefile doc/Makefile po/Makefile.in:po/Make-in,
391 case "x$CONFIG_FILES" in
392 *) sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile ;;