xref: /netbsd-src/external/gpl3/binutils.old/dist/binutils/configure.ac (revision fb5eed702691094bd687fbf1ded189c87457cd35)
1dnl Process this file with autoconf to produce a configure script.
2dnl
3dnl   Copyright (C) 2012-2018 Free Software Foundation, Inc.
4dnl
5dnl This file is free software; you can redistribute it and/or modify
6dnl it under the terms of the GNU General Public License as published by
7dnl the Free Software Foundation; either version 3 of the License, or
8dnl (at your option) any later version.
9dnl
10dnl This program is distributed in the hope that it will be useful,
11dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13dnl GNU General Public License for more details.
14dnl
15dnl You should have received a copy of the GNU General Public License
16dnl along with this program; see the file COPYING3.  If not see
17dnl <http://www.gnu.org/licenses/>.
18dnl
19
20m4_include([../bfd/version.m4])
21AC_INIT([binutils], BFD_VERSION)
22AC_CONFIG_SRCDIR(ar.c)
23
24AC_CANONICAL_TARGET
25AC_ISC_POSIX
26
27AM_INIT_AUTOMAKE
28
29AC_PROG_CC
30AC_GNU_SOURCE
31AC_USE_SYSTEM_EXTENSIONS
32
33LT_INIT
34ACX_LARGEFILE
35
36AC_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')
40            ;;
41  no)       enable_targets= ;;
42  *)        enable_targets=$enableval ;;
43esac])dnl
44
45AC_ARG_ENABLE(deterministic-archives,
46[AS_HELP_STRING([--enable-deterministic-archives],
47		[ar and ranlib default to -D behavior])], [
48if test "${enableval}" = no; then
49  default_ar_deterministic=0
50else
51  default_ar_deterministic=1
52fi], [default_ar_deterministic=0])
53
54AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic,
55		   [Should ar and ranlib use -D behavior by default?])
56
57AC_ARG_ENABLE(default-strings-all,
58[AS_HELP_STRING([--disable-default-strings-all],
59		[strings defaults to --data behavior])], [
60if test "${enableval}" = no; then
61  default_strings_all=0
62else
63  default_strings_all=1
64fi], [default_strings_all=1])
65
66AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all,
67		   [Should strings use -a behavior by default?])
68
69AM_BINUTILS_WARNINGS
70
71AC_CONFIG_HEADERS(config.h:config.in)
72
73AH_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
78#endif
79#define __CONFIG_H__ 1])
80
81if test -z "$target" ; then
82    AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
83fi
84if test -z "$host" ; then
85    AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
86fi
87
88AC_PROG_YACC
89AM_PROG_LEX
90
91ALL_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"
92ZW_GNU_GETTEXT_SISTER_DIR
93AM_PO_SUBDIRS
94
95AM_MAINTAINER_MODE
96AM_CONDITIONAL(GENINSRC_NEVER, false)
97AC_EXEEXT
98if test -n "$EXEEXT"; then
99  AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
100	    [Does the platform use an executable suffix?])
101fi
102AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
103		   [Suffix used for executables, if any.])
104
105# host-specific stuff:
106
107HDEFINES=
108
109. ${srcdir}/../bfd/configure.host
110
111AC_SUBST(HDEFINES)
112AR=${AR-ar}
113AC_SUBST(AR)
114AC_PROG_RANLIB
115AC_PROG_INSTALL
116
117BFD_CC_FOR_BUILD
118
119DEMANGLER_NAME=c++filt
120case "${host}" in
121  *-*-go32* | *-*-msdos*)
122    DEMANGLER_NAME=cxxfilt
123esac
124AC_SUBST(DEMANGLER_NAME)
125
126AC_CHECK_SIZEOF([long])
127AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
128
129AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h wchar.h)
130AC_HEADER_SYS_WAIT
131ACX_HEADER_STRING
132AC_FUNC_ALLOCA
133AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll setlocale)
134AC_CHECK_FUNC([mkstemp],
135	      AC_DEFINE([HAVE_MKSTEMP], 1,
136	      [Define to 1 if you have the `mkstemp' function.]))
137AC_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.])
147  fi
148
149# Some systems have frexp only in -lm, not in -lc.
150AC_SEARCH_LIBS(frexp, m)
151
152AM_LC_MESSAGES
153
154AC_MSG_CHECKING(for time_t in time.h)
155AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
156[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [time_t i;])],
157bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
158AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
159if 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>?])
162fi
163
164AC_MSG_CHECKING(for time_t in sys/types.h)
165AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
166[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>], [time_t i;])],
167bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
168AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
169if 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>?])
172fi
173
174AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
175AC_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 *);])],
177bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
178AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
179if 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?])
182fi
183
184# Under Next 3.2 <utime.h> apparently does not define struct utimbuf
185# by default.
186AC_MSG_CHECKING([for utime.h])
187AC_CACHE_VAL(bu_cv_header_utime_h,
188[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
189#ifdef HAVE_TIME_H
190#include <time.h>
191#endif
192#include <utime.h>],
193[struct utimbuf s;])],
194bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
195AC_MSG_RESULT($bu_cv_header_utime_h)
196if test $bu_cv_header_utime_h = yes; then
197  AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
198fi
199
200AC_CHECK_DECLS([asprintf, environ, fprintf, getc_unlocked, getenv,
201		sbrk, snprintf, stpcpy, strnlen, strstr, vsnprintf])
202
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).
206AM_ZLIB
207
208BFD_BINARY_FOPEN
209
210# target-specific stuff:
211
212# Canonicalize the secondary target names.
213if test -n "$enable_targets"; then
214    for targ in `echo $enable_targets | sed 's/,/ /g'`
215    do
216	result=`$ac_config_sub $targ 2>/dev/null`
217	if test -n "$result"; then
218	    canon_targets="$canon_targets $result"
219	else
220	    # Allow targets that config.sub doesn't recognize, like "all".
221	    canon_targets="$canon_targets $targ"
222	fi
223    done
224fi
225
226AC_CHECK_HEADER(iconv.h)
227AM_ICONV
228
229all_targets=false
230BUILD_SRCONV=
231BUILD_DLLTOOL=
232DLLTOOL_DEFS=
233DLLTOOL_DEFAULT=
234BUILD_WINDRES=
235BUILD_WINDMC=
236BUILD_DLLWRAP=
237BUILD_MISC=
238BUILD_INSTALL_MISC=
239OBJDUMP_DEFS=
240OBJDUMP_PRIVATE_VECTORS=
241OBJDUMP_PRIVATE_OFILES=
242od_vectors=
243
244for targ in $target $canon_targets
245do
246    if test "x$targ" = "xall"; then
247        all_targets=true
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"
255	fi
256	DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
257	BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
258	od_vectors="$od_vectors objdump_private_desc_xcoff"
259    else
260	case $targ in
261	*-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
262	esac
263
264	case $targ in
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"
269	  fi
270	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
271	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
272	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
273	  ;;
274	arm-*-pe*)
275  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
276	  if test -z "$DLLTOOL_DEFAULT"; then
277	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
278	  fi
279	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
280	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
281	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
282	  ;;
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"
287	  fi
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)'
292	  ;;
293changequote(,)dnl
294	i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
295changequote([,])dnl
296  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
297	  if test -z "$DLLTOOL_DEFAULT"; then
298	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
299	  fi
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)'
304	  ;;
305changequote(,)dnl
306	i[3-7]86-*-interix)
307changequote([,])dnl
308	  BUILD_DLLTOOL='$(DLLTOOL_PROG)'
309	  if test -z "$DLLTOOL_DEFAULT"; then
310	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
311	  fi
312	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
313	  ;;
314changequote(,)dnl
315	powerpc*-aix5.[01])
316changequote([,])dnl
317	  ;;
318changequote(,)dnl
319	powerpc*-aix[5-9].*)
320changequote([,])dnl
321	  OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
322	  ;;
323	powerpc*-*-pe* | powerpc*-*-cygwin*)
324  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
325	  if test -z "$DLLTOOL_DEFAULT"; then
326	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_PPC"
327	  fi
328	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
329	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
330	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
331	  ;;
332	powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*)
333	  case "$BUILD_INSTALL_MISC" in
334	    *embedspu*) ;;
335	    *) BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu"
336	  esac
337	  ;;
338	sh*-*-pe)
339  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
340	  if test -z "$DLLTOOL_DEFAULT"; then
341	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
342	  fi
343	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
344	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
345	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
346	  ;;
347	spu-*-*)
348	  BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
349	  ;;
350	mips*-*-pe)
351  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
352	  if test -z "$DLLTOOL_DEFAULT"; then
353	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MIPS"
354	  fi
355	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
356	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
357	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
358	  ;;
359	mcore-*-pe)
360  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
361	  if test -z "$DLLTOOL_DEFAULT"; then
362	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
363	  fi
364	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
365	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
366	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
367	  ;;
368	mcore-*-elf)
369  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
370	  if test -z "$DLLTOOL_DEFAULT"; then
371	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
372	  fi
373	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
374	  ;;
375  	mep-*)
376	  OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
377	  ;;
378	esac
379
380	# Add objdump private vectors.
381	case $targ in
382	avr-*-*)
383	  od_vectors="$od_vectors objdump_private_desc_elf32_avr"
384	  ;;
385	powerpc*-*-aix* | rs6000-*-aix*)
386	  od_vectors="$od_vectors objdump_private_desc_xcoff"
387	  ;;
388        *-*-darwin*)
389	  od_vectors="$od_vectors objdump_private_desc_mach_o"
390	  ;;
391	esac
392    fi
393done
394
395# Uniq objdump private vector, build objdump target ofiles.
396od_files=
397f=""
398for i in $od_vectors ; do
399    case " $f " in
400    *" $i "*) ;;
401    *)
402	f="$f $i"
403	OBJDUMP_PRIVATE_VECTORS="$OBJDUMP_PRIVATE_VECTORS &$i,"
404	case $i in
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) ;;
412	esac
413	;;
414    esac
415done
416
417# Uniq objdump target ofiles
418f=""
419for i in $od_files ; do
420    case " $f " in
421    *" $i "*) ;;
422    *)
423	f="$f $i"
424	OBJDUMP_PRIVATE_OFILES="$OBJDUMP_PRIVATE_OFILES $i.$objext"
425	;;
426    esac
427done
428
429DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
430
431if test "${with_windres+set}" = set; then
432	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
433fi
434
435if test "${with_windmc+set}" = set; then
436	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
437fi
438
439OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECTORS}\""
440
441AC_SUBST(BUILD_SRCONV)
442AC_SUBST(BUILD_DLLTOOL)
443AC_SUBST(DLLTOOL_DEFS)
444AC_SUBST(BUILD_WINDRES)
445AC_SUBST(BUILD_WINDMC)
446AC_SUBST(BUILD_DLLWRAP)
447AC_SUBST(BUILD_MISC)
448AC_SUBST(BUILD_INSTALL_MISC)
449AC_SUBST(OBJDUMP_DEFS)
450AC_SUBST(OBJDUMP_PRIVATE_OFILES)
451
452AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
453
454targ=$target
455. $srcdir/../bfd/config.bfd
456if test "x$targ_underscore" = "xyes"; then
457    UNDERSCORE=1
458else
459    UNDERSCORE=0
460fi
461AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
462 [Define to 1 if user symbol names have a leading underscore, 0 if not.])
463
464# Emulation
465targ=$target
466. ${srcdir}/configure.tgt
467EMULATION=$targ_emul
468EMULATION_VECTOR=$targ_emul_vector
469
470AC_SUBST(EMULATION)
471AC_SUBST(EMULATION_VECTOR)
472
473# Required for html and install-html
474AC_SUBST(datarootdir)
475AC_SUBST(docdir)
476AC_SUBST(htmldir)
477AC_SUBST(pdfdir)
478
479AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)
480AC_OUTPUT
481