* Makefile.am (TOOL_PROGS): Use an explicit $(EXEEXT).
[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.8.2)
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 AC_ARG_PROGRAM
37
38 AC_PROG_CC
39
40 AC_PROG_YACC
41 AC_PROG_LEX
42 AC_DECL_YYTEXT
43
44 AM_MAINTAINER_MODE
45 AM_CYGWIN32
46 AM_EXEEXT
47
48 # host-specific stuff:
49
50 HDEFINES=
51
52 . ${srcdir}/../bfd/configure.host
53
54 AC_SUBST(HDEFINES)
55 AR=${AR-ar}
56 AC_SUBST(AR)
57 AC_PROG_RANLIB
58 AM_PROG_INSTALL
59
60 BFD_CC_FOR_BUILD
61
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)
66 dnl Temporary workaround for bug in autoconf 2.12.  When the bug is
67 dnl fixed, we can just call AC_FUNC_VFORK in all cases.
68 if test "x$cross_compiling" = "xno"; then
69   AC_FUNC_VFORK
70 else
71   AC_CHECK_FUNC(vfork, , AC_DEFINE(vfork, fork))
72 fi
73
74 AC_MSG_CHECKING(for time_t in time.h)
75 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
76 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
77 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
78 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
79 if test $bu_cv_decl_time_t_time_h = yes; then
80   AC_DEFINE([HAVE_TIME_T_IN_TIME_H])
81 fi
82
83 AC_MSG_CHECKING(for time_t in sys/types.h)
84 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
85 [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
86 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
87 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
88 if test $bu_cv_decl_time_t_types_h = yes; then
89   AC_DEFINE([HAVE_TIME_T_IN_TYPES_H])
90 fi
91
92 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
93 # by default.
94 AC_MSG_CHECKING([for utime.h])
95 AC_CACHE_VAL(bu_cv_header_utime_h,
96 [AC_TRY_COMPILE([#include <sys/types.h>
97 #ifdef HAVE_TIME_H
98 #include <time.h>
99 #endif
100 #include <utime.h>],
101 [struct utimbuf s;],
102 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
103 AC_MSG_RESULT($bu_cv_header_utime_h)
104 if test $bu_cv_header_utime_h = yes; then
105   AC_DEFINE(HAVE_GOOD_UTIME_H)
106 fi
107
108 BFD_NEED_DECLARATION(fprintf)
109 BFD_NEED_DECLARATION(strstr)
110 BFD_NEED_DECLARATION(sbrk)
111 BFD_NEED_DECLARATION(getenv)
112
113 BFD_BINARY_FOPEN
114
115 # target-specific stuff:
116
117 # Canonicalize the secondary target names.
118 if test -n "$enable_targets"; then
119     for targ in `echo $enable_targets | sed 's/,/ /g'`
120     do
121         result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null`
122         if test -n "$result"; then
123             canon_targets="$canon_targets $result"
124         else
125             # Allow targets that config.sub doesn't recognize, like "all".
126             canon_targets="$canon_targets $targ"
127         fi
128     done
129 fi
130
131 all_targets=false
132 BUILD_NLMCONV=
133 NLMCONV_DEFS=
134 BUILD_SRCONV=
135 BUILD_DLLTOOL=
136 DLLTOOL_DEFS=
137 BUILD_WINDRES=
138
139 for targ in $target $canon_targets
140 do
141     if test "x$targ" = "xall"; then
142         all_targets=true
143         BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
144         BUILD_SRCONV='$(SRCONV_PROG)$(EXEEXT)'
145         NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
146     else
147         case $targ in
148 changequote(,)dnl
149         i[3456]86*-*-netware*) 
150 changequote([,])dnl
151           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
152           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
153           ;;
154         alpha*-*-netware*)
155           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
156           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
157           ;;
158         powerpc*-*-netware*)
159           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
160           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
161           ;;
162         sparc*-*-netware*)
163           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
164           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
165           ;;
166         esac
167         case $targ in
168         *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)$(EXEEXT)' ;;
169         esac
170         case $targ in
171         arm-*pe*)
172           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
173           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
174           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
175          ;;
176 changequote(,)dnl
177         i[3-6]86-*pe* | i[3-6]86-*-cygwin32)
178 changequote([,])dnl
179           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
180           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
181           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
182          ;;
183         powerpc*-*-*pe* | powerpc*-*-cygwin32)
184           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
185           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
186           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
187          ;;
188         esac
189     fi
190 done
191
192 AC_SUBST(NLMCONV_DEFS)
193 AC_SUBST(BUILD_NLMCONV)
194 AC_SUBST(BUILD_SRCONV)
195 AC_SUBST(BUILD_DLLTOOL)
196 AC_SUBST(DLLTOOL_DEFS)
197 AC_SUBST(BUILD_WINDRES)
198
199 targ=$target
200 . $srcdir/../bfd/config.bfd
201 if test "x$targ_underscore" = "xyes"; then
202     UNDERSCORE=1
203 else
204     UNDERSCORE=0
205 fi
206 AC_SUBST(UNDERSCORE)
207
208 AC_OUTPUT(Makefile)