Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | dnl Process this file with autoconf to produce a configure script |
2 | dnl | |
68b2fc7a | 3 | AC_PREREQ(2.13) |
252b5132 RH |
4 | AC_INIT(ldmain.c) |
5 | ||
6 | AC_CANONICAL_SYSTEM | |
5d64ca4e | 7 | AC_ISC_POSIX |
252b5132 | 8 | |
27b7e12d AM |
9 | changequote(,)dnl |
10 | BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${srcdir}/../bfd/configure.in` | |
11 | changequote([,])dnl | |
12 | AM_INIT_AUTOMAKE(ld, ${BFD_VERSION}) | |
252b5132 RH |
13 | |
14 | AM_PROG_LIBTOOL | |
15 | ||
8e523c23 | 16 | AC_ARG_WITH(lib-path, [ --with-lib-path=dir1:dir2... set default LIB_PATH],LIB_PATH=$withval) |
252b5132 RH |
17 | AC_ARG_ENABLE(targets, |
18 | [ --enable-targets alternative target configurations], | |
19 | [case "${enableval}" in | |
20 | yes | "") AC_ERROR(enable-targets option must specify target names or 'all') | |
21 | ;; | |
22 | no) enable_targets= ;; | |
23 | *) enable_targets=$enableval ;; | |
24 | esac])dnl | |
25 | AC_ARG_ENABLE(64-bit-bfd, | |
26 | [ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)], | |
27 | [case "${enableval}" in | |
28 | yes) want64=true ;; | |
29 | no) want64=false ;; | |
30 | *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;; | |
31 | esac],[want64=false])dnl | |
32 | ||
0218d1e4 | 33 | build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" |
a2d91340 | 34 | AC_ARG_ENABLE(build-warnings, |
8e523c23 | 35 | [ --enable-build-warnings enable build-time compiler warnings if gcc is used], |
a2d91340 AC |
36 | [case "${enableval}" in |
37 | yes) ;; | |
38 | no) build_warnings="-w";; | |
39 | ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
40 | build_warnings="${build_warnings} ${t}";; | |
41 | *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
42 | build_warnings="${t} ${build_warnings}";; | |
43 | *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; | |
44 | esac | |
45 | if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then | |
46 | echo "Setting warning flags = $build_warnings" 6>&1 | |
47 | fi])dnl | |
48 | WARN_CFLAGS="" | |
49 | if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then | |
50 | WARN_CFLAGS="${build_warnings}" | |
51 | fi | |
52 | AC_SUBST(WARN_CFLAGS) | |
53 | ||
252b5132 RH |
54 | AM_CONFIG_HEADER(config.h:config.in) |
55 | ||
56 | if test -z "$target" ; then | |
57 | AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) | |
58 | fi | |
59 | if test -z "$host" ; then | |
60 | AC_MSG_ERROR(Unrecognized host system type; please check config.sub.) | |
61 | fi | |
62 | ||
63 | # host-specific stuff: | |
64 | ||
65 | AC_PROG_CC | |
66 | AC_PROG_INSTALL | |
67 | ||
be2d1673 | 68 | ALL_LINGUAS="fr sv tr es" |
252b5132 RH |
69 | CY_GNU_GETTEXT |
70 | ||
71 | AC_EXEEXT | |
72 | ||
73 | AC_PROG_YACC | |
74 | AM_PROG_LEX | |
75 | ||
76 | AM_MAINTAINER_MODE | |
77 | ||
78 | . ${srcdir}/configure.host | |
79 | ||
80 | AC_SUBST(HDEFINES) | |
81 | AC_SUBST(HOSTING_CRT0) | |
82 | AC_SUBST(HOSTING_LIBS) | |
83 | AC_SUBST(NATIVE_LIB_DIRS) | |
84 | ||
85 | AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h) | |
86 | AC_CHECK_FUNCS(sbrk) | |
87 | AC_HEADER_DIRENT | |
88 | ||
89 | BFD_BINARY_FOPEN | |
90 | ||
91 | BFD_NEED_DECLARATION(strstr) | |
92 | BFD_NEED_DECLARATION(free) | |
93 | BFD_NEED_DECLARATION(sbrk) | |
94 | BFD_NEED_DECLARATION(getenv) | |
95 | BFD_NEED_DECLARATION(environ) | |
96 | ||
597e2591 ILT |
97 | # When converting linker scripts into strings for use in emulation |
98 | # files, use astring.sed if the compiler supports ANSI string | |
99 | # concatenation, or ostring.sed otherwise. This is to support the | |
100 | # broken Microsoft MSVC compiler, which limits the length of string | |
101 | # constants, while still supporting pre-ANSI compilers which do not | |
102 | # support string concatenation. | |
e4dabd0e | 103 | AC_MSG_CHECKING([whether ANSI C string concatenation works]) |
597e2591 ILT |
104 | AC_CACHE_VAL(ld_cv_string_concatenation, |
105 | [AC_TRY_COMPILE(,[char *a = "a" "a";], | |
e4dabd0e AS |
106 | [ld_cv_string_concatenation=yes], |
107 | [ld_cv_string_concatenation=no])]) | |
108 | AC_MSG_RESULT($ld_cv_string_concatenation) | |
109 | if test "$ld_cv_string_concatenation" = "yes"; then | |
597e2591 ILT |
110 | STRINGIFY=astring.sed |
111 | else | |
112 | STRINGIFY=ostring.sed | |
113 | fi | |
114 | AC_SUBST(STRINGIFY) | |
115 | ||
252b5132 RH |
116 | # target-specific stuff: |
117 | ||
118 | all_targets= | |
119 | EMUL= | |
120 | all_emuls= | |
121 | all_emul_extras= | |
ba2be581 | 122 | all_libpath= |
252b5132 RH |
123 | |
124 | dnl We need to get an arbitrary number of tdir definitions into | |
125 | dnl Makefile. We can't do it using AC_SUBST, because autoconf does | |
126 | dnl not permit literal newlines in an AC_SUBST variables. So we use a | |
127 | dnl file. | |
128 | rm -f tdirs | |
129 | ||
130 | for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` | |
131 | do | |
132 | if test "$targ_alias" = "all"; then | |
133 | all_targets=true | |
134 | else | |
135 | # Canonicalize the secondary target names. | |
a8100d5b | 136 | result=`$ac_config_sub $targ_alias 2>/dev/null` |
252b5132 RH |
137 | if test -n "$result"; then |
138 | targ=$result | |
139 | else | |
140 | targ=$targ_alias | |
141 | fi | |
142 | ||
143 | . ${srcdir}/configure.tgt | |
144 | ||
145 | if test "$targ" = "$target"; then | |
146 | EMUL=$targ_emul | |
147 | fi | |
148 | ||
3336653a | 149 | for i in $targ_emul $targ_extra_emuls $targ_extra_libpath; do |
252b5132 RH |
150 | case " $all_emuls " in |
151 | *" e${i}.o "*) ;; | |
152 | *) | |
153 | all_emuls="$all_emuls e${i}.o" | |
154 | eval result=\$tdir_$i | |
155 | test -z "$result" && result=$targ_alias | |
156 | echo tdir_$i=$result >> tdirs | |
157 | ;; | |
158 | esac | |
159 | done | |
160 | ||
ba2be581 | 161 | for i in $targ_emul $targ_extra_libpath; do |
3336653a RH |
162 | case " $all_libpath " in |
163 | *" ${i} "*) ;; | |
164 | *) | |
ba2be581 RH |
165 | if test -z "$all_libpath"; then |
166 | all_libpath=${i} | |
167 | else | |
168 | all_libpath="$all_libpath ${i}" | |
169 | fi | |
3336653a RH |
170 | ;; |
171 | esac | |
172 | done | |
173 | ||
252b5132 RH |
174 | for i in $targ_extra_ofiles; do |
175 | case " $all_emul_extras " in | |
176 | *" ${i} "*) ;; | |
177 | *) | |
178 | all_emul_extras="$all_emul_extras ${i}" | |
179 | ;; | |
180 | esac | |
181 | done | |
182 | fi | |
183 | done | |
184 | ||
185 | AC_SUBST(EMUL) | |
186 | ||
187 | TDIRS=tdirs | |
188 | AC_SUBST_FILE(TDIRS) | |
189 | ||
190 | dnl FIXME: We will build a 64 bit BFD for a 64 bit host or a 64 bit | |
191 | dnl target, and in those cases we should also build the 64 bit | |
192 | dnl emulations. | |
193 | if test x${all_targets} = xtrue; then | |
194 | if test x${want64} = xtrue; then | |
195 | EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)' | |
196 | else | |
197 | EMULATION_OFILES='$(ALL_EMULATIONS)' | |
198 | fi | |
199 | EMUL_EXTRA_OFILES='$(ALL_EMUL_EXTRA_OFILES)' | |
200 | else | |
201 | EMULATION_OFILES=$all_emuls | |
202 | EMUL_EXTRA_OFILES=$all_emul_extras | |
203 | fi | |
204 | AC_SUBST(EMULATION_OFILES) | |
205 | AC_SUBST(EMUL_EXTRA_OFILES) | |
8e523c23 | 206 | AC_SUBST(LIB_PATH) |
252b5132 | 207 | |
3336653a RH |
208 | EMULATION_LIBPATH=$all_libpath |
209 | AC_SUBST(EMULATION_LIBPATH) | |
210 | ||
252b5132 RH |
211 | if test x${enable_static} = xno; then |
212 | TESTBFDLIB="--rpath ../bfd/.libs ../bfd/.libs/libbfd.so" | |
213 | else | |
214 | TESTBFDLIB="../bfd/.libs/libbfd.a" | |
215 | fi | |
216 | AC_SUBST(TESTBFDLIB) | |
217 | ||
93a6d436 JL |
218 | target_vendor=${target_vendor=$host_vendor} |
219 | case "$target_vendor" in | |
220 | hp) EXTRA_SHLIB_EXTENSION=".sl" ;; | |
221 | *) EXTRA_SHLIB_EXTENSION= ;; | |
222 | esac | |
223 | if test x${EXTRA_SHLIB_EXTENSION} != x ; then | |
224 | AC_DEFINE_UNQUOTED(EXTRA_SHLIB_EXTENSION, "$EXTRA_SHLIB_EXTENSION", | |
225 | [Additional extension a shared object might have.]) | |
226 | fi | |
227 | ||
252b5132 RH |
228 | AC_OUTPUT(Makefile po/Makefile.in:po/Make-in, |
229 | [sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile]) |