OSDN Git Service

abf8631e72dbffdf3d65b94faffdc32f42dc588e
[pf3gnuchains/pf3gnuchains3x.git] / binutils / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 AC_PREREQ(2.13)
4 AC_INIT(ar.c)
5
6 AC_CANONICAL_SYSTEM
7 AC_ISC_POSIX
8
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})
13
14 AM_PROG_LIBTOOL
15
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
31
32 build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
33
34 AC_ARG_ENABLE(werror,
35   [  --enable-werror    treat compile warnings as errors],
36   [case "${enableval}" in
37      yes | y) ERROR_ON_WARNING="yes" ;;
38      no | n)  ERROR_ON_WARNING="no" ;;
39      *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
40    esac])
41
42 # Enable -Werror by default, suppressing it only for --disable-werror
43 # or --disable-build-warnings.
44 if test "${ERROR_ON_WARNING}" != no
45 then
46   build_warnings="$build_warnings -Werror"
47 fi
48
49 AC_ARG_ENABLE(build-warnings,
50 [  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
51 [case "${enableval}" in
52   yes)  ;;
53   no)   build_warnings="-w";;
54   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
55         build_warnings="${build_warnings} ${t}";;
56   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
57         build_warnings="${t} ${build_warnings}";;
58   *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
59 esac
60 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
61   echo "Setting warning flags = $build_warnings" 6>&1
62 fi])dnl
63 WARN_CFLAGS=""
64 if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
65     WARN_CFLAGS="${build_warnings}"
66 fi
67 AC_SUBST(WARN_CFLAGS)
68
69 AM_CONFIG_HEADER(config.h:config.in)
70
71 if test -z "$target" ; then
72     AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
73 fi
74 if test -z "$host" ; then
75     AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
76 fi
77
78 AC_PROG_CC
79
80 AC_PROG_YACC
81 AM_PROG_LEX
82
83 ALL_LINGUAS="fr tr ja es sv da zh_CN ru ro rw"
84 CY_GNU_GETTEXT
85
86 AM_MAINTAINER_MODE
87 AC_EXEEXT
88 if test -n "$EXEEXT"; then
89   AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
90             [Does the platform use an executable suffix?])
91 fi
92 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
93                    [Suffix used for executables, if any.])
94
95 # host-specific stuff:
96
97 HDEFINES=
98
99 . ${srcdir}/../bfd/configure.host
100
101 AC_SUBST(HDEFINES)
102 AR=${AR-ar}
103 AC_SUBST(AR)
104 AC_PROG_RANLIB
105 AC_PROG_INSTALL
106
107 BFD_CC_FOR_BUILD
108
109 DEMANGLER_NAME=c++filt
110 case "${host}" in
111   *-*-go32* | *-*-msdos*)
112     DEMANGLER_NAME=cxxfilt
113 esac
114 AC_SUBST(DEMANGLER_NAME)
115
116 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
117 AC_HEADER_SYS_WAIT
118 AC_FUNC_ALLOCA
119 AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll)
120
121 # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
122 # needs to be defined for it
123 AC_MSG_CHECKING([for fopen64])
124 AC_CACHE_VAL(bu_cv_have_fopen64,
125 [AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
126 bu_cv_have_fopen64=yes,
127 [saved_CPPFLAGS=$CPPFLAGS
128  CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
129  AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
130 bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
131 bu_cv_have_fopen64=no)
132  CPPFLAGS=$saved_CPPFLAGS])])
133 AC_MSG_RESULT($bu_cv_have_fopen64)
134 if test "$bu_cv_have_fopen64" != no; then
135   AC_DEFINE([HAVE_FOPEN64], 1,
136             [Is fopen64 available?])
137 fi
138 AC_MSG_CHECKING([for stat64])
139 AC_CACHE_VAL(bu_cv_have_stat64,
140 [AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
141 bu_cv_have_stat64=yes,
142 [saved_CPPFLAGS=$CPPFLAGS
143  CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
144  AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
145 bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE",
146 bu_cv_have_stat64=no)
147  CPPFLAGS=$saved_CPPFLAGS])])
148 AC_MSG_RESULT($bu_cv_have_stat64)
149 if test "$bu_cv_have_stat64" != no; then
150   AC_DEFINE([HAVE_STAT64], 1,
151             [Is stat64 available?])
152 fi
153 if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \
154    || test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then
155   AC_DEFINE([_LARGEFILE64_SOURCE], 1,
156             [Enable LFS])
157   CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
158 fi
159
160 # Some systems have frexp only in -lm, not in -lc.
161 AC_SEARCH_LIBS(frexp, m)
162
163 AC_MSG_CHECKING(for time_t in time.h)
164 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
165 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
166 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
167 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
168 if test $bu_cv_decl_time_t_time_h = yes; then
169   AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
170             [Is the type time_t defined in <time.h>?])
171 fi
172
173 AC_MSG_CHECKING(for time_t in sys/types.h)
174 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
175 [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
176 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
177 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
178 if test $bu_cv_decl_time_t_types_h = yes; then
179   AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
180             [Is the type time_t defined in <sys/types.h>?])
181 fi
182
183 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
184 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
185 [AC_TRY_COMPILE([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);],
186 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
187 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
188 if test $bu_cv_decl_getopt_unistd_h = yes; then
189   AC_DEFINE([HAVE_DECL_GETOPT], 1,
190             [Is the prototype for getopt in <unistd.h> in the expected format?])
191 fi
192
193 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
194 # by default.
195 AC_MSG_CHECKING([for utime.h])
196 AC_CACHE_VAL(bu_cv_header_utime_h,
197 [AC_TRY_COMPILE([#include <sys/types.h>
198 #ifdef HAVE_TIME_H
199 #include <time.h>
200 #endif
201 #include <utime.h>],
202 [struct utimbuf s;],
203 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
204 AC_MSG_RESULT($bu_cv_header_utime_h)
205 if test $bu_cv_header_utime_h = yes; then
206   AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
207 fi
208
209 BFD_NEED_DECLARATION(fprintf)
210 BFD_NEED_DECLARATION(strstr)
211 BFD_NEED_DECLARATION(sbrk)
212 BFD_NEED_DECLARATION(getenv)
213 BFD_NEED_DECLARATION(environ)
214
215 BFD_BINARY_FOPEN
216
217 # target-specific stuff:
218
219 # Canonicalize the secondary target names.
220 if test -n "$enable_targets"; then
221     for targ in `echo $enable_targets | sed 's/,/ /g'`
222     do
223         result=`$ac_config_sub $targ 2>/dev/null`
224         if test -n "$result"; then
225             canon_targets="$canon_targets $result"
226         else
227             # Allow targets that config.sub doesn't recognize, like "all".
228             canon_targets="$canon_targets $targ"
229         fi
230     done
231 fi
232
233 all_targets=false
234 BUILD_NLMCONV=
235 NLMCONV_DEFS=
236 BUILD_SRCONV=
237 BUILD_DLLTOOL=
238 DLLTOOL_DEFS=
239 BUILD_WINDRES=
240 BUILD_DLLWRAP=
241 BUILD_MISC=
242 OBJDUMP_DEFS=
243
244 for targ in $target $canon_targets
245 do
246     if test "x$targ" = "xall"; then
247         all_targets=true
248         BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
249         BUILD_SRCONV='$(SRCONV_PROG)'
250         NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
251     else
252         case $targ in
253 changequote(,)dnl
254         i[3-7]86*-*-netware*) 
255 changequote([,])dnl
256           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
257           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
258           ;;
259         alpha*-*-netware*)
260           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
261           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
262           ;;
263         powerpc*-*-netware*)
264           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
265           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
266           ;;
267         sparc*-*-netware*)
268           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
269           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
270           ;;
271         esac
272         case $targ in
273         *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
274         esac
275         case $targ in
276         arm-epoc-pe*)
277           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
278           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM"
279           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
280           ;;
281         arm-*-pe* | arm-*-wince)
282           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
283           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
284           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
285           ;;
286         thumb-*-pe*)
287           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
288           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
289           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
290           ;;
291         arm*-* | xscale-* | strongarm-* | d10v-*)
292           OBJDUMP_DEFS="-DDISASSEMBLER_NEEDS_RELOCS"
293           ;;
294 changequote(,)dnl
295         i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
296 changequote([,])dnl
297           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
298           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
299           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
300           BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
301           ;;
302 changequote(,)dnl
303         i[3-7]86-*-interix)
304 changequote([,])dnl
305           BUILD_DLLTOOL='$(DLLTOOL_PROG)'
306           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
307           ;;
308 changequote(,)dnl
309         powerpc*-aix5.[01])
310 changequote([,])dnl
311           ;;
312         powerpc*-aix5.*)
313           OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
314           ;;
315         powerpc*-*-pe* | powerpc*-*-cygwin*)
316           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
317           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
318           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
319           ;;
320         sh*-*-pe)
321           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
322           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
323           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
324           ;;
325         mips*-*-pe)
326           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
327           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
328           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
329           ;;
330         mcore-*-pe)
331           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
332           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
333           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
334           ;;
335         mcore-*-elf)
336           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
337           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
338           ;;
339         esac
340     fi
341 done
342
343 if test "${with_windres+set}" = set; then
344           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
345 fi
346
347 AC_SUBST(NLMCONV_DEFS)
348 AC_SUBST(BUILD_NLMCONV)
349 AC_SUBST(BUILD_SRCONV)
350 AC_SUBST(BUILD_DLLTOOL)
351 AC_SUBST(DLLTOOL_DEFS)
352 AC_SUBST(BUILD_WINDRES)
353 AC_SUBST(BUILD_DLLWRAP)
354 AC_SUBST(BUILD_MISC)
355 AC_SUBST(OBJDUMP_DEFS)
356
357 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
358
359 targ=$target
360 . $srcdir/../bfd/config.bfd
361 if test "x$targ_underscore" = "xyes"; then
362     UNDERSCORE=1
363 else
364     UNDERSCORE=0
365 fi
366 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
367  [Define to 1 if user symbol names have a leading underscore, 0 if not.])
368
369 # Emulation 
370 for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
371 do
372   # Canonicalize the secondary target names.
373  result=`$ac_config_sub $targ_alias 2>/dev/null`
374  if test -n "$result"; then
375    targ=$result
376  else
377    targ=$targ_alias
378  fi
379
380  . ${srcdir}/configure.tgt
381
382   EMULATION=$targ_emul
383   EMULATION_VECTOR=$targ_emul_vector    
384 done
385
386 AC_SUBST(EMULATION)
387 AC_SUBST(EMULATION_VECTOR)
388
389 AC_OUTPUT(Makefile doc/Makefile po/Makefile.in:po/Make-in,
390 [
391 case "x$CONFIG_FILES" in
392 *) sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile ;;
393 esac
394 ])