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
37 . ${srcdir}/../bfd/development.sh
38 test "$development" = true && ac_checking=yes
39 AC_ARG_ENABLE(checking,
40 [ --enable-checking enable run-time checks],
41 [case "${enableval}" in
42 no|none) ac_checking= ;;
45 if test x$ac_checking != x ; then
46 AC_DEFINE(ENABLE_CHECKING, 1, [Define if you want run-time sanity checks.])
49 AC_ARG_ENABLE(targets,
50 [ --enable-targets alternative target configurations],
51 [case "${enableval}" in
52 yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
54 no) enable_targets= ;;
55 *) enable_targets=$enableval ;;
59 AC_ARG_ENABLE(deterministic-archives,
60 [AS_HELP_STRING([--enable-deterministic-archives],
61 [ar and ranlib default to -D behavior])], [
62 if test "${enableval}" = no; then
63 default_ar_deterministic=0
65 default_ar_deterministic=1
66 fi], [default_ar_deterministic=0])
68 AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic,
69 [Should ar and ranlib use -D behavior by default?])
72 AC_ARG_ENABLE(default-strings-all,
73 [AS_HELP_STRING([--disable-default-strings-all],
74 [strings defaults to --data behavior])], [
75 if test "${enableval}" = no; then
79 fi], [default_strings_all=1])
81 AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all,
82 [Should strings use -a behavior by default?])
85 AC_ARG_ENABLE(f-for-ifunc-symbols,
86 [AS_HELP_STRING([--enable-f-for-ifunc-symbols],
87 [Have nm use F and f for global and local ifunc symbols])], [
88 if test "${enableval}" = no; then
92 fi], [default_f_for_ifunc=0])
94 AC_DEFINE_UNQUOTED(DEFAULT_F_FOR_IFUNC_SYMBOLS, $default_f_for_ifunc,
95 [Have nm use F and f for global and local ifunc symbols])
98 AC_ARG_ENABLE(follow-debug-links,
99 [AS_HELP_STRING([--enable-follow-debug-links],
100 [Have readelf and objdump follow debug links by default])], [
101 if test "${enableval}" = no; then
102 default_for_follow_links=0
104 default_for_follow_links=1
105 fi], [default_for_follow_links=1])
107 AC_DEFINE_UNQUOTED(DEFAULT_FOR_FOLLOW_LINKS, $default_for_follow_links,
108 [Have readelf and objdump follow debug links by default])
113 GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections])
114 if test "${enable_libctf}" = yes; then
115 AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections])
117 AM_CONDITIONAL(ENABLE_LIBCTF, test "${enable_libctf}" = yes)
121 AC_CONFIG_HEADERS(config.h:config.in)
123 AH_VERBATIM([00_CONFIG_H_CHECK],
124 [/* Check that config.h is #included before system headers
125 (this works only for glibc, but that should be enough). */
126 #if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
127 # error config.h must be #included before system headers
129 #define __CONFIG_H__ 1])
131 if test -z "$target" ; then
132 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
134 if test -z "$host" ; then
135 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
141 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"
142 ZW_GNU_GETTEXT_SISTER_DIR
146 AM_CONDITIONAL(GENINSRC_NEVER, false)
148 if test -n "$EXEEXT"; then
149 AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
150 [Does the platform use an executable suffix?])
152 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
153 [Suffix used for executables, if any.])
155 # host-specific stuff:
159 . ${srcdir}/../bfd/configure.host
169 DEMANGLER_NAME=c++filt
171 *-*-go32* | *-*-msdos*)
172 DEMANGLER_NAME=cxxfilt
174 AC_SUBST(DEMANGLER_NAME)
176 AC_CHECK_SIZEOF([long])
177 AC_CHECK_SIZEOF([long long])
179 # We use headers from include/ that check various HAVE_*_H macros, thus
180 # should ensure they are set by configure. This is true even when C99
181 # guarantees they are available.
182 # plugin-api.h tests HAVE_STDINT_H and HAVE_INTTYPES_H
183 # Besides those, we need to check anything used in binutils/ not in C99.
184 AC_CHECK_HEADERS(fcntl.h inttypes.h stdint.h sys/file.h \
185 sys/stat.h sys/time.h sys/types.h unistd.h)
188 AC_CHECK_FUNCS(getc_unlocked mkdtemp mkstemp sbrk utimensat utimes)
190 AC_MSG_CHECKING([for mbstate_t])
191 AC_TRY_COMPILE([#include <wchar.h>],
192 [mbstate_t teststate;],
193 have_mbstate_t=yes, have_mbstate_t=no)
194 AC_MSG_RESULT($have_mbstate_t)
195 if test x"$have_mbstate_t" = xyes; then
196 AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
199 # Copied from gnulib stat-time.m4.
200 # We should just switch over to using gnulib.
201 AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec],
202 [AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec],
203 [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec],
204 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
206 #include <sys/types.h>
207 #include <sys/stat.h>
209 # include <sys/time.h>
218 [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes],
219 [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])])
220 if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then
221 AC_DEFINE([TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC], [1],
222 [Define to 1 if the type of the st_atim member of a struct stat is
225 [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [],
226 [AC_CHECK_MEMBERS([struct stat.st_atimensec], [],
227 [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], [],
228 [#include <sys/types.h>
229 #include <sys/stat.h>])],
230 [#include <sys/types.h>
231 #include <sys/stat.h>])],
232 [#include <sys/types.h>
233 #include <sys/stat.h>])],
234 [#include <sys/types.h>
235 #include <sys/stat.h>])
237 # Some systems have frexp only in -lm, not in -lc.
238 AC_SEARCH_LIBS(frexp, m)
242 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
243 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
244 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
245 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
246 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
247 if test $bu_cv_decl_getopt_unistd_h = yes; then
248 AC_DEFINE([HAVE_DECL_GETOPT], 1,
249 [Is the prototype for getopt in <unistd.h> in the expected format?])
252 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
254 AC_MSG_CHECKING([for utime.h])
255 AC_CACHE_VAL(bu_cv_header_utime_h,
256 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
261 [struct utimbuf s;])],
262 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
263 AC_MSG_RESULT($bu_cv_header_utime_h)
264 if test $bu_cv_header_utime_h = yes; then
265 AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
268 AC_CHECK_DECLS([asprintf, environ, getc_unlocked, sbrk, stpcpy, strnlen])
270 # Link in zlib if we can. This allows us to read compressed debug
271 # sections. This is used only by readelf.c (objdump uses bfd for
272 # reading compressed sections).
277 # target-specific stuff:
279 # Canonicalize the secondary target names.
280 if test -n "$enable_targets"; then
281 for targ in `echo $enable_targets | sed 's/,/ /g'`
283 result=`$ac_config_sub $targ 2>/dev/null`
284 if test -n "$result"; then
285 canon_targets="$canon_targets $result"
287 # Allow targets that config.sub doesn't recognize, like "all".
288 canon_targets="$canon_targets $targ"
293 AC_CHECK_HEADER(iconv.h)
307 OBJDUMP_PRIVATE_VECTORS=
308 OBJDUMP_PRIVATE_OFILES=
311 for targ in $target $canon_targets
313 if test "x$targ" = "xall"; then
315 BUILD_SRCONV='$(SRCONV_PROG)'
316 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
317 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
318 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
319 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
320 if test -z "$DLLTOOL_DEFAULT"; then
321 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
323 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
324 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
325 od_vectors="$od_vectors objdump_private_desc_xcoff"
328 *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
332 arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*)
333 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
334 if test -z "$DLLTOOL_DEFAULT"; then
335 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE"
337 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
338 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
339 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
342 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
343 if test -z "$DLLTOOL_DEFAULT"; then
344 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
346 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
347 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
348 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
350 x86_64-*-mingw* | x86_64-*-cygwin*)
351 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
352 if test -z "$DLLTOOL_DEFAULT"; then
353 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
355 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
356 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
357 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
358 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
361 i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
363 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
364 if test -z "$DLLTOOL_DEFAULT"; then
365 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
367 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
368 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
369 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
370 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
375 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
376 if test -z "$DLLTOOL_DEFAULT"; then
377 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
379 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
388 OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
390 powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*)
391 case "$BUILD_INSTALL_MISC" in
393 *) BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu"
397 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
398 if test -z "$DLLTOOL_DEFAULT"; then
399 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
401 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
402 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
403 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
406 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
409 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
410 if test -z "$DLLTOOL_DEFAULT"; then
411 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MIPS"
413 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
414 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
415 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
418 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
419 if test -z "$DLLTOOL_DEFAULT"; then
420 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
422 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
423 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
424 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
427 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
428 if test -z "$DLLTOOL_DEFAULT"; then
429 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
431 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
434 OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
438 # Add objdump private vectors.
441 od_vectors="$od_vectors objdump_private_desc_elf32_avr"
443 powerpc*-*-aix* | rs6000-*-aix*)
444 od_vectors="$od_vectors objdump_private_desc_xcoff"
447 od_vectors="$od_vectors objdump_private_desc_mach_o"
453 # Uniq objdump private vector, build objdump target ofiles.
456 for i in $od_vectors ; do
461 OBJDUMP_PRIVATE_VECTORS="$OBJDUMP_PRIVATE_VECTORS &$i,"
463 objdump_private_desc_elf32_avr)
464 od_files="$od_files od-elf32_avr" ;;
465 objdump_private_desc_xcoff)
466 od_files="$od_files od-xcoff" ;;
467 objdump_private_desc_mach_o)
468 od_files="$od_files od-macho" ;;
469 *) AC_MSG_ERROR(*** unknown private vector $i) ;;
475 # Uniq objdump target ofiles
477 for i in $od_files ; do
482 OBJDUMP_PRIVATE_OFILES="$OBJDUMP_PRIVATE_OFILES $i.$objext"
487 DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
489 if test "${with_windres+set}" = set; then
490 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
493 if test "${with_windmc+set}" = set; then
494 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
497 OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECTORS}\""
499 AC_SUBST(BUILD_SRCONV)
500 AC_SUBST(BUILD_DLLTOOL)
501 AC_SUBST(DLLTOOL_DEFS)
502 AC_SUBST(BUILD_WINDRES)
503 AC_SUBST(BUILD_WINDMC)
504 AC_SUBST(BUILD_DLLWRAP)
506 AC_SUBST(BUILD_INSTALL_MISC)
507 AC_SUBST(OBJDUMP_DEFS)
508 AC_SUBST(OBJDUMP_PRIVATE_OFILES)
510 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
513 . $srcdir/../bfd/config.bfd
514 if test "x$targ_underscore" = "xyes"; then
519 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
520 [Define to 1 if user symbol names have a leading underscore, 0 if not.])
524 . ${srcdir}/configure.tgt
526 EMULATION_VECTOR=$targ_emul_vector
529 AC_SUBST(EMULATION_VECTOR)
531 # Required for html and install-html
532 AC_SUBST(datarootdir)
537 AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)