* configure.in: Substitute RPATH_ENVVAR.
[platform/upstream/binutils.git] / binutils / configure.in
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 AC_ARG_ENABLE(shared,
15 [  --enable-shared         build shared BFD library],
16 [case "${enableval}" in
17   yes) shared=true ;;
18   no)  shared=false ;;
19   *)   AC_MSG_ERROR([bad value ${enableval} for BFD shared option]) ;;
20 esac])dnl
21
22 AC_CONFIG_HEADER(config.h:config.in)
23
24 AC_CONFIG_AUX_DIR(`cd $srcdir/..; pwd`)
25 AC_CANONICAL_SYSTEM
26 if test -z "$target" ; then
27     AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
28 fi
29 if test -z "$host" ; then
30     AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
31 fi
32 AC_ARG_PROGRAM
33
34 # host-specific stuff:
35
36 HDEFINES=
37 LDFLAGS=
38 HLDFLAGS=
39 RPATH_ENVVAR=LD_LIBRARY_PATH
40
41 . ${srcdir}/../bfd/configure.host
42
43 AC_PROG_CC
44 AC_SUBST(CFLAGS)
45 AC_SUBST(HDEFINES)
46 AC_SUBST(LDFLAGS)
47 AC_SUBST(HLDFLAGS)
48 AC_SUBST(RPATH_ENVVAR)
49 AR=${AR-ar}
50 AC_SUBST(AR)
51 AC_PROG_RANLIB
52 AC_PROG_INSTALL
53
54 # For most hosts we can use a simple definition to pick up the BFD and
55 # opcodes libraries.  However, if we are building shared libraries, we
56 # need to handle some hosts specially.
57 BFDLIB='-L../bfd -lbfd'
58 OPCODES='-L../opcodes -lopcodes'
59 if test "${shared}" = "true"; then
60   case "${host}" in
61   *-*-sunos*)
62     # On SunOS, we must link against the name we are going to install,
63     # not -lbfd, since SunOS does not support SONAME.
64     BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`'
65     OPCODES='-L../opcodes -l`echo opcodes | sed '"'"'$(program_transform_name)'"'"'`'
66     ;;
67   esac
68 fi
69 AC_SUBST(BFDLIB)
70 AC_SUBST(OPCODES)
71
72 BFD_CC_FOR_BUILD
73
74 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
75 AC_HEADER_SYS_WAIT
76 AC_CHECK_FUNCS(sbrk utimes)
77
78 AC_MSG_CHECKING(for time_t in time.h)
79 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
80 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
81 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
82 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
83 if test $bu_cv_decl_time_t_time_h = yes; then
84   AC_DEFINE([HAVE_TIME_T_IN_TIME_H])
85 fi
86
87 AC_MSG_CHECKING(for time_t in sys/types.h)
88 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
89 [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
90 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
91 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
92 if test $bu_cv_decl_time_t_types_h = yes; then
93   AC_DEFINE([HAVE_TIME_T_IN_TYPES_H])
94 fi
95
96 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
97 # by default.
98 AC_MSG_CHECKING([for utime.h])
99 AC_CACHE_VAL(bu_cv_header_utime_h,
100 [AC_TRY_COMPILE([#include <sys/types.h>
101 #ifdef HAVE_TIME_H
102 #include <time.h>
103 #endif
104 #include <utime.h>],
105 [struct utimbuf s;],
106 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
107 AC_MSG_RESULT($bu_cv_header_utime_h)
108 if test $bu_cv_header_utime_h = yes; then
109   AC_DEFINE(HAVE_GOOD_UTIME_H)
110 fi
111
112 BFD_NEED_DECLARATION(fprintf)
113
114 BFD_BINARY_FOPEN
115
116 # target-specific stuff:
117
118 # Canonicalize the secondary target names.
119 if test -n "$enable_targets"; then
120     for targ in `echo $enable_targets | sed 's/,/ /g'`
121     do
122         result=`$ac_config_sub $targ 2>/dev/null`
123         if test -n "$result"; then
124             canon_targets="$canon_targets $result"
125         else
126             # Allow targets that config.sub doesn't recognize, like "all".
127             canon_targets="$canon_targets $targ"
128         fi
129     done
130 fi
131
132 all_targets=false
133 BUILD_NLMCONV=
134 NLMCONV_DEFS=
135 BUILD_SRCONV=
136 BUILD_DLLTOOL=
137 DLLTOOL_DEFS=
138
139 for targ in $target $canon_targets
140 do
141     if test "x$targ" = "xall"; then
142         all_targets=true
143         BUILD_NLMCONV='$(NLMCONV_PROG)'
144         BUILD_SRCONV='$(SRCONV_PROG)'
145         NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
146     else
147         case $targ in
148 changequote(,)dnl
149         i[345]86*-*-netware*) 
150 changequote([,])dnl
151           BUILD_NLMCONV='$(NLMCONV_PROG)'
152           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
153           ;;
154         alpha*-*-netware*)
155           BUILD_NLMCONV='$(NLMCONV_PROG)'
156           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
157           ;;
158         powerpc*-*-netware*)
159           BUILD_NLMCONV='$(NLMCONV_PROG)'
160           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
161           ;;
162         sparc*-*-netware*)
163           BUILD_NLMCONV='$(NLMCONV_PROG)'
164           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
165           ;;
166         esac
167         case $targ in
168         *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
169         esac
170         case $targ in
171         arm-*pe*)
172           BUILD_DLLTOOL='$(DLLTOOL_PROG)'
173           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
174          ;;
175 changequote(,)dnl
176         i[3-6]86-*pe* | i[3-6]86-*-cygwin32)
177 changequote([,])dnl
178           BUILD_DLLTOOL='$(DLLTOOL_PROG)'
179           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
180          ;;
181         powerpc*-*-*pe* | powerpc*-*-cygwin32)
182           BUILD_DLLTOOL='$(DLLTOOL_PROG)'
183           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
184          ;;
185         esac
186     fi
187 done
188
189 AC_SUBST(NLMCONV_DEFS)
190 AC_SUBST(BUILD_NLMCONV)
191 AC_SUBST(BUILD_SRCONV)
192 AC_SUBST(BUILD_DLLTOOL)
193 AC_SUBST(DLLTOOL_DEFS)
194
195 targ=$target
196 . $srcdir/../bfd/config.bfd
197 if test "x$targ_underscore" = "xyes"; then
198     UNDERSCORE=1
199 else
200     UNDERSCORE=0
201 fi
202 AC_SUBST(UNDERSCORE)
203
204 AC_OUTPUT(Makefile,
205 [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])