]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/binutils/binutils/configure.in
Initial import of GNU binutils version 2.8.1. Believe it or not,
[FreeBSD/FreeBSD.git] / contrib / binutils / 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.  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
108 fi
109
110 AC_SUBST(BFDLIB)
111 AC_SUBST(OPCODES)
112
113 BFD_CC_FOR_BUILD
114
115 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
116 AC_HEADER_SYS_WAIT
117 AC_FUNC_ALLOCA
118 AC_CHECK_FUNCS(sbrk utimes)
119 dnl Temporary workaround for bug in autoconf 2.12.  When the bug is
120 dnl fixed, we can just call AC_FUNC_VFORK in all cases.
121 if test "x$cross_compiling" = "xno"; then
122   AC_FUNC_VFORK
123 else
124   AC_CHECK_FUNC(vfork, , AC_DEFINE(vfork, fork))
125 fi
126
127 AC_MSG_CHECKING(for time_t in time.h)
128 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
129 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
130 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
131 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
132 if test $bu_cv_decl_time_t_time_h = yes; then
133   AC_DEFINE([HAVE_TIME_T_IN_TIME_H])
134 fi
135
136 AC_MSG_CHECKING(for time_t in sys/types.h)
137 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
138 [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
139 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
140 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
141 if test $bu_cv_decl_time_t_types_h = yes; then
142   AC_DEFINE([HAVE_TIME_T_IN_TYPES_H])
143 fi
144
145 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
146 # by default.
147 AC_MSG_CHECKING([for utime.h])
148 AC_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;],
155 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
156 AC_MSG_RESULT($bu_cv_header_utime_h)
157 if test $bu_cv_header_utime_h = yes; then
158   AC_DEFINE(HAVE_GOOD_UTIME_H)
159 fi
160
161 BFD_NEED_DECLARATION(fprintf)
162 BFD_NEED_DECLARATION(strstr)
163 BFD_NEED_DECLARATION(sbrk)
164 BFD_NEED_DECLARATION(getenv)
165
166 BFD_BINARY_FOPEN
167
168 # target-specific stuff:
169
170 # Canonicalize the secondary target names.
171 if test -n "$enable_targets"; then
172     for targ in `echo $enable_targets | sed 's/,/ /g'`
173     do
174         result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null`
175         if test -n "$result"; then
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
182 fi
183
184 all_targets=false
185 BUILD_NLMCONV=
186 NLMCONV_DEFS=
187 BUILD_SRCONV=
188 BUILD_DLLTOOL=
189 DLLTOOL_DEFS=
190
191 for targ in $target $canon_targets
192 do
193     if test "x$targ" = "xall"; then
194         all_targets=true
195         BUILD_NLMCONV='$(NLMCONV_PROG)'
196         BUILD_SRCONV='$(SRCONV_PROG)'
197         NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
198     else
199         case $targ in
200 changequote(,)dnl
201         i[3456]86*-*-netware*) 
202 changequote([,])dnl
203           BUILD_NLMCONV='$(NLMCONV_PROG)'
204           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
205           ;;
206         alpha*-*-netware*)
207           BUILD_NLMCONV='$(NLMCONV_PROG)'
208           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
209           ;;
210         powerpc*-*-netware*)
211           BUILD_NLMCONV='$(NLMCONV_PROG)'
212           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
213           ;;
214         sparc*-*-netware*)
215           BUILD_NLMCONV='$(NLMCONV_PROG)'
216           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
217           ;;
218         esac
219         case $targ in
220         *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
221         esac
222         case $targ in
223         arm-*pe*)
224           BUILD_DLLTOOL='$(DLLTOOL_PROG)'
225           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
226          ;;
227 changequote(,)dnl
228         i[3-6]86-*pe* | i[3-6]86-*-cygwin32)
229 changequote([,])dnl
230           BUILD_DLLTOOL='$(DLLTOOL_PROG)'
231           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
232          ;;
233         powerpc*-*-*pe* | powerpc*-*-cygwin32)
234           BUILD_DLLTOOL='$(DLLTOOL_PROG)'
235           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
236          ;;
237         esac
238     fi
239 done
240
241 AC_SUBST(NLMCONV_DEFS)
242 AC_SUBST(BUILD_NLMCONV)
243 AC_SUBST(BUILD_SRCONV)
244 AC_SUBST(BUILD_DLLTOOL)
245 AC_SUBST(DLLTOOL_DEFS)
246
247 targ=$target
248 . $srcdir/../bfd/config.bfd
249 if test "x$targ_underscore" = "xyes"; then
250     UNDERSCORE=1
251 else
252     UNDERSCORE=0
253 fi
254 AC_SUBST(UNDERSCORE)
255
256 AC_OUTPUT(Makefile,
257 [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])