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