OSDN Git Service

Based on patches from Mumit Khan <khan@xraylith.wisc.EDU>:
[pf3gnuchains/pf3gnuchains3x.git] / binutils / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 AC_PREREQ(2.13)
4 AC_INIT(ar.c)
5
6 AC_CANONICAL_SYSTEM
7
8 AM_INIT_AUTOMAKE(binutils, 2.9.4)
9
10 AM_PROG_LIBTOOL
11
12 AC_ARG_ENABLE(targets,
13 [  --enable-targets        alternative target configurations],
14 [case "${enableval}" in
15   yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
16             ;;
17   no)       enable_targets= ;;
18   *)        enable_targets=$enableval ;;
19 esac])dnl
20 AC_ARG_ENABLE(commonbfdlib,
21 [  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library],
22 [case "${enableval}" in
23   yes) commonbfdlib=true ;;
24   no)  commonbfdlib=false ;;
25   *)   AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
26 esac])dnl
27
28 AM_CONFIG_HEADER(config.h:config.in)
29
30 if test -z "$target" ; then
31     AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
32 fi
33 if test -z "$host" ; then
34     AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
35 fi
36
37 AC_PROG_CC
38
39 AC_PROG_YACC
40 AM_PROG_LEX
41
42 ALL_LINGUAS=
43 CY_GNU_GETTEXT
44
45 AM_MAINTAINER_MODE
46 AC_EXEEXT
47 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
48                    [Suffix used for executables, if any.])
49
50 # host-specific stuff:
51
52 HDEFINES=
53
54 . ${srcdir}/../bfd/configure.host
55
56 AC_SUBST(HDEFINES)
57 AR=${AR-ar}
58 AC_SUBST(AR)
59 AC_PROG_RANLIB
60 AC_PROG_INSTALL
61
62 BFD_CC_FOR_BUILD
63
64 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
65 AC_HEADER_SYS_WAIT
66 AC_FUNC_ALLOCA
67 AC_CHECK_FUNCS(sbrk utimes)
68
69 # Some systems have frexp only in -lm, not in -lc.
70 AC_SEARCH_LIBS(frexp, -lm)
71
72 AC_MSG_CHECKING(for time_t in time.h)
73 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
74 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
75 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
76 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
77 if test $bu_cv_decl_time_t_time_h = yes; then
78   AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
79             [Is the type time_t defined in <time.h>?])
80 fi
81
82 AC_MSG_CHECKING(for time_t in sys/types.h)
83 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
84 [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
85 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
86 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
87 if test $bu_cv_decl_time_t_types_h = yes; then
88   AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
89             [Is the type time_t defined in <sys/types.h>?])
90 fi
91
92 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
93 # by default.
94 AC_MSG_CHECKING([for utime.h])
95 AC_CACHE_VAL(bu_cv_header_utime_h,
96 [AC_TRY_COMPILE([#include <sys/types.h>
97 #ifdef HAVE_TIME_H
98 #include <time.h>
99 #endif
100 #include <utime.h>],
101 [struct utimbuf s;],
102 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
103 AC_MSG_RESULT($bu_cv_header_utime_h)
104 if test $bu_cv_header_utime_h = yes; then
105   AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
106 fi
107
108 BFD_NEED_DECLARATION(fprintf)
109 BFD_NEED_DECLARATION(strstr)
110 BFD_NEED_DECLARATION(sbrk)
111 BFD_NEED_DECLARATION(getenv)
112 BFD_NEED_DECLARATION(environ)
113
114 BFD_BINARY_FOPEN
115
116 # target-specific stuff:
117
118 # Canonicalize the secondary target names.
119 if test -n "$enable_targets"; then
120     for targ in `echo $enable_targets | sed 's/,/ /g'`
121     do
122         result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null`
123         if test -n "$result"; then
124             canon_targets="$canon_targets $result"
125         else
126             # Allow targets that config.sub doesn't recognize, like "all".
127             canon_targets="$canon_targets $targ"
128         fi
129     done
130 fi
131
132 all_targets=false
133 BUILD_NLMCONV=
134 NLMCONV_DEFS=
135 BUILD_SRCONV=
136 BUILD_DLLTOOL=
137 DLLTOOL_DEFS=
138 BUILD_WINDRES=
139 BUILD_DLLWRAP=
140 BUILD_MISC=
141
142 for targ in $target $canon_targets
143 do
144     if test "x$targ" = "xall"; then
145         all_targets=true
146         BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
147         BUILD_SRCONV='$(SRCONV_PROG)'
148         NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
149     else
150         case $targ in
151 changequote(,)dnl
152         i[3456]86*-*-netware*) 
153 changequote([,])dnl
154           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
155           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
156           ;;
157         alpha*-*-netware*)
158           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
159           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
160           ;;
161         powerpc*-*-netware*)
162           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
163           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
164           ;;
165         sparc*-*-netware*)
166           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
167           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
168           ;;
169         esac
170         case $targ in
171         *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
172         esac
173         case $targ in
174         arm-*pe*)
175           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
176           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
177           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
178          ;;
179         thumb-*pe*)
180           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
181           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
182           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
183          ;;
184 changequote(,)dnl
185         i[3-6]86-*pe* | i[3-6]86-*-cygwin* | i[3-6]86-*-mingw32*)
186 changequote([,])dnl
187           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
188           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
189           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
190           BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
191          ;;
192         powerpc*-*-*pe* | powerpc*-*-cygwin*)
193           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
194           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
195           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
196          ;;
197         mcore-*pe)
198           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
199           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
200           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
201          ;;
202         mcore-*elf)
203           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
204           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
205          ;;
206         esac
207     fi
208 done
209
210 AC_SUBST(NLMCONV_DEFS)
211 AC_SUBST(BUILD_NLMCONV)
212 AC_SUBST(BUILD_SRCONV)
213 AC_SUBST(BUILD_DLLTOOL)
214 AC_SUBST(DLLTOOL_DEFS)
215 AC_SUBST(BUILD_WINDRES)
216 AC_SUBST(BUILD_DLLWRAP)
217 AC_SUBST(BUILD_MISC)
218
219 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
220
221 targ=$target
222 . $srcdir/../bfd/config.bfd
223 if test "x$targ_underscore" = "xyes"; then
224     UNDERSCORE=1
225 else
226     UNDERSCORE=0
227 fi
228 AC_SUBST(UNDERSCORE)
229
230 AC_OUTPUT(Makefile po/Makefile.in:po/Make-in,
231 [
232 case "x$CONFIG_FILES" in
233 *) sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile ;;
234 esac
235 ])