Build dlltool for thumb-pe target
[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.5)
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 AM_CYGWIN32
47 AM_EXEEXT
48
49 # host-specific stuff:
50
51 HDEFINES=
52
53 . ${srcdir}/../bfd/configure.host
54
55 AC_SUBST(HDEFINES)
56 AR=${AR-ar}
57 AC_SUBST(AR)
58 AC_PROG_RANLIB
59 AM_PROG_INSTALL
60
61 BFD_CC_FOR_BUILD
62
63 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
64 AC_HEADER_SYS_WAIT
65 AC_FUNC_ALLOCA
66 AC_CHECK_FUNCS(sbrk utimes)
67
68 AC_MSG_CHECKING(for time_t in time.h)
69 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
70 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
71 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
72 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
73 if test $bu_cv_decl_time_t_time_h = yes; then
74   AC_DEFINE([HAVE_TIME_T_IN_TIME_H])
75 fi
76
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])
84 fi
85
86 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
87 # by default.
88 AC_MSG_CHECKING([for utime.h])
89 AC_CACHE_VAL(bu_cv_header_utime_h,
90 [AC_TRY_COMPILE([#include <sys/types.h>
91 #ifdef HAVE_TIME_H
92 #include <time.h>
93 #endif
94 #include <utime.h>],
95 [struct utimbuf s;],
96 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
97 AC_MSG_RESULT($bu_cv_header_utime_h)
98 if test $bu_cv_header_utime_h = yes; then
99   AC_DEFINE(HAVE_GOOD_UTIME_H)
100 fi
101
102 BFD_NEED_DECLARATION(fprintf)
103 BFD_NEED_DECLARATION(strstr)
104 BFD_NEED_DECLARATION(sbrk)
105 BFD_NEED_DECLARATION(getenv)
106
107 BFD_BINARY_FOPEN
108
109 # target-specific stuff:
110
111 # Canonicalize the secondary target names.
112 if test -n "$enable_targets"; then
113     for targ in `echo $enable_targets | sed 's/,/ /g'`
114     do
115         result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null`
116         if test -n "$result"; then
117             canon_targets="$canon_targets $result"
118         else
119             # Allow targets that config.sub doesn't recognize, like "all".
120             canon_targets="$canon_targets $targ"
121         fi
122     done
123 fi
124
125 all_targets=false
126 BUILD_NLMCONV=
127 NLMCONV_DEFS=
128 BUILD_SRCONV=
129 BUILD_DLLTOOL=
130 DLLTOOL_DEFS=
131 BUILD_WINDRES=
132
133 for targ in $target $canon_targets
134 do
135     if test "x$targ" = "xall"; then
136         all_targets=true
137         BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
138         BUILD_SRCONV='$(SRCONV_PROG)'
139         NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
140     else
141         case $targ in
142 changequote(,)dnl
143         i[3456]86*-*-netware*) 
144 changequote([,])dnl
145           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
146           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
147           ;;
148         alpha*-*-netware*)
149           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
150           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
151           ;;
152         powerpc*-*-netware*)
153           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
154           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
155           ;;
156         sparc*-*-netware*)
157           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
158           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
159           ;;
160         esac
161         case $targ in
162         *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
163         esac
164         case $targ in
165         arm-*pe*)
166         thumb-*pe*)
167           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
168           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
169           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
170          ;;
171 changequote(,)dnl
172         i[3-6]86-*pe* | i[3-6]86-*-cygwin32* | i[3-6]86-*-mingw32*)
173 changequote([,])dnl
174           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
175           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
176           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
177          ;;
178         powerpc*-*-*pe* | powerpc*-*-cygwin32)
179           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
180           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
181           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
182          ;;
183         esac
184     fi
185 done
186
187 AC_SUBST(NLMCONV_DEFS)
188 AC_SUBST(BUILD_NLMCONV)
189 AC_SUBST(BUILD_SRCONV)
190 AC_SUBST(BUILD_DLLTOOL)
191 AC_SUBST(DLLTOOL_DEFS)
192 AC_SUBST(BUILD_WINDRES)
193
194 AC_DEFINE_UNQUOTED(TARGET, "${target}")
195
196 targ=$target
197 . $srcdir/../bfd/config.bfd
198 if test "x$targ_underscore" = "xyes"; then
199     UNDERSCORE=1
200 else
201     UNDERSCORE=0
202 fi
203 AC_SUBST(UNDERSCORE)
204
205 AC_OUTPUT(Makefile po/Makefile.in:po/Make-in,
206 [sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile])