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