1 dnl Process this file with autoconf to produce a configure script.
3 dnl Copyright (C) 2012-2020 Free Software Foundation, Inc.
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/>.
20 m4_include([../bfd/version.m4])
21 m4_include([../config/debuginfod.m4])
22 AC_INIT([binutils], BFD_VERSION)
23 AC_CONFIG_SRCDIR(ar.c)
32 AC_USE_SYSTEM_EXTENSIONS
37 AC_ARG_ENABLE(targets,
38 [ --enable-targets alternative target configurations],
39 [case "${enableval}" in
40 yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
42 no) enable_targets= ;;
43 *) enable_targets=$enableval ;;
46 AC_ARG_ENABLE(deterministic-archives,
47 [AS_HELP_STRING([--enable-deterministic-archives],
48 [ar and ranlib default to -D behavior])], [
49 if test "${enableval}" = no; then
50 default_ar_deterministic=0
52 default_ar_deterministic=1
53 fi], [default_ar_deterministic=0])
55 AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic,
56 [Should ar and ranlib use -D behavior by default?])
58 AC_ARG_ENABLE(default-strings-all,
59 [AS_HELP_STRING([--disable-default-strings-all],
60 [strings defaults to --data behavior])], [
61 if test "${enableval}" = no; then
65 fi], [default_strings_all=1])
69 AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all,
70 [Should strings use -a behavior by default?])
74 AC_CONFIG_HEADERS(config.h:config.in)
76 AH_VERBATIM([00_CONFIG_H_CHECK],
77 [/* Check that config.h is #included before system headers
78 (this works only for glibc, but that should be enough). */
79 #if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
80 # error config.h must be #included before system headers
82 #define __CONFIG_H__ 1])
84 if test -z "$target" ; then
85 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
87 if test -z "$host" ; then
88 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
94 ALL_LINGUAS="bg ca da es fi fr hr id it ja pt ro ru rw sk sr sv tr uk vi zh_CN zh_TW"
95 ZW_GNU_GETTEXT_SISTER_DIR
99 AM_CONDITIONAL(GENINSRC_NEVER, false)
101 if test -n "$EXEEXT"; then
102 AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
103 [Does the platform use an executable suffix?])
105 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
106 [Suffix used for executables, if any.])
108 # host-specific stuff:
112 . ${srcdir}/../bfd/configure.host
122 DEMANGLER_NAME=c++filt
124 *-*-go32* | *-*-msdos*)
125 DEMANGLER_NAME=cxxfilt
127 AC_SUBST(DEMANGLER_NAME)
129 AC_CHECK_SIZEOF([long])
130 AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
132 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)
137 AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll setlocale)
138 AC_CHECK_FUNC([mkstemp],
139 AC_DEFINE([HAVE_MKSTEMP], 1,
140 [Define to 1 if you have the `mkstemp' function.]))
141 AC_CHECK_FUNC([mkdtemp],
142 AC_DEFINE([HAVE_MKDTEMP], 1,
143 [Define to 1 if you have the `mkdtemp' function.]))
144 AC_MSG_CHECKING([for mbstate_t])
145 AC_TRY_COMPILE([#include <wchar.h>],
146 [mbstate_t teststate;],
147 have_mbstate_t=yes, have_mbstate_t=no)
148 AC_MSG_RESULT($have_mbstate_t)
149 if test x"$have_mbstate_t" = xyes; then
150 AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
153 # Some systems have frexp only in -lm, not in -lc.
154 AC_SEARCH_LIBS(frexp, m)
158 AC_MSG_CHECKING(for time_t in time.h)
159 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
160 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [time_t i;])],
161 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
162 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
163 if test $bu_cv_decl_time_t_time_h = yes; then
164 AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
165 [Is the type time_t defined in <time.h>?])
168 AC_MSG_CHECKING(for time_t in sys/types.h)
169 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
170 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>], [time_t i;])],
171 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
172 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
173 if test $bu_cv_decl_time_t_types_h = yes; then
174 AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
175 [Is the type time_t defined in <sys/types.h>?])
178 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
179 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
180 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
181 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
182 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
183 if test $bu_cv_decl_getopt_unistd_h = yes; then
184 AC_DEFINE([HAVE_DECL_GETOPT], 1,
185 [Is the prototype for getopt in <unistd.h> in the expected format?])
188 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
190 AC_MSG_CHECKING([for utime.h])
191 AC_CACHE_VAL(bu_cv_header_utime_h,
192 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
197 [struct utimbuf s;])],
198 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
199 AC_MSG_RESULT($bu_cv_header_utime_h)
200 if test $bu_cv_header_utime_h = yes; then
201 AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
204 AC_CHECK_DECLS([asprintf, environ, fprintf, getc_unlocked, getenv,
205 sbrk, snprintf, stpcpy, strnlen, strstr, vsnprintf])
207 # Link in zlib if we can. This allows us to read compressed debug
208 # sections. This is used only by readelf.c (objdump uses bfd for
209 # reading compressed sections).
214 # target-specific stuff:
216 # Canonicalize the secondary target names.
217 if test -n "$enable_targets"; then
218 for targ in `echo $enable_targets | sed 's/,/ /g'`
220 result=`$ac_config_sub $targ 2>/dev/null`
221 if test -n "$result"; then
222 canon_targets="$canon_targets $result"
224 # Allow targets that config.sub doesn't recognize, like "all".
225 canon_targets="$canon_targets $targ"
230 AC_CHECK_HEADER(iconv.h)
244 OBJDUMP_PRIVATE_VECTORS=
245 OBJDUMP_PRIVATE_OFILES=
248 for targ in $target $canon_targets
250 if test "x$targ" = "xall"; then
252 BUILD_SRCONV='$(SRCONV_PROG)'
253 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
254 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
255 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
256 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
257 if test -z "$DLLTOOL_DEFAULT"; then
258 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
260 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
261 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
262 od_vectors="$od_vectors objdump_private_desc_xcoff"
265 *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
269 arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*)
270 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
271 if test -z "$DLLTOOL_DEFAULT"; then
272 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE"
274 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
275 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
276 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
279 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
280 if test -z "$DLLTOOL_DEFAULT"; then
281 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
283 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
284 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
285 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
287 x86_64-*-mingw* | x86_64-*-cygwin*)
288 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
289 if test -z "$DLLTOOL_DEFAULT"; then
290 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
292 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
293 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
294 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
295 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
298 i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
300 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
301 if test -z "$DLLTOOL_DEFAULT"; then
302 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
304 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
305 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
306 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
307 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
312 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
313 if test -z "$DLLTOOL_DEFAULT"; then
314 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
316 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
325 OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
327 powerpc*-*-pe* | powerpc*-*-cygwin*)
328 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
329 if test -z "$DLLTOOL_DEFAULT"; then
330 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_PPC"
332 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
333 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
334 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
336 powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*)
337 case "$BUILD_INSTALL_MISC" in
339 *) BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu"
343 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
344 if test -z "$DLLTOOL_DEFAULT"; then
345 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
347 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
348 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
349 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
352 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
355 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
356 if test -z "$DLLTOOL_DEFAULT"; then
357 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MIPS"
359 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
360 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
361 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
364 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
365 if test -z "$DLLTOOL_DEFAULT"; then
366 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
368 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
369 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
370 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
373 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
374 if test -z "$DLLTOOL_DEFAULT"; then
375 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
377 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
380 OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
384 # Add objdump private vectors.
387 od_vectors="$od_vectors objdump_private_desc_elf32_avr"
389 powerpc*-*-aix* | rs6000-*-aix*)
390 od_vectors="$od_vectors objdump_private_desc_xcoff"
393 od_vectors="$od_vectors objdump_private_desc_mach_o"
399 # Uniq objdump private vector, build objdump target ofiles.
402 for i in $od_vectors ; do
407 OBJDUMP_PRIVATE_VECTORS="$OBJDUMP_PRIVATE_VECTORS &$i,"
409 objdump_private_desc_elf32_avr)
410 od_files="$od_files od-elf32_avr" ;;
411 objdump_private_desc_xcoff)
412 od_files="$od_files od-xcoff" ;;
413 objdump_private_desc_mach_o)
414 od_files="$od_files od-macho" ;;
415 *) AC_MSG_ERROR(*** unknown private vector $i) ;;
421 # Uniq objdump target ofiles
423 for i in $od_files ; do
428 OBJDUMP_PRIVATE_OFILES="$OBJDUMP_PRIVATE_OFILES $i.$objext"
433 DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
435 if test "${with_windres+set}" = set; then
436 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
439 if test "${with_windmc+set}" = set; then
440 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
443 OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECTORS}\""
445 AC_SUBST(BUILD_SRCONV)
446 AC_SUBST(BUILD_DLLTOOL)
447 AC_SUBST(DLLTOOL_DEFS)
448 AC_SUBST(BUILD_WINDRES)
449 AC_SUBST(BUILD_WINDMC)
450 AC_SUBST(BUILD_DLLWRAP)
452 AC_SUBST(BUILD_INSTALL_MISC)
453 AC_SUBST(OBJDUMP_DEFS)
454 AC_SUBST(OBJDUMP_PRIVATE_OFILES)
456 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
459 . $srcdir/../bfd/config.bfd
460 if test "x$targ_underscore" = "xyes"; then
465 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
466 [Define to 1 if user symbol names have a leading underscore, 0 if not.])
470 . ${srcdir}/configure.tgt
472 EMULATION_VECTOR=$targ_emul_vector
475 AC_SUBST(EMULATION_VECTOR)
477 # Required for html and install-html
478 AC_SUBST(datarootdir)
483 AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)