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