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