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