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