1 dnl Process this file with autoconf to produce a configure script.
3 dnl Copyright (C) 2012-2021 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)
31 AC_USE_SYSTEM_EXTENSIONS
36 AC_ARG_ENABLE(targets,
37 [ --enable-targets alternative target configurations],
38 [case "${enableval}" in
39 yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
41 no) enable_targets= ;;
42 *) 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?])
59 AC_ARG_ENABLE(default-strings-all,
60 [AS_HELP_STRING([--disable-default-strings-all],
61 [strings defaults to --data behavior])], [
62 if test "${enableval}" = no; then
66 fi], [default_strings_all=1])
68 AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all,
69 [Should strings use -a behavior by default?])
72 AC_ARG_ENABLE(f-for-ifunc-symbols,
73 [AS_HELP_STRING([--enable-f-for-ifunc-symbols],
74 [Have nm use F and f for global and local ifunc symbols])], [
75 if test "${enableval}" = no; then
79 fi], [default_f_for_ifunc=0])
81 AC_DEFINE_UNQUOTED(DEFAULT_F_FOR_IFUNC_SYMBOLS, $default_f_for_ifunc,
82 [Have nm use F and f for global and local ifunc symbols])
85 AC_ARG_ENABLE(follow-debug-links,
86 [AS_HELP_STRING([--enable-follow-debug-links],
87 [Have readelf and objdump follow debug links by default])], [
88 if test "${enableval}" = no; then
89 default_for_follow_links=0
91 default_for_follow_links=1
92 fi], [default_for_follow_links=1])
94 AC_DEFINE_UNQUOTED(DEFAULT_FOR_FOLLOW_LINKS, $default_for_follow_links,
95 [Have readelf and objdump follow debug links by default])
100 GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections])
101 if test "${enable_libctf}" = yes; then
102 AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections])
104 AM_CONDITIONAL(ENABLE_LIBCTF, test "${enable_libctf}" = yes)
108 AC_CONFIG_HEADERS(config.h:config.in)
110 AH_VERBATIM([00_CONFIG_H_CHECK],
111 [/* Check that config.h is #included before system headers
112 (this works only for glibc, but that should be enough). */
113 #if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
114 # error config.h must be #included before system headers
116 #define __CONFIG_H__ 1])
118 if test -z "$target" ; then
119 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
121 if test -z "$host" ; then
122 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
128 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"
129 ZW_GNU_GETTEXT_SISTER_DIR
133 AM_CONDITIONAL(GENINSRC_NEVER, false)
135 if test -n "$EXEEXT"; then
136 AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
137 [Does the platform use an executable suffix?])
139 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
140 [Suffix used for executables, if any.])
142 # host-specific stuff:
146 . ${srcdir}/../bfd/configure.host
156 DEMANGLER_NAME=c++filt
158 *-*-go32* | *-*-msdos*)
159 DEMANGLER_NAME=cxxfilt
161 AC_SUBST(DEMANGLER_NAME)
163 AC_CHECK_SIZEOF([long])
164 AC_CHECK_SIZEOF([long long])
166 # We use headers from include/ that check various HAVE_*_H macros, thus
167 # should ensure they are set by configure. This is true even when C99
168 # guarantees they are available.
169 # plugin-api.h tests HAVE_STDINT_H and HAVE_INTTYPES_H
170 # Besides those, we need to check anything used in binutils/ not in C99.
171 AC_CHECK_HEADERS(fcntl.h inttypes.h stdint.h sys/file.h sys/param.h \
172 sys/stat.h sys/types.h unistd.h)
175 AC_CHECK_FUNCS(getc_unlocked sbrk utimes)
176 AC_CHECK_FUNC([mkstemp],
177 AC_DEFINE([HAVE_MKSTEMP], 1,
178 [Define to 1 if you have the `mkstemp' function.]))
179 AC_CHECK_FUNC([mkdtemp],
180 AC_DEFINE([HAVE_MKDTEMP], 1,
181 [Define to 1 if you have the `mkdtemp' function.]))
182 AC_MSG_CHECKING([for mbstate_t])
183 AC_TRY_COMPILE([#include <wchar.h>],
184 [mbstate_t teststate;],
185 have_mbstate_t=yes, have_mbstate_t=no)
186 AC_MSG_RESULT($have_mbstate_t)
187 if test x"$have_mbstate_t" = xyes; then
188 AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
191 # Some systems have frexp only in -lm, not in -lc.
192 AC_SEARCH_LIBS(frexp, m)
196 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
197 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
198 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
199 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
200 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
201 if test $bu_cv_decl_getopt_unistd_h = yes; then
202 AC_DEFINE([HAVE_DECL_GETOPT], 1,
203 [Is the prototype for getopt in <unistd.h> in the expected format?])
206 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
208 AC_MSG_CHECKING([for utime.h])
209 AC_CACHE_VAL(bu_cv_header_utime_h,
210 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
215 [struct utimbuf s;])],
216 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
217 AC_MSG_RESULT($bu_cv_header_utime_h)
218 if test $bu_cv_header_utime_h = yes; then
219 AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
222 AC_CHECK_DECLS([asprintf, environ, getc_unlocked, sbrk, stpcpy])
224 # Link in zlib if we can. This allows us to read compressed debug
225 # sections. This is used only by readelf.c (objdump uses bfd for
226 # reading compressed sections).
231 # target-specific stuff:
233 # Canonicalize the secondary target names.
234 if test -n "$enable_targets"; then
235 for targ in `echo $enable_targets | sed 's/,/ /g'`
237 result=`$ac_config_sub $targ 2>/dev/null`
238 if test -n "$result"; then
239 canon_targets="$canon_targets $result"
241 # Allow targets that config.sub doesn't recognize, like "all".
242 canon_targets="$canon_targets $targ"
247 AC_CHECK_HEADER(iconv.h)
261 OBJDUMP_PRIVATE_VECTORS=
262 OBJDUMP_PRIVATE_OFILES=
265 for targ in $target $canon_targets
267 if test "x$targ" = "xall"; then
269 BUILD_SRCONV='$(SRCONV_PROG)'
270 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
271 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
272 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
273 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
274 if test -z "$DLLTOOL_DEFAULT"; then
275 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
277 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
278 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
279 od_vectors="$od_vectors objdump_private_desc_xcoff"
282 *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
286 arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*)
287 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
288 if test -z "$DLLTOOL_DEFAULT"; then
289 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE"
291 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
292 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
293 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
296 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
297 if test -z "$DLLTOOL_DEFAULT"; then
298 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
300 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
301 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
302 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
304 x86_64-*-mingw* | x86_64-*-cygwin*)
305 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
306 if test -z "$DLLTOOL_DEFAULT"; then
307 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
309 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
310 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
311 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
312 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
315 i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
317 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
318 if test -z "$DLLTOOL_DEFAULT"; then
319 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
321 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
322 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
323 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
324 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
329 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
330 if test -z "$DLLTOOL_DEFAULT"; then
331 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
333 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
342 OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
344 powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*)
345 case "$BUILD_INSTALL_MISC" in
347 *) BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu"
351 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
352 if test -z "$DLLTOOL_DEFAULT"; then
353 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
355 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
356 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
357 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
360 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
363 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
364 if test -z "$DLLTOOL_DEFAULT"; then
365 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MIPS"
367 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
368 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
369 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
372 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
373 if test -z "$DLLTOOL_DEFAULT"; then
374 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
376 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
377 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
378 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
381 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
382 if test -z "$DLLTOOL_DEFAULT"; then
383 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
385 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
388 OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
392 # Add objdump private vectors.
395 od_vectors="$od_vectors objdump_private_desc_elf32_avr"
397 powerpc*-*-aix* | rs6000-*-aix*)
398 od_vectors="$od_vectors objdump_private_desc_xcoff"
401 od_vectors="$od_vectors objdump_private_desc_mach_o"
407 # Uniq objdump private vector, build objdump target ofiles.
410 for i in $od_vectors ; do
415 OBJDUMP_PRIVATE_VECTORS="$OBJDUMP_PRIVATE_VECTORS &$i,"
417 objdump_private_desc_elf32_avr)
418 od_files="$od_files od-elf32_avr" ;;
419 objdump_private_desc_xcoff)
420 od_files="$od_files od-xcoff" ;;
421 objdump_private_desc_mach_o)
422 od_files="$od_files od-macho" ;;
423 *) AC_MSG_ERROR(*** unknown private vector $i) ;;
429 # Uniq objdump target ofiles
431 for i in $od_files ; do
436 OBJDUMP_PRIVATE_OFILES="$OBJDUMP_PRIVATE_OFILES $i.$objext"
441 DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
443 if test "${with_windres+set}" = set; then
444 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
447 if test "${with_windmc+set}" = set; then
448 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
451 OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECTORS}\""
453 AC_SUBST(BUILD_SRCONV)
454 AC_SUBST(BUILD_DLLTOOL)
455 AC_SUBST(DLLTOOL_DEFS)
456 AC_SUBST(BUILD_WINDRES)
457 AC_SUBST(BUILD_WINDMC)
458 AC_SUBST(BUILD_DLLWRAP)
460 AC_SUBST(BUILD_INSTALL_MISC)
461 AC_SUBST(OBJDUMP_DEFS)
462 AC_SUBST(OBJDUMP_PRIVATE_OFILES)
464 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
467 . $srcdir/../bfd/config.bfd
468 if test "x$targ_underscore" = "xyes"; then
473 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
474 [Define to 1 if user symbol names have a leading underscore, 0 if not.])
478 . ${srcdir}/configure.tgt
480 EMULATION_VECTOR=$targ_emul_vector
483 AC_SUBST(EMULATION_VECTOR)
485 # Required for html and install-html
486 AC_SUBST(datarootdir)
491 AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)