This commit was generated by cvs2svn to track changes on a CVS vendor
[platform/upstream/binutils.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.5)
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 if test -n "$EXEEXT"; then
48   AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
49             [Does the platform use an executable suffix?])
50 fi
51 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
52                    [Suffix used for executables, if any.])
53
54 # host-specific stuff:
55
56 HDEFINES=
57
58 . ${srcdir}/../bfd/configure.host
59
60 AC_SUBST(HDEFINES)
61 AR=${AR-ar}
62 AC_SUBST(AR)
63 AC_PROG_RANLIB
64 AC_PROG_INSTALL
65
66 BFD_CC_FOR_BUILD
67
68 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
69 AC_HEADER_SYS_WAIT
70 AC_FUNC_ALLOCA
71 AC_CHECK_FUNCS(sbrk utimes)
72
73 # Some systems have frexp only in -lm, not in -lc.
74 AC_SEARCH_LIBS(frexp, -lm)
75
76 AC_MSG_CHECKING(for time_t in time.h)
77 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
78 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
79 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
80 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
81 if test $bu_cv_decl_time_t_time_h = yes; then
82   AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
83             [Is the type time_t defined in <time.h>?])
84 fi
85
86 AC_MSG_CHECKING(for time_t in sys/types.h)
87 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
88 [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
89 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
90 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
91 if test $bu_cv_decl_time_t_types_h = yes; then
92   AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
93             [Is the type time_t defined in <sys/types.h>?])
94 fi
95
96 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
97 # by default.
98 AC_MSG_CHECKING([for utime.h])
99 AC_CACHE_VAL(bu_cv_header_utime_h,
100 [AC_TRY_COMPILE([#include <sys/types.h>
101 #ifdef HAVE_TIME_H
102 #include <time.h>
103 #endif
104 #include <utime.h>],
105 [struct utimbuf s;],
106 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
107 AC_MSG_RESULT($bu_cv_header_utime_h)
108 if test $bu_cv_header_utime_h = yes; then
109   AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
110 fi
111
112 BFD_NEED_DECLARATION(fprintf)
113 BFD_NEED_DECLARATION(strstr)
114 BFD_NEED_DECLARATION(sbrk)
115 BFD_NEED_DECLARATION(getenv)
116 BFD_NEED_DECLARATION(environ)
117
118 BFD_BINARY_FOPEN
119
120 # target-specific stuff:
121
122 # Canonicalize the secondary target names.
123 if test -n "$enable_targets"; then
124     for targ in `echo $enable_targets | sed 's/,/ /g'`
125     do
126         result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null`
127         if test -n "$result"; then
128             canon_targets="$canon_targets $result"
129         else
130             # Allow targets that config.sub doesn't recognize, like "all".
131             canon_targets="$canon_targets $targ"
132         fi
133     done
134 fi
135
136 all_targets=false
137 BUILD_NLMCONV=
138 NLMCONV_DEFS=
139 BUILD_SRCONV=
140 BUILD_DLLTOOL=
141 DLLTOOL_DEFS=
142 BUILD_WINDRES=
143 BUILD_DLLWRAP=
144 BUILD_MISC=
145
146 for targ in $target $canon_targets
147 do
148     if test "x$targ" = "xall"; then
149         all_targets=true
150         BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
151         BUILD_SRCONV='$(SRCONV_PROG)'
152         NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
153     else
154         case $targ in
155 changequote(,)dnl
156         i[3456]86*-*-netware*) 
157 changequote([,])dnl
158           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
159           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
160           ;;
161         alpha*-*-netware*)
162           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
163           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
164           ;;
165         powerpc*-*-netware*)
166           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
167           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
168           ;;
169         sparc*-*-netware*)
170           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
171           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
172           ;;
173         esac
174         case $targ in
175         *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
176         esac
177         case $targ in
178         arm-*pe*)
179           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
180           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
181           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
182          ;;
183         thumb-*pe*)
184           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
185           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
186           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
187          ;;
188 changequote(,)dnl
189         i[3-6]86-*pe* | i[3-6]86-*-cygwin* | i[3-6]86-*-mingw32*)
190 changequote([,])dnl
191           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
192           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
193           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
194           BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
195          ;;
196         powerpc*-*-*pe* | powerpc*-*-cygwin*)
197           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
198           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
199           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
200          ;;
201         mcore-*pe)
202           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
203           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
204           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
205          ;;
206         mcore-*elf)
207           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
208           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
209          ;;
210         esac
211     fi
212 done
213
214 AC_SUBST(NLMCONV_DEFS)
215 AC_SUBST(BUILD_NLMCONV)
216 AC_SUBST(BUILD_SRCONV)
217 AC_SUBST(BUILD_DLLTOOL)
218 AC_SUBST(DLLTOOL_DEFS)
219 AC_SUBST(BUILD_WINDRES)
220 AC_SUBST(BUILD_DLLWRAP)
221 AC_SUBST(BUILD_MISC)
222
223 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
224
225 targ=$target
226 . $srcdir/../bfd/config.bfd
227 if test "x$targ_underscore" = "xyes"; then
228     UNDERSCORE=1
229 else
230     UNDERSCORE=0
231 fi
232 AC_SUBST(UNDERSCORE)
233
234 AC_OUTPUT(Makefile po/Makefile.in:po/Make-in,
235 [
236 case "x$CONFIG_FILES" in
237 *) sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile ;;
238 esac
239 ])