1 dnl Process this file with autoconf to produce a configure script
8 AM_INIT_AUTOMAKE(ld, 2.9.5)
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')
17 no) enable_targets= ;;
18 *) enable_targets=$enableval ;;
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
25 *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
26 esac],[want64=false])dnl
28 build_warnings="-W -Wall"
29 AC_ARG_ENABLE(build-warnings,
30 [ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
31 [case "${enableval}" in
33 no) build_warnings="-w";;
34 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
35 build_warnings="${build_warnings} ${t}";;
36 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
37 build_warnings="${t} ${build_warnings}";;
38 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
40 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
41 echo "Setting warning flags = $build_warnings" 6>&1
44 if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
45 WARN_CFLAGS="${build_warnings}"
49 AM_CONFIG_HEADER(config.h:config.in)
51 if test -z "$target" ; then
52 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
54 if test -z "$host" ; then
55 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
58 # host-specific stuff:
73 . ${srcdir}/configure.host
76 AC_SUBST(HOSTING_CRT0)
77 AC_SUBST(HOSTING_LIBS)
78 AC_SUBST(NATIVE_LIB_DIRS)
80 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h)
86 BFD_NEED_DECLARATION(strstr)
87 BFD_NEED_DECLARATION(free)
88 BFD_NEED_DECLARATION(sbrk)
89 BFD_NEED_DECLARATION(getenv)
90 BFD_NEED_DECLARATION(environ)
92 # When converting linker scripts into strings for use in emulation
93 # files, use astring.sed if the compiler supports ANSI string
94 # concatenation, or ostring.sed otherwise. This is to support the
95 # broken Microsoft MSVC compiler, which limits the length of string
96 # constants, while still supporting pre-ANSI compilers which do not
97 # support string concatenation.
98 AC_MSG_CHECKING([whether ANSI C string concatenation works])
99 AC_CACHE_VAL(ld_cv_string_concatenation,
100 [AC_TRY_COMPILE(,[char *a = "a" "a";],
101 [ld_cv_string_concatenation=yes],
102 [ld_cv_string_concatenation=no])])
103 AC_MSG_RESULT($ld_cv_string_concatenation)
104 if test "$ld_cv_string_concatenation" = "yes"; then
105 STRINGIFY=astring.sed
107 STRINGIFY=ostring.sed
111 # target-specific stuff:
119 dnl We need to get an arbitrary number of tdir definitions into
120 dnl Makefile. We can't do it using AC_SUBST, because autoconf does
121 dnl not permit literal newlines in an AC_SUBST variables. So we use a
125 for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
127 if test "$targ_alias" = "all"; then
130 # Canonicalize the secondary target names.
131 result=`$ac_config_sub $targ_alias 2>/dev/null`
132 if test -n "$result"; then
138 . ${srcdir}/configure.tgt
140 if test "$targ" = "$target"; then
144 for i in $targ_emul $targ_extra_emuls $targ_extra_libpath; do
145 case " $all_emuls " in
148 all_emuls="$all_emuls e${i}.o"
149 eval result=\$tdir_$i
150 test -z "$result" && result=$targ_alias
151 echo tdir_$i=$result >> tdirs
156 for i in $targ_emul $targ_extra_libpath; do
157 case " $all_libpath " in
160 if test -z "$all_libpath"; then
163 all_libpath="$all_libpath ${i}"
169 for i in $targ_extra_ofiles; do
170 case " $all_emul_extras " in
173 all_emul_extras="$all_emul_extras ${i}"
185 dnl FIXME: We will build a 64 bit BFD for a 64 bit host or a 64 bit
186 dnl target, and in those cases we should also build the 64 bit
188 if test x${all_targets} = xtrue; then
189 if test x${want64} = xtrue; then
190 EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)'
192 EMULATION_OFILES='$(ALL_EMULATIONS)'
194 EMUL_EXTRA_OFILES='$(ALL_EMUL_EXTRA_OFILES)'
196 EMULATION_OFILES=$all_emuls
197 EMUL_EXTRA_OFILES=$all_emul_extras
199 AC_SUBST(EMULATION_OFILES)
200 AC_SUBST(EMUL_EXTRA_OFILES)
202 EMULATION_LIBPATH=$all_libpath
203 AC_SUBST(EMULATION_LIBPATH)
205 if test x${enable_static} = xno; then
206 TESTBFDLIB="--rpath ../bfd/.libs ../bfd/.libs/libbfd.so"
208 TESTBFDLIB="../bfd/.libs/libbfd.a"
212 target_vendor=${target_vendor=$host_vendor}
213 case "$target_vendor" in
214 hp) EXTRA_SHLIB_EXTENSION=".sl" ;;
215 *) EXTRA_SHLIB_EXTENSION= ;;
217 if test x${EXTRA_SHLIB_EXTENSION} != x ; then
218 AC_DEFINE_UNQUOTED(EXTRA_SHLIB_EXTENSION, "$EXTRA_SHLIB_EXTENSION",
219 [Additional extension a shared object might have.])
222 AC_OUTPUT(Makefile po/Makefile.in:po/Make-in,
223 [sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile])