1 dnl Process this file with autoconf to produce a configure script.
3 dnl Copyright (C) 2012-2017 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/>.
21 m4_include([../bfd/version.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])
67 AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all,
68 [Should strings use -a behavior by default?])
72 AC_CONFIG_HEADERS(config.h:config.in)
74 AH_VERBATIM([00_CONFIG_H_CHECK],
75 [/* Check that config.h is #included before system headers
76 (this works only for glibc, but that should be enough). */
77 #if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
78 # error config.h must be #included before system headers
80 #define __CONFIG_H__ 1])
82 if test -z "$target" ; then
83 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
85 if test -z "$host" ; then
86 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
92 ALL_LINGUAS="bg da es fi fr id it ja ro ru rw sk sv tr uk vi zh_CN zh_TW hr ca"
93 ZW_GNU_GETTEXT_SISTER_DIR
97 AM_CONDITIONAL(GENINSRC_NEVER, false)
99 if test -n "$EXEEXT"; then
100 AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
101 [Does the platform use an executable suffix?])
103 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
104 [Suffix used for executables, if any.])
106 # host-specific stuff:
110 . ${srcdir}/../bfd/configure.host
120 DEMANGLER_NAME=c++filt
122 *-*-go32* | *-*-msdos*)
123 DEMANGLER_NAME=cxxfilt
125 AC_SUBST(DEMANGLER_NAME)
127 AC_CHECK_SIZEOF([long])
128 AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
130 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)
134 AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll setlocale)
135 AC_CHECK_FUNC([mkstemp],
136 AC_DEFINE([HAVE_MKSTEMP], 1,
137 [Define to 1 if you have the `mkstemp' function.]))
138 AC_CHECK_FUNC([mkdtemp],
139 AC_DEFINE([HAVE_MKDTEMP], 1,
140 [Define to 1 if you have the `mkdtemp' function.]))
141 AC_MSG_CHECKING([for mbstate_t])
142 AC_TRY_COMPILE([#include <wchar.h>],
143 [mbstate_t teststate;],
144 have_mbstate_t=yes, have_mbstate_t=no)
145 AC_MSG_RESULT($have_mbstate_t)
146 if test x"$have_mbstate_t" = xyes; then
147 AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
150 # Some systems have frexp only in -lm, not in -lc.
151 AC_SEARCH_LIBS(frexp, m)
155 AC_MSG_CHECKING(for time_t in time.h)
156 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
157 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [time_t i;])],
158 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
159 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
160 if test $bu_cv_decl_time_t_time_h = yes; then
161 AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
162 [Is the type time_t defined in <time.h>?])
165 AC_MSG_CHECKING(for time_t in sys/types.h)
166 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
167 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>], [time_t i;])],
168 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
169 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
170 if test $bu_cv_decl_time_t_types_h = yes; then
171 AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
172 [Is the type time_t defined in <sys/types.h>?])
175 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
176 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
177 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
178 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
179 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
180 if test $bu_cv_decl_getopt_unistd_h = yes; then
181 AC_DEFINE([HAVE_DECL_GETOPT], 1,
182 [Is the prototype for getopt in <unistd.h> in the expected format?])
185 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
187 AC_MSG_CHECKING([for utime.h])
188 AC_CACHE_VAL(bu_cv_header_utime_h,
189 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
194 [struct utimbuf s;])],
195 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
196 AC_MSG_RESULT($bu_cv_header_utime_h)
197 if test $bu_cv_header_utime_h = yes; then
198 AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
201 AC_CHECK_DECLS([asprintf, environ, fprintf, getc_unlocked, getenv,
202 sbrk, snprintf, stpcpy, strnlen, strstr, vsnprintf])
204 # Link in zlib if we can. This allows us to read compressed debug
205 # sections. This is used only by readelf.c (objdump uses bfd for
206 # reading compressed sections).
211 # target-specific stuff:
213 # Canonicalize the secondary target names.
214 if test -n "$enable_targets"; then
215 for targ in `echo $enable_targets | sed 's/,/ /g'`
217 result=`$ac_config_sub $targ 2>/dev/null`
218 if test -n "$result"; then
219 canon_targets="$canon_targets $result"
221 # Allow targets that config.sub doesn't recognize, like "all".
222 canon_targets="$canon_targets $targ"
227 AC_CHECK_HEADER(iconv.h)
243 OBJDUMP_PRIVATE_VECTORS=
244 OBJDUMP_PRIVATE_OFILES=
247 for targ in $target $canon_targets
249 if test "x$targ" = "xall"; then
251 BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
252 BUILD_SRCONV='$(SRCONV_PROG)'
253 NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
254 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
255 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
256 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
257 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
258 if test -z "$DLLTOOL_DEFAULT"; then
259 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
261 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
262 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
263 od_vectors="$od_vectors objdump_private_desc_xcoff"
267 i[3-7]86*-*-netware*)
269 BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
270 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
273 BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
274 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
277 BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
278 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
281 BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
282 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
287 *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
292 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
293 if test -z "$DLLTOOL_DEFAULT"; then
294 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_EPOC"
296 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM"
297 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
298 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
300 arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*)
301 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
302 if test -z "$DLLTOOL_DEFAULT"; then
303 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE"
305 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
306 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
307 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
310 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
311 if test -z "$DLLTOOL_DEFAULT"; then
312 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
314 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
315 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
316 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
318 x86_64-*-mingw* | x86_64-*-cygwin*)
319 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
320 if test -z "$DLLTOOL_DEFAULT"; then
321 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
323 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
324 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
325 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
326 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
329 i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
331 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
332 if test -z "$DLLTOOL_DEFAULT"; then
333 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
335 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
336 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
337 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
338 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
343 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
344 if test -z "$DLLTOOL_DEFAULT"; then
345 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
347 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
356 OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
358 powerpc*-*-pe* | powerpc*-*-cygwin*)
359 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
360 if test -z "$DLLTOOL_DEFAULT"; then
361 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_PPC"
363 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
364 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
365 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
367 powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*)
368 case "$BUILD_INSTALL_MISC" in
370 *) BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu"
374 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
375 if test -z "$DLLTOOL_DEFAULT"; then
376 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
378 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
379 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
380 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
383 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
386 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
387 if test -z "$DLLTOOL_DEFAULT"; then
388 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MIPS"
390 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
391 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
392 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
395 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
396 if test -z "$DLLTOOL_DEFAULT"; then
397 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
399 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
400 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
401 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
404 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
405 if test -z "$DLLTOOL_DEFAULT"; then
406 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
408 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
411 OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
415 # Add objdump private vectors.
418 od_vectors="$od_vectors objdump_private_desc_elf32_avr"
421 od_vectors="$od_vectors objdump_private_desc_xcoff"
424 od_vectors="$od_vectors objdump_private_desc_mach_o"
430 # Uniq objdump private vector, build objdump target ofiles.
433 for i in $od_vectors ; do
438 OBJDUMP_PRIVATE_VECTORS="$OBJDUMP_PRIVATE_VECTORS &$i,"
440 objdump_private_desc_elf32_avr)
441 od_files="$od_files od-elf32_avr" ;;
442 objdump_private_desc_xcoff)
443 od_files="$od_files od-xcoff" ;;
444 objdump_private_desc_mach_o)
445 od_files="$od_files od-macho" ;;
446 *) AC_MSG_ERROR(*** unknown private vector $i) ;;
452 # Uniq objdump target ofiles
454 for i in $od_files ; do
459 OBJDUMP_PRIVATE_OFILES="$OBJDUMP_PRIVATE_OFILES $i.$objext"
464 DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
466 if test "${with_windres+set}" = set; then
467 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
470 if test "${with_windmc+set}" = set; then
471 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
474 OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECTORS}\""
476 AC_SUBST(NLMCONV_DEFS)
477 AC_SUBST(BUILD_NLMCONV)
478 AC_SUBST(BUILD_SRCONV)
479 AC_SUBST(BUILD_DLLTOOL)
480 AC_SUBST(DLLTOOL_DEFS)
481 AC_SUBST(BUILD_WINDRES)
482 AC_SUBST(BUILD_WINDMC)
483 AC_SUBST(BUILD_DLLWRAP)
485 AC_SUBST(BUILD_INSTALL_MISC)
486 AC_SUBST(OBJDUMP_DEFS)
487 AC_SUBST(OBJDUMP_PRIVATE_OFILES)
489 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
492 . $srcdir/../bfd/config.bfd
493 if test "x$targ_underscore" = "xyes"; then
498 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
499 [Define to 1 if user symbol names have a leading underscore, 0 if not.])
503 . ${srcdir}/configure.tgt
505 EMULATION_VECTOR=$targ_emul_vector
508 AC_SUBST(EMULATION_VECTOR)
510 # Required for html and install-html
511 AC_SUBST(datarootdir)
516 AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)