Initial revision
[binutils.git] / binutils / configure.in
blob298dcd89c6410b2c72ff32a10f79b4bb02a3cd71
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.9.4)
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 AM_CONFIG_HEADER(config.h:config.in)
30 if test -z "$target" ; then
31     AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
33 if test -z "$host" ; then
34     AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
37 AC_PROG_CC
39 AC_PROG_YACC
40 AM_PROG_LEX
42 ALL_LINGUAS=
43 CY_GNU_GETTEXT
45 AM_MAINTAINER_MODE
46 AC_EXEEXT
48 # host-specific stuff:
50 HDEFINES=
52 . ${srcdir}/../bfd/configure.host
54 AC_SUBST(HDEFINES)
55 AR=${AR-ar}
56 AC_SUBST(AR)
57 AC_PROG_RANLIB
58 AC_PROG_INSTALL
60 BFD_CC_FOR_BUILD
62 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
63 AC_HEADER_SYS_WAIT
64 AC_FUNC_ALLOCA
65 AC_CHECK_FUNCS(sbrk utimes)
67 AC_MSG_CHECKING(for time_t in time.h)
68 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
69 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
70 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
71 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
72 if test $bu_cv_decl_time_t_time_h = yes; then
73   AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
74             [Is the type time_t defined in <time.h>?])
77 AC_MSG_CHECKING(for time_t in sys/types.h)
78 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
79 [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
80 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
81 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
82 if test $bu_cv_decl_time_t_types_h = yes; then
83   AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
84             [Is the type time_t defined in <sys/types.h>?])
87 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
88 # by default.
89 AC_MSG_CHECKING([for utime.h])
90 AC_CACHE_VAL(bu_cv_header_utime_h,
91 [AC_TRY_COMPILE([#include <sys/types.h>
92 #ifdef HAVE_TIME_H
93 #include <time.h>
94 #endif
95 #include <utime.h>],
96 [struct utimbuf s;],
97 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
98 AC_MSG_RESULT($bu_cv_header_utime_h)
99 if test $bu_cv_header_utime_h = yes; then
100   AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
103 BFD_NEED_DECLARATION(fprintf)
104 BFD_NEED_DECLARATION(strstr)
105 BFD_NEED_DECLARATION(sbrk)
106 BFD_NEED_DECLARATION(getenv)
107 BFD_NEED_DECLARATION(environ)
109 BFD_BINARY_FOPEN
111 # target-specific stuff:
113 # Canonicalize the secondary target names.
114 if test -n "$enable_targets"; then
115     for targ in `echo $enable_targets | sed 's/,/ /g'`
116     do
117         result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null`
118         if test -n "$result"; then
119             canon_targets="$canon_targets $result"
120         else
121             # Allow targets that config.sub doesn't recognize, like "all".
122             canon_targets="$canon_targets $targ"
123         fi
124     done
127 all_targets=false
128 BUILD_NLMCONV=
129 NLMCONV_DEFS=
130 BUILD_SRCONV=
131 BUILD_DLLTOOL=
132 DLLTOOL_DEFS=
133 BUILD_WINDRES=
134 BUILD_DLLWRAP=
135 BUILD_MISC=
137 for targ in $target $canon_targets
139     if test "x$targ" = "xall"; then
140         all_targets=true
141         BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
142         BUILD_SRCONV='$(SRCONV_PROG)'
143         NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
144     else
145         case $targ in
146 changequote(,)dnl
147         i[3456]86*-*-netware*) 
148 changequote([,])dnl
149           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
150           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
151           ;;
152         alpha*-*-netware*)
153           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
154           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
155           ;;
156         powerpc*-*-netware*)
157           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
158           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
159           ;;
160         sparc*-*-netware*)
161           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
162           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
163           ;;
164         esac
165         case $targ in
166         *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
167         esac
168         case $targ in
169         arm-*pe*)
170           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
171           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
172           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
173          ;;
174         thumb-*pe*)
175           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
176           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
177           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
178          ;;
179 changequote(,)dnl
180         i[3-6]86-*pe* | i[3-6]86-*-cygwin* | i[3-6]86-*-mingw32*)
181 changequote([,])dnl
182           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
183           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
184           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
185           BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
186          ;;
187         powerpc*-*-*pe* | powerpc*-*-cygwin*)
188           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
189           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
190           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
191          ;;
192         esac
193     fi
194 done
196 AC_SUBST(NLMCONV_DEFS)
197 AC_SUBST(BUILD_NLMCONV)
198 AC_SUBST(BUILD_SRCONV)
199 AC_SUBST(BUILD_DLLTOOL)
200 AC_SUBST(DLLTOOL_DEFS)
201 AC_SUBST(BUILD_WINDRES)
202 AC_SUBST(BUILD_DLLWRAP)
203 AC_SUBST(BUILD_MISC)
205 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
207 targ=$target
208 . $srcdir/../bfd/config.bfd
209 if test "x$targ_underscore" = "xyes"; then
210     UNDERSCORE=1
211 else
212     UNDERSCORE=0
214 AC_SUBST(UNDERSCORE)
216 AC_OUTPUT(Makefile po/Makefile.in:po/Make-in,
218 case "x$CONFIG_FILES" in
219 *) sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile ;;
220 esac