* configure.in: Add AC_FUNC_ALLOCA.
[deliverable/binutils-gdb.git] / binutils / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 AC_PREREQ(2.5)
4 AC_INIT(ar.c)
5
6 AC_ARG_ENABLE(targets,
7 [ --enable-targets alternative target configurations],
8 [case "${enableval}" in
9 yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
10 ;;
11 no) enable_targets= ;;
12 *) enable_targets=$enableval ;;
13 esac])dnl
14 AC_ARG_ENABLE(shared,
15 [ --enable-shared build shared BFD library],
16 [case "${enableval}" in
17 yes) shared=true shared_bfd=true shared_opcodes=true ;;
18 no) shared=false ;;
19 *bfd*opcodes*) shared=true shared_bfd=true shared_opcodes=true ;;
20 *opcodes*bfd*) shared=true shared_bfd=true shared_opcodes=true ;;
21 *bfd*) shared=true shared_bfd=true ;;
22 *opcodes*) shared=true shared_opcodes=true ;;
23 *) shared=false ;;
24 esac])dnl
25 AC_ARG_ENABLE(commonbfdlib,
26 [ --enable-commonbfdlib build shared BFD/opcodes/libiberty library],
27 [case "${enableval}" in
28 yes) commonbfdlib=true ;;
29 no) commonbfdlib=false ;;
30 *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
31 esac])dnl
32
33 AC_CONFIG_HEADER(config.h:config.in)
34
35 AC_CONFIG_AUX_DIR(`cd $srcdir/..; pwd`)
36 AC_CANONICAL_SYSTEM
37 if test -z "$target" ; then
38 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
39 fi
40 if test -z "$host" ; then
41 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
42 fi
43 AC_ARG_PROGRAM
44
45 # host-specific stuff:
46
47 HDEFINES=
48 HLDFLAGS=
49 HLDENV=
50 RPATH_ENVVAR=LD_LIBRARY_PATH
51
52 AC_PROG_CC
53
54 . ${srcdir}/../bfd/configure.host
55
56 AC_SUBST(HDEFINES)
57 AC_SUBST(HLDFLAGS)
58 AC_SUBST(HLDENV)
59 AC_SUBST(RPATH_ENVVAR)
60 AR=${AR-ar}
61 AC_SUBST(AR)
62 AC_PROG_RANLIB
63 AC_PROG_INSTALL
64
65 # For most hosts we can use a simple definition to pick up the BFD and
66 # opcodes libraries. However, if we are building shared libraries, we
67 # need to handle some hosts specially.
68 BFDLIB='-L../bfd -lbfd'
69 OPCODES='-L../opcodes -lopcodes'
70
71 case "${host}" in
72 *-*-sunos*)
73 # On SunOS, we must link against the name we are going to install,
74 # not -lbfd, since SunOS does not support SONAME.
75 if test "${shared_bfd}" = "true"; then
76 BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`'
77 fi
78 if test "${shared_opcodes}" = "true"; then
79 OPCODES='-L../opcodes -l`echo opcodes | sed '"'"'$(program_transform_name)'"'"'`'
80 fi
81 ;;
82 alpha*-*-osf*)
83 # On Alpha OSF/1, the native linker searches all the -L
84 # directories for any LIB.so files, and only then searches for any
85 # LIB.a files. That means that if there is an installed
86 # libbfd.so, but this build is not done with --enable-shared, the
87 # link will wind up being against the install libbfd.so rather
88 # than the newly built libbfd. To avoid this, we must explicitly
89 # link against libbfd.a when --enable-shared is not used.
90 if test "${shared_bfd}" != "true"; then
91 BFDLIB='../bfd/libbfd.a'
92 fi
93 if test "${shared_opcodes}" != "true"; then
94 OPCODES='../opcodes/libopcodes.a'
95 fi
96 ;;
97 esac
98
99 if test "${commonbfdlib}" = "true"; then
100 # when a shared libbfd is built with --enable-commonbfdlib,
101 # all of libopcodes is available in libbfd.so
102 OPCODES=
103 fi
104
105 AC_SUBST(BFDLIB)
106 AC_SUBST(OPCODES)
107
108 BFD_CC_FOR_BUILD
109
110 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
111 AC_HEADER_SYS_WAIT
112 AC_FUNC_ALLOCA
113 AC_CHECK_FUNCS(sbrk utimes)
114 dnl Temporary workaround for bug in autoconf 2.12. When the bug is
115 dnl fixed, we can just call AC_FUNC_VFORK in all cases.
116 if test "x$cross_compiling" = "xno"; then
117 AC_FUNC_VFORK
118 else
119 AC_CHECK_FUNC(vfork, , AC_DEFINE(vfork, fork))
120 fi
121
122 AC_MSG_CHECKING(for time_t in time.h)
123 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
124 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
125 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
126 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
127 if test $bu_cv_decl_time_t_time_h = yes; then
128 AC_DEFINE([HAVE_TIME_T_IN_TIME_H])
129 fi
130
131 AC_MSG_CHECKING(for time_t in sys/types.h)
132 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
133 [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
134 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
135 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
136 if test $bu_cv_decl_time_t_types_h = yes; then
137 AC_DEFINE([HAVE_TIME_T_IN_TYPES_H])
138 fi
139
140 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
141 # by default.
142 AC_MSG_CHECKING([for utime.h])
143 AC_CACHE_VAL(bu_cv_header_utime_h,
144 [AC_TRY_COMPILE([#include <sys/types.h>
145 #ifdef HAVE_TIME_H
146 #include <time.h>
147 #endif
148 #include <utime.h>],
149 [struct utimbuf s;],
150 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
151 AC_MSG_RESULT($bu_cv_header_utime_h)
152 if test $bu_cv_header_utime_h = yes; then
153 AC_DEFINE(HAVE_GOOD_UTIME_H)
154 fi
155
156 BFD_NEED_DECLARATION(fprintf)
157 BFD_NEED_DECLARATION(strstr)
158 BFD_NEED_DECLARATION(sbrk)
159 BFD_NEED_DECLARATION(getenv)
160
161 BFD_BINARY_FOPEN
162
163 # target-specific stuff:
164
165 # Canonicalize the secondary target names.
166 if test -n "$enable_targets"; then
167 for targ in `echo $enable_targets | sed 's/,/ /g'`
168 do
169 result=`$ac_config_sub $targ 2>/dev/null`
170 if test -n "$result"; then
171 canon_targets="$canon_targets $result"
172 else
173 # Allow targets that config.sub doesn't recognize, like "all".
174 canon_targets="$canon_targets $targ"
175 fi
176 done
177 fi
178
179 all_targets=false
180 BUILD_NLMCONV=
181 NLMCONV_DEFS=
182 BUILD_SRCONV=
183 BUILD_DLLTOOL=
184 DLLTOOL_DEFS=
185
186 for targ in $target $canon_targets
187 do
188 if test "x$targ" = "xall"; then
189 all_targets=true
190 BUILD_NLMCONV='$(NLMCONV_PROG)'
191 BUILD_SRCONV='$(SRCONV_PROG)'
192 NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
193 else
194 case $targ in
195 changequote(,)dnl
196 i[3456]86*-*-netware*)
197 changequote([,])dnl
198 BUILD_NLMCONV='$(NLMCONV_PROG)'
199 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
200 ;;
201 alpha*-*-netware*)
202 BUILD_NLMCONV='$(NLMCONV_PROG)'
203 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
204 ;;
205 powerpc*-*-netware*)
206 BUILD_NLMCONV='$(NLMCONV_PROG)'
207 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
208 ;;
209 sparc*-*-netware*)
210 BUILD_NLMCONV='$(NLMCONV_PROG)'
211 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
212 ;;
213 esac
214 case $targ in
215 *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
216 esac
217 case $targ in
218 arm-*pe*)
219 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
220 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
221 ;;
222 changequote(,)dnl
223 i[3-6]86-*pe* | i[3-6]86-*-cygwin32)
224 changequote([,])dnl
225 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
226 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
227 ;;
228 powerpc*-*-*pe* | powerpc*-*-cygwin32)
229 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
230 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
231 ;;
232 esac
233 fi
234 done
235
236 AC_SUBST(NLMCONV_DEFS)
237 AC_SUBST(BUILD_NLMCONV)
238 AC_SUBST(BUILD_SRCONV)
239 AC_SUBST(BUILD_DLLTOOL)
240 AC_SUBST(DLLTOOL_DEFS)
241
242 targ=$target
243 . $srcdir/../bfd/config.bfd
244 if test "x$targ_underscore" = "xyes"; then
245 UNDERSCORE=1
246 else
247 UNDERSCORE=0
248 fi
249 AC_SUBST(UNDERSCORE)
250
251 AC_OUTPUT(Makefile,
252 [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])
This page took 0.041815 seconds and 5 git commands to generate.