aboutsummaryrefslogtreecommitdiff
path: root/binutils/configure.in
blob: 18e930ee938eaefac01c196844e508dafb9414f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
dnl Process this file with autoconf to produce a configure script.
dnl
AC_PREREQ(2.0)
AC_INIT(ar.c)

AC_ARG_ENABLE(targets,
[  --enable-targets        alternative target configurations],
[case "${enableval}" in
  yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
            ;;
  no)       enable_targets= ;;
  *)        enable_targets=$enableval ;;
esac])dnl
AC_ARG_ENABLE(shared,
[  --enable-shared         build shared BFD library],
[case "${enableval}" in
  yes) shared=true ;;
  no)  shared=false ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for BFD shared option]) ;;
esac])dnl

AC_CONFIG_HEADER(config.h:config.in)

AC_CONFIG_AUX_DIR(`cd $srcdir/..; pwd`)
AC_CANONICAL_SYSTEM
if test -z "$target" ; then
    AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
fi
if test -z "$host" ; then
    AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
fi
AC_ARG_PROGRAM

# host-specific stuff:

HDEFINES=
LDFLAGS=
HLDFLAGS=
RPATH_ENVVAR=LD_LIBRARY_PATH

. ${srcdir}/../bfd/configure.host

AC_PROG_CC
AC_SUBST(CFLAGS)
AC_SUBST(HDEFINES)
AC_SUBST(LDFLAGS)
AC_SUBST(HLDFLAGS)
AC_SUBST(RPATH_ENVVAR)
AR=${AR-ar}
AC_SUBST(AR)
AC_PROG_RANLIB
AC_PROG_INSTALL

# For most hosts we can use a simple definition to pick up the BFD and
# opcodes libraries.  However, if we are building shared libraries, we
# need to handle some hosts specially.
BFDLIB='-L../bfd -lbfd'
OPCODES='-L../opcodes -lopcodes'
if test "${shared}" = "true"; then
  case "${host}" in
  *-*-sunos*)
    # On SunOS, we must link against the name we are going to install,
    # not -lbfd, since SunOS does not support SONAME.
    BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`'
    OPCODES='-L../opcodes -l`echo opcodes | sed '"'"'$(program_transform_name)'"'"'`'
    ;;
  esac
fi
AC_SUBST(BFDLIB)
AC_SUBST(OPCODES)

BFD_CC_FOR_BUILD

AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
AC_HEADER_SYS_WAIT
AC_CHECK_FUNCS(sbrk utimes)

AC_MSG_CHECKING(for time_t in time.h)
AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
[AC_TRY_COMPILE([#include <time.h>], [time_t i;],
bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
if test $bu_cv_decl_time_t_time_h = yes; then
  AC_DEFINE([HAVE_TIME_T_IN_TIME_H])
fi

AC_MSG_CHECKING(for time_t in sys/types.h)
AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
[AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
if test $bu_cv_decl_time_t_types_h = yes; then
  AC_DEFINE([HAVE_TIME_T_IN_TYPES_H])
fi

# Under Next 3.2 <utime.h> apparently does not define struct utimbuf
# by default.
AC_MSG_CHECKING([for utime.h])
AC_CACHE_VAL(bu_cv_header_utime_h,
[AC_TRY_COMPILE([#include <sys/types.h>
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#include <utime.h>],
[struct utimbuf s;],
bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
AC_MSG_RESULT($bu_cv_header_utime_h)
if test $bu_cv_header_utime_h = yes; then
  AC_DEFINE(HAVE_GOOD_UTIME_H)
fi

BFD_NEED_DECLARATION(fprintf)

BFD_BINARY_FOPEN

# target-specific stuff:

# Canonicalize the secondary target names.
if test -n "$enable_targets"; then
    for targ in `echo $enable_targets | sed 's/,/ /g'`
    do
	result=`$ac_config_sub $targ 2>/dev/null`
	if test -n "$result"; then
	    canon_targets="$canon_targets $result"
	else
	    # Allow targets that config.sub doesn't recognize, like "all".
	    canon_targets="$canon_targets $targ"
	fi
    done
fi

all_targets=false
BUILD_NLMCONV=
NLMCONV_DEFS=
BUILD_SRCONV=
BUILD_DLLTOOL=
DLLTOOL_DEFS=

for targ in $target $canon_targets
do
    if test "x$targ" = "xall"; then
        all_targets=true
	BUILD_NLMCONV='$(NLMCONV_PROG)'
	BUILD_SRCONV='$(SRCONV_PROG)'
	NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
    else
	case $targ in
changequote(,)dnl
	i[345]86*-*-netware*) 
changequote([,])dnl
	  BUILD_NLMCONV='$(NLMCONV_PROG)'
	  NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
	  ;;
	alpha*-*-netware*)
	  BUILD_NLMCONV='$(NLMCONV_PROG)'
	  NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
	  ;;
	powerpc*-*-netware*)
	  BUILD_NLMCONV='$(NLMCONV_PROG)'
	  NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
	  ;;
	sparc*-*-netware*)
	  BUILD_NLMCONV='$(NLMCONV_PROG)'
	  NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
	  ;;
	esac
	case $targ in
	*-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
	esac
	case $targ in
	arm-*pe*)
  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)'
	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
	 ;;
changequote(,)dnl
	i[3-6]86-*pe* | i[3-6]86-*-cygwin32)
changequote([,])dnl
  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)'
	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
	 ;;
	powerpc*-*-*pe* | powerpc*-*-cygwin32)
  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)'
	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
	 ;;
	esac
    fi
done

AC_SUBST(NLMCONV_DEFS)
AC_SUBST(BUILD_NLMCONV)
AC_SUBST(BUILD_SRCONV)
AC_SUBST(BUILD_DLLTOOL)
AC_SUBST(DLLTOOL_DEFS)

targ=$target
. $srcdir/../bfd/config.bfd
if test "x$targ_underscore" = "xyes"; then
    UNDERSCORE=1
else
    UNDERSCORE=0
fi
AC_SUBST(UNDERSCORE)

AC_OUTPUT(Makefile,
[case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])