Rename 'index' to 'offset'
[binutils.git] / binutils / configure.in
blobb38f12dba79266b8d729042b81f0c72df003b3f7
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 AC_PREREQ(2.13)
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 build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
33 AC_ARG_ENABLE(build-warnings,
34 [  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
35 [case "${enableval}" in
36   yes)  ;;
37   no)   build_warnings="-w";;
38   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
39         build_warnings="${build_warnings} ${t}";;
40   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
41         build_warnings="${t} ${build_warnings}";;
42   *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
43 esac
44 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
45   echo "Setting warning flags = $build_warnings" 6>&1
46 fi])dnl
47 WARN_CFLAGS=""
48 if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
49     WARN_CFLAGS="${build_warnings}"
51 AC_SUBST(WARN_CFLAGS)
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
64 AC_PROG_YACC
65 AM_PROG_LEX
67 ALL_LINGUAS="fr tr ja es sv da"
68 CY_GNU_GETTEXT
70 AM_MAINTAINER_MODE
71 AC_EXEEXT
72 if test -n "$EXEEXT"; then
73   AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
74             [Does the platform use an executable suffix?])
76 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
77                    [Suffix used for executables, if any.])
79 # host-specific stuff:
81 HDEFINES=
83 . ${srcdir}/../bfd/configure.host
85 AC_SUBST(HDEFINES)
86 AR=${AR-ar}
87 AC_SUBST(AR)
88 AC_PROG_RANLIB
89 AC_PROG_INSTALL
91 BFD_CC_FOR_BUILD
93 DEMANGLER_NAME=c++filt
94 case "${host}" in
95   *-*-go32* | *-*-msdos*)
96     DEMANGLER_NAME=cxxfilt
97 esac
98 AC_SUBST(DEMANGLER_NAME)
100 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
101 AC_HEADER_SYS_WAIT
102 AC_FUNC_ALLOCA
103 AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll)
105 # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
106 # needs to be defined for it
107 AC_MSG_CHECKING([for fopen64])
108 AC_CACHE_VAL(bu_cv_have_fopen64,
109 [AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
110 bu_cv_have_fopen64=yes,
111 [saved_CPPFLAGS=$CPPFLAGS
112  CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
113  AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
114 bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
115 bu_cv_have_fopen64=no)
116  CPPFLAGS=$saved_CPPFLAGS])])
117 AC_MSG_RESULT($bu_cv_have_fopen64)
118 if test "$bu_cv_have_fopen64" != no; then
119   AC_DEFINE([HAVE_FOPEN64], 1,
120             [Is fopen64 available?])
121   if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE"; then
122     AC_DEFINE([_LARGEFILE64_SOURCE], 1,
123               [Enable LFS])
124   fi
127 # Some systems have frexp only in -lm, not in -lc.
128 AC_SEARCH_LIBS(frexp, m)
130 AC_MSG_CHECKING(for time_t in time.h)
131 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
132 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
133 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
134 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
135 if test $bu_cv_decl_time_t_time_h = yes; then
136   AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
137             [Is the type time_t defined in <time.h>?])
140 AC_MSG_CHECKING(for time_t in sys/types.h)
141 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
142 [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
143 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
144 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
145 if test $bu_cv_decl_time_t_types_h = yes; then
146   AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
147             [Is the type time_t defined in <sys/types.h>?])
150 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
151 # by default.
152 AC_MSG_CHECKING([for utime.h])
153 AC_CACHE_VAL(bu_cv_header_utime_h,
154 [AC_TRY_COMPILE([#include <sys/types.h>
155 #ifdef HAVE_TIME_H
156 #include <time.h>
157 #endif
158 #include <utime.h>],
159 [struct utimbuf s;],
160 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
161 AC_MSG_RESULT($bu_cv_header_utime_h)
162 if test $bu_cv_header_utime_h = yes; then
163   AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
166 BFD_NEED_DECLARATION(fprintf)
167 BFD_NEED_DECLARATION(strstr)
168 BFD_NEED_DECLARATION(sbrk)
169 BFD_NEED_DECLARATION(getenv)
170 BFD_NEED_DECLARATION(environ)
172 BFD_BINARY_FOPEN
174 # target-specific stuff:
176 # Canonicalize the secondary target names.
177 if test -n "$enable_targets"; then
178     for targ in `echo $enable_targets | sed 's/,/ /g'`
179     do
180         result=`$ac_config_sub $targ 2>/dev/null`
181         if test -n "$result"; then
182             canon_targets="$canon_targets $result"
183         else
184             # Allow targets that config.sub doesn't recognize, like "all".
185             canon_targets="$canon_targets $targ"
186         fi
187     done
190 all_targets=false
191 BUILD_NLMCONV=
192 NLMCONV_DEFS=
193 BUILD_SRCONV=
194 BUILD_DLLTOOL=
195 DLLTOOL_DEFS=
196 BUILD_WINDRES=
197 BUILD_DLLWRAP=
198 BUILD_MISC=
199 OBJDUMP_DEFS=
201 for targ in $target $canon_targets
203     if test "x$targ" = "xall"; then
204         all_targets=true
205         BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
206         BUILD_SRCONV='$(SRCONV_PROG)'
207         NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
208     else
209         case $targ in
210 changequote(,)dnl
211         i[3456]86*-*-netware*) 
212 changequote([,])dnl
213           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
214           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
215           ;;
216         alpha*-*-netware*)
217           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
218           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
219           ;;
220         powerpc*-*-netware*)
221           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
222           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
223           ;;
224         sparc*-*-netware*)
225           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
226           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
227           ;;
228         esac
229         case $targ in
230         *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
231         esac
232         case $targ in
233         arm-epoc-pe*)
234           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
235           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM"
236           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
237           ;;
238         arm-pe* | arm-*-wince)
239           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
240           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
241           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
242           ;;
243         thumb-pe*)
244           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
245           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
246           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
247           ;;
248         arm*-* | xscale-* | strongarm-* | d10v-*)
249           OBJDUMP_DEFS="-DDISASSEMBLER_NEEDS_RELOCS"
250           ;;
251 changequote(,)dnl
252         i[3-6]86-pe* | i[3-6]86-*-cygwin* | i[3-6]86-*-mingw32** | i[3-6]86-*-netbsdpe*)
253 changequote([,])dnl
254           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
255           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
256           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
257           BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
258           ;;
259         i[3-6]86-*-interix)
260           BUILD_DLLTOOL='$(DLLTOOL_PROG)'
261           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
262           ;;
263         powerpc*-*-pe* | powerpc*-*-cygwin*)
264           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
265           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
266           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
267           ;;
268         sh*-*-pe)
269           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
270           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
271           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
272           ;;
273         mips*-*-pe)
274           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
275           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
276           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
277           ;;
278         mcore-pe)
279           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
280           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
281           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
282           ;;
283         mcore-*elf)
284           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
285           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
286           ;;
287         c4x-*-* | tic4x-*-*)
288           OBJDUMP_DEFS="$OBJDUMP_DEFS -DSKIP_ZEROES=32"
289           ;;
290         ia64-*-*)
291           OBJDUMP_DEFS="$OBJDUMP_DEFS -DSKIP_ZEROES=16"
292           ;;
293         esac
294     fi
295 done
297 if test "${with_windres+set}" = set; then
298           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
301 AC_SUBST(NLMCONV_DEFS)
302 AC_SUBST(BUILD_NLMCONV)
303 AC_SUBST(BUILD_SRCONV)
304 AC_SUBST(BUILD_DLLTOOL)
305 AC_SUBST(DLLTOOL_DEFS)
306 AC_SUBST(BUILD_WINDRES)
307 AC_SUBST(BUILD_DLLWRAP)
308 AC_SUBST(BUILD_MISC)
309 AC_SUBST(OBJDUMP_DEFS)
311 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
313 targ=$target
314 . $srcdir/../bfd/config.bfd
315 if test "x$targ_underscore" = "xyes"; then
316     UNDERSCORE=1
317 else
318     UNDERSCORE=0
320 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
321  [Define to 1 if user symbol names have a leading underscore, 0 if not.])
323 # Emulation 
324 for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
326   # Canonicalize the secondary target names.
327  result=`$ac_config_sub $targ_alias 2>/dev/null`
328  if test -n "$result"; then
329    targ=$result
330  else
331    targ=$targ_alias
332  fi
334  . ${srcdir}/configure.tgt
336   EMULATION=$targ_emul
337   EMULATION_VECTOR=$targ_emul_vector    
338 done
340 AC_SUBST(EMULATION)
341 AC_SUBST(EMULATION_VECTOR)
343 AC_OUTPUT(Makefile doc/Makefile po/Makefile.in:po/Make-in,
345 case "x$CONFIG_FILES" in
346 *) sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile ;;
347 esac