gdb/riscv: Fix an ARI warning
[external/binutils.git] / binutils / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 dnl   Copyright (C) 2012-2018 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 AC_INIT([binutils], BFD_VERSION)
22 AC_CONFIG_SRCDIR(ar.c)
23
24 AC_CANONICAL_TARGET
25 AC_ISC_POSIX
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_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 ;;
43 esac])dnl
44
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
50 else
51   default_ar_deterministic=1
52 fi], [default_ar_deterministic=0])
53
54 AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic,
55                    [Should ar and ranlib use -D behavior by default?])
56
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
61   default_strings_all=0
62 else
63   default_strings_all=1
64 fi], [default_strings_all=1])
65
66 AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all,
67                    [Should strings use -a behavior by default?])
68
69 AM_BINUTILS_WARNINGS
70
71 AC_CONFIG_HEADERS(config.h:config.in)
72
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
78 #endif
79 #define __CONFIG_H__ 1])
80
81 if test -z "$target" ; then
82     AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
83 fi
84 if test -z "$host" ; then
85     AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
86 fi
87
88 AC_PROG_YACC
89 AM_PROG_LEX
90
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
93 AM_PO_SUBDIRS
94
95 AM_MAINTAINER_MODE
96 AM_CONDITIONAL(GENINSRC_NEVER, false)
97 AC_EXEEXT
98 if test -n "$EXEEXT"; then
99   AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
100             [Does the platform use an executable suffix?])
101 fi
102 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
103                    [Suffix used for executables, if any.])
104
105 # host-specific stuff:
106
107 HDEFINES=
108
109 . ${srcdir}/../bfd/configure.host
110
111 AC_SUBST(HDEFINES)
112 AR=${AR-ar}
113 AC_SUBST(AR)
114 AC_PROG_RANLIB
115 AC_PROG_INSTALL
116
117 BFD_CC_FOR_BUILD
118
119 DEMANGLER_NAME=c++filt
120 case "${host}" in
121   *-*-go32* | *-*-msdos*)
122     DEMANGLER_NAME=cxxfilt
123 esac
124 AC_SUBST(DEMANGLER_NAME)
125
126 AC_CHECK_SIZEOF([long])
127 AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
128
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)
130 AC_HEADER_SYS_WAIT
131 ACX_HEADER_STRING
132 AC_FUNC_ALLOCA
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.])
147   fi
148
149 # Some systems have frexp only in -lm, not in -lc.
150 AC_SEARCH_LIBS(frexp, m)
151
152 AM_LC_MESSAGES
153
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>?])
162 fi
163
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>?])
172 fi
173
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?])
182 fi
183
184 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
185 # by default.
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>
189 #ifdef HAVE_TIME_H
190 #include <time.h>
191 #endif
192 #include <utime.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?])
198 fi
199
200 AC_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).
206 AM_ZLIB
207
208 BFD_BINARY_FOPEN
209
210 # target-specific stuff:
211
212 # Canonicalize the secondary target names.
213 if 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
224 fi
225
226 AC_CHECK_HEADER(iconv.h)
227 AM_ICONV
228
229 all_targets=false
230 BUILD_SRCONV=
231 BUILD_DLLTOOL=
232 DLLTOOL_DEFS=
233 DLLTOOL_DEFAULT=
234 BUILD_WINDRES=
235 BUILD_WINDMC=
236 BUILD_DLLWRAP=
237 BUILD_MISC=
238 BUILD_INSTALL_MISC=
239 OBJDUMP_DEFS=
240 OBJDUMP_PRIVATE_VECTORS=
241 OBJDUMP_PRIVATE_OFILES=
242 od_vectors=
243
244 for targ in $target $canon_targets
245 do
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           ;;
293 changequote(,)dnl
294         i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
295 changequote([,])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           ;;
305 changequote(,)dnl
306         i[3-7]86-*-interix)
307 changequote([,])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           ;;
314 changequote(,)dnl
315         powerpc*-aix5.[01])
316 changequote([,])dnl
317           ;;
318 changequote(,)dnl
319         powerpc*-aix[5-9].*)
320 changequote([,])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
393 done
394
395 # Uniq objdump private vector, build objdump target ofiles.
396 od_files=
397 f=""
398 for 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
415 done
416
417 # Uniq objdump target ofiles
418 f=""
419 for 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
427 done
428
429 DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
430
431 if test "${with_windres+set}" = set; then
432           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
433 fi
434
435 if test "${with_windmc+set}" = set; then
436           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
437 fi
438
439 OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECTORS}\""
440
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)
447 AC_SUBST(BUILD_MISC)
448 AC_SUBST(BUILD_INSTALL_MISC)
449 AC_SUBST(OBJDUMP_DEFS)
450 AC_SUBST(OBJDUMP_PRIVATE_OFILES)
451
452 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
453
454 targ=$target
455 . $srcdir/../bfd/config.bfd
456 if test "x$targ_underscore" = "xyes"; then
457     UNDERSCORE=1
458 else
459     UNDERSCORE=0
460 fi
461 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
462  [Define to 1 if user symbol names have a leading underscore, 0 if not.])
463
464 # Emulation
465 targ=$target
466 . ${srcdir}/configure.tgt
467 EMULATION=$targ_emul
468 EMULATION_VECTOR=$targ_emul_vector
469
470 AC_SUBST(EMULATION)
471 AC_SUBST(EMULATION_VECTOR)
472
473 # Required for html and install-html
474 AC_SUBST(datarootdir)
475 AC_SUBST(docdir)
476 AC_SUBST(htmldir)
477 AC_SUBST(pdfdir)
478
479 AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)
480 AC_OUTPUT