blob: 4f56c3b596f00cb6d876e92d9a72c7cbf457791d [file] [log] [blame]
Daniel Jacobowitzfa958512007-01-04 04:22:37 +00001dnl Process this file with autoconf to produce a configure script.
2
H.J. Lu6f461e72007-07-06 07:00:46 -07003sinclude(../config/enable.m4)
4sinclude(../config/tls.m4)
Daniel Jacobowitzfa958512007-01-04 04:22:37 +00005sinclude(../config/acx.m4)
6sinclude(../config/no-executables.m4)
Rainer Orthca24c5a2011-06-01 14:39:17 +00007sinclude(../config/lib-ld.m4)
Ralf Wildenhues18c04402008-06-17 23:13:35 +00008sinclude(../config/override.m4)
Andreas Krebbel3c39bca2010-09-03 13:14:14 +00009sinclude(../config/dfp.m4)
Daniel Jacobowitzfa958512007-01-04 04:22:37 +000010
Ralf Wildenhuesdf58e642009-08-24 19:08:51 +000011AC_PREREQ(2.64)
Daniel Jacobowitzfa958512007-01-04 04:22:37 +000012AC_INIT([GNU C Runtime Library], 1.0,,[libgcc])
13AC_CONFIG_SRCDIR([static-object.mk])
14
15AC_ARG_WITH(target-subdir,
16[ --with-target-subdir=SUBDIR Configuring in a subdirectory for target])
17AC_ARG_WITH(cross-host,
18[ --with-cross-host=HOST Configuring with a cross compiler])
19AC_ARG_WITH(ld,
20[ --with-ld arrange to use the specified ld (full pathname)])
21
22if test "${srcdir}" = "."; then
23 if test -n "${with_build_subdir}"; then
24 libgcc_topdir="${srcdir}/../.."
25 with_target_subdir=
26 elif test -z "${with_target_subdir}"; then
27 libgcc_topdir="${srcdir}/.."
28 else
29 if test "${with_target_subdir}" != "."; then
30 libgcc_topdir="${srcdir}/${with_multisrctop}../.."
31 else
32 libgcc_topdir="${srcdir}/${with_multisrctop}.."
33 fi
34 fi
35else
36 libgcc_topdir="${srcdir}/.."
37fi
38AC_SUBST(libgcc_topdir)
39AC_CONFIG_AUX_DIR($libgcc_topdir)
40
41AC_ARG_ENABLE(shared,
42[ --disable-shared don't provide a shared libgcc],
43[
44 case $enable_shared in
45 yes | no) ;;
46 *)
47 enable_shared=no
48 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
49 for pkg in $enableval; do
50 if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then
51 enable_shared=yes
52 fi
53 done
54 IFS="$ac_save_ifs"
55 ;;
56 esac
57], [enable_shared=yes])
58AC_SUBST(enable_shared)
59
Daniel Jacobowitzd6efbf52007-01-25 16:00:32 +000060AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
61AC_ARG_ENABLE(version-specific-runtime-libs,
62[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
63[case "$enableval" in
64 yes) version_specific_libs=yes ;;
65 no) version_specific_libs=no ;;
66 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
67 esac],
68[version_specific_libs=no])
69AC_MSG_RESULT($version_specific_libs)
70
Daniel Jacobowitzfa958512007-01-04 04:22:37 +000071AC_ARG_WITH(slibdir,
72[ --with-slibdir=DIR shared libraries in DIR [LIBDIR]],
73slibdir="$with_slibdir",
Daniel Jacobowitzd6efbf52007-01-25 16:00:32 +000074if test "${version_specific_libs}" = yes; then
Daniel Jacobowitzfa958512007-01-04 04:22:37 +000075 slibdir='$(libsubdir)'
Daniel Jacobowitzd6efbf52007-01-25 16:00:32 +000076elif test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
77 slibdir='$(exec_prefix)/$(host_noncanonical)/lib'
Daniel Jacobowitzfa958512007-01-04 04:22:37 +000078else
79 slibdir='$(libdir)'
80fi)
81AC_SUBST(slibdir)
82
Ralf Wildenhues6efbd532009-07-30 22:33:49 +000083# Command-line options.
84# Very limited version of AC_MAINTAINER_MODE.
85AC_ARG_ENABLE([maintainer-mode],
86 [AC_HELP_STRING([--enable-maintainer-mode],
87 [enable make rules and dependencies not useful (and
88 sometimes confusing) to the casual installer])],
89 [case ${enable_maintainer_mode} in
90 yes) MAINT='' ;;
91 no) MAINT='#' ;;
92 *) AC_MSG_ERROR([--enable-maintainer-mode must be yes or no]) ;;
93 esac
94 maintainer_mode=${enableval}],
95 [MAINT='#'])
96AC_SUBST([MAINT])dnl
97
Daniel Jacobowitzfa958512007-01-04 04:22:37 +000098AC_PROG_INSTALL
99
100AC_PROG_AWK
101# We need awk; bail out if it's missing.
102case ${AWK} in
103 "") AC_MSG_ERROR([can't build without awk, bailing out]) ;;
104esac
105
106AC_CANONICAL_HOST
107ACX_NONCANONICAL_HOST
Dave Korn58c741a2011-01-26 04:19:58 +0000108ACX_NONCANONICAL_TARGET
Paolo Bonzini14e8fc82007-01-04 18:12:08 +0000109GCC_TOPLEV_SUBDIRS
Daniel Jacobowitzfa958512007-01-04 04:22:37 +0000110
Dave Korn58c741a2011-01-26 04:19:58 +0000111# Calculate toolexeclibdir
112# Also toolexecdir, though it's only used in toolexeclibdir
113case ${version_specific_libs} in
114 yes)
115 # Need the gcc compiler version to know where to install libraries
116 # and header files if --enable-version-specific-runtime-libs option
117 # is selected.
118 toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
119 toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
120 ;;
121 no)
122 if test -n "$with_cross_host" &&
123 test x"$with_cross_host" != x"no"; then
124 # Install a library built with a cross compiler in tooldir, not libdir.
125 toolexecdir='$(exec_prefix)/$(target_noncanonical)'
126 toolexeclibdir='$(toolexecdir)/lib'
127 else
128 toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
129 toolexeclibdir='$(libdir)'
130 fi
131 multi_os_directory=`$CC -print-multi-os-directory`
132 case $multi_os_directory in
133 .) ;; # Avoid trailing /.
134 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
135 esac
136 ;;
137esac
138AC_SUBST(toolexecdir)
139AC_SUBST(toolexeclibdir)
140
Daniel Jacobowitzfa958512007-01-04 04:22:37 +0000141dnl These must be called before AM_PROG_LIBTOOL, because it may want
142dnl to call AC_CHECK_PROG.
143AC_CHECK_TOOL(AR, ar)
144AC_CHECK_TOOL(LIPO, lipo, :)
145AC_CHECK_TOOL(NM, nm)
146AC_CHECK_TOOL(RANLIB, ranlib, :)
147AC_CHECK_TOOL(STRIP, strip, :)
148AC_PROG_LN_S
149
150GCC_NO_EXECUTABLES
151AC_PROG_CC
152AC_PROG_CPP_WERROR
153
154# Check for decimal float support.
155AC_CACHE_CHECK([whether decimal floating point is supported], [libgcc_cv_dfp],
156 [AC_COMPILE_IFELSE([_Decimal32 x;], [libgcc_cv_dfp=yes],
157 [libgcc_cv_dfp=no])])
158decimal_float=$libgcc_cv_dfp
159AC_SUBST(decimal_float)
160
Andreas Krebbel3c39bca2010-09-03 13:14:14 +0000161GCC_AC_ENABLE_DECIMAL_FLOAT([$host])
Michael Meissner79b87c72007-03-24 17:04:47 +0000162
Chao-ying Fu8d2a9e02007-09-17 22:18:13 +0000163# Check for fixed-point support.
164AC_CACHE_CHECK([whether fixed-point is supported], [libgcc_cv_fixed_point],
165 [AC_COMPILE_IFELSE([_Sat _Fract x;], [libgcc_cv_fixed_point=yes],
166 [libgcc_cv_fixed_point=no])])
167fixed_point=$libgcc_cv_fixed_point
168AC_SUBST(fixed_point)
169
Rainer Orthca24c5a2011-06-01 14:39:17 +0000170AC_LIB_PROG_LD_GNU
171
Rainer Orthee33b5f2011-06-03 13:23:35 +0000172AC_MSG_CHECKING([for thread model used by GCC])
173target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
174AC_MSG_RESULT([$target_thread_file])
175
Ian Lance Taylorb6110d62010-09-28 00:07:12 +0000176# Check for assembler CFI support.
177AC_CACHE_CHECK([whether assembler supports CFI directives], [libgcc_cv_cfi],
Ian Lance Taylor6dace302010-09-29 00:54:08 +0000178 [AC_COMPILE_IFELSE(
179[asm("\n\
180 .text\n\
181 .cfi_startproc\n\
182 .cfi_personality 0, symbol\n\
183 .cfi_endproc");],
184 [libgcc_cv_cfi=yes],
185 [libgcc_cv_cfi=no])])
Ian Lance Taylorb6110d62010-09-28 00:07:12 +0000186
H.J. Luff473282008-07-02 15:59:19 +0000187# Check 32bit or 64bit for x86.
188case ${host} in
189i?86*-*-* | x86_64*-*-*)
190 cat > conftest.c <<EOF
191#ifdef __x86_64__
192host_address=64
193#else
194host_address=32
195#endif
196EOF
197 eval `${CC-cc} -E conftest.c | grep host_address=`
198 rm -f conftest.c
199 ;;
200esac
201
Daniel Jacobowitzfa958512007-01-04 04:22:37 +0000202# Collect host-machine-specific information.
203. ${srcdir}/config.host
204
Rainer Orth19523302008-11-20 17:13:01 +0000205# Check if Solaris/x86 linker supports ZERO terminator unwind entries.
206# This is after config.host so we can augment tmake_file.
207# Link with -nostartfiles -nodefaultlibs since neither are present while
208# building libgcc.
209case ${host} in
Rainer Orthb595b1a2010-12-10 17:03:53 +0000210i?86-*-solaris2*)
Rainer Orth19523302008-11-20 17:13:01 +0000211 cat > conftest.s <<EOF
212 .section .eh_frame,"a",@unwind
213 .zero 4
214 .section .jcr,"aw",@progbits
215 .zero 8
216EOF
217 if AC_TRY_COMMAND(${CC-cc} -shared -nostartfiles -nodefaultlibs -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD); then
218 # configure expects config files in libgcc/config, so need a relative
219 # path here.
220 tmake_file="${tmake_file} ../../gcc/config/i386/t-crtstuff"
221 fi
222 ;;
223esac
224
Daniel Jacobowitzfa958512007-01-04 04:22:37 +0000225# Check for visibility support. This is after config.host so that
226# we can check for asm_hidden_op.
227AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
228 libgcc_cv_hidden_visibility_attribute, [
229 echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c
230 libgcc_cv_hidden_visibility_attribute=no
231 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
232 if grep "\\$asm_hidden_op.*foo" conftest.s >/dev/null; then
233 libgcc_cv_hidden_visibility_attribute=yes
234 fi
235 fi
236 rm -f conftest.*
237 ])
238
239if test $libgcc_cv_hidden_visibility_attribute = yes; then
240 vis_hide='-fvisibility=hidden -DHIDE_EXPORTS'
241else
242 vis_hide=
243fi
244AC_SUBST(vis_hide)
245
H.J. Lu6f461e72007-07-06 07:00:46 -0700246# See if we have thread-local storage. We can only test assembler
247# sicne link-time and run-time tests require the newly built
248# gcc, which can't be used to build executable due to that libgcc
249# is yet to be built here.
250GCC_CHECK_CC_TLS
H.J. Lu22867d02007-07-06 14:53:06 +0000251set_have_cc_tls=
H.J. Lub4e9c2c2007-10-27 23:22:57 +0000252if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
H.J. Lu6f461e72007-07-06 07:00:46 -0700253 set_have_cc_tls="-DHAVE_CC_TLS"
254fi
255AC_SUBST(set_have_cc_tls)
256
Jack Howarth368fabd2010-03-30 13:08:52 +0000257# See if we have emulated thread-local storage.
258GCC_CHECK_EMUTLS
259set_use_emutls=
260if test "$enable_tls $gcc_cv_use_emutls" = "yes yes"; then
261 set_use_emutls="-DUSE_EMUTLS"
262fi
263AC_SUBST(set_use_emutls)
264
Daniel Jacobowitzfa958512007-01-04 04:22:37 +0000265# Conditionalize the makefile for this target machine.
266tmake_file_=
267for f in ${tmake_file}
268do
269 if test -f ${srcdir}/config/$f
270 then
271 tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
272 fi
273done
274tmake_file="${tmake_file_}"
275AC_SUBST(tmake_file)
276
277# Substitute configuration variables
Rainer Orthca24c5a2011-06-01 14:39:17 +0000278AC_SUBST(cpu_type)
Daniel Jacobowitzfa958512007-01-04 04:22:37 +0000279AC_SUBST(extra_parts)
280AC_SUBST(asm_hidden_op)
Rainer Orth10e48e32011-06-09 12:30:46 +0000281AC_CONFIG_LINKS([enable-execute-stack.c:$enable_execute_stack])
Rainer Orth58cd1d72011-06-03 18:30:39 +0000282AC_CONFIG_LINKS([md-unwind-support.h:config/$md_unwind_header])
Daniel Jacobowitzfa958512007-01-04 04:22:37 +0000283
284# We need multilib support.
285AC_CONFIG_FILES([Makefile])
286AC_CONFIG_COMMANDS([default],
287 [[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
288if test -n "$CONFIG_FILES"; then
289 # FIXME: We shouldn't need to set ac_file
290 ac_file=Makefile
291 . ${libgcc_topdir}/config-ml.in
292fi]],
293[[srcdir=${srcdir}
294host=${host}
Daniel Jacobowitzfa958512007-01-04 04:22:37 +0000295with_target_subdir=${with_target_subdir}
296with_multisubdir=${with_multisubdir}
297ac_configure_args="--enable-multilib ${ac_configure_args}"
298CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
299libgcc_topdir=${libgcc_topdir}
300CC="${CC}"
301]])
302AC_OUTPUT