bfd/
[binutils.git] / binutils / configure.in
blob3bd05364813e9c9c866274be0651916338e9b254
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_TO="<URL:$withval>" ;;
40    esac],
41    REPORT_BUGS_TO=""
43 AC_SUBST(REPORT_BUGS_TO)
45 AM_BINUTILS_WARNINGS
46                    
47 AM_CONFIG_HEADER(config.h:config.in)
49 if test -z "$target" ; then
50     AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
52 if test -z "$host" ; then
53     AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
56 AC_PROG_CC
57 AC_GNU_SOURCE
59 AC_PROG_YACC
60 AM_PROG_LEX
62 ALL_LINGUAS="fr tr ja es sv da zh_CN ru ro rw zh_TW fi vi"
63 CY_GNU_GETTEXT
65 AM_MAINTAINER_MODE
66 AC_EXEEXT
67 if test -n "$EXEEXT"; then
68   AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
69             [Does the platform use an executable suffix?])
71 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
72                    [Suffix used for executables, if any.])
74 # host-specific stuff:
76 HDEFINES=
78 . ${srcdir}/../bfd/configure.host
80 AC_SUBST(HDEFINES)
81 AR=${AR-ar}
82 AC_SUBST(AR)
83 AC_PROG_RANLIB
84 AC_PROG_INSTALL
86 BFD_CC_FOR_BUILD
88 DEMANGLER_NAME=c++filt
89 case "${host}" in
90   *-*-go32* | *-*-msdos*)
91     DEMANGLER_NAME=cxxfilt
92 esac
93 AC_SUBST(DEMANGLER_NAME)
95 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
96 AC_HEADER_SYS_WAIT
97 AC_FUNC_ALLOCA
98 AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll)
100 # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
101 # needs to be defined for it
102 AC_MSG_CHECKING([for fopen64])
103 AC_CACHE_VAL(bu_cv_have_fopen64,
104 [AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
105 bu_cv_have_fopen64=yes,
106 [saved_CPPFLAGS=$CPPFLAGS
107  CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
108  AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
109 bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
110 bu_cv_have_fopen64=no)
111  CPPFLAGS=$saved_CPPFLAGS])])
112 AC_MSG_RESULT($bu_cv_have_fopen64)
113 if test "$bu_cv_have_fopen64" != no; then
114   AC_DEFINE([HAVE_FOPEN64], 1,
115             [Is fopen64 available?])
117 AC_MSG_CHECKING([for stat64])
118 AC_CACHE_VAL(bu_cv_have_stat64,
119 [AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
120 bu_cv_have_stat64=yes,
121 [saved_CPPFLAGS=$CPPFLAGS
122  CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
123  AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
124 bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE",
125 bu_cv_have_stat64=no)
126  CPPFLAGS=$saved_CPPFLAGS])])
127 AC_MSG_RESULT($bu_cv_have_stat64)
128 if test "$bu_cv_have_stat64" != no; then
129   AC_DEFINE([HAVE_STAT64], 1,
130             [Is stat64 available?])
132 if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \
133    || test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then
134   AC_DEFINE([_LARGEFILE64_SOURCE], 1,
135             [Enable LFS])
136   CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
139 # Some systems have frexp only in -lm, not in -lc.
140 AC_SEARCH_LIBS(frexp, m)
142 AC_MSG_CHECKING(for time_t in time.h)
143 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
144 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
145 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
146 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
147 if test $bu_cv_decl_time_t_time_h = yes; then
148   AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
149             [Is the type time_t defined in <time.h>?])
152 AC_MSG_CHECKING(for time_t in sys/types.h)
153 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
154 [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
155 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
156 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
157 if test $bu_cv_decl_time_t_types_h = yes; then
158   AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
159             [Is the type time_t defined in <sys/types.h>?])
162 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
163 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
164 [AC_TRY_COMPILE([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);],
165 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
166 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
167 if test $bu_cv_decl_getopt_unistd_h = yes; then
168   AC_DEFINE([HAVE_DECL_GETOPT], 1,
169             [Is the prototype for getopt in <unistd.h> in the expected format?])
172 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
173 # by default.
174 AC_MSG_CHECKING([for utime.h])
175 AC_CACHE_VAL(bu_cv_header_utime_h,
176 [AC_TRY_COMPILE([#include <sys/types.h>
177 #ifdef HAVE_TIME_H
178 #include <time.h>
179 #endif
180 #include <utime.h>],
181 [struct utimbuf s;],
182 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
183 AC_MSG_RESULT($bu_cv_header_utime_h)
184 if test $bu_cv_header_utime_h = yes; then
185   AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
188 AC_CHECK_DECLS([fprintf, stpcpy, strstr, sbrk, getenv, environ, getc_unlocked,
189                 snprintf, vsnprintf])
191 BFD_BINARY_FOPEN
193 # target-specific stuff:
195 # Canonicalize the secondary target names.
196 if test -n "$enable_targets"; then
197     for targ in `echo $enable_targets | sed 's/,/ /g'`
198     do
199         result=`$ac_config_sub $targ 2>/dev/null`
200         if test -n "$result"; then
201             canon_targets="$canon_targets $result"
202         else
203             # Allow targets that config.sub doesn't recognize, like "all".
204             canon_targets="$canon_targets $targ"
205         fi
206     done
209 all_targets=false
210 BUILD_NLMCONV=
211 NLMCONV_DEFS=
212 BUILD_SRCONV=
213 BUILD_DLLTOOL=
214 DLLTOOL_DEFS=
215 BUILD_WINDRES=
216 BUILD_DLLWRAP=
217 BUILD_MISC=
218 OBJDUMP_DEFS=
220 for targ in $target $canon_targets
222     if test "x$targ" = "xall"; then
223         all_targets=true
224         BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
225         BUILD_SRCONV='$(SRCONV_PROG)'
226         NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
227     else
228         case $targ in
229 changequote(,)dnl
230         i[3-7]86*-*-netware*) 
231 changequote([,])dnl
232           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
233           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
234           ;;
235         alpha*-*-netware*)
236           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
237           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
238           ;;
239         powerpc*-*-netware*)
240           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
241           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
242           ;;
243         sparc*-*-netware*)
244           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
245           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
246           ;;
247         esac
248         case $targ in
249         *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
250         esac
251         case $targ in
252         arm-epoc-pe*)
253           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
254           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM"
255           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
256           ;;
257         arm-*-pe* | arm-*-wince)
258           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
259           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
260           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
261           ;;
262         thumb-*-pe*)
263           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
264           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
265           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
266           ;;
267 changequote(,)dnl
268         i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
269 changequote([,])dnl
270           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
271           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
272           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
273           BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
274           ;;
275 changequote(,)dnl
276         i[3-7]86-*-interix)
277 changequote([,])dnl
278           BUILD_DLLTOOL='$(DLLTOOL_PROG)'
279           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
280           ;;
281 changequote(,)dnl
282         powerpc*-aix5.[01])
283 changequote([,])dnl
284           ;;
285         powerpc*-aix5.*)
286           OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
287           ;;
288         powerpc*-*-pe* | powerpc*-*-cygwin*)
289           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
290           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
291           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
292           ;;
293         sh*-*-pe)
294           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
295           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
296           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
297           ;;
298         mips*-*-pe)
299           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
300           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
301           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
302           ;;
303         mcore-*-pe)
304           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
305           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
306           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
307           ;;
308         mcore-*-elf)
309           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
310           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
311           ;;
312         esac
313     fi
314 done
316 if test "${with_windres+set}" = set; then
317           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
320 AC_SUBST(NLMCONV_DEFS)
321 AC_SUBST(BUILD_NLMCONV)
322 AC_SUBST(BUILD_SRCONV)
323 AC_SUBST(BUILD_DLLTOOL)
324 AC_SUBST(DLLTOOL_DEFS)
325 AC_SUBST(BUILD_WINDRES)
326 AC_SUBST(BUILD_DLLWRAP)
327 AC_SUBST(BUILD_MISC)
328 AC_SUBST(OBJDUMP_DEFS)
330 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
332 targ=$target
333 . $srcdir/../bfd/config.bfd
334 if test "x$targ_underscore" = "xyes"; then
335     UNDERSCORE=1
336 else
337     UNDERSCORE=0
339 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
340  [Define to 1 if user symbol names have a leading underscore, 0 if not.])
342 # Emulation 
343 for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
345   # Canonicalize the secondary target names.
346  result=`$ac_config_sub $targ_alias 2>/dev/null`
347  if test -n "$result"; then
348    targ=$result
349  else
350    targ=$targ_alias
351  fi
353  . ${srcdir}/configure.tgt
355   EMULATION=$targ_emul
356   EMULATION_VECTOR=$targ_emul_vector    
357 done
359 AC_SUBST(EMULATION)
360 AC_SUBST(EMULATION_VECTOR)
362 # Required for html and install-html
363 AC_SUBST(datarootdir)
364 AC_SUBST(docdir)
365 AC_SUBST(htmldir)
367 AC_OUTPUT(Makefile doc/Makefile po/Makefile.in:po/Make-in,
369 case "x$CONFIG_FILES" in
370 *) sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile ;;
371 esac