]>
Commit | Line | Data |
---|---|---|
b2dad0e3 | 1 | # Process this file with autoconf to produce a configure script, like so: |
d94611f1 | 2 | # aclocal, autoconf, autoheader, automake |
b2dad0e3 BK |
3 | |
4 | AC_PREREQ(2.13) | |
1228c7b6 | 5 | AC_INIT(src/ios.cc) |
b2dad0e3 BK |
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 | ||
f4c79fef BK |
18 | # Runs configure.host and configure.target. Have to run this before |
19 | # the GLIBCPP_ENABLE_* macros below. | |
b2dad0e3 | 20 | GLIBCPP_CONFIGURE(.) |
f4c79fef | 21 | |
b2dad0e3 | 22 | AC_LIBTOOL_DLOPEN |
5780a46b | 23 | AM_PROG_LIBTOOL |
34791641 PE |
24 | AC_SUBST(enable_shared) |
25 | AC_SUBST(enable_static) | |
29bd52c8 PE |
26 | GLIBCPP_CHECK_GNU_MAKE |
27 | if test "x$_cv_gnu_make_command" = "x"; then | |
99b51359 | 28 | AC_MSG_ERROR([GNU make not found. Please install it or correct your path.]) |
29bd52c8 | 29 | fi |
b2dad0e3 BK |
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 | |
b2dad0e3 | 34 | |
8b8ab21c | 35 | # Enable all the crazy c++ stuff. C_MBCHAR must come early. |
7f586614 | 36 | GLIBCPP_ENABLE_DEBUG($USE_MAINTAINER_MODE) |
b2dad0e3 | 37 | GLIBCPP_ENABLE_CSTDIO |
e26cb7ab | 38 | GLIBCPP_ENABLE_C_MBCHAR([yes]) |
205c6f17 | 39 | GLIBCPP_ENABLE_LONG_LONG([no]) |
e3123ab3 | 40 | GLIBCPP_ENABLE_CHEADERS([c_std]) |
b2dad0e3 | 41 | GLIBCPP_ENABLE_THREADS |
e974e9cc | 42 | GLIBCPP_ENABLE_ATOMICITY |
32a4595e | 43 | GLIBCPP_ENABLE_CXX_FLAGS([none]) |
b2dad0e3 BK |
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. | |
b2dad0e3 BK |
50 | xcompiling=1 |
51 | NATIVE=no | |
eebc608e | 52 | |
b2dad0e3 BK |
53 | # If Canadian cross, then don't pick up tools from the build |
54 | # directory. | |
eebc608e | 55 | if test x"$build" != x"$with_cross_host" && x"$build" != x"$target"; then |
b2dad0e3 BK |
56 | CANADIAN=yes |
57 | NULL_TARGET=yes | |
58 | else | |
59 | CANADIAN=no | |
60 | NULL_TARGET=no | |
61 | fi | |
62 | ||
63 | case "$target_alias" in | |
1d8939ef | 64 | *-linux*) |
eebc608e BK |
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) | |
b2dad0e3 BK |
154 | ;; |
155 | *) | |
156 | # We assume newlib. This lets us hard-code the functions we know | |
157 | # we'll have. | |
1fd2f510 BK |
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" | |
6e138b89 | 165 | os_include_dir="config/os/newlib" |
b2dad0e3 | 166 | |
1fd2f510 BK |
167 | AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX) |
168 | AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX) | |
34791641 | 169 | # need to check for faster f versions of math functions, ie sinf? |
b2dad0e3 BK |
170 | ;; |
171 | esac | |
172 | else | |
173 | ||
174 | # We are being configured natively. We can do more elaborate tests | |
175 | # that include AC_TRY_COMPILE now, as the linker is assumed to be | |
176 | # working. | |
b2dad0e3 BK |
177 | xcompiling=0 |
178 | NATIVE=yes | |
179 | CANADIAN=no | |
180 | NULL_TARGET=no | |
181 | ||
182 | # Check for available headers. | |
183 | AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \ | |
34791641 | 184 | machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h]) |
b2dad0e3 | 185 | |
c470c17d BK |
186 | GLIBCPP_CHECK_COMPILER_FEATURES |
187 | GLIBCPP_CHECK_LINKER_FEATURES | |
b2dad0e3 BK |
188 | GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT |
189 | GLIBCPP_CHECK_MATH_SUPPORT | |
2f103494 BK |
190 | GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT |
191 | GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT | |
b2dad0e3 | 192 | GLIBCPP_CHECK_WCHAR_T_SUPPORT |
e7140677 BK |
193 | GLIBCPP_CHECK_CTYPE_SUPPORT |
194 | GLIBCPP_CHECK_STDLIB_SUPPORT | |
b2dad0e3 BK |
195 | |
196 | AC_FUNC_MMAP | |
197 | fi | |
198 | ||
eebc608e BK |
199 | # Now that ctype is determined for all possible targets, we can do this... |
200 | AC_LINK_FILES($ctype_include_dir/bits/ctype_base.h, \ | |
201 | include/bits/ctype_base.h) | |
202 | AC_LINK_FILES($ctype_include_dir/bits/ctype_inline.h, \ | |
203 | include/bits/ctype_inline.h) | |
204 | AC_LINK_FILES($ctype_include_dir/bits/ctype_noninline.h, \ | |
205 | include/bits/ctype_noninline.h) | |
206 | ||
b2dad0e3 BK |
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") | |
6e138b89 | 210 | AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes) |
c4d3f801 | 211 | |
5e53dba6 | 212 | AC_CACHE_SAVE |
b2dad0e3 BK |
213 | AC_LC_MESSAGES |
214 | ||
b2dad0e3 BK |
215 | if test "${multilib}" = "yes"; then |
216 | multilib_arg="--enable-multilib" | |
217 | else | |
218 | multilib_arg= | |
219 | fi | |
220 | ||
221 | ||
222 | # Generate the various Makefiles, include files, and scripts. | |
223 | ||
1fd2f510 BK |
224 | # This helps subvert libstdcxx_interface, as calculated by devo/config.if |
225 | # Needed so that g++ can find the correct include subdir automatically. | |
226 | INTERFACE=v3 | |
227 | ||
228 | # Check for the interface version number for specifying where header | |
229 | # files are installed, if a version number is provided. | |
230 | AC_MSG_CHECKING([for interface version number]) | |
231 | libstdcxx_interface=$INTERFACE | |
232 | AC_MSG_RESULT($libstdcxx_interface) | |
233 | AC_SUBST(libstdcxx_interface) | |
234 | ||
235 | # Process the option --with-gxx-include-dir=<path to include-files directory> | |
236 | AC_MSG_CHECKING([for --with-gxx-include-dir]) | |
237 | AC_ARG_WITH(gxx-include-dir, | |
238 | [ --with-gxx-include-dir the installation directory for include files], | |
239 | [case "${withval}" in | |
240 | yes) | |
241 | AC_MSG_ERROR(Missing directory for --with-gxx-include-dir) | |
242 | gxx_include_dir=no | |
243 | ;; | |
244 | no) | |
245 | gxx_include_dir=no | |
246 | ;; | |
247 | *) | |
248 | gxx_include_dir=${withval} | |
249 | ;; | |
250 | esac], [gxx_include_dir=no]) | |
251 | AC_MSG_RESULT($gxx_include_dir) | |
252 | AC_SUBST(gxx_include_dir) | |
253 | AM_CONDITIONAL(GXX_INCLUDE_DIR, test x${gxx_include_dir} != xno) | |
254 | ||
255 | # Process the option "--enable-version-specific-runtime-libs" | |
256 | AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) | |
257 | AC_ARG_ENABLE(version-specific-runtime-libs, | |
258 | [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ], | |
259 | [ version_specific_libs=yes | |
260 | # Need the gcc compiler version to know where to install libraries | |
261 | # and header files if --enable-version-specific-runtime-libs option | |
262 | # is selected. | |
263 | changequote(,)dnl | |
264 | gcc_tmp=`grep version_string ${srcdir}/../gcc/version.c | awk '{print $6}'` | |
265 | gcc_num=`echo ${gcc_tmp} | sed 's/\"//g'` | |
266 | #gcc_date=`grep version_string ${srcdir}/../gcc/version.c | awk '{print $7}'` | |
267 | #gcc_version=$gcc_num-$gcc_date | |
268 | gcc_version=$gcc_num | |
269 | changequote([,])dnl | |
270 | AC_SUBST(gcc_version) | |
271 | ],version_specific_libs=no) | |
272 | AC_MSG_RESULT($version_specific_libs) | |
273 | if test x${version_specific_libs} = xyes; then | |
274 | AM_CONDITIONAL(VERSION_SPECIFIC_LIBS, test x${version_specific_libs} = xyes) | |
275 | AC_MSG_WARN(version specific directory is: $gcc_version) | |
276 | fi | |
277 | ||
6e138b89 BK |
278 | # We have to install all the generated or linked includes files |
279 | # specified as build_headers in src/Makefile.am in a target-dependent | |
280 | # place, or else multiple installs for different compilers will | |
281 | # overwrite these files. | |
49caba3b | 282 | # NB: Keep this and gcc/Makefile.in's -DGPLUSPLUS_TOOL_INCLUDE_DIR in sync. |
6e138b89 BK |
283 | gxx_target_include_dir='$(exec_prefix)/$(target_alias)/include/g++-$(libstdcxx_interface)' |
284 | AC_SUBST(gxx_target_include_dir) | |
1fd2f510 BK |
285 | |
286 | ||
e466dc8a BK |
287 | # Export all the include and flag information to makefiles. |
288 | GLIBCPP_EXPORT_INCLUDES | |
289 | GLIBCPP_EXPORT_FLAGS | |
290 | ||
5e53dba6 BK |
291 | # This should be done by mkincludedir, but hack around it now. |
292 | blddir=`pwd` | |
293 | echo "checking for $blddir/include" | |
294 | ||
295 | if test ! -d "$blddir/include"; then | |
296 | mkdir "$blddir/include" | |
297 | fi | |
298 | ||
b2dad0e3 BK |
299 | # NB: Multilibs need MULTISUBDIR defined correctly in src/Makefile.am |
300 | # so that multilib installs will end up installed in the correct | |
301 | # place. To work around this not being passed down from config-ml.in | |
302 | # -> top_srcdir/Makefile.am -> top_srcdir/src/Makefile.am, manually | |
303 | # append it here. | |
b21218ce | 304 | AC_OUTPUT(tests_flags mkcheck Makefile src/Makefile libmath/Makefile libio/Makefile libsupc++/Makefile, |
b2dad0e3 BK |
305 | [if test -n "$CONFIG_FILES"; then |
306 | ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in | |
307 | grep '^MULTISUBDIR =' Makefile >> src/Makefile | |
be5aeb60 | 308 | fi |
b21218ce | 309 | chmod +x tests_flags |
be5aeb60 MM |
310 | chmod +x mkcheck |
311 | ], | |
b2dad0e3 BK |
312 | srcdir=${srcdir} |
313 | host=${host} | |
314 | target=${target} | |
315 | with_multisubdir=${with_multisubdir} | |
316 | ac_configure_args="${multilib_arg} ${ac_configure_args}" | |
317 | CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} | |
318 | glibcpp_basedir=${glibcpp_basedir} | |
319 | CC="${CC}" | |
320 | CXX="${CXX}" | |
321 | ) | |
322 | ||
323 | ||
b2dad0e3 BK |
324 | # Generate bits/c++config.h |
325 | # NB: This must be the first generated file as others include it. . . | |
35a63b94 | 326 | $srcdir/mkc++config $blddir $srcdir |
b2dad0e3 BK |
327 | |
328 | # Generate bits/std_limits.h and src/limitsMEMBERS.cc | |
1fd2f510 | 329 | if test ! -f stamp-limits; then |
35a63b94 | 330 | $srcdir/mknumeric_limits $blddir $srcdir $xcompiling |
2e7e7828 BK |
331 | if test ! -f include/bits/std_limits.h; then |
332 | echo "mknumeric_limits failed to execute properly: exiting" | |
333 | exit 1 | |
334 | else | |
335 | touch stamp-limits | |
336 | fi | |
1fd2f510 | 337 | fi |
29bd52c8 | 338 | |
a9117427 | 339 | |
29bd52c8 PE |
340 | # Sanity checking & User-visible messages. |
341 | # Checks down here, otherwise they get scrolled off before | |
342 | # the user will notice. | |
29bd52c8 | 343 | |
5780a46b BK |
344 | # Trying to get more people to read documentation. Possibly remove |
345 | # check and warn all the time. There is no "informational" AC_MSG_ | |
346 | # macro, so these are going to be printed even when --quiet/--silent | |
347 | # is given. | |
99b51359 BK |
348 | if test ! -f stamp-sanity-warned; then |
349 | touch stamp-sanity-warned | |
5780a46b BK |
350 | echo "" |
351 | echo "Please make certain that you read the installation information here:" | |
29bd52c8 | 352 | echo " faster => ${srcdir}/docs/install.html" |
a9ab8db1 | 353 | echo " slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/install.html>" |
5780a46b BK |
354 | echo "" |
355 | echo "and the configuration information here:" | |
29bd52c8 | 356 | echo " faster => ${srcdir}/docs/configopts.html" |
a9ab8db1 | 357 | echo " slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html>" |
5780a46b | 358 | echo "" |
421173e6 | 359 | echo "before proceeding with ${_cv_gnu_make_command}." |
5780a46b | 360 | echo "" |
29bd52c8 | 361 | fi |