1 # Process this file with autoconf to produce a configure script, like so:
2 # aclocal, autoconf, autoheader, automake
8 # Gets and sets build, host, target, *_vendor, *_cpu, *_os, etc.
11 # We use these options to decide which functions to include.
12 AC_ARG_WITH(target-subdir,
13 [ --with-target-subdir=SUBDIR
14 configuring in a subdirectory])
15 AC_ARG_WITH(cross-host,
16 [ --with-cross-host=HOST configuring with a cross compiler])
18 # Runs configure.host and configure.target. Have to run this before
19 # the GLIBCPP_ENABLE_* macros below.
24 AC_SUBST(enable_shared)
25 AC_SUBST(enable_static)
26 GLIBCPP_CHECK_GNU_MAKE
27 if test "x$_cv_gnu_make_command" = "x"; then
28 AC_MSG_ERROR([GNU make not found. Please install it or correct your path.])
30 AM_CONFIG_HEADER(config.h)
32 # Check for c++ or library specific bits that don't require linking.
33 GLIBCPP_CHECK_COMPILER_VERSION
35 # Enable all the crazy c++ stuff. C_MBCHAR must come early.
36 GLIBCPP_ENABLE_DEBUG($USE_MAINTAINER_MODE)
38 GLIBCPP_ENABLE_C_MBCHAR([yes])
39 GLIBCPP_ENABLE_LONG_LONG([no])
40 GLIBCPP_ENABLE_CHEADERS([c_std])
41 GLIBCPP_ENABLE_THREADS
42 GLIBCPP_ENABLE_CXX_FLAGS([none])
44 if test -n "$with_cross_host"; then
46 # We are being configured with a cross compiler. AC_REPLACE_FUNCS
47 # may not work correctly, because the compiler may not be able to
52 # If Canadian cross, then don't pick up tools from the build
54 if test x"$build" != x"$with_cross_host" && x"$build" != x"$target"; then
62 case "$target_alias" in
64 # Construct linux crosses by hand, eliminating bits that need ld...
65 # Check for available headers.
66 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
67 machine/endian.h machine/param.h sys/machine.h fp.h locale.h \
70 # GLIBCPP_CHECK_COMPILER_FEATURES
71 WFMT_FLAGS='-fdiagnostics-show-location=once'
72 SECTION_FLAGS='-ffunction-sections -fdata-sections'
74 AC_SUBST(SECTION_FLAGS)
75 GLIBCPP_CHECK_LINKER_FEATURES
76 # GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
77 # GLIBCPP_CHECK_MATH_SUPPORT
80 AC_DEFINE(HAVE_ATAN2F)
83 AC_DEFINE(HAVE_COPYSIGN)
84 AC_DEFINE(HAVE_COPYSIGNF)
89 AC_DEFINE(HAVE_FINITE)
90 AC_DEFINE(HAVE_FINITEF)
91 AC_DEFINE(HAVE_FLOORF)
93 AC_DEFINE(HAVE_FREXPF)
95 AC_DEFINE(HAVE_ISINFF)
97 AC_DEFINE(HAVE_ISNANF)
98 AC_DEFINE(HAVE_LDEXPF)
99 AC_DEFINE(HAVE_LOG10F)
101 AC_DEFINE(HAVE_MODFF)
103 AC_DEFINE(HAVE_SINCOS)
104 AC_DEFINE(HAVE_SINCOSF)
106 AC_DEFINE(HAVE_SINHF)
107 AC_DEFINE(HAVE_SQRTF)
109 AC_DEFINE(HAVE_TANHF)
111 # At some point, we should differentiate between architectures
112 # like x86, which have long double versions, and alpha/powerpc/etc.,
113 # which don't. For the time being, punt.
114 if test x"long_double_math_on_this_cpu" = x"yes"; then
115 AC_DEFINE(HAVE_ACOSL)
116 AC_DEFINE(HAVE_ASINL)
117 AC_DEFINE(HAVE_ATAN2L)
118 AC_DEFINE(HAVE_ATANL)
119 AC_DEFINE(HAVE_CEILL)
120 AC_DEFINE(HAVE_COPYSIGNL)
122 AC_DEFINE(HAVE_COSHL)
124 AC_DEFINE(HAVE_FABSL)
125 AC_DEFINE(HAVE_FINITEL)
126 AC_DEFINE(HAVE_FLOORL)
127 AC_DEFINE(HAVE_FMODL)
128 AC_DEFINE(HAVE_FREXPL)
129 AC_DEFINE(HAVE_ISINFL)
130 AC_DEFINE(HAVE_ISNANL)
131 AC_DEFINE(HAVE_LDEXPL)
132 AC_DEFINE(HAVE_LOG10L)
134 AC_DEFINE(HAVE_MODFL)
136 AC_DEFINE(HAVE_SINCOSL)
138 AC_DEFINE(HAVE_SINHL)
139 AC_DEFINE(HAVE_SQRTL)
141 AC_DEFINE(HAVE_TANHL)
143 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
144 GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT
145 GLIBCPP_CHECK_WCHAR_T_SUPPORT
146 os_include_dir="config/os/gnu-linux"
147 # GLIBCPP_CHECK_STDLIB_SUPPORT
148 AC_DEFINE(HAVE_STRTOF)
149 AC_DEFINE(HAVE_STRTOLD)
154 # We assume newlib. This lets us hard-code the functions we know
156 AC_DEFINE(HAVE_FINITE)
157 AC_DEFINE(HAVE_ISNAN)
158 AC_DEFINE(HAVE_ISNANF)
159 AC_DEFINE(HAVE_ISINF)
160 AC_DEFINE(HAVE_ISINFF)
162 os_include_dir="config/os/newlib"
164 AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
165 AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
166 # need to check for faster f versions of math functions, ie sinf?
171 # We are being configured natively. We can do more elaborate tests
172 # that include AC_TRY_COMPILE now, as the linker is assumed to be
179 # Check for available headers.
180 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
181 machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h])
183 GLIBCPP_CHECK_COMPILER_FEATURES
184 GLIBCPP_CHECK_LINKER_FEATURES
185 GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
186 GLIBCPP_CHECK_MATH_SUPPORT
187 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
188 GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT
189 GLIBCPP_CHECK_WCHAR_T_SUPPORT
190 GLIBCPP_CHECK_STDLIB_SUPPORT
195 # Now that ctype is determined for all possible targets, we can do this...
196 AC_LINK_FILES($os_include_dir/bits/ctype_base.h, \
197 include/bits/ctype_base.h)
198 AC_LINK_FILES($os_include_dir/bits/ctype_inline.h, \
199 include/bits/ctype_inline.h)
200 AC_LINK_FILES($os_include_dir/bits/ctype_noninline.h, \
201 include/bits/ctype_noninline.h)
202 AC_LINK_FILES($ATOMICITYH/bits/atomicity.h, include/bits/atomicity.h)
204 AM_CONDITIONAL(NULL_TARGET, test "$NULL_TARGET" = yes)
205 AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes || test "$NULL_TARGET" = yes)
206 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
207 AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
212 if test "${multilib}" = "yes"; then
213 multilib_arg="--enable-multilib"
219 # Generate the various Makefiles, include files, and scripts.
221 # This helps subvert libstdcxx_interface, as calculated by devo/config.if
222 # Needed so that g++ can find the correct include subdir automatically.
225 # Check for the interface version number for specifying where header
226 # files are installed, if a version number is provided.
227 AC_MSG_CHECKING([for interface version number])
228 libstdcxx_interface=$INTERFACE
229 AC_MSG_RESULT($libstdcxx_interface)
230 AC_SUBST(libstdcxx_interface)
232 # Process the option --with-gxx-include-dir=<path to include-files directory>
233 AC_MSG_CHECKING([for --with-gxx-include-dir])
234 AC_ARG_WITH(gxx-include-dir,
235 [ --with-gxx-include-dir the installation directory for include files],
236 [case "${withval}" in
238 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
245 gxx_include_dir=${withval}
247 esac], [gxx_include_dir=no])
248 AC_MSG_RESULT($gxx_include_dir)
249 AC_SUBST(gxx_include_dir)
250 AM_CONDITIONAL(GXX_INCLUDE_DIR, test x${gxx_include_dir} != xno)
252 # Process the option "--enable-version-specific-runtime-libs"
253 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
254 AC_ARG_ENABLE(version-specific-runtime-libs,
255 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
256 [ version_specific_libs=yes
257 # Need the gcc compiler version to know where to install libraries
258 # and header files if --enable-version-specific-runtime-libs option
261 gcc_tmp=`grep version_string ${srcdir}/../gcc/version.c | awk '{print $6}'`
262 gcc_num=`echo ${gcc_tmp} | sed 's/\"//g'`
263 #gcc_date=`grep version_string ${srcdir}/../gcc/version.c | awk '{print $7}'`
264 #gcc_version=$gcc_num-$gcc_date
267 AC_SUBST(gcc_version)
268 ],version_specific_libs=no)
269 AC_MSG_RESULT($version_specific_libs)
270 if test x${version_specific_libs} = xyes; then
271 AM_CONDITIONAL(VERSION_SPECIFIC_LIBS, test x${version_specific_libs} = xyes)
272 AC_MSG_WARN(version specific directory is: $gcc_version)
275 # We have to install all the generated or linked includes files
276 # specified as build_headers in src/Makefile.am in a target-dependent
277 # place, or else multiple installs for different compilers will
278 # overwrite these files.
279 # NB: Keep this and gcc/Makefile.in's -DGPLUSPLUS_TOOL_INCLUDE_DIR in sync.
280 gxx_target_include_dir='$(exec_prefix)/$(target_alias)/include/g++-$(libstdcxx_interface)'
281 AC_SUBST(gxx_target_include_dir)
284 # Export all the include and flag information to makefiles.
285 GLIBCPP_EXPORT_INCLUDES
288 # This should be done by mkincludedir, but hack around it now.
290 echo "checking for $blddir/include"
292 if test ! -d "$blddir/include"; then
293 mkdir "$blddir/include"
296 # NB: Multilibs need MULTISUBDIR defined correctly in src/Makefile.am
297 # and libsupc++/Makefile.am so that multilib installs will end up
298 # installed in the correct place. To work around this not being passed
299 # down from config-ml.in -> top_srcdir/Makefile.am ->
300 # top_srcdir/{src,libsupc++}/Makefile.am, manually append it here.
301 AC_OUTPUT(tests_flags mkcheck Makefile src/Makefile libmath/Makefile libio/Makefile libsupc++/Makefile,
302 [if test -n "$CONFIG_FILES"; then
303 ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
304 grep '^MULTISUBDIR =' Makefile >> src/Makefile
305 grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
313 with_multisubdir=${with_multisubdir}
314 ac_configure_args="${multilib_arg} ${ac_configure_args}"
315 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
316 glibcpp_basedir=${glibcpp_basedir}
322 # Generate bits/c++config.h
323 # NB: This must be the first generated file as others include it. . .
324 $srcdir/mkc++config $blddir $srcdir
326 # Generate bits/std_limits.h and src/limitsMEMBERS.cc
327 if test ! -f stamp-limits; then
328 $srcdir/mknumeric_limits $blddir $srcdir $xcompiling
329 if test ! -f include/bits/std_limits.h; then
330 echo "mknumeric_limits failed to execute properly: exiting"
338 # Sanity checking & User-visible messages.
339 # Checks down here, otherwise they get scrolled off before
340 # the user will notice.
342 # Trying to get more people to read documentation. Possibly remove
343 # check and warn all the time. There is no "informational" AC_MSG_
344 # macro, so these are going to be printed even when --quiet/--silent
346 if test ! -f stamp-sanity-warned; then
347 touch stamp-sanity-warned
349 echo "Please make certain that you read the installation information here:"
350 echo " faster => ${srcdir}/docs/install.html"
351 echo " slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/install.html>"
353 echo "and the configuration information here:"
354 echo " faster => ${srcdir}/docs/configopts.html"
355 echo " slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html>"
357 echo "before proceeding with ${_cv_gnu_make_command}."