1 dnl Process this file with autoconf to produce a configure script.
3 dnl Copyright (C) 2012-2024 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)
28 AM_SILENT_RULES([yes])
32 AC_USE_SYSTEM_EXTENSIONS
40 . ${srcdir}/../bfd/development.sh
41 test "$development" = true && ac_checking=yes
42 AC_ARG_ENABLE(checking,
43 [ --enable-checking enable run-time checks],
44 [case "${enableval}" in
45 no|none) ac_checking= ;;
48 if test x$ac_checking != x ; then
49 AC_DEFINE(ENABLE_CHECKING, 1, [Define if you want run-time sanity checks.])
52 AC_ARG_ENABLE(targets,
53 [ --enable-targets alternative target configurations],
54 [case "${enableval}" in
55 yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
57 no) enable_targets= ;;
58 *) enable_targets=$enableval ;;
62 AC_ARG_ENABLE(deterministic-archives,
63 [AS_HELP_STRING([--enable-deterministic-archives],
64 [ar and ranlib default to -D behavior])], [
65 if test "${enableval}" = no; then
66 default_ar_deterministic=0
68 default_ar_deterministic=1
69 fi], [default_ar_deterministic=0])
71 AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic,
72 [Should ar and ranlib use -D behavior by default?])
75 AC_ARG_ENABLE(default-strings-all,
76 [AS_HELP_STRING([--disable-default-strings-all],
77 [strings defaults to --data behavior])], [
78 if test "${enableval}" = no; then
82 fi], [default_strings_all=1])
84 AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all,
85 [Should strings use -a behavior by default?])
88 AC_ARG_ENABLE(f-for-ifunc-symbols,
89 [AS_HELP_STRING([--enable-f-for-ifunc-symbols],
90 [Have nm use F and f for global and local ifunc symbols])], [
91 if test "${enableval}" = no; then
95 fi], [default_f_for_ifunc=0])
97 AC_DEFINE_UNQUOTED(DEFAULT_F_FOR_IFUNC_SYMBOLS, $default_f_for_ifunc,
98 [Have nm use F and f for global and local ifunc symbols])
101 AC_ARG_ENABLE(follow-debug-links,
102 [AS_HELP_STRING([--enable-follow-debug-links],
103 [Have readelf and objdump follow debug links by default])], [
104 if test "${enableval}" = no; then
105 default_for_follow_links=0
107 default_for_follow_links=1
108 fi], [default_for_follow_links=1])
110 AC_DEFINE_UNQUOTED(DEFAULT_FOR_FOLLOW_LINKS, $default_for_follow_links,
111 [Have readelf and objdump follow debug links by default])
116 AC_ARG_ENABLE(colored-disassembly,
117 [AS_HELP_STRING([--enable-colored-disassembly],
118 [Have objdump use colors in its disassembly by default])], [
119 if test "${enableval}" = no; then
120 default_for_colored_disassembly=0
122 default_for_colored_disassembly=1
123 fi], [default_for_colored_disassembly=0])
125 AC_DEFINE_UNQUOTED(DEFAULT_FOR_COLORED_DISASSEMBLY, $default_for_colored_disassembly,
126 [Have objdump use colors in its disassembly by default])
131 GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections])
132 if test "${enable_libctf}" = yes; then
133 AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections])
135 AM_CONDITIONAL(ENABLE_LIBCTF, test "${enable_libctf}" = yes)
139 AC_CONFIG_HEADERS(config.h:config.in)
141 AH_VERBATIM([00_CONFIG_H_CHECK],
142 [/* Check that config.h is #included before system headers
143 (this works only for glibc, but that should be enough). */
144 #if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
145 # error config.h must be #included before system headers
147 #define __CONFIG_H__ 1])
149 if test -z "$target" ; then
150 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
152 if test -z "$host" ; then
153 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
159 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"
160 ZW_GNU_GETTEXT_SISTER_DIR
164 AM_CONDITIONAL(GENINSRC_NEVER, false)
166 if test -n "$EXEEXT"; then
167 AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
168 [Does the platform use an executable suffix?])
170 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
171 [Suffix used for executables, if any.])
173 # host-specific stuff:
177 . ${srcdir}/../bfd/configure.host
187 DEMANGLER_NAME=c++filt
189 *-*-go32* | *-*-msdos*)
190 DEMANGLER_NAME=cxxfilt
192 AC_SUBST(DEMANGLER_NAME)
194 # We use headers from include/ that check various HAVE_*_H macros, thus
195 # should ensure they are set by configure. This is true even when C99
196 # guarantees they are available.
197 # plugin-api.h tests HAVE_STDINT_H and HAVE_INTTYPES_H
198 # Besides those, we need to check anything used in binutils/ not in C99.
199 AC_CHECK_HEADERS(fcntl.h inttypes.h stdint.h sys/file.h \
200 sys/stat.h sys/time.h sys/types.h unistd.h)
203 AC_CHECK_FUNCS(fseeko fseeko64 getc_unlocked mkdtemp mkstemp utimensat utimes)
205 AC_MSG_CHECKING([for mbstate_t])
206 AC_TRY_COMPILE([#include <wchar.h>],
207 [mbstate_t teststate;],
208 have_mbstate_t=yes, have_mbstate_t=no)
209 AC_MSG_RESULT($have_mbstate_t)
210 if test x"$have_mbstate_t" = xyes; then
211 AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
214 # Copied from gnulib stat-time.m4.
215 # We should just switch over to using gnulib.
216 AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec],
217 [AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec],
218 [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec],
219 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
221 #include <sys/types.h>
222 #include <sys/stat.h>
224 # include <sys/time.h>
233 [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes],
234 [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])])
235 if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then
236 AC_DEFINE([TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC], [1],
237 [Define to 1 if the type of the st_atim member of a struct stat is
240 [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [],
241 [AC_CHECK_MEMBERS([struct stat.st_atimensec], [],
242 [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], [],
243 [#include <sys/types.h>
244 #include <sys/stat.h>])],
245 [#include <sys/types.h>
246 #include <sys/stat.h>])],
247 [#include <sys/types.h>
248 #include <sys/stat.h>])],
249 [#include <sys/types.h>
250 #include <sys/stat.h>])
252 # Some systems have frexp only in -lm, not in -lc.
253 AC_SEARCH_LIBS(frexp, m)
257 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
258 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
259 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
260 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
261 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
262 if test $bu_cv_decl_getopt_unistd_h = yes; then
263 AC_DEFINE([HAVE_DECL_GETOPT], 1,
264 [Is the prototype for getopt in <unistd.h> in the expected format?])
267 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
269 AC_MSG_CHECKING([for utime.h])
270 AC_CACHE_VAL(bu_cv_header_utime_h,
271 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
276 [struct utimbuf s;])],
277 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
278 AC_MSG_RESULT($bu_cv_header_utime_h)
279 if test $bu_cv_header_utime_h = yes; then
280 AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
283 AC_CHECK_DECLS([asprintf, environ, getc_unlocked, stpcpy, strnlen])
285 # Link in zlib/zstd if we can. This allows us to read compressed debug
286 # sections. This is used only by readelf.c (objdump uses bfd for
287 # reading compressed sections).
293 # Support for the msgpack C library.
294 AC_ARG_WITH([msgpack],
295 AC_HELP_STRING([--with-msgpack], [Enable msgpack support (auto/yes/no)]),
299 AS_IF([test "$with_msgpack" != no],
300 [PKG_CHECK_MODULES(MSGPACK, msgpack,
301 [AC_DEFINE([HAVE_MSGPACK], [1], [Define to 1 if msgpack is available.])],
302 [AS_IF([test "$with_msgpack" = yes],
303 [AC_MSG_ERROR([--with-msgpack was given, but msgpack is missing or unusable.])])])])
305 # target-specific stuff:
307 # Canonicalize the secondary target names.
308 if test -n "$enable_targets"; then
309 for targ in `echo $enable_targets | sed 's/,/ /g'`
311 result=`$ac_config_sub $targ 2>/dev/null`
312 if test -n "$result"; then
313 canon_targets="$canon_targets $result"
315 # Allow targets that config.sub doesn't recognize, like "all".
316 canon_targets="$canon_targets $targ"
321 AC_CHECK_HEADER(iconv.h)
334 OBJDUMP_PRIVATE_VECTORS=
335 OBJDUMP_PRIVATE_OFILES=
338 for targ in $target $canon_targets
342 BUILD_SRCONV='$(SRCONV_PROG)'
348 BUILD_MISC='bin2c$(EXEEXT_FOR_BUILD)'
353 powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*)
354 BUILD_INSTALL_MISC=embedspu
360 OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
367 OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
373 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
374 if test -z "$DLLTOOL_DEFAULT"; then
375 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_AARCH64"
377 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_AARCH64"
378 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
379 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
380 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
382 arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*)
383 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
384 if test -z "$DLLTOOL_DEFAULT"; then
385 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE"
387 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
388 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
389 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
392 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
393 if test -z "$DLLTOOL_DEFAULT"; then
394 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
396 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
397 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
398 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
401 i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | all)
403 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
404 if test -z "$DLLTOOL_DEFAULT"; then
405 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
407 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
408 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
409 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
410 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
415 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
416 if test -z "$DLLTOOL_DEFAULT"; then
417 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
419 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
422 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
423 if test -z "$DLLTOOL_DEFAULT"; then
424 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
426 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
427 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
428 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
431 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
432 if test -z "$DLLTOOL_DEFAULT"; then
433 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
435 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
438 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
439 if test -z "$DLLTOOL_DEFAULT"; then
440 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
442 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
443 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
444 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
446 x86_64-*-mingw* | x86_64-*-cygwin*)
447 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
448 if test -z "$DLLTOOL_DEFAULT"; then
449 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
451 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
452 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
453 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
454 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
458 # Add objdump private vectors.
461 od_vectors="objdump_private_desc_elf32_avr objdump_private_desc_xcoff\
462 objdump_private_desc_pe objdump_private_desc_mach_o"
465 od_vectors="$od_vectors objdump_private_desc_elf32_avr"
467 powerpc*-*-aix* | rs6000-*-aix*)
468 od_vectors="$od_vectors objdump_private_desc_xcoff"
470 *-*-pe* | *-*-cygwin* | *-*-mingw*)
471 od_vectors="$od_vectors objdump_private_desc_pe"
474 od_vectors="$od_vectors objdump_private_desc_mach_o"
479 # Uniq objdump private vector, build objdump target ofiles.
482 for i in $od_vectors ; do
487 OBJDUMP_PRIVATE_VECTORS="$OBJDUMP_PRIVATE_VECTORS &$i,"
489 objdump_private_desc_elf32_avr)
490 od_files="$od_files od-elf32_avr" ;;
491 objdump_private_desc_xcoff)
492 od_files="$od_files od-xcoff" ;;
493 objdump_private_desc_pe)
494 od_files="$od_files od-pe" ;;
495 objdump_private_desc_mach_o)
496 od_files="$od_files od-macho" ;;
497 *) AC_MSG_ERROR(*** unknown private vector $i) ;;
503 # Uniq objdump target ofiles
505 for i in $od_files ; do
510 OBJDUMP_PRIVATE_OFILES="$OBJDUMP_PRIVATE_OFILES $i.$objext"
515 DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
517 if test "${with_windres+set}" = set; then
518 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
521 if test "${with_windmc+set}" = set; then
522 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
525 OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECTORS}\""
527 AC_SUBST(BUILD_SRCONV)
528 AC_SUBST(BUILD_DLLTOOL)
529 AC_SUBST(DLLTOOL_DEFS)
530 AC_SUBST(BUILD_WINDRES)
531 AC_SUBST(BUILD_WINDMC)
532 AC_SUBST(BUILD_DLLWRAP)
534 AC_SUBST(BUILD_INSTALL_MISC)
535 AC_SUBST(OBJDUMP_DEFS)
536 AC_SUBST(OBJDUMP_PRIVATE_OFILES)
538 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
541 . $srcdir/../bfd/config.bfd
542 if test "x$targ_underscore" = "xyes"; then
547 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
548 [Define to 1 if user symbol names have a leading underscore, 0 if not.])
552 . ${srcdir}/configure.tgt
554 EMULATION_VECTOR=$targ_emul_vector
557 AC_SUBST(EMULATION_VECTOR)
559 # Required for html and install-html
560 AC_SUBST(datarootdir)
565 AC_CONFIG_FILES(Makefile po/Makefile.in:po/Make-in)