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