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 | |
36 | AC_ARG_PROGRAM | |
db19f828 | 37 | |
d467c30d ILT |
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 | ||
5ab6ca68 | 48 | # host-specific stuff: |
db19f828 | 49 | |
5ab6ca68 | 50 | HDEFINES= |
33106b60 | 51 | |
b5775df3 DHW |
52 | . ${srcdir}/../bfd/configure.host |
53 | ||
5ab6ca68 | 54 | AC_SUBST(HDEFINES) |
5ab6ca68 ILT |
55 | AR=${AR-ar} |
56 | AC_SUBST(AR) | |
57 | AC_PROG_RANLIB | |
d467c30d | 58 | AM_PROG_INSTALL |
36fb98be | 59 | |
320d4f29 ILT |
60 | BFD_CC_FOR_BUILD |
61 | ||
5ab6ca68 | 62 | AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h) |
ae0daa11 | 63 | AC_HEADER_SYS_WAIT |
33106b60 | 64 | AC_FUNC_ALLOCA |
5ab6ca68 | 65 | AC_CHECK_FUNCS(sbrk utimes) |
33106b60 ILT |
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 | |
5ab6ca68 ILT |
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 | ||
36fb98be | 108 | BFD_NEED_DECLARATION(fprintf) |
33106b60 ILT |
109 | BFD_NEED_DECLARATION(strstr) |
110 | BFD_NEED_DECLARATION(sbrk) | |
111 | BFD_NEED_DECLARATION(getenv) | |
5ab6ca68 | 112 | |
320d4f29 | 113 | BFD_BINARY_FOPEN |
5ab6ca68 ILT |
114 | |
115 | # target-specific stuff: | |
b5775df3 DHW |
116 | |
117 | # Canonicalize the secondary target names. | |
5ab6ca68 | 118 | if test -n "$enable_targets"; then |
99ac7754 | 119 | for targ in `echo $enable_targets | sed 's/,/ /g'` |
b5775df3 | 120 | do |
1d371d35 | 121 | result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null` |
5ab6ca68 | 122 | if test -n "$result"; then |
b5775df3 DHW |
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 | |
b5775df3 DHW |
129 | fi |
130 | ||
131 | all_targets=false | |
5ab6ca68 ILT |
132 | BUILD_NLMCONV= |
133 | NLMCONV_DEFS= | |
134 | BUILD_SRCONV= | |
135 | BUILD_DLLTOOL= | |
136 | DLLTOOL_DEFS= | |
1d371d35 | 137 | BUILD_WINDRES= |
b5775df3 DHW |
138 | |
139 | for targ in $target $canon_targets | |
140 | do | |
5ab6ca68 | 141 | if test "x$targ" = "xall"; then |
b5775df3 | 142 | all_targets=true |
bf2a3cb1 ILT |
143 | BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' |
144 | BUILD_SRCONV='$(SRCONV_PROG)$(EXEEXT)' | |
5ab6ca68 | 145 | NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC" |
b5775df3 DHW |
146 | else |
147 | case $targ in | |
5ab6ca68 | 148 | changequote(,)dnl |
33106b60 | 149 | i[3456]86*-*-netware*) |
5ab6ca68 | 150 | changequote([,])dnl |
bf2a3cb1 | 151 | BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' |
5ab6ca68 | 152 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386" |
99ac7754 JM |
153 | ;; |
154 | alpha*-*-netware*) | |
bf2a3cb1 | 155 | BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' |
5ab6ca68 | 156 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA" |
99ac7754 JM |
157 | ;; |
158 | powerpc*-*-netware*) | |
bf2a3cb1 | 159 | BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' |
5ab6ca68 | 160 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC" |
99ac7754 JM |
161 | ;; |
162 | sparc*-*-netware*) | |
bf2a3cb1 | 163 | BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' |
5ab6ca68 | 164 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC" |
99ac7754 | 165 | ;; |
b5775df3 | 166 | esac |
b5775df3 | 167 | case $targ in |
bf2a3cb1 | 168 | *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)$(EXEEXT)' ;; |
b5775df3 | 169 | esac |
99ac7754 JM |
170 | case $targ in |
171 | arm-*pe*) | |
bf2a3cb1 | 172 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
5ab6ca68 | 173 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" |
bf2a3cb1 | 174 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' |
99ac7754 | 175 | ;; |
5ab6ca68 | 176 | changequote(,)dnl |
36fb98be | 177 | i[3-6]86-*pe* | i[3-6]86-*-cygwin32) |
5ab6ca68 | 178 | changequote([,])dnl |
bf2a3cb1 | 179 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
5ab6ca68 | 180 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" |
bf2a3cb1 | 181 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' |
99ac7754 | 182 | ;; |
36fb98be | 183 | powerpc*-*-*pe* | powerpc*-*-cygwin32) |
bf2a3cb1 | 184 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
36fb98be | 185 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC" |
bf2a3cb1 | 186 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' |
36fb98be | 187 | ;; |
99ac7754 | 188 | esac |
b5775df3 DHW |
189 | fi |
190 | done | |
191 | ||
5ab6ca68 ILT |
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) | |
1d371d35 | 197 | AC_SUBST(BUILD_WINDRES) |
99ac7754 | 198 | |
fe48a154 ILT |
199 | targ=$target |
200 | . $srcdir/../bfd/config.bfd | |
201 | if test "x$targ_underscore" = "xyes"; then | |
5ab6ca68 | 202 | UNDERSCORE=1 |
6f88f031 | 203 | else |
5ab6ca68 | 204 | UNDERSCORE=0 |
6f88f031 | 205 | fi |
5ab6ca68 ILT |
206 | AC_SUBST(UNDERSCORE) |
207 | ||
d467c30d | 208 | AC_OUTPUT(Makefile) |