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?])
72 GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections])
73 if test "${enable_libctf}" = yes; then
74 AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections])
76 AM_CONDITIONAL(ENABLE_LIBCTF, test "${enable_libctf}" = yes)
80 AC_CONFIG_HEADERS(config.h:config.in)
82 AH_VERBATIM([00_CONFIG_H_CHECK],
83 [/* Check that config.h is #included before system headers
84 (this works only for glibc, but that should be enough). */
85 #if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
86 # error config.h must be #included before system headers
88 #define __CONFIG_H__ 1])
90 if test -z "$target" ; then
91 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
93 if test -z "$host" ; then
94 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
100 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"
101 ZW_GNU_GETTEXT_SISTER_DIR
105 AM_CONDITIONAL(GENINSRC_NEVER, false)
107 if test -n "$EXEEXT"; then
108 AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
109 [Does the platform use an executable suffix?])
111 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
112 [Suffix used for executables, if any.])
114 # host-specific stuff:
118 . ${srcdir}/../bfd/configure.host
128 DEMANGLER_NAME=c++filt
130 *-*-go32* | *-*-msdos*)
131 DEMANGLER_NAME=cxxfilt
133 AC_SUBST(DEMANGLER_NAME)
135 AC_CHECK_SIZEOF([long])
136 AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
138 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)
143 AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll setlocale)
144 AC_CHECK_FUNC([mkstemp],
145 AC_DEFINE([HAVE_MKSTEMP], 1,
146 [Define to 1 if you have the `mkstemp' function.]))
147 AC_CHECK_FUNC([mkdtemp],
148 AC_DEFINE([HAVE_MKDTEMP], 1,
149 [Define to 1 if you have the `mkdtemp' function.]))
150 AC_MSG_CHECKING([for mbstate_t])
151 AC_TRY_COMPILE([#include <wchar.h>],
152 [mbstate_t teststate;],
153 have_mbstate_t=yes, have_mbstate_t=no)
154 AC_MSG_RESULT($have_mbstate_t)
155 if test x"$have_mbstate_t" = xyes; then
156 AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
159 # Some systems have frexp only in -lm, not in -lc.
160 AC_SEARCH_LIBS(frexp, m)
164 AC_MSG_CHECKING(for time_t in time.h)
165 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
166 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [time_t i;])],
167 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
168 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
169 if test $bu_cv_decl_time_t_time_h = yes; then
170 AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
171 [Is the type time_t defined in <time.h>?])
174 AC_MSG_CHECKING(for time_t in sys/types.h)
175 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
176 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>], [time_t i;])],
177 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
178 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
179 if test $bu_cv_decl_time_t_types_h = yes; then
180 AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
181 [Is the type time_t defined in <sys/types.h>?])
184 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
185 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
186 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
187 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
188 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
189 if test $bu_cv_decl_getopt_unistd_h = yes; then
190 AC_DEFINE([HAVE_DECL_GETOPT], 1,
191 [Is the prototype for getopt in <unistd.h> in the expected format?])
194 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
196 AC_MSG_CHECKING([for utime.h])
197 AC_CACHE_VAL(bu_cv_header_utime_h,
198 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
203 [struct utimbuf s;])],
204 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
205 AC_MSG_RESULT($bu_cv_header_utime_h)
206 if test $bu_cv_header_utime_h = yes; then
207 AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
210 AC_CHECK_DECLS([asprintf, environ, fprintf, getc_unlocked, getenv,
211 sbrk, snprintf, stpcpy, strnlen, strstr, vsnprintf])
213 # Link in zlib if we can. This allows us to read compressed debug
214 # sections. This is used only by readelf.c (objdump uses bfd for
215 # reading compressed sections).
220 # target-specific stuff:
222 # Canonicalize the secondary target names.
223 if test -n "$enable_targets"; then
224 for targ in `echo $enable_targets | sed 's/,/ /g'`
226 result=`$ac_config_sub $targ 2>/dev/null`
227 if test -n "$result"; then
228 canon_targets="$canon_targets $result"
230 # Allow targets that config.sub doesn't recognize, like "all".
231 canon_targets="$canon_targets $targ"
236 AC_CHECK_HEADER(iconv.h)
250 OBJDUMP_PRIVATE_VECTORS=
251 OBJDUMP_PRIVATE_OFILES=
254 for targ in $target $canon_targets
256 if test "x$targ" = "xall"; then
258 BUILD_SRCONV='$(SRCONV_PROG)'
259 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
260 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
261 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
262 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
263 if test -z "$DLLTOOL_DEFAULT"; then
264 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
266 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
267 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
268 od_vectors="$od_vectors objdump_private_desc_xcoff"
271 *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
275 arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*)
276 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
277 if test -z "$DLLTOOL_DEFAULT"; then
278 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE"
280 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
281 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
282 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
285 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
286 if test -z "$DLLTOOL_DEFAULT"; then
287 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
289 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
290 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
291 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
293 x86_64-*-mingw* | x86_64-*-cygwin*)
294 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
295 if test -z "$DLLTOOL_DEFAULT"; then
296 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
298 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
299 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
300 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
301 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
304 i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
306 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
307 if test -z "$DLLTOOL_DEFAULT"; then
308 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
310 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
311 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
312 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
313 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
318 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
319 if test -z "$DLLTOOL_DEFAULT"; then
320 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
322 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
331 OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
333 powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*)
334 case "$BUILD_INSTALL_MISC" in
336 *) BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu"
340 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
341 if test -z "$DLLTOOL_DEFAULT"; then
342 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
344 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
345 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
346 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
349 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
352 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
353 if test -z "$DLLTOOL_DEFAULT"; then
354 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MIPS"
356 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
357 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
358 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
361 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
362 if test -z "$DLLTOOL_DEFAULT"; then
363 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
365 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
366 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
367 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
370 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
371 if test -z "$DLLTOOL_DEFAULT"; then
372 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
374 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
377 OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
381 # Add objdump private vectors.
384 od_vectors="$od_vectors objdump_private_desc_elf32_avr"
386 powerpc*-*-aix* | rs6000-*-aix*)
387 od_vectors="$od_vectors objdump_private_desc_xcoff"
390 od_vectors="$od_vectors objdump_private_desc_mach_o"
396 # Uniq objdump private vector, build objdump target ofiles.
399 for i in $od_vectors ; do
404 OBJDUMP_PRIVATE_VECTORS="$OBJDUMP_PRIVATE_VECTORS &$i,"
406 objdump_private_desc_elf32_avr)
407 od_files="$od_files od-elf32_avr" ;;
408 objdump_private_desc_xcoff)
409 od_files="$od_files od-xcoff" ;;
410 objdump_private_desc_mach_o)
411 od_files="$od_files od-macho" ;;
412 *) AC_MSG_ERROR(*** unknown private vector $i) ;;
418 # Uniq objdump target ofiles
420 for i in $od_files ; do
425 OBJDUMP_PRIVATE_OFILES="$OBJDUMP_PRIVATE_OFILES $i.$objext"
430 DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
432 if test "${with_windres+set}" = set; then
433 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
436 if test "${with_windmc+set}" = set; then
437 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
440 OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECTORS}\""
442 AC_SUBST(BUILD_SRCONV)
443 AC_SUBST(BUILD_DLLTOOL)
444 AC_SUBST(DLLTOOL_DEFS)
445 AC_SUBST(BUILD_WINDRES)
446 AC_SUBST(BUILD_WINDMC)
447 AC_SUBST(BUILD_DLLWRAP)
449 AC_SUBST(BUILD_INSTALL_MISC)
450 AC_SUBST(OBJDUMP_DEFS)
451 AC_SUBST(OBJDUMP_PRIVATE_OFILES)
453 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
456 . $srcdir/../bfd/config.bfd
457 if test "x$targ_underscore" = "xyes"; then
462 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
463 [Define to 1 if user symbol names have a leading underscore, 0 if not.])
467 . ${srcdir}/configure.tgt
469 EMULATION_VECTOR=$targ_emul_vector
472 AC_SUBST(EMULATION_VECTOR)
474 # Required for html and install-html
475 AC_SUBST(datarootdir)
480 AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)