OSDN Git Service

gcc:
[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 sinclude(../config/lib-ld.m4)
8 sinclude(../config/override.m4)
9 sinclude(../config/dfp.m4)
10
11 AC_PREREQ(2.64)
12 AC_INIT([GNU C Runtime Library], 1.0,,[libgcc])
13 AC_CONFIG_SRCDIR([static-object.mk])
14
15 AC_ARG_WITH(target-subdir,
16 [  --with-target-subdir=SUBDIR      Configuring in a subdirectory for target])
17 AC_ARG_WITH(cross-host,
18 [  --with-cross-host=HOST           Configuring with a cross compiler])
19 AC_ARG_WITH(ld,
20 [  --with-ld               arrange to use the specified ld (full pathname)])
21
22 if 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
35 else
36   libgcc_topdir="${srcdir}/.."
37 fi
38 AC_SUBST(libgcc_topdir)
39 AC_CONFIG_AUX_DIR($libgcc_topdir)
40
41 AC_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])
58 AC_SUBST(enable_shared)
59
60 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
61 AC_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])
69 AC_MSG_RESULT($version_specific_libs)
70
71 AC_ARG_WITH(slibdir,
72 [  --with-slibdir=DIR      shared libraries in DIR [LIBDIR]],
73 slibdir="$with_slibdir",
74 if test "${version_specific_libs}" = yes; then
75   slibdir='$(libsubdir)'
76 elif test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
77   slibdir='$(exec_prefix)/$(host_noncanonical)/lib'
78 else
79   slibdir='$(libdir)'
80 fi)
81 AC_SUBST(slibdir)
82
83 # Command-line options.
84 # Very limited version of AC_MAINTAINER_MODE.
85 AC_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='#'])
96 AC_SUBST([MAINT])dnl
97
98 AC_PROG_INSTALL
99
100 AC_PROG_AWK
101 # We need awk; bail out if it's missing.
102 case ${AWK} in
103   "") AC_MSG_ERROR([can't build without awk, bailing out]) ;;
104 esac
105
106 AC_CANONICAL_HOST
107 ACX_NONCANONICAL_HOST
108 ACX_NONCANONICAL_TARGET
109 GCC_TOPLEV_SUBDIRS
110
111 # Calculate toolexeclibdir
112 # Also toolexecdir, though it's only used in toolexeclibdir
113 case ${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     ;;
137 esac
138 AC_SUBST(toolexecdir)
139 AC_SUBST(toolexeclibdir)
140
141 dnl These must be called before AM_PROG_LIBTOOL, because it may want
142 dnl to call AC_CHECK_PROG.
143 AC_CHECK_TOOL(AR, ar)
144 AC_CHECK_TOOL(LIPO, lipo, :)
145 AC_CHECK_TOOL(NM, nm)
146 AC_CHECK_TOOL(RANLIB, ranlib, :)
147 AC_CHECK_TOOL(STRIP, strip, :)
148 AC_PROG_LN_S
149
150 GCC_NO_EXECUTABLES
151 AC_PROG_CC
152 AC_PROG_CPP_WERROR
153
154 # Check for decimal float support.
155 AC_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])])
158 decimal_float=$libgcc_cv_dfp
159 AC_SUBST(decimal_float)
160
161 GCC_AC_ENABLE_DECIMAL_FLOAT([$host])
162
163 # Check for fixed-point support.
164 AC_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])])
167 fixed_point=$libgcc_cv_fixed_point
168 AC_SUBST(fixed_point)
169
170 AC_LIB_PROG_LD_GNU
171
172 # Check for assembler CFI support.
173 AC_CACHE_CHECK([whether assembler supports CFI directives], [libgcc_cv_cfi],
174                [AC_COMPILE_IFELSE(
175 [asm("\n\
176         .text\n\
177         .cfi_startproc\n\
178         .cfi_personality 0, symbol\n\
179         .cfi_endproc");],
180   [libgcc_cv_cfi=yes],
181   [libgcc_cv_cfi=no])])
182
183 # Check 32bit or 64bit for x86.
184 case ${host} in
185 i?86*-*-* | x86_64*-*-*)
186   cat > conftest.c <<EOF
187 #ifdef __x86_64__
188 host_address=64
189 #else
190 host_address=32
191 #endif
192 EOF
193     eval `${CC-cc} -E conftest.c | grep host_address=`
194     rm -f conftest.c
195     ;;
196 esac
197
198 # Collect host-machine-specific information.
199 . ${srcdir}/config.host
200
201 # Check if Solaris/x86 linker supports ZERO terminator unwind entries.
202 # This is after config.host so we can augment tmake_file.
203 # Link with -nostartfiles -nodefaultlibs since neither are present while
204 # building libgcc.
205 case ${host} in
206 i?86-*-solaris2*)
207   cat > conftest.s <<EOF
208         .section        .eh_frame,"a",@unwind
209         .zero   4
210         .section        .jcr,"aw",@progbits
211         .zero   8
212 EOF
213   if AC_TRY_COMMAND(${CC-cc} -shared -nostartfiles -nodefaultlibs -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD); then
214       # configure expects config files in libgcc/config, so need a relative
215       # path here.
216       tmake_file="${tmake_file} ../../gcc/config/i386/t-crtstuff"
217   fi
218   ;;
219 esac
220
221 # Check for visibility support.  This is after config.host so that
222 # we can check for asm_hidden_op.
223 AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
224     libgcc_cv_hidden_visibility_attribute, [
225         echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c
226         libgcc_cv_hidden_visibility_attribute=no
227         if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
228             if grep "\\$asm_hidden_op.*foo" conftest.s >/dev/null; then
229                 libgcc_cv_hidden_visibility_attribute=yes
230             fi
231         fi
232         rm -f conftest.*
233     ])
234
235 if test $libgcc_cv_hidden_visibility_attribute = yes; then
236     vis_hide='-fvisibility=hidden -DHIDE_EXPORTS'
237 else
238     vis_hide=
239 fi
240 AC_SUBST(vis_hide)
241
242 # See if we have thread-local storage.  We can only test assembler
243 # sicne link-time and run-time tests require the newly built
244 # gcc, which can't be used to build executable due to that libgcc
245 # is yet to be built here.
246 GCC_CHECK_CC_TLS
247 set_have_cc_tls=
248 if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
249   set_have_cc_tls="-DHAVE_CC_TLS"
250 fi
251 AC_SUBST(set_have_cc_tls)
252
253 # See if we have emulated thread-local storage.
254 GCC_CHECK_EMUTLS
255 set_use_emutls=
256 if test "$enable_tls $gcc_cv_use_emutls" = "yes yes"; then
257   set_use_emutls="-DUSE_EMUTLS"
258 fi
259 AC_SUBST(set_use_emutls)
260
261 # Conditionalize the makefile for this target machine.
262 tmake_file_=
263 for f in ${tmake_file}
264 do
265         if test -f ${srcdir}/config/$f
266         then
267                 tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
268         fi
269 done
270 tmake_file="${tmake_file_}"
271 AC_SUBST(tmake_file)
272
273 # Substitute configuration variables
274 AC_SUBST(cpu_type)
275 AC_SUBST(extra_parts)
276 AC_SUBST(asm_hidden_op)
277
278 # We need multilib support.
279 AC_CONFIG_FILES([Makefile])
280 AC_CONFIG_COMMANDS([default],
281   [[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
282 if test -n "$CONFIG_FILES"; then
283   # FIXME: We shouldn't need to set ac_file
284   ac_file=Makefile
285   . ${libgcc_topdir}/config-ml.in
286 fi]],
287 [[srcdir=${srcdir}
288 host=${host}
289 with_target_subdir=${with_target_subdir}
290 with_multisubdir=${with_multisubdir}
291 ac_configure_args="--enable-multilib ${ac_configure_args}"
292 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
293 libgcc_topdir=${libgcc_topdir}
294 CC="${CC}"
295 ]])
296 AC_OUTPUT