* m32r.opc: Formatting.
[binutils.git] / binutils / configure.in
blob46a56a0e44f7a11022ffd6ffbbe1584d75d43afa
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 AM_PROG_LIBTOOL
16 AC_ARG_ENABLE(targets,
17 [  --enable-targets        alternative target configurations],
18 [case "${enableval}" in
19   yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
20             ;;
21   no)       enable_targets= ;;
22   *)        enable_targets=$enableval ;;
23 esac])dnl
24 AC_ARG_ENABLE(commonbfdlib,
25 [  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library],
26 [case "${enableval}" in
27   yes) commonbfdlib=true ;;
28   no)  commonbfdlib=false ;;
29   *)   AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
30 esac])dnl
32 # The location to which bugs should be reported.
33 AC_ARG_WITH(bugurl,
34   AS_HELP_STRING([--with-bugurl=URL],
35                  [Direct users to URL to report a bug]),
36   [case "$withval" in
37     yes) AC_MSG_ERROR([bug URL not specified]) ;;
38     no)  REPORT_BUGS_TO="";
39          REPORT_BUGS_TEXI=""
40          ;;
41     *)   REPORT_BUGS_TO="<URL:$withval>"
42          REPORT_BUGS_TEXI="@uref{`echo $withval | sed 's/@/@@/g'`}"
43          ;;
44    esac],
45    REPORT_BUGS_TO="<URL:http://www.sourceware.org/bugzilla/>"
46    REPORT_BUGS_TEXI="@uref{http://www.sourceware.org/bugzilla/}"
48 AC_SUBST(REPORT_BUGS_TO)
49 AC_SUBST(REPORT_BUGS_TEXI)
51 AM_BINUTILS_WARNINGS
52                    
53 AM_CONFIG_HEADER(config.h:config.in)
55 if test -z "$target" ; then
56     AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
58 if test -z "$host" ; then
59     AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
62 AC_PROG_CC
63 AC_GNU_SOURCE
65 AC_PROG_YACC
66 AM_PROG_LEX
68 ALL_LINGUAS="fr tr ja es sv da zh_CN ru ro rw zh_TW fi vi"
69 ZW_GNU_GETTEXT_SISTER_DIR
70 AM_PO_SUBDIRS
72 AM_MAINTAINER_MODE
73 AM_CONDITIONAL(GENINSRC_NEVER, false)
74 AC_EXEEXT
75 if test -n "$EXEEXT"; then
76   AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
77             [Does the platform use an executable suffix?])
79 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
80                    [Suffix used for executables, if any.])
82 # host-specific stuff:
84 HDEFINES=
86 . ${srcdir}/../bfd/configure.host
88 AC_SUBST(HDEFINES)
89 AR=${AR-ar}
90 AC_SUBST(AR)
91 AC_PROG_RANLIB
92 AC_PROG_INSTALL
94 BFD_CC_FOR_BUILD
96 DEMANGLER_NAME=c++filt
97 case "${host}" in
98   *-*-go32* | *-*-msdos*)
99     DEMANGLER_NAME=cxxfilt
100 esac
101 AC_SUBST(DEMANGLER_NAME)
103 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h sys/param.h)
104 AC_HEADER_SYS_WAIT
105 AC_FUNC_ALLOCA
106 AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll)
107 AC_CHECK_FUNC([mkstemp],
108               AC_DEFINE([HAVE_MKSTEMP], 1,
109               [Define to 1 if you have the `mkstemp' function.]))
110 AC_CHECK_FUNC([mkdtemp],
111               AC_DEFINE([HAVE_MKDTEMP], 1,
112               [Define to 1 if you have the `mkdtemp' function.]))
114 # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
115 # needs to be defined for it
116 AC_MSG_CHECKING([for fopen64])
117 AC_CACHE_VAL(bu_cv_have_fopen64,
118 [AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
119 bu_cv_have_fopen64=yes,
120 [saved_CPPFLAGS=$CPPFLAGS
121  CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
122  AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
123 bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
124 bu_cv_have_fopen64=no)
125  CPPFLAGS=$saved_CPPFLAGS])])
126 AC_MSG_RESULT($bu_cv_have_fopen64)
127 if test "$bu_cv_have_fopen64" != no; then
128   AC_DEFINE([HAVE_FOPEN64], 1,
129             [Is fopen64 available?])
131 AC_MSG_CHECKING([for stat64])
132 AC_CACHE_VAL(bu_cv_have_stat64,
133 [AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
134 bu_cv_have_stat64=yes,
135 [saved_CPPFLAGS=$CPPFLAGS
136  CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
137  AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
138 bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE",
139 bu_cv_have_stat64=no)
140  CPPFLAGS=$saved_CPPFLAGS])])
141 AC_MSG_RESULT($bu_cv_have_stat64)
142 if test "$bu_cv_have_stat64" != no; then
143   AC_DEFINE([HAVE_STAT64], 1,
144             [Is stat64 available?])
146 if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \
147    || test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then
148   AC_DEFINE([_LARGEFILE64_SOURCE], 1,
149             [Enable LFS])
150   CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
153 # Some systems have frexp only in -lm, not in -lc.
154 AC_SEARCH_LIBS(frexp, m)
156 AC_MSG_CHECKING(for time_t in time.h)
157 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
158 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
159 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
160 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
161 if test $bu_cv_decl_time_t_time_h = yes; then
162   AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
163             [Is the type time_t defined in <time.h>?])
166 AC_MSG_CHECKING(for time_t in sys/types.h)
167 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
168 [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
169 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
170 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
171 if test $bu_cv_decl_time_t_types_h = yes; then
172   AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
173             [Is the type time_t defined in <sys/types.h>?])
176 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
177 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
178 [AC_TRY_COMPILE([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);],
179 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
180 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
181 if test $bu_cv_decl_getopt_unistd_h = yes; then
182   AC_DEFINE([HAVE_DECL_GETOPT], 1,
183             [Is the prototype for getopt in <unistd.h> in the expected format?])
186 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
187 # by default.
188 AC_MSG_CHECKING([for utime.h])
189 AC_CACHE_VAL(bu_cv_header_utime_h,
190 [AC_TRY_COMPILE([#include <sys/types.h>
191 #ifdef HAVE_TIME_H
192 #include <time.h>
193 #endif
194 #include <utime.h>],
195 [struct utimbuf s;],
196 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
197 AC_MSG_RESULT($bu_cv_header_utime_h)
198 if test $bu_cv_header_utime_h = yes; then
199   AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
202 AC_CHECK_DECLS([fprintf, stpcpy, strstr, sbrk, getenv, environ, getc_unlocked,
203                 snprintf, vsnprintf])
205 BFD_BINARY_FOPEN
207 # target-specific stuff:
209 # Canonicalize the secondary target names.
210 if test -n "$enable_targets"; then
211     for targ in `echo $enable_targets | sed 's/,/ /g'`
212     do
213         result=`$ac_config_sub $targ 2>/dev/null`
214         if test -n "$result"; then
215             canon_targets="$canon_targets $result"
216         else
217             # Allow targets that config.sub doesn't recognize, like "all".
218             canon_targets="$canon_targets $targ"
219         fi
220     done
223 all_targets=false
224 BUILD_NLMCONV=
225 NLMCONV_DEFS=
226 BUILD_SRCONV=
227 BUILD_DLLTOOL=
228 DLLTOOL_DEFS=
229 DLLTOOL_DEFAULT=
230 BUILD_WINDRES=
231 BUILD_DLLWRAP=
232 BUILD_MISC=
233 BUILD_INSTALL_MISC=
234 OBJDUMP_DEFS=
236 for targ in $target $canon_targets
238     if test "x$targ" = "xall"; then
239         all_targets=true
240         BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
241         BUILD_SRCONV='$(SRCONV_PROG)'
242         NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
243         BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
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           ;;
277         arm-wince-pe* | arm-*-wince)
278           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
279           if test -z "$DLLTOOL_DEFAULT"; then
280             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE"
281           fi
282           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
283           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
284           ;;
285         arm-*-pe*)
286           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
287           if test -z "$DLLTOOL_DEFAULT"; then
288             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
289           fi
290           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
291           BUILD_WINDRES='$(WINDRES_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           ;;
301         x86_64-*-mingw*)
302           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
303           if test -z "$DLLTOOL_DEFAULT"; then
304             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
305           fi
306           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
307           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
308           BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
309           ;;
310 changequote(,)dnl
311         i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
312 changequote([,])dnl
313           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
314           if test -z "$DLLTOOL_DEFAULT"; then
315             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
316           fi
317           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
318           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
319           BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
320           ;;
321 changequote(,)dnl
322         i[3-7]86-*-interix)
323 changequote([,])dnl
324           BUILD_DLLTOOL='$(DLLTOOL_PROG)'
325           if test -z "$DLLTOOL_DEFAULT"; then
326             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
327           fi
328           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
329           ;;
330 changequote(,)dnl
331         powerpc*-aix5.[01])
332 changequote([,])dnl
333           ;;
334         powerpc*-aix5.*)
335           OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
336           ;;
337         powerpc*-*-pe* | powerpc*-*-cygwin*)
338           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
339           if test -z "$DLLTOOL_DEFAULT"; then
340             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_PPC"
341           fi
342           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
343           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
344           ;;
345         powerpc*-*-linux* | powerpc*-*-elf*)
346           BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu"
347           ;;
348         sh*-*-pe)
349           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
350           if test -z "$DLLTOOL_DEFAULT"; then
351             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
352           fi
353           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
354           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
355           ;;
356         spu-*-*)
357           BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
358           ;;
359         mips*-*-pe)
360           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
361           if test -z "$DLLTOOL_DEFAULT"; then
362             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MIPS"
363           fi
364           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
365           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
366           ;;
367         mcore-*-pe)
368           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
369           if test -z "$DLLTOOL_DEFAULT"; then
370             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
371           fi
372           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
373           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
374           ;;
375         mcore-*-elf)
376           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
377           if test -z "$DLLTOOL_DEFAULT"; then
378             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
379           fi
380           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
381           ;;
382         mep-*)
383           OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
384           ;;
385         esac
386     fi
387 done
389 DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
391 if test "${with_windres+set}" = set; then
392           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
395 AC_SUBST(NLMCONV_DEFS)
396 AC_SUBST(BUILD_NLMCONV)
397 AC_SUBST(BUILD_SRCONV)
398 AC_SUBST(BUILD_DLLTOOL)
399 AC_SUBST(DLLTOOL_DEFS)
400 AC_SUBST(BUILD_WINDRES)
401 AC_SUBST(BUILD_DLLWRAP)
402 AC_SUBST(BUILD_MISC)
403 AC_SUBST(BUILD_INSTALL_MISC)
404 AC_SUBST(OBJDUMP_DEFS)
406 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
408 targ=$target
409 . $srcdir/../bfd/config.bfd
410 if test "x$targ_underscore" = "xyes"; then
411     UNDERSCORE=1
412 else
413     UNDERSCORE=0
415 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
416  [Define to 1 if user symbol names have a leading underscore, 0 if not.])
418 # Emulation 
419 for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
421   # Canonicalize the secondary target names.
422  result=`$ac_config_sub $targ_alias 2>/dev/null`
423  if test -n "$result"; then
424    targ=$result
425  else
426    targ=$targ_alias
427  fi
429  . ${srcdir}/configure.tgt
431   EMULATION=$targ_emul
432   EMULATION_VECTOR=$targ_emul_vector    
433 done
435 AC_SUBST(EMULATION)
436 AC_SUBST(EMULATION_VECTOR)
438 # Required for html and install-html
439 AC_SUBST(datarootdir)
440 AC_SUBST(docdir)
441 AC_SUBST(htmldir)
443 AC_OUTPUT(Makefile doc/Makefile po/Makefile.in:po/Make-in)