Commit | Line | Data |
---|---|---|
5ab6ca68 ILT |
1 | dnl Process this file with autoconf to produce a configure script. |
2 | dnl | |
3 | AC_PREREQ(2.0) | |
4 | AC_INIT(ar.c) | |
5 | ||
6 | AC_ARG_ENABLE(targets, | |
7 | [ --enable-targets alternative target configurations], | |
8 | [case "${enableval}" in | |
9 | yes | "") AC_ERROR(enable-targets option must specify target names or 'all') | |
10 | ;; | |
11 | no) enable_targets= ;; | |
12 | *) enable_targets=$enableval ;; | |
13 | esac])dnl | |
14 | ||
320d4f29 | 15 | AC_CONFIG_HEADER(config.h:config.in) |
5ab6ca68 ILT |
16 | |
17 | AC_CONFIG_AUX_DIR(`cd $srcdir/..; pwd`) | |
18 | AC_CANONICAL_SYSTEM | |
19 | if test -z "$target" ; then | |
20 | AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) | |
21 | fi | |
22 | if test -z "$host" ; then | |
23 | AC_MSG_ERROR(Unrecognized host system type; please check config.sub.) | |
24 | fi | |
25 | AC_ARG_PROGRAM | |
db19f828 | 26 | |
5ab6ca68 | 27 | # host-specific stuff: |
db19f828 | 28 | |
5ab6ca68 ILT |
29 | HDEFINES= |
30 | LDFLAGS= | |
db19f828 | 31 | |
b5775df3 DHW |
32 | . ${srcdir}/../bfd/configure.host |
33 | ||
5ab6ca68 ILT |
34 | AC_PROG_CC |
35 | AC_SUBST(CFLAGS) | |
36 | AC_SUBST(HDEFINES) | |
37 | AC_SUBST(LDFLAGS) | |
38 | AR=${AR-ar} | |
39 | AC_SUBST(AR) | |
40 | AC_PROG_RANLIB | |
41 | AC_PROG_INSTALL | |
42 | ||
320d4f29 ILT |
43 | BFD_CC_FOR_BUILD |
44 | ||
5ab6ca68 | 45 | AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h) |
ae0daa11 | 46 | AC_HEADER_SYS_WAIT |
5ab6ca68 ILT |
47 | AC_CHECK_FUNCS(sbrk utimes) |
48 | ||
49 | AC_MSG_CHECKING(for time_t in time.h) | |
50 | AC_CACHE_VAL(bu_cv_decl_time_t_time_h, | |
51 | [AC_TRY_COMPILE([#include <time.h>], [time_t i;], | |
52 | bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)]) | |
53 | AC_MSG_RESULT($bu_cv_decl_time_t_time_h) | |
54 | if test $bu_cv_decl_time_t_time_h = yes; then | |
55 | AC_DEFINE([HAVE_TIME_T_IN_TIME_H]) | |
56 | fi | |
57 | ||
58 | AC_MSG_CHECKING(for time_t in sys/types.h) | |
59 | AC_CACHE_VAL(bu_cv_decl_time_t_types_h, | |
60 | [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;], | |
61 | bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)]) | |
62 | AC_MSG_RESULT($bu_cv_decl_time_t_types_h) | |
63 | if test $bu_cv_decl_time_t_types_h = yes; then | |
64 | AC_DEFINE([HAVE_TIME_T_IN_TYPES_H]) | |
65 | fi | |
66 | ||
67 | # Under Next 3.2 <utime.h> apparently does not define struct utimbuf | |
68 | # by default. | |
69 | AC_MSG_CHECKING([for utime.h]) | |
70 | AC_CACHE_VAL(bu_cv_header_utime_h, | |
71 | [AC_TRY_COMPILE([#include <sys/types.h> | |
72 | #ifdef HAVE_TIME_H | |
73 | #include <time.h> | |
74 | #endif | |
75 | #include <utime.h>], | |
76 | [struct utimbuf s;], | |
77 | bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)]) | |
78 | AC_MSG_RESULT($bu_cv_header_utime_h) | |
79 | if test $bu_cv_header_utime_h = yes; then | |
80 | AC_DEFINE(HAVE_GOOD_UTIME_H) | |
81 | fi | |
82 | ||
83 | AC_MSG_CHECKING([whether fprintf must be declared]) | |
84 | AC_CACHE_VAL(bu_cv_decl_needed_fprintf, | |
85 | [AC_TRY_COMPILE([#include <stdio.h>], | |
86 | [int (*pfn) = (int (*)) fprintf], | |
87 | bu_cv_decl_needed_fprintf=no, bu_cv_decl_needed_fprintf=yes)]) | |
88 | AC_MSG_RESULT($bu_cv_decl_needed_fprintf) | |
89 | if test $bu_cv_decl_needed_fprintf = yes; then | |
90 | AC_DEFINE(NEED_DECLARATION_FPRINTF) | |
91 | fi | |
92 | ||
320d4f29 | 93 | BFD_BINARY_FOPEN |
5ab6ca68 ILT |
94 | |
95 | # target-specific stuff: | |
b5775df3 DHW |
96 | |
97 | # Canonicalize the secondary target names. | |
5ab6ca68 | 98 | if test -n "$enable_targets"; then |
99ac7754 | 99 | for targ in `echo $enable_targets | sed 's/,/ /g'` |
b5775df3 | 100 | do |
5ab6ca68 ILT |
101 | result=`$ac_config_sub $targ 2>/dev/null` |
102 | if test -n "$result"; then | |
b5775df3 DHW |
103 | canon_targets="$canon_targets $result" |
104 | else | |
105 | # Allow targets that config.sub doesn't recognize, like "all". | |
106 | canon_targets="$canon_targets $targ" | |
107 | fi | |
108 | done | |
b5775df3 DHW |
109 | fi |
110 | ||
111 | all_targets=false | |
5ab6ca68 ILT |
112 | BUILD_NLMCONV= |
113 | NLMCONV_DEFS= | |
114 | BUILD_SRCONV= | |
115 | BUILD_DLLTOOL= | |
116 | DLLTOOL_DEFS= | |
b5775df3 DHW |
117 | |
118 | for targ in $target $canon_targets | |
119 | do | |
5ab6ca68 | 120 | if test "x$targ" = "xall"; then |
b5775df3 | 121 | all_targets=true |
5ab6ca68 ILT |
122 | BUILD_NLMCONV='$(NLMCONV_PROG)' |
123 | BUILD_SRCONV='$(SRCONV_PROG)' | |
124 | NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC" | |
b5775df3 DHW |
125 | else |
126 | case $targ in | |
5ab6ca68 | 127 | changequote(,)dnl |
99ac7754 | 128 | i[345]86*-*-netware*) |
5ab6ca68 ILT |
129 | changequote([,])dnl |
130 | BUILD_NLMCONV='$(NLMCONV_PROG)' | |
131 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386" | |
99ac7754 JM |
132 | ;; |
133 | alpha*-*-netware*) | |
5ab6ca68 ILT |
134 | BUILD_NLMCONV='$(NLMCONV_PROG)' |
135 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA" | |
99ac7754 JM |
136 | ;; |
137 | powerpc*-*-netware*) | |
5ab6ca68 ILT |
138 | BUILD_NLMCONV='$(NLMCONV_PROG)' |
139 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC" | |
99ac7754 JM |
140 | ;; |
141 | sparc*-*-netware*) | |
5ab6ca68 ILT |
142 | BUILD_NLMCONV='$(NLMCONV_PROG)' |
143 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC" | |
99ac7754 | 144 | ;; |
b5775df3 | 145 | esac |
b5775df3 | 146 | case $targ in |
5ab6ca68 | 147 | *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;; |
b5775df3 | 148 | esac |
99ac7754 JM |
149 | case $targ in |
150 | arm-*pe*) | |
5ab6ca68 ILT |
151 | BUILD_DLLTOOL='$(DLLTOOL_PROG)' |
152 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" | |
99ac7754 | 153 | ;; |
5ab6ca68 | 154 | changequote(,)dnl |
99ac7754 | 155 | i[3-6]86-*pe* | i[3-6]86-*-win32) |
5ab6ca68 ILT |
156 | changequote([,])dnl |
157 | BUILD_DLLTOOL='$(DLLTOOL_PROG)' | |
158 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" | |
99ac7754 JM |
159 | ;; |
160 | esac | |
b5775df3 DHW |
161 | fi |
162 | done | |
163 | ||
5ab6ca68 ILT |
164 | AC_SUBST(NLMCONV_DEFS) |
165 | AC_SUBST(BUILD_NLMCONV) | |
166 | AC_SUBST(BUILD_SRCONV) | |
167 | AC_SUBST(BUILD_DLLTOOL) | |
168 | AC_SUBST(DLLTOOL_DEFS) | |
99ac7754 | 169 | |
fe48a154 ILT |
170 | targ=$target |
171 | . $srcdir/../bfd/config.bfd | |
172 | if test "x$targ_underscore" = "xyes"; then | |
5ab6ca68 | 173 | UNDERSCORE=1 |
6f88f031 | 174 | else |
5ab6ca68 | 175 | UNDERSCORE=0 |
6f88f031 | 176 | fi |
5ab6ca68 ILT |
177 | AC_SUBST(UNDERSCORE) |
178 | ||
179 | AC_OUTPUT(Makefile, | |
320d4f29 | 180 | [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac]) |