38b8bcb43e0ab33d36984831b0f7565df70d450f
[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 GLIBCPP_CONFIGURE(.)
19 AC_LIBTOOL_DLOPEN
20 AM_PROG_LIBTOOL
21 AC_SUBST(enable_shared)
22 AC_SUBST(enable_static)
23 GLIBCPP_CHECK_GNU_MAKE
24 if test "x$_cv_gnu_make_command" = "x"; then
25 AC_MSG_ERROR([GNU make not found. Please install it or correct your path.])
26 fi
27 AM_CONFIG_HEADER(config.h)
28
29 # Check for c++ or library specific bits that don't require linking.
30 GLIBCPP_CHECK_COMPILER_VERSION
31 GLIBCPP_CHECK_CPU
32 GLIBCPP_CHECK_OS
33
34 # Enable all the crazy c++ stuff. C_MBCHAR must come early.
35 GLIBCPP_ENABLE_DEBUG($USE_MAINTAINER_MODE)
36 GLIBCPP_ENABLE_C_MBCHAR([yes])
37 GLIBCPP_ENABLE_CSTDIO
38 GLIBCPP_ENABLE_LONG_LONG([yes])
39 GLIBCPP_ENABLE_SHADOW([no])
40 GLIBCPP_ENABLE_THREADS
41 GLIBCPP_ENABLE_ATOMICITY
42 GLIBCPP_ENABLE_CXX_FLAGS([none])
43
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
51 xcompiling=1
52 NATIVE=no
53 # If Canadian cross, then don't pick up tools from the build
54 # directory.
55 if test "$build" != "$with_cross_host"; 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 *-wince-*)
65 # Configure for Microsoft Windows CE, or whatever they are
66 # currently calling it.
67 AC_DEFINE(HAVE_FLOAT_H)
68
69 AC_DEFINE(HAVE__FINITE)
70 AC_DEFINE(HAVE__ISNAN)
71 AC_DEFINE(HAVE__COPYSIGN)
72 AC_DEFINE(HAVE__FPCLASS)
73 AC_DEFINE(HAVE_MODF)
74
75 ctype_include_dir="config/os/wince"
76 AC_LINK_FILES($ctype_include_dir/bits/ctype_base.h,
77 include/bits/ctype_base.h)
78 AC_LINK_FILES($ctype_include_dir/bits/ctype_inline.h, \
79 include/bits/ctype_inline.h)
80 AC_LINK_FILES($ctype_include_dir/bits/ctype_noninline.h, \
81 include/bits/ctype_noninline.h)
82
83
84 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
85
86 AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
87 AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
88 ;;
89 *)
90 # We assume newlib. This lets us hard-code the functions we know
91 # we'll have.
92 AC_DEFINE(HAVE_FINITE)
93 AC_DEFINE(HAVE_ISNAN)
94 AC_DEFINE(HAVE_ISNANF)
95 AC_DEFINE(HAVE_ISINF)
96 AC_DEFINE(HAVE_ISINFF)
97
98 ctype_include_dir="config/os/newlib"
99 AC_LINK_FILES($ctype_include_dir/bits/ctype_base.h,
100 include/bits/ctype_base.h)
101 AC_LINK_FILES($ctype_include_dir/bits/ctype_inline.h, \
102 include/bits/ctype_inline.h)
103 AC_LINK_FILES($ctype_include_dir/bits/ctype_noninline.h, \
104 include/bits/ctype_noninline.h)
105
106 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
107
108 AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
109 AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
110 # need to check for faster f versions of math functions, ie sinf?
111 ;;
112 esac
113 else
114
115 # We are being configured natively. We can do more elaborate tests
116 # that include AC_TRY_COMPILE now, as the linker is assumed to be
117 # working.
118
119 xcompiling=0
120 NATIVE=yes
121 CANADIAN=no
122 NULL_TARGET=no
123
124 # Check for available headers.
125 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
126 machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h])
127
128 GLIBCPP_CHECK_COMPILER_FEATURES
129 GLIBCPP_CHECK_LINKER_FEATURES
130 GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
131 GLIBCPP_CHECK_MATH_SUPPORT
132 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
133 GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT
134 GLIBCPP_CHECK_WCHAR_T_SUPPORT
135 GLIBCPP_CHECK_CTYPE_SUPPORT
136 GLIBCPP_CHECK_STDLIB_SUPPORT
137
138 AC_FUNC_MMAP
139 fi
140
141 AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
142 AM_CONDITIONAL(NULL_TARGET, test "$NULL_TARGET" = yes)
143 AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes || test "$NULL_TARGET" = yes)
144 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
145
146 AC_CACHE_SAVE
147 AC_LC_MESSAGES
148
149 if test "${multilib}" = "yes"; then
150 multilib_arg="--enable-multilib"
151 else
152 multilib_arg=
153 fi
154
155
156 # Generate the various Makefiles, include files, and scripts.
157
158 # This helps subvert libstdcxx_interface, as calculated by devo/config.if
159 # Needed so that g++ can find the correct include subdir automatically.
160 INTERFACE=v3
161
162 # Check for the interface version number for specifying where header
163 # files are installed, if a version number is provided.
164 AC_MSG_CHECKING([for interface version number])
165 libstdcxx_interface=$INTERFACE
166 AC_MSG_RESULT($libstdcxx_interface)
167 AC_SUBST(libstdcxx_interface)
168
169 # Process the option --with-gxx-include-dir=<path to include-files directory>
170 AC_MSG_CHECKING([for --with-gxx-include-dir])
171 AC_ARG_WITH(gxx-include-dir,
172 [ --with-gxx-include-dir the installation directory for include files],
173 [case "${withval}" in
174 yes)
175 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
176 gxx_include_dir=no
177 ;;
178 no)
179 gxx_include_dir=no
180 ;;
181 *)
182 gxx_include_dir=${withval}
183 ;;
184 esac], [gxx_include_dir=no])
185 AC_MSG_RESULT($gxx_include_dir)
186 AC_SUBST(gxx_include_dir)
187 AM_CONDITIONAL(GXX_INCLUDE_DIR, test x${gxx_include_dir} != xno)
188
189 # Process the option "--enable-version-specific-runtime-libs"
190 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
191 AC_ARG_ENABLE(version-specific-runtime-libs,
192 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
193 [ version_specific_libs=yes
194 # Need the gcc compiler version to know where to install libraries
195 # and header files if --enable-version-specific-runtime-libs option
196 # is selected.
197 changequote(,)dnl
198 gcc_tmp=`grep version_string ${srcdir}/../gcc/version.c | awk '{print $6}'`
199 gcc_num=`echo ${gcc_tmp} | sed 's/\"//g'`
200 #gcc_date=`grep version_string ${srcdir}/../gcc/version.c | awk '{print $7}'`
201 #gcc_version=$gcc_num-$gcc_date
202 gcc_version=$gcc_num
203 changequote([,])dnl
204 AC_SUBST(gcc_version)
205 ],version_specific_libs=no)
206 AC_MSG_RESULT($version_specific_libs)
207 if test x${version_specific_libs} = xyes; then
208 AM_CONDITIONAL(VERSION_SPECIFIC_LIBS, test x${version_specific_libs} = xyes)
209 AC_MSG_WARN(version specific directory is: $gcc_version)
210 fi
211
212
213
214 # Export all the include and flag information to makefiles.
215 GLIBCPP_EXPORT_INCLUDES
216 GLIBCPP_EXPORT_FLAGS
217
218 # This should be done by mkincludedir, but hack around it now.
219 blddir=`pwd`
220 echo "checking for $blddir/include"
221
222 if test ! -d "$blddir/include"; then
223 mkdir "$blddir/include"
224 fi
225
226 # NB: Multilibs need MULTISUBDIR defined correctly in src/Makefile.am
227 # so that multilib installs will end up installed in the correct
228 # place. To work around this not being passed down from config-ml.in
229 # -> top_srcdir/Makefile.am -> top_srcdir/src/Makefile.am, manually
230 # append it here.
231 AC_OUTPUT(mkcheck Makefile src/Makefile libmath/Makefile libio/Makefile libsupc++/Makefile,
232 [if test -n "$CONFIG_FILES"; then
233 ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
234 grep '^MULTISUBDIR =' Makefile >> src/Makefile
235 fi
236 chmod +x mkcheck
237 ],
238 srcdir=${srcdir}
239 host=${host}
240 target=${target}
241 with_multisubdir=${with_multisubdir}
242 ac_configure_args="${multilib_arg} ${ac_configure_args}"
243 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
244 glibcpp_basedir=${glibcpp_basedir}
245 CC="${CC}"
246 CXX="${CXX}"
247 )
248
249
250 # Generate bits/c++config.h
251 # NB: This must be the first generated file as others include it. . .
252 AC_OUTPUT_COMMANDS([$srcdir/mkc++config $blddir $srcdir])
253
254 # Generate bits/std_limits.h and src/limitsMEMBERS.cc
255 if test ! -f stamp-limits; then
256 AC_OUTPUT_COMMANDS([$srcdir/mknumeric_limits $blddir $srcdir $xcompiling])
257 touch stamp-limits
258 fi
259
260
261 # Sanity checking & User-visible messages.
262 # Checks down here, otherwise they get scrolled off before
263 # the user will notice.
264
265 # Trying to get more people to read documentation. Possibly remove
266 # check and warn all the time. There is no "informational" AC_MSG_
267 # macro, so these are going to be printed even when --quiet/--silent
268 # is given.
269 if test ! -f stamp-sanity-warned; then
270 touch stamp-sanity-warned
271 echo ""
272 echo "Please make certain that you read the installation information here:"
273 echo " faster => ${srcdir}/docs/install.html"
274 echo " slower => <URL:http://sources.redhat.com/libstdc++/install.html>"
275 echo ""
276 echo "and the configuration information here:"
277 echo " faster => ${srcdir}/docs/configopts.html"
278 echo " slower => <URL:http://sources.redhat.com/libstdc++/configopts.html>"
279 echo ""
280 echo "before proceeding with ${_cv_gnu_make_command}."
281 echo ""
282 fi
283
284