1 dnl Process this file with autoconf to produce a configure script.
3 dnl Copyright 2012 Free Software Foundation
5 dnl This file is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3 of the License, or
8 dnl (at your option) any later version.
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 dnl GNU General Public License for more details.
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with this program; see the file COPYING3. If not see
17 dnl <http://www.gnu.org/licenses/>.
22 AC_CONFIG_SRCDIR(ar.c)
28 BFD_VERSION=`${srcdir}/../bfd/configure --version | sed -n -e '1s,.* ,,p'`
30 AM_INIT_AUTOMAKE(binutils, ${BFD_VERSION})
34 AC_USE_SYSTEM_EXTENSIONS
39 AC_ARG_ENABLE(targets,
40 [ --enable-targets alternative target configurations],
41 [case "${enableval}" in
42 yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
44 no) enable_targets= ;;
45 *) enable_targets=$enableval ;;
48 AC_ARG_ENABLE(deterministic-archives,
49 [AS_HELP_STRING([--enable-deterministic-archives],
50 [ar and ranlib default to -D behavior])], [
51 if test "${enableval}" = no; then
52 default_ar_deterministic=0
54 default_ar_deterministic=1
55 fi], [default_ar_deterministic=0])
57 AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic,
58 [Should ar and ranlib use -D behavior by default?])
62 AC_CONFIG_HEADERS(config.h:config.in)
64 AH_VERBATIM([00_CONFIG_H_CHECK],
65 [/* Check that config.h is #included before system headers
66 (this works only for glibc, but that should be enough). */
67 #if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
68 # error config.h must be #included before system headers
70 #define __CONFIG_H__ 1])
72 if test -z "$target" ; then
73 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
75 if test -z "$host" ; then
76 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
82 ALL_LINGUAS="bg da es fi fr id it ja ro ru rw sk sv tr uk vi zh_CN zh_TW hr"
83 ZW_GNU_GETTEXT_SISTER_DIR
87 AM_CONDITIONAL(GENINSRC_NEVER, false)
89 if test -n "$EXEEXT"; then
90 AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
91 [Does the platform use an executable suffix?])
93 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
94 [Suffix used for executables, if any.])
96 # host-specific stuff:
100 . ${srcdir}/../bfd/configure.host
110 DEMANGLER_NAME=c++filt
112 *-*-go32* | *-*-msdos*)
113 DEMANGLER_NAME=cxxfilt
115 AC_SUBST(DEMANGLER_NAME)
117 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h wchar.h)
121 AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll setlocale)
122 AC_CHECK_FUNC([mkstemp],
123 AC_DEFINE([HAVE_MKSTEMP], 1,
124 [Define to 1 if you have the `mkstemp' function.]))
125 AC_CHECK_FUNC([mkdtemp],
126 AC_DEFINE([HAVE_MKDTEMP], 1,
127 [Define to 1 if you have the `mkdtemp' function.]))
128 AC_MSG_CHECKING([for mbstate_t])
129 AC_TRY_COMPILE([#include <wchar.h>],
130 [mbstate_t teststate;],
131 have_mbstate_t=yes, have_mbstate_t=no)
132 AC_MSG_RESULT($have_mbstate_t)
133 if test x"$have_mbstate_t" = xyes; then
134 AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
137 # Some systems have frexp only in -lm, not in -lc.
138 AC_SEARCH_LIBS(frexp, m)
142 AC_MSG_CHECKING(for time_t in time.h)
143 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
144 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [time_t i;])],
145 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
146 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
147 if test $bu_cv_decl_time_t_time_h = yes; then
148 AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
149 [Is the type time_t defined in <time.h>?])
152 AC_MSG_CHECKING(for time_t in sys/types.h)
153 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
154 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>], [time_t i;])],
155 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
156 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
157 if test $bu_cv_decl_time_t_types_h = yes; then
158 AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
159 [Is the type time_t defined in <sys/types.h>?])
162 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
163 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
164 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
165 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
166 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
167 if test $bu_cv_decl_getopt_unistd_h = yes; then
168 AC_DEFINE([HAVE_DECL_GETOPT], 1,
169 [Is the prototype for getopt in <unistd.h> in the expected format?])
172 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
174 AC_MSG_CHECKING([for utime.h])
175 AC_CACHE_VAL(bu_cv_header_utime_h,
176 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
181 [struct utimbuf s;])],
182 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
183 AC_MSG_RESULT($bu_cv_header_utime_h)
184 if test $bu_cv_header_utime_h = yes; then
185 AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
188 AC_CHECK_DECLS([environ, fprintf, getc_unlocked, getenv,
189 sbrk, snprintf, stpcpy, strnlen, strstr, vsnprintf])
191 # Link in zlib if we can. This allows us to read compressed debug
192 # sections. This is used only by readelf.c (objdump uses bfd for
193 # reading compressed sections).
198 # target-specific stuff:
200 # Canonicalize the secondary target names.
201 if test -n "$enable_targets"; then
202 for targ in `echo $enable_targets | sed 's/,/ /g'`
204 result=`$ac_config_sub $targ 2>/dev/null`
205 if test -n "$result"; then
206 canon_targets="$canon_targets $result"
208 # Allow targets that config.sub doesn't recognize, like "all".
209 canon_targets="$canon_targets $targ"
214 AC_CHECK_HEADER(iconv.h)
230 OBJDUMP_PRIVATE_VECTORS=
231 OBJDUMP_PRIVATE_OFILES=
234 for targ in $target $canon_targets
236 if test "x$targ" = "xall"; then
238 BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
239 BUILD_SRCONV='$(SRCONV_PROG)'
240 NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
241 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
242 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
243 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
244 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
245 if test -z "$DLLTOOL_DEFAULT"; then
246 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
248 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
249 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
250 od_vectors="$od_vectors objdump_private_desc_xcoff"
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"
274 *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
279 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
280 if test -z "$DLLTOOL_DEFAULT"; then
281 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_EPOC"
283 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM"
284 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
285 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
287 arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*)
288 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
289 if test -z "$DLLTOOL_DEFAULT"; then
290 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE"
292 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
293 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
294 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
297 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
298 if test -z "$DLLTOOL_DEFAULT"; then
299 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
301 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
302 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
303 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
305 x86_64-*-mingw* | x86_64-*-cygwin*)
306 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
307 if test -z "$DLLTOOL_DEFAULT"; then
308 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
310 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
311 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
312 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
313 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
316 i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
318 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
319 if test -z "$DLLTOOL_DEFAULT"; then
320 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
322 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
323 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
324 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
325 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
330 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
331 if test -z "$DLLTOOL_DEFAULT"; then
332 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
334 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
343 OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
345 powerpc*-*-pe* | powerpc*-*-cygwin*)
346 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
347 if test -z "$DLLTOOL_DEFAULT"; then
348 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_PPC"
350 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
351 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
352 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
354 powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*)
355 case "$BUILD_INSTALL_MISC" in
357 *) BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu"
361 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
362 if test -z "$DLLTOOL_DEFAULT"; then
363 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
365 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
366 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
367 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
370 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
373 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
374 if test -z "$DLLTOOL_DEFAULT"; then
375 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MIPS"
377 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
378 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
379 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
382 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
383 if test -z "$DLLTOOL_DEFAULT"; then
384 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
386 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
387 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
388 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
391 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
392 if test -z "$DLLTOOL_DEFAULT"; then
393 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
395 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
398 OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
402 # Add objdump private vectors.
405 od_vectors="$od_vectors objdump_private_desc_xcoff"
408 od_vectors="$od_vectors objdump_private_desc_mach_o"
414 # Uniq objdump private vector, build objdump target ofiles.
417 for i in $od_vectors ; do
422 OBJDUMP_PRIVATE_VECTORS="$OBJDUMP_PRIVATE_VECTORS &$i,"
424 objdump_private_desc_xcoff)
425 od_files="$od_files od-xcoff" ;;
426 objdump_private_desc_mach_o)
427 od_files="$od_files od-macho" ;;
428 *) AC_MSG_ERROR(*** unknown private vector $i) ;;
434 # Uniq objdump target ofiles
436 for i in $od_files ; do
441 OBJDUMP_PRIVATE_OFILES="$OBJDUMP_PRIVATE_OFILES $i.$objext"
446 DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
448 if test "${with_windres+set}" = set; then
449 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
452 if test "${with_windmc+set}" = set; then
453 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
456 OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECTORS}\""
458 AC_SUBST(NLMCONV_DEFS)
459 AC_SUBST(BUILD_NLMCONV)
460 AC_SUBST(BUILD_SRCONV)
461 AC_SUBST(BUILD_DLLTOOL)
462 AC_SUBST(DLLTOOL_DEFS)
463 AC_SUBST(BUILD_WINDRES)
464 AC_SUBST(BUILD_WINDMC)
465 AC_SUBST(BUILD_DLLWRAP)
467 AC_SUBST(BUILD_INSTALL_MISC)
468 AC_SUBST(OBJDUMP_DEFS)
469 AC_SUBST(OBJDUMP_PRIVATE_OFILES)
471 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
474 . $srcdir/../bfd/config.bfd
475 if test "x$targ_underscore" = "xyes"; then
480 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
481 [Define to 1 if user symbol names have a leading underscore, 0 if not.])
485 . ${srcdir}/configure.tgt
487 EMULATION_VECTOR=$targ_emul_vector
490 AC_SUBST(EMULATION_VECTOR)
492 # Required for html and install-html
493 AC_SUBST(datarootdir)
498 AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)