OSDN Git Service

2007-07-06 H.J. Lu <hongjiu.lu@intel.com>
[pf3gnuchains/gcc-fork.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
8 AC_PREREQ(2.59)
9 AC_INIT([GNU C Runtime Library], 1.0,,[libgcc])
10 AC_CONFIG_SRCDIR([static-object.mk])
11
12 AC_ARG_WITH(target-subdir,
13 [  --with-target-subdir=SUBDIR      Configuring in a subdirectory for target])
14 AC_ARG_WITH(cross-host,
15 [  --with-cross-host=HOST           Configuring with a cross compiler])
16 AC_ARG_WITH(ld,
17 [  --with-ld               arrange to use the specified ld (full pathname)])
18
19 if test "${srcdir}" = "."; then
20   if test -n "${with_build_subdir}"; then
21     libgcc_topdir="${srcdir}/../.."
22     with_target_subdir=
23   elif test -z "${with_target_subdir}"; then
24     libgcc_topdir="${srcdir}/.."
25   else
26     if test "${with_target_subdir}" != "."; then
27       libgcc_topdir="${srcdir}/${with_multisrctop}../.."
28     else
29       libgcc_topdir="${srcdir}/${with_multisrctop}.."
30     fi
31   fi
32 else
33   libgcc_topdir="${srcdir}/.."
34 fi
35 AC_SUBST(libgcc_topdir)
36 AC_CONFIG_AUX_DIR($libgcc_topdir)
37
38 AC_ARG_ENABLE(shared,
39 [  --disable-shared        don't provide a shared libgcc],
40 [
41   case $enable_shared in
42   yes | no) ;;
43   *)
44     enable_shared=no
45     IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
46     for pkg in $enableval; do
47       if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then
48         enable_shared=yes
49       fi
50     done
51     IFS="$ac_save_ifs"
52     ;;
53   esac
54 ], [enable_shared=yes])
55 AC_SUBST(enable_shared)
56
57 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
58 AC_ARG_ENABLE(version-specific-runtime-libs,
59 [  --enable-version-specific-runtime-libs    Specify that runtime libraries should be installed in a compiler-specific directory ],
60 [case "$enableval" in
61  yes) version_specific_libs=yes ;;
62  no)  version_specific_libs=no ;;
63  *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
64  esac],
65 [version_specific_libs=no])
66 AC_MSG_RESULT($version_specific_libs)
67
68 AC_ARG_WITH(slibdir,
69 [  --with-slibdir=DIR      shared libraries in DIR [LIBDIR]],
70 slibdir="$with_slibdir",
71 if test "${version_specific_libs}" = yes; then
72   slibdir='$(libsubdir)'
73 elif test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
74   slibdir='$(exec_prefix)/$(host_noncanonical)/lib'
75 else
76   slibdir='$(libdir)'
77 fi)
78 AC_SUBST(slibdir)
79
80 AC_PROG_INSTALL
81
82 AC_PROG_AWK
83 # We need awk; bail out if it's missing.
84 case ${AWK} in
85   "") AC_MSG_ERROR([can't build without awk, bailing out]) ;;
86 esac
87
88 AC_CANONICAL_HOST
89 ACX_NONCANONICAL_HOST
90 GCC_TOPLEV_SUBDIRS
91
92 dnl These must be called before AM_PROG_LIBTOOL, because it may want
93 dnl to call AC_CHECK_PROG.
94 AC_CHECK_TOOL(AR, ar)
95 AC_CHECK_TOOL(LIPO, lipo, :)
96 AC_CHECK_TOOL(NM, nm)
97 AC_CHECK_TOOL(RANLIB, ranlib, :)
98 AC_CHECK_TOOL(STRIP, strip, :)
99 AC_PROG_LN_S
100
101 GCC_NO_EXECUTABLES
102 AC_PROG_CC
103 AC_PROG_CPP_WERROR
104
105 # Check for decimal float support.
106 AC_CACHE_CHECK([whether decimal floating point is supported], [libgcc_cv_dfp],
107                [AC_COMPILE_IFELSE([_Decimal32 x;], [libgcc_cv_dfp=yes],
108                                   [libgcc_cv_dfp=no])])
109 decimal_float=$libgcc_cv_dfp
110 AC_SUBST(decimal_float)
111
112 AC_ARG_ENABLE(decimal-float,
113 [  --enable-decimal-float={no,yes,bid,dpd}
114                         enable decimal float extension to C.  Selecting 'bid'
115                         or 'dpd' choses which decimal floating point format
116                         to use],
117 [
118   case $enable_decimal_float in
119     yes | no | bid | dpd) ;;
120     *) AC_MSG_ERROR(['$enable_decimal_float' is an invalid value for --enable-decimal-float.
121 Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;;
122   esac
123 ],
124 [
125   case $host in
126     powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux*)
127       enable_decimal_float=yes
128       ;;
129     *)
130       enable_decimal_float=no
131       ;;
132   esac
133 ])
134
135 # x86's use BID format instead of DPD
136 if test x$enable_decimal_float = xyes; then
137   case $host in
138     i?86*-*-linux* | x86_64*-*-linux*)
139       enable_decimal_float=bid
140       ;;
141     *)
142       enable_decimal_float=dpd
143       ;;
144   esac
145 fi
146 AC_SUBST(enable_decimal_float)
147
148 # Collect host-machine-specific information.
149 . ${srcdir}/config.host
150
151 # Check for visibility support.  This is after config.host so that
152 # we can check for asm_hidden_op.
153 AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
154     libgcc_cv_hidden_visibility_attribute, [
155         echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c
156         libgcc_cv_hidden_visibility_attribute=no
157         if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
158             if grep "\\$asm_hidden_op.*foo" conftest.s >/dev/null; then
159                 libgcc_cv_hidden_visibility_attribute=yes
160             fi
161         fi
162         rm -f conftest.*
163     ])
164
165 if test $libgcc_cv_hidden_visibility_attribute = yes; then
166     vis_hide='-fvisibility=hidden -DHIDE_EXPORTS'
167 else
168     vis_hide=
169 fi
170 AC_SUBST(vis_hide)
171
172 # See if we have thread-local storage.  We can only test assembler
173 # sicne link-time and run-time tests require the newly built
174 # gcc, which can't be used to build executable due to that libgcc
175 # is yet to be built here.
176 GCC_CHECK_CC_TLS
177 set_have_cc_tls=
178 if test "$enable_tls $have_cc_tls" = "yes yes"; then
179   set_have_cc_tls="-DHAVE_CC_TLS"
180 fi
181 AC_SUBST(set_have_cc_tls)
182
183 # Conditionalize the makefile for this target machine.
184 tmake_file_=
185 for f in ${tmake_file}
186 do
187         if test -f ${srcdir}/config/$f
188         then
189                 tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
190         fi
191 done
192 tmake_file="${tmake_file_}"
193 AC_SUBST(tmake_file)
194
195 # Substitute configuration variables
196 AC_SUBST(extra_parts)
197 AC_SUBST(asm_hidden_op)
198
199 # We need multilib support.
200 AC_CONFIG_FILES([Makefile])
201 AC_CONFIG_COMMANDS([default],
202   [[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
203 if test -n "$CONFIG_FILES"; then
204   # FIXME: We shouldn't need to set ac_file
205   ac_file=Makefile
206   . ${libgcc_topdir}/config-ml.in
207 fi]],
208 [[srcdir=${srcdir}
209 host=${host}
210 with_target_subdir=${with_target_subdir}
211 with_multisubdir=${with_multisubdir}
212 ac_configure_args="--enable-multilib ${ac_configure_args}"
213 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
214 libgcc_topdir=${libgcc_topdir}
215 CC="${CC}"
216 ]])
217 AC_OUTPUT