config.gcc: Handle softfp as for Linux.
[gcc.git] / libgcc / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2
3 sinclude(../config/enable.m4)
4 sinclude(../config/tls.m4)
5 sinclude(../config/acx.m4)
6 sinclude(../config/no-executables.m4)
7 sinclude(../config/override.m4)
8
9 AC_PREREQ(2.64)
10 AC_INIT([GNU C Runtime Library], 1.0,,[libgcc])
11 AC_CONFIG_SRCDIR([static-object.mk])
12
13 AC_ARG_WITH(target-subdir,
14 [ --with-target-subdir=SUBDIR Configuring in a subdirectory for target])
15 AC_ARG_WITH(cross-host,
16 [ --with-cross-host=HOST Configuring with a cross compiler])
17 AC_ARG_WITH(ld,
18 [ --with-ld arrange to use the specified ld (full pathname)])
19
20 if test "${srcdir}" = "."; then
21 if test -n "${with_build_subdir}"; then
22 libgcc_topdir="${srcdir}/../.."
23 with_target_subdir=
24 elif test -z "${with_target_subdir}"; then
25 libgcc_topdir="${srcdir}/.."
26 else
27 if test "${with_target_subdir}" != "."; then
28 libgcc_topdir="${srcdir}/${with_multisrctop}../.."
29 else
30 libgcc_topdir="${srcdir}/${with_multisrctop}.."
31 fi
32 fi
33 else
34 libgcc_topdir="${srcdir}/.."
35 fi
36 AC_SUBST(libgcc_topdir)
37 AC_CONFIG_AUX_DIR($libgcc_topdir)
38
39 AC_ARG_ENABLE(shared,
40 [ --disable-shared don't provide a shared libgcc],
41 [
42 case $enable_shared in
43 yes | no) ;;
44 *)
45 enable_shared=no
46 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
47 for pkg in $enableval; do
48 if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then
49 enable_shared=yes
50 fi
51 done
52 IFS="$ac_save_ifs"
53 ;;
54 esac
55 ], [enable_shared=yes])
56 AC_SUBST(enable_shared)
57
58 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
59 AC_ARG_ENABLE(version-specific-runtime-libs,
60 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
61 [case "$enableval" in
62 yes) version_specific_libs=yes ;;
63 no) version_specific_libs=no ;;
64 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
65 esac],
66 [version_specific_libs=no])
67 AC_MSG_RESULT($version_specific_libs)
68
69 AC_ARG_WITH(slibdir,
70 [ --with-slibdir=DIR shared libraries in DIR [LIBDIR]],
71 slibdir="$with_slibdir",
72 if test "${version_specific_libs}" = yes; then
73 slibdir='$(libsubdir)'
74 elif test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
75 slibdir='$(exec_prefix)/$(host_noncanonical)/lib'
76 else
77 slibdir='$(libdir)'
78 fi)
79 AC_SUBST(slibdir)
80
81 # Command-line options.
82 # Very limited version of AC_MAINTAINER_MODE.
83 AC_ARG_ENABLE([maintainer-mode],
84 [AC_HELP_STRING([--enable-maintainer-mode],
85 [enable make rules and dependencies not useful (and
86 sometimes confusing) to the casual installer])],
87 [case ${enable_maintainer_mode} in
88 yes) MAINT='' ;;
89 no) MAINT='#' ;;
90 *) AC_MSG_ERROR([--enable-maintainer-mode must be yes or no]) ;;
91 esac
92 maintainer_mode=${enableval}],
93 [MAINT='#'])
94 AC_SUBST([MAINT])dnl
95
96 AC_PROG_INSTALL
97
98 AC_PROG_AWK
99 # We need awk; bail out if it's missing.
100 case ${AWK} in
101 "") AC_MSG_ERROR([can't build without awk, bailing out]) ;;
102 esac
103
104 AC_CANONICAL_HOST
105 ACX_NONCANONICAL_HOST
106 GCC_TOPLEV_SUBDIRS
107
108 dnl These must be called before AM_PROG_LIBTOOL, because it may want
109 dnl to call AC_CHECK_PROG.
110 AC_CHECK_TOOL(AR, ar)
111 AC_CHECK_TOOL(LIPO, lipo, :)
112 AC_CHECK_TOOL(NM, nm)
113 AC_CHECK_TOOL(RANLIB, ranlib, :)
114 AC_CHECK_TOOL(STRIP, strip, :)
115 AC_PROG_LN_S
116
117 GCC_NO_EXECUTABLES
118 AC_PROG_CC
119 AC_PROG_CPP_WERROR
120
121 # Check for decimal float support.
122 AC_CACHE_CHECK([whether decimal floating point is supported], [libgcc_cv_dfp],
123 [AC_COMPILE_IFELSE([_Decimal32 x;], [libgcc_cv_dfp=yes],
124 [libgcc_cv_dfp=no])])
125 decimal_float=$libgcc_cv_dfp
126 AC_SUBST(decimal_float)
127
128 AC_ARG_ENABLE(decimal-float,
129 [ --enable-decimal-float={no,yes,bid,dpd}
130 enable decimal float extension to C. Selecting 'bid'
131 or 'dpd' choses which decimal floating point format
132 to use],
133 [
134 case $enable_decimal_float in
135 yes | no | bid | dpd) ;;
136 *) AC_MSG_ERROR(['$enable_decimal_float' is an invalid value for --enable-decimal-float.
137 Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;;
138 esac
139 ],
140 [
141 case $host in
142 powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux*)
143 enable_decimal_float=yes
144 ;;
145 *)
146 enable_decimal_float=no
147 ;;
148 esac
149 ])
150
151 # x86's use BID format instead of DPD
152 if test x$enable_decimal_float = xyes; then
153 case $host in
154 i?86*-*-linux* | x86_64*-*-linux*)
155 enable_decimal_float=bid
156 ;;
157 *)
158 enable_decimal_float=dpd
159 ;;
160 esac
161 fi
162 AC_SUBST(enable_decimal_float)
163
164 # Check for fixed-point support.
165 AC_CACHE_CHECK([whether fixed-point is supported], [libgcc_cv_fixed_point],
166 [AC_COMPILE_IFELSE([_Sat _Fract x;], [libgcc_cv_fixed_point=yes],
167 [libgcc_cv_fixed_point=no])])
168 fixed_point=$libgcc_cv_fixed_point
169 AC_SUBST(fixed_point)
170
171 # Check 32bit or 64bit for x86.
172 case ${host} in
173 i?86*-*-* | x86_64*-*-*)
174 cat > conftest.c <<EOF
175 #ifdef __x86_64__
176 host_address=64
177 #else
178 host_address=32
179 #endif
180 EOF
181 eval `${CC-cc} -E conftest.c | grep host_address=`
182 rm -f conftest.c
183 ;;
184 esac
185
186 # Collect host-machine-specific information.
187 . ${srcdir}/config.host
188
189 # Check if Solaris/x86 linker supports ZERO terminator unwind entries.
190 # This is after config.host so we can augment tmake_file.
191 # Link with -nostartfiles -nodefaultlibs since neither are present while
192 # building libgcc.
193 case ${host} in
194 i?86-*-solaris2.1[[0-9]]*)
195 cat > conftest.s <<EOF
196 .section .eh_frame,"a",@unwind
197 .zero 4
198 .section .jcr,"aw",@progbits
199 .zero 8
200 EOF
201 if AC_TRY_COMMAND(${CC-cc} -shared -nostartfiles -nodefaultlibs -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD); then
202 # configure expects config files in libgcc/config, so need a relative
203 # path here.
204 tmake_file="${tmake_file} ../../gcc/config/i386/t-crtstuff"
205 fi
206 ;;
207 esac
208
209 # Check for visibility support. This is after config.host so that
210 # we can check for asm_hidden_op.
211 AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
212 libgcc_cv_hidden_visibility_attribute, [
213 echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c
214 libgcc_cv_hidden_visibility_attribute=no
215 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
216 if grep "\\$asm_hidden_op.*foo" conftest.s >/dev/null; then
217 libgcc_cv_hidden_visibility_attribute=yes
218 fi
219 fi
220 rm -f conftest.*
221 ])
222
223 if test $libgcc_cv_hidden_visibility_attribute = yes; then
224 vis_hide='-fvisibility=hidden -DHIDE_EXPORTS'
225 else
226 vis_hide=
227 fi
228 AC_SUBST(vis_hide)
229
230 # See if we have thread-local storage. We can only test assembler
231 # sicne link-time and run-time tests require the newly built
232 # gcc, which can't be used to build executable due to that libgcc
233 # is yet to be built here.
234 GCC_CHECK_CC_TLS
235 set_have_cc_tls=
236 if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
237 set_have_cc_tls="-DHAVE_CC_TLS"
238 fi
239 AC_SUBST(set_have_cc_tls)
240
241 # See if we have emulated thread-local storage.
242 GCC_CHECK_EMUTLS
243 set_use_emutls=
244 if test "$enable_tls $gcc_cv_use_emutls" = "yes yes"; then
245 set_use_emutls="-DUSE_EMUTLS"
246 fi
247 AC_SUBST(set_use_emutls)
248
249 # Conditionalize the makefile for this target machine.
250 tmake_file_=
251 for f in ${tmake_file}
252 do
253 if test -f ${srcdir}/config/$f
254 then
255 tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
256 fi
257 done
258 tmake_file="${tmake_file_}"
259 AC_SUBST(tmake_file)
260
261 # Substitute configuration variables
262 AC_SUBST(extra_parts)
263 AC_SUBST(asm_hidden_op)
264
265 # We need multilib support.
266 AC_CONFIG_FILES([Makefile])
267 AC_CONFIG_COMMANDS([default],
268 [[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
269 if test -n "$CONFIG_FILES"; then
270 # FIXME: We shouldn't need to set ac_file
271 ac_file=Makefile
272 . ${libgcc_topdir}/config-ml.in
273 fi]],
274 [[srcdir=${srcdir}
275 host=${host}
276 with_target_subdir=${with_target_subdir}
277 with_multisubdir=${with_multisubdir}
278 ac_configure_args="--enable-multilib ${ac_configure_args}"
279 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
280 libgcc_topdir=${libgcc_topdir}
281 CC="${CC}"
282 ]])
283 AC_OUTPUT