Wed Nov 3 23:31:19 1999 Jeffrey A Law (law@cygnus.com)
[external/binutils.git] / ld / configure.in
1 dnl Process this file with autoconf to produce a configure script
2 dnl
3 AC_PREREG(2.13)
4 AC_INIT(ldmain.c)
5
6 AC_CANONICAL_SYSTEM
7
8 AM_INIT_AUTOMAKE(ld, 2.9.5)
9
10 AM_PROG_LIBTOOL
11
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
20 AC_ARG_ENABLE(64-bit-bfd,
21 [  --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)],
22 [case "${enableval}" in
23   yes)  want64=true  ;;
24   no)   want64=false ;;
25   *)    AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
26 esac],[want64=false])dnl
27
28 AM_CONFIG_HEADER(config.h:config.in)
29
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
37 # host-specific stuff:
38
39 AC_PROG_CC
40 AC_PROG_INSTALL
41
42 ALL_LINGUAS=
43 CY_GNU_GETTEXT
44
45 AC_EXEEXT
46
47 AC_PROG_YACC
48 AM_PROG_LEX
49
50 AM_MAINTAINER_MODE
51
52 . ${srcdir}/configure.host
53
54 AC_SUBST(HDEFINES)
55 AC_SUBST(HOSTING_CRT0)
56 AC_SUBST(HOSTING_LIBS)
57 AC_SUBST(NATIVE_LIB_DIRS)
58
59 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h)
60 AC_CHECK_FUNCS(sbrk)
61 AC_HEADER_DIRENT
62
63 BFD_BINARY_FOPEN
64
65 BFD_NEED_DECLARATION(strstr)
66 BFD_NEED_DECLARATION(free)
67 BFD_NEED_DECLARATION(sbrk)
68 BFD_NEED_DECLARATION(getenv)
69 BFD_NEED_DECLARATION(environ)
70
71 # When converting linker scripts into strings for use in emulation
72 # files, use astring.sed if the compiler supports ANSI string
73 # concatenation, or ostring.sed otherwise.  This is to support the
74 # broken Microsoft MSVC compiler, which limits the length of string
75 # constants, while still supporting pre-ANSI compilers which do not
76 # support string concatenation.
77 AC_CACHE_VAL(ld_cv_string_concatenation,
78 [AC_TRY_COMPILE(,[char *a = "a" "a";],
79   [ld_cv_string_concatenation=true],
80   [ld_cv_string_concatenation=false])])
81 if test "$ld_cv_string_concatenation" = "true"; then
82   STRINGIFY=astring.sed
83 else
84   STRINGIFY=ostring.sed
85 fi
86 AC_SUBST(STRINGIFY)
87
88 # target-specific stuff:
89
90 all_targets=
91 EMUL=
92 all_emuls=
93 all_emul_extras=
94 all_libpath=
95
96 dnl We need to get an arbitrary number of tdir definitions into
97 dnl Makefile.  We can't do it using AC_SUBST, because autoconf does
98 dnl not permit literal newlines in an AC_SUBST variables.  So we use a
99 dnl file.
100 rm -f tdirs
101
102 for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
103 do
104   if test "$targ_alias" = "all"; then
105     all_targets=true
106   else
107     # Canonicalize the secondary target names.
108     result=`$ac_config_sub $targ_alias 2>/dev/null`
109     if test -n "$result"; then
110         targ=$result
111     else
112         targ=$targ_alias
113     fi
114
115     . ${srcdir}/configure.tgt
116
117     if test "$targ" = "$target"; then
118       EMUL=$targ_emul
119     fi
120
121     for i in $targ_emul $targ_extra_emuls $targ_extra_libpath; do
122         case " $all_emuls " in
123         *" e${i}.o "*) ;;
124         *)
125           all_emuls="$all_emuls e${i}.o"
126           eval result=\$tdir_$i
127           test -z "$result" && result=$targ_alias
128           echo tdir_$i=$result >> tdirs
129           ;;
130         esac
131     done
132
133     for i in $targ_emul $targ_extra_libpath; do
134         case " $all_libpath " in
135         *" ${i} "*) ;;
136         *)
137           if test -z "$all_libpath"; then
138             all_libpath=${i}
139           else
140             all_libpath="$all_libpath ${i}"
141           fi
142           ;;
143         esac
144     done
145
146     for i in $targ_extra_ofiles; do
147         case " $all_emul_extras " in
148         *" ${i} "*) ;;
149         *)
150           all_emul_extras="$all_emul_extras ${i}"
151           ;;
152         esac
153     done
154   fi
155 done
156
157 AC_SUBST(EMUL)
158
159 TDIRS=tdirs
160 AC_SUBST_FILE(TDIRS)
161
162 dnl FIXME: We will build a 64 bit BFD for a 64 bit host or a 64 bit
163 dnl target, and in those cases we should also build the 64 bit
164 dnl emulations.
165 if test x${all_targets} = xtrue; then
166   if test x${want64} = xtrue; then
167     EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)'
168   else
169     EMULATION_OFILES='$(ALL_EMULATIONS)'
170   fi
171   EMUL_EXTRA_OFILES='$(ALL_EMUL_EXTRA_OFILES)'
172 else
173   EMULATION_OFILES=$all_emuls
174   EMUL_EXTRA_OFILES=$all_emul_extras
175 fi
176 AC_SUBST(EMULATION_OFILES)
177 AC_SUBST(EMUL_EXTRA_OFILES)
178
179 EMULATION_LIBPATH=$all_libpath
180 AC_SUBST(EMULATION_LIBPATH)
181
182 if test x${enable_static} = xno; then
183   TESTBFDLIB="--rpath ../bfd/.libs ../bfd/.libs/libbfd.so"
184 else
185   TESTBFDLIB="../bfd/.libs/libbfd.a"
186 fi
187 AC_SUBST(TESTBFDLIB)
188
189 target_vendor=${target_vendor=$host_vendor}
190 case "$target_vendor" in
191   hp) EXTRA_SHLIB_EXTENSION=".sl" ;;
192   *)  EXTRA_SHLIB_EXTENSION= ;;
193 esac
194 if test x${EXTRA_SHLIB_EXTENSION} != x ; then
195   AC_DEFINE_UNQUOTED(EXTRA_SHLIB_EXTENSION, "$EXTRA_SHLIB_EXTENSION",
196    [Additional extension a shared object might have.])
197 fi
198
199 AC_OUTPUT(Makefile po/Makefile.in:po/Make-in,
200 [sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile])