]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - binutils/configure.ac
PR27716, build failure for msdosdjgpp: PATH_MAX undeclared
[thirdparty/binutils-gdb.git] / binutils / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 dnl Copyright (C) 2012-2021 Free Software Foundation, Inc.
4 dnl
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.
9 dnl
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.
14 dnl
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/>.
18 dnl
19
20 m4_include([../bfd/version.m4])
21 m4_include([../config/debuginfod.m4])
22 AC_INIT([binutils], BFD_VERSION)
23 AC_CONFIG_SRCDIR(ar.c)
24
25 AC_CANONICAL_TARGET
26
27 AM_INIT_AUTOMAKE
28
29 AC_PROG_CC
30 AC_GNU_SOURCE
31 AC_USE_SYSTEM_EXTENSIONS
32
33 LT_INIT
34 ACX_LARGEFILE
35
36 ac_checking=
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= ;;
43 *) ac_checking=yes ;;
44 esac])dnl
45 if test x$ac_checking != x ; then
46 AC_DEFINE(ENABLE_CHECKING, 1, [Define if you want run-time sanity checks.])
47 fi
48
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')
53 ;;
54 no) enable_targets= ;;
55 *) enable_targets=$enableval ;;
56 esac])dnl
57
58
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
64 else
65 default_ar_deterministic=1
66 fi], [default_ar_deterministic=0])
67
68 AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic,
69 [Should ar and ranlib use -D behavior by default?])
70
71
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
76 default_strings_all=0
77 else
78 default_strings_all=1
79 fi], [default_strings_all=1])
80
81 AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all,
82 [Should strings use -a behavior by default?])
83
84
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
89 default_f_for_ifunc=0
90 else
91 default_f_for_ifunc=1
92 fi], [default_f_for_ifunc=0])
93
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])
96
97
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
103 else
104 default_for_follow_links=1
105 fi], [default_for_follow_links=1])
106
107 AC_DEFINE_UNQUOTED(DEFAULT_FOR_FOLLOW_LINKS, $default_for_follow_links,
108 [Have readelf and objdump follow debug links by default])
109
110
111 AC_DEBUGINFOD
112
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])
116 fi
117 AM_CONDITIONAL(ENABLE_LIBCTF, test "${enable_libctf}" = yes)
118
119 AM_BINUTILS_WARNINGS
120
121 AC_CONFIG_HEADERS(config.h:config.in)
122
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
128 #endif
129 #define __CONFIG_H__ 1])
130
131 if test -z "$target" ; then
132 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
133 fi
134 if test -z "$host" ; then
135 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
136 fi
137
138 AC_PROG_YACC
139 AM_PROG_LEX
140
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
143 AM_PO_SUBDIRS
144
145 AM_MAINTAINER_MODE
146 AM_CONDITIONAL(GENINSRC_NEVER, false)
147 AC_EXEEXT
148 if test -n "$EXEEXT"; then
149 AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
150 [Does the platform use an executable suffix?])
151 fi
152 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
153 [Suffix used for executables, if any.])
154
155 # host-specific stuff:
156
157 HDEFINES=
158
159 . ${srcdir}/../bfd/configure.host
160
161 AC_SUBST(HDEFINES)
162 AR=${AR-ar}
163 AC_SUBST(AR)
164 AC_PROG_RANLIB
165 AC_PROG_INSTALL
166
167 BFD_CC_FOR_BUILD
168
169 DEMANGLER_NAME=c++filt
170 case "${host}" in
171 *-*-go32* | *-*-msdos*)
172 DEMANGLER_NAME=cxxfilt
173 esac
174 AC_SUBST(DEMANGLER_NAME)
175
176 AC_CHECK_SIZEOF([long])
177 AC_CHECK_SIZEOF([long long])
178
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/types.h unistd.h)
186 AC_HEADER_SYS_WAIT
187 AC_FUNC_MMAP
188 AC_CHECK_FUNCS(getc_unlocked sbrk utimes)
189 AC_CHECK_FUNC([mkstemp],
190 AC_DEFINE([HAVE_MKSTEMP], 1,
191 [Define to 1 if you have the `mkstemp' function.]))
192 AC_CHECK_FUNC([mkdtemp],
193 AC_DEFINE([HAVE_MKDTEMP], 1,
194 [Define to 1 if you have the `mkdtemp' function.]))
195 AC_MSG_CHECKING([for mbstate_t])
196 AC_TRY_COMPILE([#include <wchar.h>],
197 [mbstate_t teststate;],
198 have_mbstate_t=yes, have_mbstate_t=no)
199 AC_MSG_RESULT($have_mbstate_t)
200 if test x"$have_mbstate_t" = xyes; then
201 AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
202 fi
203
204 # Some systems have frexp only in -lm, not in -lc.
205 AC_SEARCH_LIBS(frexp, m)
206
207 AM_LC_MESSAGES
208
209 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
210 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
211 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
212 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
213 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
214 if test $bu_cv_decl_getopt_unistd_h = yes; then
215 AC_DEFINE([HAVE_DECL_GETOPT], 1,
216 [Is the prototype for getopt in <unistd.h> in the expected format?])
217 fi
218
219 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
220 # by default.
221 AC_MSG_CHECKING([for utime.h])
222 AC_CACHE_VAL(bu_cv_header_utime_h,
223 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
224 #ifdef HAVE_TIME_H
225 #include <time.h>
226 #endif
227 #include <utime.h>],
228 [struct utimbuf s;])],
229 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
230 AC_MSG_RESULT($bu_cv_header_utime_h)
231 if test $bu_cv_header_utime_h = yes; then
232 AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
233 fi
234
235 AC_CHECK_DECLS([asprintf, environ, getc_unlocked, sbrk, stpcpy])
236
237 # Link in zlib if we can. This allows us to read compressed debug
238 # sections. This is used only by readelf.c (objdump uses bfd for
239 # reading compressed sections).
240 AM_ZLIB
241
242 BFD_BINARY_FOPEN
243
244 # target-specific stuff:
245
246 # Canonicalize the secondary target names.
247 if test -n "$enable_targets"; then
248 for targ in `echo $enable_targets | sed 's/,/ /g'`
249 do
250 result=`$ac_config_sub $targ 2>/dev/null`
251 if test -n "$result"; then
252 canon_targets="$canon_targets $result"
253 else
254 # Allow targets that config.sub doesn't recognize, like "all".
255 canon_targets="$canon_targets $targ"
256 fi
257 done
258 fi
259
260 AC_CHECK_HEADER(iconv.h)
261 AM_ICONV
262
263 all_targets=false
264 BUILD_SRCONV=
265 BUILD_DLLTOOL=
266 DLLTOOL_DEFS=
267 DLLTOOL_DEFAULT=
268 BUILD_WINDRES=
269 BUILD_WINDMC=
270 BUILD_DLLWRAP=
271 BUILD_MISC=
272 BUILD_INSTALL_MISC=
273 OBJDUMP_DEFS=
274 OBJDUMP_PRIVATE_VECTORS=
275 OBJDUMP_PRIVATE_OFILES=
276 od_vectors=
277
278 for targ in $target $canon_targets
279 do
280 if test "x$targ" = "xall"; then
281 all_targets=true
282 BUILD_SRCONV='$(SRCONV_PROG)'
283 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
284 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
285 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
286 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
287 if test -z "$DLLTOOL_DEFAULT"; then
288 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
289 fi
290 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
291 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
292 od_vectors="$od_vectors objdump_private_desc_xcoff"
293 else
294 case $targ in
295 *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
296 esac
297
298 case $targ in
299 arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*)
300 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
301 if test -z "$DLLTOOL_DEFAULT"; then
302 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE"
303 fi
304 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
305 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
306 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
307 ;;
308 arm-*-pe*)
309 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
310 if test -z "$DLLTOOL_DEFAULT"; then
311 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
312 fi
313 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
314 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
315 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
316 ;;
317 x86_64-*-mingw* | x86_64-*-cygwin*)
318 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
319 if test -z "$DLLTOOL_DEFAULT"; then
320 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
321 fi
322 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
323 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
324 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
325 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
326 ;;
327 changequote(,)dnl
328 i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
329 changequote([,])dnl
330 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
331 if test -z "$DLLTOOL_DEFAULT"; then
332 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
333 fi
334 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
335 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
336 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
337 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
338 ;;
339 changequote(,)dnl
340 i[3-7]86-*-interix)
341 changequote([,])dnl
342 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
343 if test -z "$DLLTOOL_DEFAULT"; then
344 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
345 fi
346 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
347 ;;
348 changequote(,)dnl
349 powerpc*-aix5.[01])
350 changequote([,])dnl
351 ;;
352 changequote(,)dnl
353 powerpc*-aix[5-9].*)
354 changequote([,])dnl
355 OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
356 ;;
357 powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*)
358 case "$BUILD_INSTALL_MISC" in
359 *embedspu*) ;;
360 *) BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu"
361 esac
362 ;;
363 sh*-*-pe)
364 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
365 if test -z "$DLLTOOL_DEFAULT"; then
366 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
367 fi
368 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
369 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
370 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
371 ;;
372 spu-*-*)
373 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
374 ;;
375 mips*-*-pe)
376 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
377 if test -z "$DLLTOOL_DEFAULT"; then
378 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MIPS"
379 fi
380 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
381 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
382 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
383 ;;
384 mcore-*-pe)
385 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
386 if test -z "$DLLTOOL_DEFAULT"; then
387 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
388 fi
389 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
390 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
391 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
392 ;;
393 mcore-*-elf)
394 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
395 if test -z "$DLLTOOL_DEFAULT"; then
396 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
397 fi
398 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
399 ;;
400 mep-*)
401 OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
402 ;;
403 esac
404
405 # Add objdump private vectors.
406 case $targ in
407 avr-*-*)
408 od_vectors="$od_vectors objdump_private_desc_elf32_avr"
409 ;;
410 powerpc*-*-aix* | rs6000-*-aix*)
411 od_vectors="$od_vectors objdump_private_desc_xcoff"
412 ;;
413 *-*-darwin*)
414 od_vectors="$od_vectors objdump_private_desc_mach_o"
415 ;;
416 esac
417 fi
418 done
419
420 # Uniq objdump private vector, build objdump target ofiles.
421 od_files=
422 f=""
423 for i in $od_vectors ; do
424 case " $f " in
425 *" $i "*) ;;
426 *)
427 f="$f $i"
428 OBJDUMP_PRIVATE_VECTORS="$OBJDUMP_PRIVATE_VECTORS &$i,"
429 case $i in
430 objdump_private_desc_elf32_avr)
431 od_files="$od_files od-elf32_avr" ;;
432 objdump_private_desc_xcoff)
433 od_files="$od_files od-xcoff" ;;
434 objdump_private_desc_mach_o)
435 od_files="$od_files od-macho" ;;
436 *) AC_MSG_ERROR(*** unknown private vector $i) ;;
437 esac
438 ;;
439 esac
440 done
441
442 # Uniq objdump target ofiles
443 f=""
444 for i in $od_files ; do
445 case " $f " in
446 *" $i "*) ;;
447 *)
448 f="$f $i"
449 OBJDUMP_PRIVATE_OFILES="$OBJDUMP_PRIVATE_OFILES $i.$objext"
450 ;;
451 esac
452 done
453
454 DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
455
456 if test "${with_windres+set}" = set; then
457 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
458 fi
459
460 if test "${with_windmc+set}" = set; then
461 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
462 fi
463
464 OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECTORS}\""
465
466 AC_SUBST(BUILD_SRCONV)
467 AC_SUBST(BUILD_DLLTOOL)
468 AC_SUBST(DLLTOOL_DEFS)
469 AC_SUBST(BUILD_WINDRES)
470 AC_SUBST(BUILD_WINDMC)
471 AC_SUBST(BUILD_DLLWRAP)
472 AC_SUBST(BUILD_MISC)
473 AC_SUBST(BUILD_INSTALL_MISC)
474 AC_SUBST(OBJDUMP_DEFS)
475 AC_SUBST(OBJDUMP_PRIVATE_OFILES)
476
477 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
478
479 targ=$target
480 . $srcdir/../bfd/config.bfd
481 if test "x$targ_underscore" = "xyes"; then
482 UNDERSCORE=1
483 else
484 UNDERSCORE=0
485 fi
486 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
487 [Define to 1 if user symbol names have a leading underscore, 0 if not.])
488
489 # Emulation
490 targ=$target
491 . ${srcdir}/configure.tgt
492 EMULATION=$targ_emul
493 EMULATION_VECTOR=$targ_emul_vector
494
495 AC_SUBST(EMULATION)
496 AC_SUBST(EMULATION_VECTOR)
497
498 # Required for html and install-html
499 AC_SUBST(datarootdir)
500 AC_SUBST(docdir)
501 AC_SUBST(htmldir)
502 AC_SUBST(pdfdir)
503
504 AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)
505 AC_OUTPUT
506
507 GNU_MAKE_JOBSERVER