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 | ||
15 | AC_CONFIG_HEADER(config.h) | |
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 | ||
43 | AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h) | |
44 | AC_CHECK_FUNCS(sbrk utimes) | |
45 | ||
46 | AC_MSG_CHECKING(for time_t in time.h) | |
47 | AC_CACHE_VAL(bu_cv_decl_time_t_time_h, | |
48 | [AC_TRY_COMPILE([#include <time.h>], [time_t i;], | |
49 | bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)]) | |
50 | AC_MSG_RESULT($bu_cv_decl_time_t_time_h) | |
51 | if test $bu_cv_decl_time_t_time_h = yes; then | |
52 | AC_DEFINE([HAVE_TIME_T_IN_TIME_H]) | |
53 | fi | |
54 | ||
55 | AC_MSG_CHECKING(for time_t in sys/types.h) | |
56 | AC_CACHE_VAL(bu_cv_decl_time_t_types_h, | |
57 | [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;], | |
58 | bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)]) | |
59 | AC_MSG_RESULT($bu_cv_decl_time_t_types_h) | |
60 | if test $bu_cv_decl_time_t_types_h = yes; then | |
61 | AC_DEFINE([HAVE_TIME_T_IN_TYPES_H]) | |
62 | fi | |
63 | ||
64 | # Under Next 3.2 <utime.h> apparently does not define struct utimbuf | |
65 | # by default. | |
66 | AC_MSG_CHECKING([for utime.h]) | |
67 | AC_CACHE_VAL(bu_cv_header_utime_h, | |
68 | [AC_TRY_COMPILE([#include <sys/types.h> | |
69 | #ifdef HAVE_TIME_H | |
70 | #include <time.h> | |
71 | #endif | |
72 | #include <utime.h>], | |
73 | [struct utimbuf s;], | |
74 | bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)]) | |
75 | AC_MSG_RESULT($bu_cv_header_utime_h) | |
76 | if test $bu_cv_header_utime_h = yes; then | |
77 | AC_DEFINE(HAVE_GOOD_UTIME_H) | |
78 | fi | |
79 | ||
80 | AC_MSG_CHECKING([whether fprintf must be declared]) | |
81 | AC_CACHE_VAL(bu_cv_decl_needed_fprintf, | |
82 | [AC_TRY_COMPILE([#include <stdio.h>], | |
83 | [int (*pfn) = (int (*)) fprintf], | |
84 | bu_cv_decl_needed_fprintf=no, bu_cv_decl_needed_fprintf=yes)]) | |
85 | AC_MSG_RESULT($bu_cv_decl_needed_fprintf) | |
86 | if test $bu_cv_decl_needed_fprintf = yes; then | |
87 | AC_DEFINE(NEED_DECLARATION_FPRINTF) | |
88 | fi | |
89 | ||
90 | dnl FIXME: We should check this in some central place somehow | |
91 | case "${host}" in | |
92 | i[345]86-*-msdos* | i[345]86-*-go32* | i[345]86-*-win32) | |
93 | AC_DEFINE(USE_BINARY_FOPEN) ;; | |
94 | esac | |
95 | ||
96 | # target-specific stuff: | |
b5775df3 DHW |
97 | |
98 | # Canonicalize the secondary target names. | |
5ab6ca68 ILT |
99 | target_makefile_fragment=/dev/null |
100 | if test -n "$enable_targets"; then | |
99ac7754 | 101 | for targ in `echo $enable_targets | sed 's/,/ /g'` |
b5775df3 | 102 | do |
5ab6ca68 ILT |
103 | result=`$ac_config_sub $targ 2>/dev/null` |
104 | if test -n "$result"; then | |
b5775df3 DHW |
105 | canon_targets="$canon_targets $result" |
106 | else | |
107 | # Allow targets that config.sub doesn't recognize, like "all". | |
108 | canon_targets="$canon_targets $targ" | |
109 | fi | |
110 | done | |
111 | else | |
5ab6ca68 | 112 | # If our target is rs6000 _and nothing else_ then we build only nm! |
b5775df3 | 113 | case $target in |
5ab6ca68 | 114 | rs6000-*-lynx*) target_makefile_fragment=${srcdir}/config/rslynx ;; |
b5775df3 DHW |
115 | esac |
116 | fi | |
5ab6ca68 | 117 | AC_SUBST_FILE(target_makefile_fragment) |
b5775df3 DHW |
118 | |
119 | all_targets=false | |
5ab6ca68 ILT |
120 | BUILD_NLMCONV= |
121 | NLMCONV_DEFS= | |
122 | BUILD_SRCONV= | |
123 | BUILD_DLLTOOL= | |
124 | DLLTOOL_DEFS= | |
b5775df3 DHW |
125 | |
126 | for targ in $target $canon_targets | |
127 | do | |
5ab6ca68 | 128 | if test "x$targ" = "xall"; then |
b5775df3 | 129 | all_targets=true |
5ab6ca68 ILT |
130 | BUILD_NLMCONV='$(NLMCONV_PROG)' |
131 | BUILD_SRCONV='$(SRCONV_PROG)' | |
132 | NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC" | |
b5775df3 DHW |
133 | else |
134 | case $targ in | |
5ab6ca68 | 135 | changequote(,)dnl |
99ac7754 | 136 | i[345]86*-*-netware*) |
5ab6ca68 ILT |
137 | changequote([,])dnl |
138 | BUILD_NLMCONV='$(NLMCONV_PROG)' | |
139 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386" | |
99ac7754 JM |
140 | ;; |
141 | alpha*-*-netware*) | |
5ab6ca68 ILT |
142 | BUILD_NLMCONV='$(NLMCONV_PROG)' |
143 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA" | |
99ac7754 JM |
144 | ;; |
145 | powerpc*-*-netware*) | |
5ab6ca68 ILT |
146 | BUILD_NLMCONV='$(NLMCONV_PROG)' |
147 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC" | |
99ac7754 JM |
148 | ;; |
149 | sparc*-*-netware*) | |
5ab6ca68 ILT |
150 | BUILD_NLMCONV='$(NLMCONV_PROG)' |
151 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC" | |
99ac7754 | 152 | ;; |
b5775df3 | 153 | esac |
b5775df3 | 154 | case $targ in |
5ab6ca68 | 155 | *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;; |
b5775df3 | 156 | esac |
99ac7754 JM |
157 | case $targ in |
158 | arm-*pe*) | |
5ab6ca68 ILT |
159 | BUILD_DLLTOOL='$(DLLTOOL_PROG)' |
160 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" | |
99ac7754 | 161 | ;; |
5ab6ca68 | 162 | changequote(,)dnl |
99ac7754 | 163 | i[3-6]86-*pe* | i[3-6]86-*-win32) |
5ab6ca68 ILT |
164 | changequote([,])dnl |
165 | BUILD_DLLTOOL='$(DLLTOOL_PROG)' | |
166 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" | |
99ac7754 JM |
167 | ;; |
168 | esac | |
b5775df3 DHW |
169 | fi |
170 | done | |
171 | ||
5ab6ca68 ILT |
172 | AC_SUBST(NLMCONV_DEFS) |
173 | AC_SUBST(BUILD_NLMCONV) | |
174 | AC_SUBST(BUILD_SRCONV) | |
175 | AC_SUBST(BUILD_DLLTOOL) | |
176 | AC_SUBST(DLLTOOL_DEFS) | |
99ac7754 | 177 | |
fe48a154 ILT |
178 | targ=$target |
179 | . $srcdir/../bfd/config.bfd | |
180 | if test "x$targ_underscore" = "xyes"; then | |
5ab6ca68 | 181 | UNDERSCORE=1 |
6f88f031 | 182 | else |
5ab6ca68 | 183 | UNDERSCORE=0 |
6f88f031 | 184 | fi |
5ab6ca68 ILT |
185 | AC_SUBST(UNDERSCORE) |
186 | ||
187 | AC_OUTPUT(Makefile, | |
188 | [case x$CONFIG_HEADERS in xconfig.h) echo > stamp-h ;; esac]) |