* acinclude.m4: Include libtool and gettext macros from the
[binutils.git] / binutils / configure.in
blob32683624c01eacc6484c83443a150c375b686b27
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 AC_PREREQ(2.13)
4 AC_INIT(ar.c)
6 AC_CANONICAL_SYSTEM
8 AM_INIT_AUTOMAKE(binutils, 2.10.90)
10 AM_PROG_LIBTOOL
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
28 build_warnings="-W -Wall"
29 AC_ARG_ENABLE(build-warnings,
30 [  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
31 [case "${enableval}" in
32   yes)  ;;
33   no)   build_warnings="-w";;
34   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
35         build_warnings="${build_warnings} ${t}";;
36   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
37         build_warnings="${t} ${build_warnings}";;
38   *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
39 esac
40 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
41   echo "Setting warning flags = $build_warnings" 6>&1
42 fi])dnl
43 WARN_CFLAGS=""
44 if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
45     WARN_CFLAGS="${build_warnings}"
47 AC_SUBST(WARN_CFLAGS)
49 AM_CONFIG_HEADER(config.h:config.in)
51 if test -z "$target" ; then
52     AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
54 if test -z "$host" ; then
55     AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
58 AC_PROG_CC
60 AC_PROG_YACC
61 AM_PROG_LEX
63 ALL_LINGUAS=
64 CY_GNU_GETTEXT
66 AM_MAINTAINER_MODE
67 AC_EXEEXT
68 if test -n "$EXEEXT"; then
69   AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
70             [Does the platform use an executable suffix?])
72 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
73                    [Suffix used for executables, if any.])
75 # host-specific stuff:
77 HDEFINES=
79 . ${srcdir}/../bfd/configure.host
81 AC_SUBST(HDEFINES)
82 AR=${AR-ar}
83 AC_SUBST(AR)
84 AC_PROG_RANLIB
85 AC_PROG_INSTALL
87 BFD_CC_FOR_BUILD
89 DEMANGLER_NAME=c++filt
90 case "${host}" in
91   *-*-go32* | *-*-msdos*)
92     DEMANGLER_NAME=cxxfilt
93 esac
94 AC_SUBST(DEMANGLER_NAME)
96 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
97 AC_HEADER_SYS_WAIT
98 AC_FUNC_ALLOCA
99 AC_CHECK_FUNCS(sbrk utimes setmode)
101 # Some systems have frexp only in -lm, not in -lc.
102 AC_SEARCH_LIBS(frexp, m)
104 AC_MSG_CHECKING(for time_t in time.h)
105 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
106 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
107 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
108 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
109 if test $bu_cv_decl_time_t_time_h = yes; then
110   AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
111             [Is the type time_t defined in <time.h>?])
114 AC_MSG_CHECKING(for time_t in sys/types.h)
115 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
116 [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
117 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
118 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
119 if test $bu_cv_decl_time_t_types_h = yes; then
120   AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
121             [Is the type time_t defined in <sys/types.h>?])
124 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
125 # by default.
126 AC_MSG_CHECKING([for utime.h])
127 AC_CACHE_VAL(bu_cv_header_utime_h,
128 [AC_TRY_COMPILE([#include <sys/types.h>
129 #ifdef HAVE_TIME_H
130 #include <time.h>
131 #endif
132 #include <utime.h>],
133 [struct utimbuf s;],
134 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
135 AC_MSG_RESULT($bu_cv_header_utime_h)
136 if test $bu_cv_header_utime_h = yes; then
137   AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
140 BFD_NEED_DECLARATION(fprintf)
141 BFD_NEED_DECLARATION(strstr)
142 BFD_NEED_DECLARATION(sbrk)
143 BFD_NEED_DECLARATION(getenv)
144 BFD_NEED_DECLARATION(environ)
146 BFD_BINARY_FOPEN
148 # target-specific stuff:
150 # Canonicalize the secondary target names.
151 if test -n "$enable_targets"; then
152     for targ in `echo $enable_targets | sed 's/,/ /g'`
153     do
154         result=`$ac_config_sub $targ 2>/dev/null`
155         if test -n "$result"; then
156             canon_targets="$canon_targets $result"
157         else
158             # Allow targets that config.sub doesn't recognize, like "all".
159             canon_targets="$canon_targets $targ"
160         fi
161     done
164 all_targets=false
165 BUILD_NLMCONV=
166 NLMCONV_DEFS=
167 BUILD_SRCONV=
168 BUILD_DLLTOOL=
169 DLLTOOL_DEFS=
170 BUILD_WINDRES=
171 BUILD_DLLWRAP=
172 BUILD_MISC=
174 for targ in $target $canon_targets
176     if test "x$targ" = "xall"; then
177         all_targets=true
178         BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
179         BUILD_SRCONV='$(SRCONV_PROG)'
180         NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
181     else
182         case $targ in
183 changequote(,)dnl
184         i[3456]86*-*-netware*) 
185 changequote([,])dnl
186           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
187           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
188           ;;
189         alpha*-*-netware*)
190           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
191           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
192           ;;
193         powerpc*-*-netware*)
194           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
195           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
196           ;;
197         sparc*-*-netware*)
198           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
199           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
200           ;;
201         esac
202         case $targ in
203         *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
204         esac
205         case $targ in
206         arm-*pe* | arm-*-wince)
207           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
208           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
209           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
210           ;;
211         thumb-*pe*)
212           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
213           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
214           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
215           ;;
216 changequote(,)dnl
217         i[3-6]86-*pe* | i[3-6]86-*-cygwin* | i[3-6]86-*-mingw32*)
218 changequote([,])dnl
219           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
220           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
221           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
222           BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
223           ;;
224         i[3-6]86-*-interix)
225           BUILD_DLLTOOL='$(DLLTOOL_PROG)'
226           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
227           ;;
228         powerpc*-*-*pe* | powerpc*-*-cygwin*)
229           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
230           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
231           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
232           ;;
233         sh*-*-*pe)
234           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
235           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
236           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
237           ;;
238         mips*-*-*pe)
239           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
240           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
241           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
242           ;;
243         mcore-*pe)
244           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
245           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
246           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
247           ;;
248         mcore-*elf)
249           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
250           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
251           ;;
252         esac
253     fi
254 done
256 AC_SUBST(NLMCONV_DEFS)
257 AC_SUBST(BUILD_NLMCONV)
258 AC_SUBST(BUILD_SRCONV)
259 AC_SUBST(BUILD_DLLTOOL)
260 AC_SUBST(DLLTOOL_DEFS)
261 AC_SUBST(BUILD_WINDRES)
262 AC_SUBST(BUILD_DLLWRAP)
263 AC_SUBST(BUILD_MISC)
265 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
267 targ=$target
268 . $srcdir/../bfd/config.bfd
269 if test "x$targ_underscore" = "xyes"; then
270     UNDERSCORE=1
271 else
272     UNDERSCORE=0
274 AC_SUBST(UNDERSCORE)
276 AC_OUTPUT(Makefile po/Makefile.in:po/Make-in,
278 case "x$CONFIG_FILES" in
279 *) sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile ;;
280 esac