* configure.in (LIMITS_INC_SRCDIR): New variable.
[official-gcc.git] / libstdc++-v3 / configure.in
blob80e36db275f147143127d80790701242c3a5efd0
1 # Process this file with autoconf to produce a configure script, like so:
2 # aclocal, autoconf, autoheader, automake
4 AC_PREREQ(2.13)
5 AC_INIT(src/ios.cc)
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=".."
25 AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
26 toplevel_srcdir=\${top_srcdir}/$toprel
27 AC_SUBST(toplevel_srcdir)
29 dnl This is here just to satisfy automake.
30 ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)])
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)
39 # Will set LN_S to either 'ln -s' or 'ln'.  With autoconf 2.50+, can also
40 # be 'cp -p' if linking isn't available.
41 AC_PROG_LN_S
43 # We use these options to decide which functions to include.
44 AC_ARG_WITH(target-subdir,
45 [  --with-target-subdir=SUBDIR
46                            configuring in a subdirectory])
47 AC_ARG_WITH(cross-host,
48 [  --with-cross-host=HOST  configuring with a cross compiler])
50 # Runs configure.host and configure.target. Have to run this before
51 # the GLIBCPP_ENABLE_* macros below.
52 GLIBCPP_CONFIGURE(.)
54 AC_LIBTOOL_DLOPEN
55 AM_PROG_LIBTOOL
56 AC_SUBST(enable_shared)
57 AC_SUBST(enable_static)
58 GLIBCPP_CHECK_GNU_MAKE
60 AM_CONFIG_HEADER(config.h)
62 # Check for c++ or library specific bits that don't require linking.
63 GLIBCPP_CHECK_COMPILER_VERSION
65 # Enable all the crazy c++ stuff.  C_MBCHAR must come early.
66 GLIBCPP_ENABLE_DEBUG($USE_MAINTAINER_MODE)
67 GLIBCPP_ENABLE_CSTDIO
68 GLIBCPP_ENABLE_CLOCALE
69 GLIBCPP_ENABLE_C_MBCHAR([yes])
70 GLIBCPP_ENABLE_C99([yes])
71 GLIBCPP_ENABLE_LONG_LONG([yes])
72 GLIBCPP_ENABLE_CHEADERS([c_std])
73 GLIBCPP_ENABLE_THREADS
74 GLIBCPP_ENABLE_CXX_FLAGS([none])
75 GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
77 if test -n "$with_cross_host" || test x"$build" != x"$host"; then
79   # We are being configured with some form of cross compiler.
80   # mknumeric_limits may not work correctly, either because the
81   # compiler may not run on this machine, may not be able to link
82   # executables, or may produce executables we can't run on this
83   # machine.
84   GLIBCPP_IS_CROSS_COMPILING=1
86   # If Canadian cross, then don't pick up tools from the build
87   # directory.
88   if test -n "$with_cross_host" && test x"$build" != x"$with_cross_host"; then
89     CANADIAN=yes
90   else
91     CANADIAN=no
92   fi
94   case "$target_alias" in
95     *-linux*)
96         # Construct linux crosses by hand, eliminating bits that need ld...
97         # Check for available headers.
98         AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
99         machine/endian.h machine/param.h sys/machine.h fp.h locale.h \
100         float.h inttypes.h])
102         # GLIBCPP_CHECK_COMPILER_FEATURES
103         SECTION_FLAGS='-ffunction-sections -fdata-sections'
104         AC_SUBST(SECTION_FLAGS)
105         GLIBCPP_CHECK_LINKER_FEATURES
106         # GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
107         # GLIBCPP_CHECK_MATH_SUPPORT
108         AC_DEFINE(HAVE_ACOSF)
109         AC_DEFINE(HAVE_ASINF)
110         AC_DEFINE(HAVE_ATAN2F)
111         AC_DEFINE(HAVE_ATANF)
112         AC_DEFINE(HAVE_CEILF)
113         AC_DEFINE(HAVE_COPYSIGN)
114         AC_DEFINE(HAVE_COPYSIGNF)
115         AC_DEFINE(HAVE_COSF)
116         AC_DEFINE(HAVE_COSHF)
117         AC_DEFINE(HAVE_EXPF)
118         AC_DEFINE(HAVE_FABSF)
119         AC_DEFINE(HAVE_FINITE)
120         AC_DEFINE(HAVE_FINITEF)
121         AC_DEFINE(HAVE_FLOORF)
122         AC_DEFINE(HAVE_FMODF)
123         AC_DEFINE(HAVE_FREXPF)
124         AC_DEFINE(HAVE_ISINF)
125         AC_DEFINE(HAVE_ISINFF)
126         AC_DEFINE(HAVE_ISNAN)
127         AC_DEFINE(HAVE_ISNANF)
128         AC_DEFINE(HAVE_LDEXPF)
129         AC_DEFINE(HAVE_LOG10F)
130         AC_DEFINE(HAVE_LOGF)
131         AC_DEFINE(HAVE_MODFF)
132         AC_DEFINE(HAVE_POWF)
133         AC_DEFINE(HAVE_SINCOS)
134         AC_DEFINE(HAVE_SINCOSF)
135         AC_DEFINE(HAVE_SINF)
136         AC_DEFINE(HAVE_SINHF)
137         AC_DEFINE(HAVE_SQRTF)
138         AC_DEFINE(HAVE_TANF)
139         AC_DEFINE(HAVE_TANHF)
141         # At some point, we should differentiate between architectures
142         # like x86, which have long double versions, and alpha/powerpc/etc.,
143         # which don't. For the time being, punt.
144         if test x"long_double_math_on_this_cpu" = x"yes"; then
145           AC_DEFINE(HAVE_ACOSL)
146           AC_DEFINE(HAVE_ASINL)
147           AC_DEFINE(HAVE_ATAN2L)
148           AC_DEFINE(HAVE_ATANL)
149           AC_DEFINE(HAVE_CEILL)
150           AC_DEFINE(HAVE_COPYSIGNL)
151           AC_DEFINE(HAVE_COSL)
152           AC_DEFINE(HAVE_COSHL)
153           AC_DEFINE(HAVE_EXPL)
154           AC_DEFINE(HAVE_FABSL)
155           AC_DEFINE(HAVE_FINITEL)
156           AC_DEFINE(HAVE_FLOORL)
157           AC_DEFINE(HAVE_FMODL)
158           AC_DEFINE(HAVE_FREXPL)
159           AC_DEFINE(HAVE_ISINFL)
160           AC_DEFINE(HAVE_ISNANL)
161           AC_DEFINE(HAVE_LDEXPL)
162           AC_DEFINE(HAVE_LOG10L)
163           AC_DEFINE(HAVE_LOGL)
164           AC_DEFINE(HAVE_MODFL)
165           AC_DEFINE(HAVE_POWL)
166           AC_DEFINE(HAVE_SINCOSL)
167           AC_DEFINE(HAVE_SINL)
168           AC_DEFINE(HAVE_SINHL)
169           AC_DEFINE(HAVE_SQRTL)
170           AC_DEFINE(HAVE_TANL)
171           AC_DEFINE(HAVE_TANHL)
172         fi
173         GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
174         GLIBCPP_CHECK_WCHAR_T_SUPPORT
175         os_include_dir="config/os/gnu-linux"
176         # GLIBCPP_CHECK_STDLIB_SUPPORT
177         AC_DEFINE(HAVE_STRTOF)        
178         AC_DEFINE(HAVE_STRTOLD)        
179         # AC_FUNC_MMAP
180         AC_DEFINE(HAVE_MMAP)
181         ;;
182     *)
183         # We assume newlib.  This lets us hard-code the functions we know
184         # we'll have.
185         AC_DEFINE(HAVE_FINITE)
186         AC_DEFINE(HAVE_ISNAN)
187         AC_DEFINE(HAVE_ISNANF)
188         AC_DEFINE(HAVE_ISINF)
189         AC_DEFINE(HAVE_ISINFF)
191         os_include_dir="config/os/newlib"
193         # need to check for faster f versions of math functions, ie sinf?
194         ;;
195   esac
196 else
198   # We are being configured natively. We can do more elaborate tests
199   # that include AC_TRY_COMPILE now, as the linker is assumed to be
200   # working.
201   GLIBCPP_IS_CROSS_COMPILING=0
202   CANADIAN=no
204   # Check for available headers.
205   AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
206   machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h])
208   GLIBCPP_CHECK_COMPILER_FEATURES
209   GLIBCPP_CHECK_LINKER_FEATURES
210   GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
211   GLIBCPP_CHECK_MATH_SUPPORT
212   GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
213   GLIBCPP_CHECK_WCHAR_T_SUPPORT
214   GLIBCPP_CHECK_STDLIB_SUPPORT
216   AC_TRY_COMPILE([
217 #include <setjmp.h>
218 ], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
219 [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available.  ])])
221   AC_FUNC_MMAP
224 # Propagate the target-specific source directories through the build chain.
225 OS_INC_SRCDIR=$os_include_dir/bits
226 ATOMICITY_INC_SRCDIR=$ATOMICITYH/bits
227 LIMITS_INC_SRCDIR=$LIMITSH/bits
228 AC_SUBST(OS_INC_SRCDIR)
229 AC_SUBST(ATOMICITY_INC_SRCDIR)
230 AC_SUBST(LIMITS_INC_SRCDIR)
232 # Set up cross-compile flags
233 AC_SUBST(GLIBCPP_IS_CROSS_COMPILING)
234 AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
236 AC_CACHE_SAVE
237 AC_LC_MESSAGES
239 if test "${multilib}" = "yes"; then
240   multilib_arg="--enable-multilib"
241 else
242   multilib_arg=
245 # Needed so that g++ can find the correct include subdir automatically.
246 INTERFACE=v3
248 # Export all the install information
249 GLIBCPP_EXPORT_INSTALL_INFO
251 # Export all the include and flag information to makefiles.
252 GLIBCPP_EXPORT_INCLUDES
253 GLIBCPP_EXPORT_FLAGS
255 if ${CONFIG_SHELL-/bin/sh} ./libtool --tag CXX --features |
256    grep "enable shared" > /dev/null; then
257   LIBSUPCXX_PICFLAGS=-prefer-pic
258 else
259   LIBSUPCXX_PICFLAGS=
261 AC_SUBST(LIBSUPCXX_PICFLAGS)
263 # Generate the various Makefiles, include files, and scripts.
264 # NB: Multilibs need MULTISUBDIR defined correctly in src/Makefile.am
265 # and libsupc++/Makefile.am so that multilib installs will end up
266 # installed in the correct place. To work around this not being passed
267 # down from config-ml.in -> top_srcdir/Makefile.am ->
268 # top_srcdir/{src,libsupc++}/Makefile.am, manually append it here.
269 AC_OUTPUT(Makefile \
270     include/Makefile src/Makefile \
271     libmath/Makefile libio/Makefile libsupc++/Makefile \
272     testsuite/Makefile mkcheck testsuite_flags,
273 [if test -n "$CONFIG_FILES"; then
274   ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
275   grep '^MULTISUBDIR =' Makefile >> src/Makefile
276   grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
278 chmod +x mkcheck
279 chmod +x testsuite_flags
281 srcdir=${srcdir}
282 host=${host}
283 target=${target}
284 with_multisubdir=${with_multisubdir}
285 ac_configure_args="${multilib_arg} ${ac_configure_args}"
286 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
287 glibcpp_basedir=${glibcpp_basedir}
288 CC="${CC}"
289 CXX="${CXX}"
293 # Sanity checking & User-visible messages.
294 # Checks down here, otherwise they get scrolled off before
295 # the user will notice.
297 # Trying to get more people to read documentation.  Possibly remove
298 # check and warn all the time. There is no "informational" AC_MSG_
299 # macro, so these are going to be printed even when --quiet/--silent
300 # is given.
301 if test ! -f stamp-sanity-warned; then
302   touch stamp-sanity-warned
303   echo ""
304   echo "Please make certain that you read the installation information here:"
305   echo "  faster => ${srcdir}/docs/install.html"
306   echo "  slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/install.html>"
307   echo ""
308   echo "and the configuration information here:"
309   echo "  faster => ${srcdir}/docs/configopts.html"
310   echo "  slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html>"
311   echo ""
312   echo "before proceeding with ${_cv_gnu_make_command}."
313   echo ""