bfd/
[binutils.git] / binutils / configure.in
blobb4d4dcd26d3a8acca62cf88d816e420c486d2435
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 AC_PREREQ(2.59)
4 AC_INIT
5 AC_CONFIG_SRCDIR(ar.c)
7 AC_CANONICAL_TARGET
8 AC_ISC_POSIX
10 changequote(,)dnl
11 BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[         ]*\([^  ]*\)[   ]*).*/\1/p' < ${srcdir}/../bfd/configure.in`
12 changequote([,])dnl
13 AM_INIT_AUTOMAKE(binutils, ${BFD_VERSION})
15 AC_PROG_CC
16 AC_GNU_SOURCE
17 AC_USE_SYSTEM_EXTENSIONS
18 AC_SYS_LARGEFILE
19 LT_INIT
21 AC_ARG_ENABLE(targets,
22 [  --enable-targets        alternative target configurations],
23 [case "${enableval}" in
24   yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
25             ;;
26   no)       enable_targets= ;;
27   *)        enable_targets=$enableval ;;
28 esac])dnl
29 AC_ARG_ENABLE(commonbfdlib,
30 [  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library],
31 [case "${enableval}" in
32   yes) commonbfdlib=true ;;
33   no)  commonbfdlib=false ;;
34   *)   AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
35 esac])dnl
37 AM_BINUTILS_WARNINGS
38                    
39 AC_CONFIG_HEADERS(config.h:config.in)
41 if test -z "$target" ; then
42     AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
44 if test -z "$host" ; then
45     AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
48 AC_PROG_YACC
49 AM_PROG_LEX
51 ALL_LINGUAS="da es fi fr id ja ro ru rw sk sv tr uk vi zh_CN zh_TW"
52 ZW_GNU_GETTEXT_SISTER_DIR
53 AM_PO_SUBDIRS
55 AM_MAINTAINER_MODE
56 AM_CONDITIONAL(GENINSRC_NEVER, false)
57 AC_EXEEXT
58 if test -n "$EXEEXT"; then
59   AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
60             [Does the platform use an executable suffix?])
62 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
63                    [Suffix used for executables, if any.])
65 # host-specific stuff:
67 HDEFINES=
69 . ${srcdir}/../bfd/configure.host
71 AC_SUBST(HDEFINES)
72 AR=${AR-ar}
73 AC_SUBST(AR)
74 AC_PROG_RANLIB
75 AC_PROG_INSTALL
77 BFD_CC_FOR_BUILD
79 DEMANGLER_NAME=c++filt
80 case "${host}" in
81   *-*-go32* | *-*-msdos*)
82     DEMANGLER_NAME=cxxfilt
83 esac
84 AC_SUBST(DEMANGLER_NAME)
86 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h sys/param.h)
87 AC_HEADER_SYS_WAIT
88 AC_FUNC_ALLOCA
89 AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll)
90 AC_CHECK_FUNC([mkstemp],
91               AC_DEFINE([HAVE_MKSTEMP], 1,
92               [Define to 1 if you have the `mkstemp' function.]))
93 AC_CHECK_FUNC([mkdtemp],
94               AC_DEFINE([HAVE_MKDTEMP], 1,
95               [Define to 1 if you have the `mkdtemp' function.]))
97 # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
98 # needs to be defined for it
99 AC_MSG_CHECKING([for fopen64])
100 AC_CACHE_VAL(bu_cv_have_fopen64,
101 [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");])],
102 bu_cv_have_fopen64=yes,
103 [saved_CPPFLAGS=$CPPFLAGS
104  CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
105  AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");])],
106  bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
107  bu_cv_have_fopen64=no)
108  CPPFLAGS=$saved_CPPFLAGS])])
109 AC_MSG_RESULT($bu_cv_have_fopen64)
110 if test "$bu_cv_have_fopen64" != no; then
111   AC_DEFINE([HAVE_FOPEN64], 1,
112             [Is fopen64 available?])
114 AC_MSG_CHECKING([for stat64])
115 AC_CACHE_VAL(bu_cv_have_stat64,
116 [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);])],
117 bu_cv_have_stat64=yes,
118 [saved_CPPFLAGS=$CPPFLAGS
119  CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
120  AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);])],
121  bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE",
122  bu_cv_have_stat64=no)
123  CPPFLAGS=$saved_CPPFLAGS])])
124 AC_MSG_RESULT($bu_cv_have_stat64)
125 if test "$bu_cv_have_stat64" != no; then
126   AC_DEFINE([HAVE_STAT64], 1,
127             [Is stat64 available?])
129 if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \
130    || test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then
131   AC_DEFINE([_LARGEFILE64_SOURCE], 1,
132             [Enable LFS])
133   CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
136 # Some systems have frexp only in -lm, not in -lc.
137 AC_SEARCH_LIBS(frexp, m)
139 AC_MSG_CHECKING(for time_t in time.h)
140 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
141 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [time_t i;])],
142 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
143 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
144 if test $bu_cv_decl_time_t_time_h = yes; then
145   AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
146             [Is the type time_t defined in <time.h>?])
149 AC_MSG_CHECKING(for time_t in sys/types.h)
150 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
151 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>], [time_t i;])],
152 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
153 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
154 if test $bu_cv_decl_time_t_types_h = yes; then
155   AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
156             [Is the type time_t defined in <sys/types.h>?])
159 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
160 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
161 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
162 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
163 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
164 if test $bu_cv_decl_getopt_unistd_h = yes; then
165   AC_DEFINE([HAVE_DECL_GETOPT], 1,
166             [Is the prototype for getopt in <unistd.h> in the expected format?])
169 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
170 # by default.
171 AC_MSG_CHECKING([for utime.h])
172 AC_CACHE_VAL(bu_cv_header_utime_h,
173 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
174 #ifdef HAVE_TIME_H
175 #include <time.h>
176 #endif
177 #include <utime.h>],
178 [struct utimbuf s;])],
179 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
180 AC_MSG_RESULT($bu_cv_header_utime_h)
181 if test $bu_cv_header_utime_h = yes; then
182   AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
185 AC_CHECK_DECLS([fprintf, stpcpy, strstr, sbrk, getenv, environ, getc_unlocked,
186                 snprintf, vsnprintf])
188 # Link in zlib if we can.  This allows us to read compressed debug
189 # sections.  This is used only by readelf.c (objdump uses bfd for
190 # reading compressed sections).
191 AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
193 BFD_BINARY_FOPEN
195 # target-specific stuff:
197 # Canonicalize the secondary target names.
198 if test -n "$enable_targets"; then
199     for targ in `echo $enable_targets | sed 's/,/ /g'`
200     do
201         result=`$ac_config_sub $targ 2>/dev/null`
202         if test -n "$result"; then
203             canon_targets="$canon_targets $result"
204         else
205             # Allow targets that config.sub doesn't recognize, like "all".
206             canon_targets="$canon_targets $targ"
207         fi
208     done
211 AC_CHECK_HEADER(iconv.h)
212 AM_ICONV
214 all_targets=false
215 BUILD_NLMCONV=
216 NLMCONV_DEFS=
217 BUILD_SRCONV=
218 BUILD_DLLTOOL=
219 DLLTOOL_DEFS=
220 DLLTOOL_DEFAULT=
221 BUILD_WINDRES=
222 BUILD_WINDMC=
223 BUILD_DLLWRAP=
224 BUILD_MISC=
225 BUILD_INSTALL_MISC=
226 OBJDUMP_DEFS=
228 for targ in $target $canon_targets
230     if test "x$targ" = "xall"; then
231         all_targets=true
232         BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
233         BUILD_SRCONV='$(SRCONV_PROG)'
234         NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
235         BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
236         BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
237         BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
238         BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
239         if test -z "$DLLTOOL_DEFAULT"; then
240           DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
241         fi
242         DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
243         BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
244     else
245         case $targ in
246 changequote(,)dnl
247         i[3-7]86*-*-netware*) 
248 changequote([,])dnl
249           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
250           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
251           ;;
252         alpha*-*-netware*)
253           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
254           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
255           ;;
256         powerpc*-*-netware*)
257           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
258           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
259           ;;
260         sparc*-*-netware*)
261           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
262           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
263           ;;
264         esac
265         case $targ in
266         *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
267         esac
268         case $targ in
269         arm-epoc-pe*)
270           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
271           if test -z "$DLLTOOL_DEFAULT"; then
272             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_EPOC"
273           fi
274           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM"
275           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
276           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
277           ;;
278         arm-wince-pe* | arm-*-wince)
279           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
280           if test -z "$DLLTOOL_DEFAULT"; then
281             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE"
282           fi
283           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
284           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
285           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
286           ;;
287         arm-*-pe*)
288           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
289           if test -z "$DLLTOOL_DEFAULT"; then
290             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
291           fi
292           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
293           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
294           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
295           ;;
296         thumb-*-pe*)
297           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
298           if test -z "$DLLTOOL_DEFAULT"; then
299             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
300           fi
301           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
302           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
303           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
304           ;;
305         x86_64-*-mingw*)
306           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
307           if test -z "$DLLTOOL_DEFAULT"; then
308             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
309           fi
310           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
311           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
312           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
313           BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
314           ;;
315 changequote(,)dnl
316         i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
317 changequote([,])dnl
318           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
319           if test -z "$DLLTOOL_DEFAULT"; then
320             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
321           fi
322           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
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-*-interix)
329 changequote([,])dnl
330           BUILD_DLLTOOL='$(DLLTOOL_PROG)'
331           if test -z "$DLLTOOL_DEFAULT"; then
332             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
333           fi
334           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
335           ;;
336 changequote(,)dnl
337         powerpc*-aix5.[01])
338 changequote([,])dnl
339           ;;
340         powerpc*-aix5.*)
341           OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
342           ;;
343         powerpc*-*-pe* | powerpc*-*-cygwin*)
344           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
345           if test -z "$DLLTOOL_DEFAULT"; then
346             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_PPC"
347           fi
348           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
349           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
350           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
351           ;;
352         powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*)
353           BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu"
354           ;;
355         sh*-*-pe)
356           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
357           if test -z "$DLLTOOL_DEFAULT"; then
358             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
359           fi
360           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
361           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
362           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
363           ;;
364         spu-*-*)
365           BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
366           ;;
367         mips*-*-pe)
368           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
369           if test -z "$DLLTOOL_DEFAULT"; then
370             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MIPS"
371           fi
372           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
373           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
374           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
375           ;;
376         mcore-*-pe)
377           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
378           if test -z "$DLLTOOL_DEFAULT"; then
379             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
380           fi
381           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
382           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
383           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
384           ;;
385         mcore-*-elf)
386           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
387           if test -z "$DLLTOOL_DEFAULT"; then
388             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
389           fi
390           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
391           ;;
392         mep-*)
393           OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
394           ;;
395         esac
396     fi
397 done
399 DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
401 if test "${with_windres+set}" = set; then
402           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
405 if test "${with_windmc+set}" = set; then
406           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
409 AC_SUBST(NLMCONV_DEFS)
410 AC_SUBST(BUILD_NLMCONV)
411 AC_SUBST(BUILD_SRCONV)
412 AC_SUBST(BUILD_DLLTOOL)
413 AC_SUBST(DLLTOOL_DEFS)
414 AC_SUBST(BUILD_WINDRES)
415 AC_SUBST(BUILD_WINDMC)
416 AC_SUBST(BUILD_DLLWRAP)
417 AC_SUBST(BUILD_MISC)
418 AC_SUBST(BUILD_INSTALL_MISC)
419 AC_SUBST(OBJDUMP_DEFS)
421 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
423 targ=$target
424 . $srcdir/../bfd/config.bfd
425 if test "x$targ_underscore" = "xyes"; then
426     UNDERSCORE=1
427 else
428     UNDERSCORE=0
430 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
431  [Define to 1 if user symbol names have a leading underscore, 0 if not.])
433 # Emulation 
434 for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
436   # Canonicalize the secondary target names.
437  result=`$ac_config_sub $targ_alias 2>/dev/null`
438  if test -n "$result"; then
439    targ=$result
440  else
441    targ=$targ_alias
442  fi
444  . ${srcdir}/configure.tgt
446   EMULATION=$targ_emul
447   EMULATION_VECTOR=$targ_emul_vector    
448 done
450 AC_SUBST(EMULATION)
451 AC_SUBST(EMULATION_VECTOR)
453 # Required for html and install-html
454 AC_SUBST(datarootdir)
455 AC_SUBST(docdir)
456 AC_SUBST(htmldir)
458 AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)
459 AC_OUTPUT