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 ;;
47 AC_ARG_ENABLE(deterministic-archives,
48 [AS_HELP_STRING([--enable-deterministic-archives],
49 [ar and ranlib default to -D behavior])], [
50 if test "${enableval}" = no; then
51 default_ar_deterministic=0
53 default_ar_deterministic=1
54 fi], [default_ar_deterministic=0])
56 AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic,
57 [Should ar and ranlib use -D behavior by default?])
60 AC_ARG_ENABLE(default-strings-all,
61 [AS_HELP_STRING([--disable-default-strings-all],
62 [strings defaults to --data behavior])], [
63 if test "${enableval}" = no; then
67 fi], [default_strings_all=1])
69 AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all,
70 [Should strings use -a behavior by default?])
73 AC_ARG_ENABLE(f-for-ifunc-symbols,
74 [AS_HELP_STRING([--enable-f-for-ifunc-symbols],
75 [Have nm use F and f for global and local ifunc symbols])], [
76 if test "${enableval}" = no; then
80 fi], [default_f_for_ifunc=0])
82 AC_DEFINE_UNQUOTED(DEFAULT_F_FOR_IFUNC_SYMBOLS, $default_f_for_ifunc,
83 [Have nm use F and f for global and local ifunc symbols])
87 GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections])
88 if test "${enable_libctf}" = yes; then
89 AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections])
91 AM_CONDITIONAL(ENABLE_LIBCTF, test "${enable_libctf}" = yes)
95 AC_CONFIG_HEADERS(config.h:config.in)
97 AH_VERBATIM([00_CONFIG_H_CHECK],
98 [/* Check that config.h is #included before system headers
99 (this works only for glibc, but that should be enough). */
100 #if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
101 # error config.h must be #included before system headers
103 #define __CONFIG_H__ 1])
105 if test -z "$target" ; then
106 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
108 if test -z "$host" ; then
109 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
115 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"
116 ZW_GNU_GETTEXT_SISTER_DIR
120 AM_CONDITIONAL(GENINSRC_NEVER, false)
122 if test -n "$EXEEXT"; then
123 AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
124 [Does the platform use an executable suffix?])
126 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
127 [Suffix used for executables, if any.])
129 # host-specific stuff:
133 . ${srcdir}/../bfd/configure.host
143 DEMANGLER_NAME=c++filt
145 *-*-go32* | *-*-msdos*)
146 DEMANGLER_NAME=cxxfilt
148 AC_SUBST(DEMANGLER_NAME)
150 AC_CHECK_SIZEOF([long])
151 AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
153 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)
158 AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll setlocale)
159 AC_CHECK_FUNC([mkstemp],
160 AC_DEFINE([HAVE_MKSTEMP], 1,
161 [Define to 1 if you have the `mkstemp' function.]))
162 AC_CHECK_FUNC([mkdtemp],
163 AC_DEFINE([HAVE_MKDTEMP], 1,
164 [Define to 1 if you have the `mkdtemp' function.]))
165 AC_MSG_CHECKING([for mbstate_t])
166 AC_TRY_COMPILE([#include <wchar.h>],
167 [mbstate_t teststate;],
168 have_mbstate_t=yes, have_mbstate_t=no)
169 AC_MSG_RESULT($have_mbstate_t)
170 if test x"$have_mbstate_t" = xyes; then
171 AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
174 # Some systems have frexp only in -lm, not in -lc.
175 AC_SEARCH_LIBS(frexp, m)
179 AC_MSG_CHECKING(for time_t in time.h)
180 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
181 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [time_t i;])],
182 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
183 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
184 if test $bu_cv_decl_time_t_time_h = yes; then
185 AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
186 [Is the type time_t defined in <time.h>?])
189 AC_MSG_CHECKING(for time_t in sys/types.h)
190 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
191 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>], [time_t i;])],
192 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
193 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
194 if test $bu_cv_decl_time_t_types_h = yes; then
195 AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
196 [Is the type time_t defined in <sys/types.h>?])
199 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
200 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
201 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
202 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
203 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
204 if test $bu_cv_decl_getopt_unistd_h = yes; then
205 AC_DEFINE([HAVE_DECL_GETOPT], 1,
206 [Is the prototype for getopt in <unistd.h> in the expected format?])
209 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
211 AC_MSG_CHECKING([for utime.h])
212 AC_CACHE_VAL(bu_cv_header_utime_h,
213 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
218 [struct utimbuf s;])],
219 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
220 AC_MSG_RESULT($bu_cv_header_utime_h)
221 if test $bu_cv_header_utime_h = yes; then
222 AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
225 AC_CHECK_DECLS([asprintf, environ, fprintf, getc_unlocked, getenv,
226 sbrk, snprintf, stpcpy, strnlen, strstr, vsnprintf])
228 # Link in zlib if we can. This allows us to read compressed debug
229 # sections. This is used only by readelf.c (objdump uses bfd for
230 # reading compressed sections).
235 # target-specific stuff:
237 # Canonicalize the secondary target names.
238 if test -n "$enable_targets"; then
239 for targ in `echo $enable_targets | sed 's/,/ /g'`
241 result=`$ac_config_sub $targ 2>/dev/null`
242 if test -n "$result"; then
243 canon_targets="$canon_targets $result"
245 # Allow targets that config.sub doesn't recognize, like "all".
246 canon_targets="$canon_targets $targ"
251 AC_CHECK_HEADER(iconv.h)
265 OBJDUMP_PRIVATE_VECTORS=
266 OBJDUMP_PRIVATE_OFILES=
269 for targ in $target $canon_targets
271 if test "x$targ" = "xall"; then
273 BUILD_SRCONV='$(SRCONV_PROG)'
274 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
275 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
276 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
277 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
278 if test -z "$DLLTOOL_DEFAULT"; then
279 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
281 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
282 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
283 od_vectors="$od_vectors objdump_private_desc_xcoff"
286 *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
290 arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*)
291 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
292 if test -z "$DLLTOOL_DEFAULT"; then
293 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE"
295 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
296 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
297 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
300 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
301 if test -z "$DLLTOOL_DEFAULT"; then
302 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
304 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
305 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
306 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
308 x86_64-*-mingw* | x86_64-*-cygwin*)
309 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
310 if test -z "$DLLTOOL_DEFAULT"; then
311 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
313 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
314 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
315 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
316 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
319 i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
321 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
322 if test -z "$DLLTOOL_DEFAULT"; then
323 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
325 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
326 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
327 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
328 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
333 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
334 if test -z "$DLLTOOL_DEFAULT"; then
335 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
337 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
346 OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
348 powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*)
349 case "$BUILD_INSTALL_MISC" in
351 *) BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu"
355 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
356 if test -z "$DLLTOOL_DEFAULT"; then
357 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
359 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
360 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
361 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
364 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
367 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
368 if test -z "$DLLTOOL_DEFAULT"; then
369 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MIPS"
371 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
372 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
373 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
376 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
377 if test -z "$DLLTOOL_DEFAULT"; then
378 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
380 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
381 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
382 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
385 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
386 if test -z "$DLLTOOL_DEFAULT"; then
387 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
389 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
392 OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
396 # Add objdump private vectors.
399 od_vectors="$od_vectors objdump_private_desc_elf32_avr"
401 powerpc*-*-aix* | rs6000-*-aix*)
402 od_vectors="$od_vectors objdump_private_desc_xcoff"
405 od_vectors="$od_vectors objdump_private_desc_mach_o"
411 # Uniq objdump private vector, build objdump target ofiles.
414 for i in $od_vectors ; do
419 OBJDUMP_PRIVATE_VECTORS="$OBJDUMP_PRIVATE_VECTORS &$i,"
421 objdump_private_desc_elf32_avr)
422 od_files="$od_files od-elf32_avr" ;;
423 objdump_private_desc_xcoff)
424 od_files="$od_files od-xcoff" ;;
425 objdump_private_desc_mach_o)
426 od_files="$od_files od-macho" ;;
427 *) AC_MSG_ERROR(*** unknown private vector $i) ;;
433 # Uniq objdump target ofiles
435 for i in $od_files ; do
440 OBJDUMP_PRIVATE_OFILES="$OBJDUMP_PRIVATE_OFILES $i.$objext"
445 DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
447 if test "${with_windres+set}" = set; then
448 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
451 if test "${with_windmc+set}" = set; then
452 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
455 OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECTORS}\""
457 AC_SUBST(BUILD_SRCONV)
458 AC_SUBST(BUILD_DLLTOOL)
459 AC_SUBST(DLLTOOL_DEFS)
460 AC_SUBST(BUILD_WINDRES)
461 AC_SUBST(BUILD_WINDMC)
462 AC_SUBST(BUILD_DLLWRAP)
464 AC_SUBST(BUILD_INSTALL_MISC)
465 AC_SUBST(OBJDUMP_DEFS)
466 AC_SUBST(OBJDUMP_PRIVATE_OFILES)
468 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
471 . $srcdir/../bfd/config.bfd
472 if test "x$targ_underscore" = "xyes"; then
477 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
478 [Define to 1 if user symbol names have a leading underscore, 0 if not.])
482 . ${srcdir}/configure.tgt
484 EMULATION_VECTOR=$targ_emul_vector
487 AC_SUBST(EMULATION_VECTOR)
489 # Required for html and install-html
490 AC_SUBST(datarootdir)
495 AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)