1 dnl Process this file with autoconf to produce a configure script.
3 dnl Copyright (C) 2012-2018 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 AC_INIT([binutils], BFD_VERSION)
22 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 ;;
45 AC_ARG_ENABLE(deterministic-archives,
46 [AS_HELP_STRING([--enable-deterministic-archives],
47 [ar and ranlib default to -D behavior])], [
48 if test "${enableval}" = no; then
49 default_ar_deterministic=0
51 default_ar_deterministic=1
52 fi], [default_ar_deterministic=0])
54 AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic,
55 [Should ar and ranlib use -D behavior by default?])
57 AC_ARG_ENABLE(default-strings-all,
58 [AS_HELP_STRING([--disable-default-strings-all],
59 [strings defaults to --data behavior])], [
60 if test "${enableval}" = no; then
64 fi], [default_strings_all=1])
66 AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all,
67 [Should strings use -a behavior by default?])
71 AC_CONFIG_HEADERS(config.h:config.in)
73 AH_VERBATIM([00_CONFIG_H_CHECK],
74 [/* Check that config.h is #included before system headers
75 (this works only for glibc, but that should be enough). */
76 #if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
77 # error config.h must be #included before system headers
79 #define __CONFIG_H__ 1])
81 if test -z "$target" ; then
82 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
84 if test -z "$host" ; then
85 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
91 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"
92 ZW_GNU_GETTEXT_SISTER_DIR
96 AM_CONDITIONAL(GENINSRC_NEVER, false)
98 if test -n "$EXEEXT"; then
99 AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
100 [Does the platform use an executable suffix?])
102 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
103 [Suffix used for executables, if any.])
105 # host-specific stuff:
109 . ${srcdir}/../bfd/configure.host
119 DEMANGLER_NAME=c++filt
121 *-*-go32* | *-*-msdos*)
122 DEMANGLER_NAME=cxxfilt
124 AC_SUBST(DEMANGLER_NAME)
126 AC_CHECK_SIZEOF([long])
127 AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
129 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)
133 AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll setlocale)
134 AC_CHECK_FUNC([mkstemp],
135 AC_DEFINE([HAVE_MKSTEMP], 1,
136 [Define to 1 if you have the `mkstemp' function.]))
137 AC_CHECK_FUNC([mkdtemp],
138 AC_DEFINE([HAVE_MKDTEMP], 1,
139 [Define to 1 if you have the `mkdtemp' function.]))
140 AC_MSG_CHECKING([for mbstate_t])
141 AC_TRY_COMPILE([#include <wchar.h>],
142 [mbstate_t teststate;],
143 have_mbstate_t=yes, have_mbstate_t=no)
144 AC_MSG_RESULT($have_mbstate_t)
145 if test x"$have_mbstate_t" = xyes; then
146 AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
149 # Some systems have frexp only in -lm, not in -lc.
150 AC_SEARCH_LIBS(frexp, m)
154 AC_MSG_CHECKING(for time_t in time.h)
155 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
156 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [time_t i;])],
157 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
158 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
159 if test $bu_cv_decl_time_t_time_h = yes; then
160 AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
161 [Is the type time_t defined in <time.h>?])
164 AC_MSG_CHECKING(for time_t in sys/types.h)
165 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
166 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>], [time_t i;])],
167 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
168 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
169 if test $bu_cv_decl_time_t_types_h = yes; then
170 AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
171 [Is the type time_t defined in <sys/types.h>?])
174 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
175 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
176 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
177 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
178 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
179 if test $bu_cv_decl_getopt_unistd_h = yes; then
180 AC_DEFINE([HAVE_DECL_GETOPT], 1,
181 [Is the prototype for getopt in <unistd.h> in the expected format?])
184 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
186 AC_MSG_CHECKING([for utime.h])
187 AC_CACHE_VAL(bu_cv_header_utime_h,
188 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
193 [struct utimbuf s;])],
194 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
195 AC_MSG_RESULT($bu_cv_header_utime_h)
196 if test $bu_cv_header_utime_h = yes; then
197 AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
200 AC_CHECK_DECLS([asprintf, environ, fprintf, getc_unlocked, getenv,
201 sbrk, snprintf, stpcpy, strnlen, strstr, vsnprintf])
203 # Link in zlib if we can. This allows us to read compressed debug
204 # sections. This is used only by readelf.c (objdump uses bfd for
205 # reading compressed sections).
210 # target-specific stuff:
212 # Canonicalize the secondary target names.
213 if test -n "$enable_targets"; then
214 for targ in `echo $enable_targets | sed 's/,/ /g'`
216 result=`$ac_config_sub $targ 2>/dev/null`
217 if test -n "$result"; then
218 canon_targets="$canon_targets $result"
220 # Allow targets that config.sub doesn't recognize, like "all".
221 canon_targets="$canon_targets $targ"
226 AC_CHECK_HEADER(iconv.h)
240 OBJDUMP_PRIVATE_VECTORS=
241 OBJDUMP_PRIVATE_OFILES=
244 for targ in $target $canon_targets
246 if test "x$targ" = "xall"; then
248 BUILD_SRCONV='$(SRCONV_PROG)'
249 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
250 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
251 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
252 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
253 if test -z "$DLLTOOL_DEFAULT"; then
254 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
256 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
257 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
258 od_vectors="$od_vectors objdump_private_desc_xcoff"
261 *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
265 arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*)
266 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
267 if test -z "$DLLTOOL_DEFAULT"; then
268 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE"
270 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
271 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
272 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
275 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
276 if test -z "$DLLTOOL_DEFAULT"; then
277 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
279 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
280 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
281 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
283 x86_64-*-mingw* | x86_64-*-cygwin*)
284 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
285 if test -z "$DLLTOOL_DEFAULT"; then
286 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
288 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
289 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
290 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
291 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
294 i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
296 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
297 if test -z "$DLLTOOL_DEFAULT"; then
298 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
300 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
301 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
302 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
303 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
308 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
309 if test -z "$DLLTOOL_DEFAULT"; then
310 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
312 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
321 OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
323 powerpc*-*-pe* | powerpc*-*-cygwin*)
324 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
325 if test -z "$DLLTOOL_DEFAULT"; then
326 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_PPC"
328 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
329 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
330 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
332 powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*)
333 case "$BUILD_INSTALL_MISC" in
335 *) BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu"
339 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
340 if test -z "$DLLTOOL_DEFAULT"; then
341 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
343 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
344 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
345 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
348 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
351 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
352 if test -z "$DLLTOOL_DEFAULT"; then
353 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MIPS"
355 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
356 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
357 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
360 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
361 if test -z "$DLLTOOL_DEFAULT"; then
362 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
364 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
365 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
366 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
369 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
370 if test -z "$DLLTOOL_DEFAULT"; then
371 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
373 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
376 OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
380 # Add objdump private vectors.
383 od_vectors="$od_vectors objdump_private_desc_elf32_avr"
385 powerpc*-*-aix* | rs6000-*-aix*)
386 od_vectors="$od_vectors objdump_private_desc_xcoff"
389 od_vectors="$od_vectors objdump_private_desc_mach_o"
395 # Uniq objdump private vector, build objdump target ofiles.
398 for i in $od_vectors ; do
403 OBJDUMP_PRIVATE_VECTORS="$OBJDUMP_PRIVATE_VECTORS &$i,"
405 objdump_private_desc_elf32_avr)
406 od_files="$od_files od-elf32_avr" ;;
407 objdump_private_desc_xcoff)
408 od_files="$od_files od-xcoff" ;;
409 objdump_private_desc_mach_o)
410 od_files="$od_files od-macho" ;;
411 *) AC_MSG_ERROR(*** unknown private vector $i) ;;
417 # Uniq objdump target ofiles
419 for i in $od_files ; do
424 OBJDUMP_PRIVATE_OFILES="$OBJDUMP_PRIVATE_OFILES $i.$objext"
429 DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
431 if test "${with_windres+set}" = set; then
432 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
435 if test "${with_windmc+set}" = set; then
436 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
439 OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECTORS}\""
441 AC_SUBST(BUILD_SRCONV)
442 AC_SUBST(BUILD_DLLTOOL)
443 AC_SUBST(DLLTOOL_DEFS)
444 AC_SUBST(BUILD_WINDRES)
445 AC_SUBST(BUILD_WINDMC)
446 AC_SUBST(BUILD_DLLWRAP)
448 AC_SUBST(BUILD_INSTALL_MISC)
449 AC_SUBST(OBJDUMP_DEFS)
450 AC_SUBST(OBJDUMP_PRIVATE_OFILES)
452 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
455 . $srcdir/../bfd/config.bfd
456 if test "x$targ_underscore" = "xyes"; then
461 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
462 [Define to 1 if user symbol names have a leading underscore, 0 if not.])
466 . ${srcdir}/configure.tgt
468 EMULATION_VECTOR=$targ_emul_vector
471 AC_SUBST(EMULATION_VECTOR)
473 # Required for html and install-html
474 AC_SUBST(datarootdir)
479 AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)