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