OSDN Git Service

* configure.in (auxdir): Replace by ...
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / configure.in
1 # Process this file with autoconf to produce a configure script, like so:
2 # aclocal, autoconf, autoheader, automake
3
4 AC_PREREQ(2.13)
5 AC_INIT(src/ios.cc)
6
7 # When building with srcdir == objdir, links to the source files will
8 # be created in directories within the target_subdir.  We have to
9 # adjust toplevel_srcdir accordingly, so that configure finds
10 # install-sh and other auxiliary files that live in the top-level
11 # source directory.
12 if test "${srcdir}" = "."; then
13   if test -z "${with_target_subdir}"; then
14     toprel=".."
15   else
16     if test "${with_target_subdir}" != "."; then
17       toprel="${with_multisrctop}../.."
18     else
19       toprel="${with_multisrctop}.."
20     fi
21   fi
22 else
23   toprel=".."
24 fi
25 AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
26 toplevel_srcdir=\${top_srcdir}/$toprel
27 AC_SUBST(toplevel_srcdir)
28
29 dnl This is here just to satisfy automake.
30 ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)])
31
32 # Gets and sets build, host, target, *_vendor, *_cpu, *_os, etc.
33 # AC 2.50 sets target_alias iff the user specified --target, but we use it
34 # everywhere, so we set it here just to be sure.
35 AC_CANONICAL_SYSTEM
36 target_alias=${target_alias-$target}
37 AC_SUBST(target_alias)
38
39 # We use these options to decide which functions to include.
40 AC_ARG_WITH(target-subdir,
41 [  --with-target-subdir=SUBDIR
42                            configuring in a subdirectory])
43 AC_ARG_WITH(cross-host,
44 [  --with-cross-host=HOST  configuring with a cross compiler])
45
46 # Runs configure.host and configure.target. Have to run this before
47 # the GLIBCPP_ENABLE_* macros below.
48 GLIBCPP_CONFIGURE(.)
49
50 AC_LIBTOOL_DLOPEN
51 AM_PROG_LIBTOOL
52 AC_SUBST(enable_shared)
53 AC_SUBST(enable_static)
54 GLIBCPP_CHECK_GNU_MAKE
55
56
57
58 AM_CONFIG_HEADER(config.h)
59
60 # Check for c++ or library specific bits that don't require linking.
61 GLIBCPP_CHECK_COMPILER_VERSION
62
63 # Enable all the crazy c++ stuff.  C_MBCHAR must come early.
64 GLIBCPP_ENABLE_DEBUG($USE_MAINTAINER_MODE)
65 GLIBCPP_ENABLE_CSTDIO
66 GLIBCPP_ENABLE_CLOCALE
67 GLIBCPP_ENABLE_C_MBCHAR([yes])
68 GLIBCPP_ENABLE_C99([yes])
69 GLIBCPP_ENABLE_LONG_LONG([yes])
70 GLIBCPP_ENABLE_CHEADERS([c_std])
71 GLIBCPP_ENABLE_THREADS
72 GLIBCPP_ENABLE_CXX_FLAGS([none])
73 GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
74
75 if test -n "$with_cross_host"; then
76
77   # We are being configured with a cross compiler.  AC_REPLACE_FUNCS
78   # may not work correctly, because the compiler may not be able to
79   # link executables.
80   xcompiling=1
81   NATIVE=no
82
83   # If Canadian cross, then don't pick up tools from the build
84   # directory.
85   if test x"$build" != x"$with_cross_host" && x"$build" != x"$target"; then
86     CANADIAN=yes
87     NULL_TARGET=yes
88   else
89     CANADIAN=no
90     NULL_TARGET=no
91   fi
92
93   case "$target_alias" in
94     *-linux*)
95         # Construct linux crosses by hand, eliminating bits that need ld...
96         # Check for available headers.
97         AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
98         machine/endian.h machine/param.h sys/machine.h fp.h locale.h \
99         float.h inttypes.h])
100
101         # GLIBCPP_CHECK_COMPILER_FEATURES
102         SECTION_FLAGS='-ffunction-sections -fdata-sections'
103         AC_SUBST(SECTION_FLAGS)
104         GLIBCPP_CHECK_LINKER_FEATURES
105         # GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
106         # GLIBCPP_CHECK_MATH_SUPPORT
107         AC_DEFINE(HAVE_ACOSF)
108         AC_DEFINE(HAVE_ASINF)
109         AC_DEFINE(HAVE_ATAN2F)
110         AC_DEFINE(HAVE_ATANF)
111         AC_DEFINE(HAVE_CEILF)
112         AC_DEFINE(HAVE_COPYSIGN)
113         AC_DEFINE(HAVE_COPYSIGNF)
114         AC_DEFINE(HAVE_COSF)
115         AC_DEFINE(HAVE_COSHF)
116         AC_DEFINE(HAVE_EXPF)
117         AC_DEFINE(HAVE_FABSF)
118         AC_DEFINE(HAVE_FINITE)
119         AC_DEFINE(HAVE_FINITEF)
120         AC_DEFINE(HAVE_FLOORF)
121         AC_DEFINE(HAVE_FMODF)
122         AC_DEFINE(HAVE_FREXPF)
123         AC_DEFINE(HAVE_ISINF)
124         AC_DEFINE(HAVE_ISINFF)
125         AC_DEFINE(HAVE_ISNAN)
126         AC_DEFINE(HAVE_ISNANF)
127         AC_DEFINE(HAVE_LDEXPF)
128         AC_DEFINE(HAVE_LOG10F)
129         AC_DEFINE(HAVE_LOGF)
130         AC_DEFINE(HAVE_MODFF)
131         AC_DEFINE(HAVE_POWF)
132         AC_DEFINE(HAVE_SINCOS)
133         AC_DEFINE(HAVE_SINCOSF)
134         AC_DEFINE(HAVE_SINF)
135         AC_DEFINE(HAVE_SINHF)
136         AC_DEFINE(HAVE_SQRTF)
137         AC_DEFINE(HAVE_TANF)
138         AC_DEFINE(HAVE_TANHF)
139
140         # At some point, we should differentiate between architectures
141         # like x86, which have long double versions, and alpha/powerpc/etc.,
142         # which don't. For the time being, punt.
143         if test x"long_double_math_on_this_cpu" = x"yes"; then
144           AC_DEFINE(HAVE_ACOSL)
145           AC_DEFINE(HAVE_ASINL)
146           AC_DEFINE(HAVE_ATAN2L)
147           AC_DEFINE(HAVE_ATANL)
148           AC_DEFINE(HAVE_CEILL)
149           AC_DEFINE(HAVE_COPYSIGNL)
150           AC_DEFINE(HAVE_COSL)
151           AC_DEFINE(HAVE_COSHL)
152           AC_DEFINE(HAVE_EXPL)
153           AC_DEFINE(HAVE_FABSL)
154           AC_DEFINE(HAVE_FINITEL)
155           AC_DEFINE(HAVE_FLOORL)
156           AC_DEFINE(HAVE_FMODL)
157           AC_DEFINE(HAVE_FREXPL)
158           AC_DEFINE(HAVE_ISINFL)
159           AC_DEFINE(HAVE_ISNANL)
160           AC_DEFINE(HAVE_LDEXPL)
161           AC_DEFINE(HAVE_LOG10L)
162           AC_DEFINE(HAVE_LOGL)
163           AC_DEFINE(HAVE_MODFL)
164           AC_DEFINE(HAVE_POWL)
165           AC_DEFINE(HAVE_SINCOSL)
166           AC_DEFINE(HAVE_SINL)
167           AC_DEFINE(HAVE_SINHL)
168           AC_DEFINE(HAVE_SQRTL)
169           AC_DEFINE(HAVE_TANL)
170           AC_DEFINE(HAVE_TANHL)
171         fi
172         GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
173         GLIBCPP_CHECK_WCHAR_T_SUPPORT
174         os_include_dir="config/os/gnu-linux"
175         # GLIBCPP_CHECK_STDLIB_SUPPORT
176         AC_DEFINE(HAVE_STRTOF)        
177         AC_DEFINE(HAVE_STRTOLD)        
178         # AC_FUNC_MMAP
179         AC_DEFINE(HAVE_MMAP)
180         ;;
181     *)
182         # We assume newlib.  This lets us hard-code the functions we know
183         # we'll have.
184         AC_DEFINE(HAVE_FINITE)
185         AC_DEFINE(HAVE_ISNAN)
186         AC_DEFINE(HAVE_ISNANF)
187         AC_DEFINE(HAVE_ISINF)
188         AC_DEFINE(HAVE_ISINFF)
189
190         os_include_dir="config/os/newlib"
191
192         # need to check for faster f versions of math functions, ie sinf?
193         ;;
194   esac
195 else
196
197   # We are being configured natively. We can do more elaborate tests
198   # that include AC_TRY_COMPILE now, as the linker is assumed to be
199   # working.
200   xcompiling=0
201   NATIVE=yes
202   CANADIAN=no
203   NULL_TARGET=no
204
205   # Check for available headers.
206   AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
207   machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h])
208
209   GLIBCPP_CHECK_COMPILER_FEATURES
210   GLIBCPP_CHECK_LINKER_FEATURES
211   GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
212   GLIBCPP_CHECK_MATH_SUPPORT
213   GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
214   GLIBCPP_CHECK_WCHAR_T_SUPPORT
215   GLIBCPP_CHECK_STDLIB_SUPPORT
216
217   AC_TRY_COMPILE([
218 #include <setjmp.h>
219 ], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
220 [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available.  ])])
221
222   AC_FUNC_MMAP
223 fi
224
225 # Now that ctype is determined for all possible targets, we can do this...
226 AC_LINK_FILES($os_include_dir/bits/ctype_base.h, \
227 include/bits/ctype_base.h)
228 AC_LINK_FILES($os_include_dir/bits/ctype_inline.h, \
229 include/bits/ctype_inline.h)
230 AC_LINK_FILES($os_include_dir/bits/ctype_noninline.h, \
231 include/bits/ctype_noninline.h)
232 AC_LINK_FILES($ATOMICITYH/bits/atomicity.h, include/bits/atomicity.h)
233
234 AM_CONDITIONAL(NULL_TARGET, test "$NULL_TARGET" = yes)
235 AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes || test "$NULL_TARGET" = yes)
236 AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
237  
238 AC_CACHE_SAVE
239 AC_LC_MESSAGES
240
241 if test "${multilib}" = "yes"; then
242   multilib_arg="--enable-multilib"
243 else
244   multilib_arg=
245 fi
246
247
248 # Generate the various Makefiles, include files, and scripts.
249
250 # Needed so that g++ can find the correct include subdir automatically.
251 INTERFACE=v3
252
253 # Export all the install information
254 GLIBCPP_EXPORT_INSTALL_INFO
255
256 # Export all the include and flag information to makefiles.
257 GLIBCPP_EXPORT_INCLUDES
258 GLIBCPP_EXPORT_FLAGS
259
260 if ${CONFIG_SHELL-/bin/sh} ./libtool --tag CXX --features |
261    grep "enable shared" > /dev/null; then
262   LIBSUPCXX_PICFLAGS=-prefer-pic
263 else
264   LIBSUPCXX_PICFLAGS=
265 fi
266 AC_SUBST(LIBSUPCXX_PICFLAGS)
267
268 # This should be done by mkincludedir, but hack around it now.
269 blddir=`pwd`
270 echo "checking for $blddir/include"
271
272 if test ! -d "$blddir/include"; then
273   mkdir "$blddir/include"
274 fi
275
276 # NB: Multilibs need MULTISUBDIR defined correctly in src/Makefile.am
277 # and libsupc++/Makefile.am so that multilib installs will end up
278 # installed in the correct place. To work around this not being passed
279 # down from config-ml.in -> top_srcdir/Makefile.am ->
280 # top_srcdir/{src,libsupc++}/Makefile.am, manually append it here.
281 AC_OUTPUT(Makefile src/Makefile libmath/Makefile libio/Makefile libsupc++/Makefile testsuite/Makefile mkcheck testsuite_flags,
282 [if test -n "$CONFIG_FILES"; then
283   ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
284   grep '^MULTISUBDIR =' Makefile >> src/Makefile
285   grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
286 fi
287 chmod +x mkcheck
288 chmod +x testsuite_flags
289 ],
290 srcdir=${srcdir}
291 host=${host}
292 target=${target}
293 with_multisubdir=${with_multisubdir}
294 ac_configure_args="${multilib_arg} ${ac_configure_args}"
295 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
296 glibcpp_basedir=${glibcpp_basedir}
297 CC="${CC}"
298 CXX="${CXX}"
299 )
300
301
302 # Generate bits/c++config.h
303 # NB: This must be the first generated file as others include it. . .
304 $srcdir/mkc++config $blddir $srcdir
305
306 # Generate bits/std_limits.h and src/limitsMEMBERS.cc
307 if test ! -f stamp-limits; then
308   $srcdir/mknumeric_limits $blddir $srcdir $xcompiling
309   if test ! -f include/bits/std_limits.h; then
310     echo "mknumeric_limits failed to execute properly: exiting"
311     exit 1
312   else
313     touch stamp-limits 
314   fi
315 fi
316
317
318 # Sanity checking & User-visible messages.
319 # Checks down here, otherwise they get scrolled off before
320 # the user will notice.
321
322 # Trying to get more people to read documentation.  Possibly remove
323 # check and warn all the time. There is no "informational" AC_MSG_
324 # macro, so these are going to be printed even when --quiet/--silent
325 # is given.
326 if test ! -f stamp-sanity-warned; then
327   touch stamp-sanity-warned
328   echo ""
329   echo "Please make certain that you read the installation information here:"
330   echo "  faster => ${srcdir}/docs/install.html"
331   echo "  slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/install.html>"
332   echo ""
333   echo "and the configuration information here:"
334   echo "  faster => ${srcdir}/docs/configopts.html"
335   echo "  slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html>"
336   echo ""
337   echo "before proceeding with ${_cv_gnu_make_command}."
338   echo ""
339 fi