* Makefile.am: New file, based on old Makefile.in.
[deliverable/binutils-gdb.git] / binutils / configure.in
CommitLineData
5ab6ca68
ILT
1dnl Process this file with autoconf to produce a configure script.
2dnl
33106b60 3AC_PREREQ(2.5)
5ab6ca68
ILT
4AC_INIT(ar.c)
5
6AC_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 ;;
13esac])dnl
36fb98be
ILT
14AC_ARG_ENABLE(shared,
15[ --enable-shared build shared BFD library],
16[case "${enableval}" in
33106b60 17 yes) shared=true shared_bfd=true shared_opcodes=true ;;
36fb98be 18 no) shared=false ;;
33106b60
ILT
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 ;;
24esac])dnl
25AC_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]) ;;
36fb98be 31esac])dnl
5ab6ca68 32
320d4f29 33AC_CONFIG_HEADER(config.h:config.in)
5ab6ca68
ILT
34
35AC_CONFIG_AUX_DIR(`cd $srcdir/..; pwd`)
36AC_CANONICAL_SYSTEM
37if test -z "$target" ; then
38 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
39fi
40if test -z "$host" ; then
41 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
42fi
43AC_ARG_PROGRAM
db19f828 44
5ab6ca68 45# host-specific stuff:
db19f828 46
5ab6ca68 47HDEFINES=
36fb98be 48HLDFLAGS=
33106b60 49HLDENV=
efa86453 50RPATH_ENVVAR=LD_LIBRARY_PATH
db19f828 51
33106b60
ILT
52AC_PROG_CC
53
b5775df3
DHW
54. ${srcdir}/../bfd/configure.host
55
5ab6ca68 56AC_SUBST(HDEFINES)
36fb98be 57AC_SUBST(HLDFLAGS)
33106b60 58AC_SUBST(HLDENV)
efa86453 59AC_SUBST(RPATH_ENVVAR)
5ab6ca68
ILT
60AR=${AR-ar}
61AC_SUBST(AR)
62AC_PROG_RANLIB
63AC_PROG_INSTALL
64
36fb98be
ILT
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.
68BFDLIB='-L../bfd -lbfd'
69OPCODES='-L../opcodes -lopcodes'
33106b60
ILT
70
71case "${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
36fb98be 76 BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`'
33106b60
ILT
77 fi
78 if test "${shared_opcodes}" = "true"; then
36fb98be 79 OPCODES='-L../opcodes -l`echo opcodes | sed '"'"'$(program_transform_name)'"'"'`'
33106b60
ILT
80 fi
81 ;;
82alpha*-*-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 ;;
97esac
98
99if test "${commonbfdlib}" = "true"; then
100 # when a shared libbfd is built with --enable-commonbfdlib,
1d371d35
ILT
101 # all of libopcodes is available in libbfd.so. Unfortunately, on
102 # HP/UX, when using gcc -g, the linker does a static link, so we
103 # need to continue linking against opcodes on that platform.
104 case "${host}" in
105 *-*-hpux*) ;;
106 *) OPCODES= ;;
107 esac
36fb98be 108fi
33106b60 109
36fb98be
ILT
110AC_SUBST(BFDLIB)
111AC_SUBST(OPCODES)
112
320d4f29
ILT
113BFD_CC_FOR_BUILD
114
5ab6ca68 115AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
ae0daa11 116AC_HEADER_SYS_WAIT
33106b60 117AC_FUNC_ALLOCA
5ab6ca68 118AC_CHECK_FUNCS(sbrk utimes)
33106b60
ILT
119dnl Temporary workaround for bug in autoconf 2.12. When the bug is
120dnl fixed, we can just call AC_FUNC_VFORK in all cases.
121if test "x$cross_compiling" = "xno"; then
122 AC_FUNC_VFORK
123else
124 AC_CHECK_FUNC(vfork, , AC_DEFINE(vfork, fork))
125fi
5ab6ca68
ILT
126
127AC_MSG_CHECKING(for time_t in time.h)
128AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
129[AC_TRY_COMPILE([#include <time.h>], [time_t i;],
130bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
131AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
132if test $bu_cv_decl_time_t_time_h = yes; then
133 AC_DEFINE([HAVE_TIME_T_IN_TIME_H])
134fi
135
136AC_MSG_CHECKING(for time_t in sys/types.h)
137AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
138[AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
139bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
140AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
141if test $bu_cv_decl_time_t_types_h = yes; then
142 AC_DEFINE([HAVE_TIME_T_IN_TYPES_H])
143fi
144
145# Under Next 3.2 <utime.h> apparently does not define struct utimbuf
146# by default.
147AC_MSG_CHECKING([for utime.h])
148AC_CACHE_VAL(bu_cv_header_utime_h,
149[AC_TRY_COMPILE([#include <sys/types.h>
150#ifdef HAVE_TIME_H
151#include <time.h>
152#endif
153#include <utime.h>],
154[struct utimbuf s;],
155bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
156AC_MSG_RESULT($bu_cv_header_utime_h)
157if test $bu_cv_header_utime_h = yes; then
158 AC_DEFINE(HAVE_GOOD_UTIME_H)
159fi
160
36fb98be 161BFD_NEED_DECLARATION(fprintf)
33106b60
ILT
162BFD_NEED_DECLARATION(strstr)
163BFD_NEED_DECLARATION(sbrk)
164BFD_NEED_DECLARATION(getenv)
5ab6ca68 165
320d4f29 166BFD_BINARY_FOPEN
5ab6ca68
ILT
167
168# target-specific stuff:
b5775df3
DHW
169
170# Canonicalize the secondary target names.
5ab6ca68 171if test -n "$enable_targets"; then
99ac7754 172 for targ in `echo $enable_targets | sed 's/,/ /g'`
b5775df3 173 do
1d371d35 174 result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null`
5ab6ca68 175 if test -n "$result"; then
b5775df3
DHW
176 canon_targets="$canon_targets $result"
177 else
178 # Allow targets that config.sub doesn't recognize, like "all".
179 canon_targets="$canon_targets $targ"
180 fi
181 done
b5775df3
DHW
182fi
183
184all_targets=false
5ab6ca68
ILT
185BUILD_NLMCONV=
186NLMCONV_DEFS=
187BUILD_SRCONV=
188BUILD_DLLTOOL=
189DLLTOOL_DEFS=
1d371d35 190BUILD_WINDRES=
b5775df3
DHW
191
192for targ in $target $canon_targets
193do
5ab6ca68 194 if test "x$targ" = "xall"; then
b5775df3 195 all_targets=true
5ab6ca68
ILT
196 BUILD_NLMCONV='$(NLMCONV_PROG)'
197 BUILD_SRCONV='$(SRCONV_PROG)'
198 NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
b5775df3
DHW
199 else
200 case $targ in
5ab6ca68 201changequote(,)dnl
33106b60 202 i[3456]86*-*-netware*)
5ab6ca68
ILT
203changequote([,])dnl
204 BUILD_NLMCONV='$(NLMCONV_PROG)'
205 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
99ac7754
JM
206 ;;
207 alpha*-*-netware*)
5ab6ca68
ILT
208 BUILD_NLMCONV='$(NLMCONV_PROG)'
209 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
99ac7754
JM
210 ;;
211 powerpc*-*-netware*)
5ab6ca68
ILT
212 BUILD_NLMCONV='$(NLMCONV_PROG)'
213 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
99ac7754
JM
214 ;;
215 sparc*-*-netware*)
5ab6ca68
ILT
216 BUILD_NLMCONV='$(NLMCONV_PROG)'
217 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
99ac7754 218 ;;
b5775df3 219 esac
b5775df3 220 case $targ in
5ab6ca68 221 *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
b5775df3 222 esac
99ac7754
JM
223 case $targ in
224 arm-*pe*)
5ab6ca68
ILT
225 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
226 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
1d371d35 227 BUILD_WINDRES='$(WINDRES_PROG)'
99ac7754 228 ;;
5ab6ca68 229changequote(,)dnl
36fb98be 230 i[3-6]86-*pe* | i[3-6]86-*-cygwin32)
5ab6ca68
ILT
231changequote([,])dnl
232 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
233 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
1d371d35 234 BUILD_WINDRES='$(WINDRES_PROG)'
99ac7754 235 ;;
36fb98be
ILT
236 powerpc*-*-*pe* | powerpc*-*-cygwin32)
237 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
238 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
1d371d35 239 BUILD_WINDRES='$(WINDRES_PROG)'
36fb98be 240 ;;
99ac7754 241 esac
b5775df3
DHW
242 fi
243done
244
5ab6ca68
ILT
245AC_SUBST(NLMCONV_DEFS)
246AC_SUBST(BUILD_NLMCONV)
247AC_SUBST(BUILD_SRCONV)
248AC_SUBST(BUILD_DLLTOOL)
249AC_SUBST(DLLTOOL_DEFS)
1d371d35 250AC_SUBST(BUILD_WINDRES)
99ac7754 251
fe48a154
ILT
252targ=$target
253. $srcdir/../bfd/config.bfd
254if test "x$targ_underscore" = "xyes"; then
5ab6ca68 255 UNDERSCORE=1
6f88f031 256else
5ab6ca68 257 UNDERSCORE=0
6f88f031 258fi
5ab6ca68
ILT
259AC_SUBST(UNDERSCORE)
260
261AC_OUTPUT(Makefile,
320d4f29 262[case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])
This page took 0.189073 seconds and 4 git commands to generate.