]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/aclocal.m4
Fix miscompilation of linux kernel ia64_do_signal routine.
[thirdparty/gcc.git] / libstdc++-v3 / aclocal.m4
CommitLineData
b2dad0e3
BK
1dnl aclocal.m4 generated automatically by aclocal 1.4
2
e7140677 3dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
b2dad0e3
BK
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13dnl
14dnl Initialize configure bits.
15dnl
16dnl Define OPTLEVEL='-O2' if new inlining code present.
17dnl
18dnl GLIBCPP_CONFIGURE
19AC_DEFUN(GLIBCPP_CONFIGURE, [
20 dnl Default to --enable-multilib
21 AC_ARG_ENABLE(multilib,
22 [ --enable-multilib build hella library versions (default)],
23 [case "${enableval}" in
24 yes) multilib=yes ;;
25 no) multilib=no ;;
26 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
27 esac], [multilib=yes])dnl
28
29 dnl We may get other options which we dont document:
30 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
31 if test "[$]{srcdir}" = "."; then
32 if test "[$]{with_target_subdir}" != "."; then
33 glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
34 else
35 glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
36 fi
37 else
38 glibcpp_basedir="[$]{srcdir}/$1"
39 fi
40 AC_SUBST(glibcpp_basedir)
41
b2dad0e3
BK
42 AM_INIT_AUTOMAKE(libstdc++, 2.90.8)
43
28861379
BK
44 # Never versions of autoconf add an underscore to these functions.
45 # Prevent future problems ...
46 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
47 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
48 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
49 ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
5780a46b
BK
50
51# AC_PROG_CC
52
b2dad0e3
BK
53# FIXME: We temporarily define our own version of AC_PROG_CC. This is
54# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
55# are probably using a cross compiler, which will not be able to fully
56# link an executable. This should really be fixed in autoconf
57# itself.
58
59AC_DEFUN(LIB_AC_PROG_CC,
60[AC_BEFORE([$0], [AC_PROG_CPP])dnl
61dnl Fool anybody using AC_PROG_CC.
62AC_PROVIDE([AC_PROG_CC])
63AC_CHECK_PROG(CC, gcc, gcc)
64if test -z "$CC"; then
65 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
66 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
67fi
68
69AC_PROG_CC_GNU
70
71if test $ac_cv_prog_gcc = yes; then
72 GCC=yes
73dnl Check whether -g works, even if CFLAGS is set, in case the package
74dnl plays around with CFLAGS (such as to build both debugging and
75dnl normal versions of a library), tasteless as that idea is.
76 ac_test_CFLAGS="${CFLAGS+set}"
77 ac_save_CFLAGS="$CFLAGS"
78 CFLAGS=
79 AC_PROG_CC_G
80 if test "$ac_test_CFLAGS" = set; then
81 CFLAGS="$ac_save_CFLAGS"
82 elif test $ac_cv_prog_cc_g = yes; then
83 CFLAGS="-g -O2"
84 else
85 CFLAGS="-O2"
86 fi
87else
88 GCC=
89 test "${CFLAGS+set}" = set || CFLAGS="-g"
90fi
91])
92
93LIB_AC_PROG_CC
94
5780a46b
BK
95# Can't just call these here as g++ requires libstc++ to be built....
96# AC_PROG_CXX
97
b2dad0e3
BK
98# Likewise for AC_PROG_CXX.
99AC_DEFUN(LIB_AC_PROG_CXX,
100[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
101dnl Fool anybody using AC_PROG_CXX.
102AC_PROVIDE([AC_PROG_CXX])
de9aefe0
AO
103# Use CXX_libstdcxx so that we do not cause CXX to be cached with the
104# flags that come in CXX while configuring libstdc++. They're different
bb4127f8
MM
105# from those used for all other target libraries. If CXX is set in
106# the environment, respect that here.
107CXX_libstdcxx=$CXX
aa17a5f3 108AC_CHECK_PROGS(CXX_libstdcxx, $CCC c++ g++ gcc CC cxx cc++, gcc)
de9aefe0
AO
109CXX=$CXX_libstdcxx
110AC_SUBST(CXX)
b2dad0e3
BK
111test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
112
113AC_PROG_CXX_GNU
114
115if test $ac_cv_prog_gxx = yes; then
116 GXX=yes
117dnl Check whether -g works, even if CXXFLAGS is set, in case the package
118dnl plays around with CXXFLAGS (such as to build both debugging and
119dnl normal versions of a library), tasteless as that idea is.
120 ac_test_CXXFLAGS="${CXXFLAGS+set}"
121 ac_save_CXXFLAGS="$CXXFLAGS"
122 CXXFLAGS=
123 AC_PROG_CXX_G
124 if test "$ac_test_CXXFLAGS" = set; then
125 CXXFLAGS="$ac_save_CXXFLAGS"
126 elif test $ac_cv_prog_cxx_g = yes; then
127 CXXFLAGS="-g -O2"
128 else
129 CXXFLAGS="-O2"
130 fi
131else
132 GXX=
133 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
134fi
135])
136
137LIB_AC_PROG_CXX
138
5780a46b
BK
139 AC_CHECK_TOOL(AS, as)
140 AC_CHECK_TOOL(AR, ar)
141 AC_CHECK_TOOL(RANLIB, ranlib, :)
142
143 AC_PROG_INSTALL
b2dad0e3 144
5780a46b 145 AM_MAINTAINER_MODE
b2dad0e3 146
5780a46b
BK
147 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
148 # at least currently, we never actually build a program, so we never
149 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
150 # fails, because we are probably configuring with a cross compiler
151 # which cant create executables. So we include AC_EXEEXT to keep
152 # automake happy, but we dont execute it, since we dont care about
153 # the result.
154 if false; then
155 AC_EXEEXT
156 fi
b2dad0e3 157
5780a46b 158 # configure.host sets the following important variables
8b8ab21c
BK
159 # glibcpp_cflags - host specific C compiler flags
160 # glibcpp_cxxflags - host specific C++ compiler flags
5780a46b
BK
161 glibcpp_cflags=
162 glibcpp_cxxflags=
b2dad0e3 163
5780a46b
BK
164 . [$]{glibcpp_basedir}/configure.host
165
166 case [$]{glibcpp_basedir} in
167 /* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
168 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
169 esac
b2dad0e3 170
d0941a31
PE
171 # This does for the target what configure.host does for the host. In
172 # addition to modifying the same flags, it also sets up symlinks.
173 GLIBCPP_CHECK_TARGET
174
5780a46b
BK
175 GLIBCPP_CFLAGS="[$]{glibcpp_cflags}"
176 GLIBCPP_CXXFLAGS="[$]{glibcpp_cxxflags}"
177 AC_SUBST(GLIBCPP_CFLAGS)
178 AC_SUBST(GLIBCPP_CXXFLAGS)
b2dad0e3
BK
179])
180
181
182dnl
8bd636c5 183dnl Check to see if g++ can compile this library, and if so, if any version-
c470c17d
BK
184dnl specific precautions need to be taken.
185dnl
186dnl GLIBCPP_CHECK_COMPILER_VERSION
187AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
c470c17d
BK
188 # Sanity check that g++ is capable of dealing with v-3.
189 AC_MSG_CHECKING([for g++ that will successfully compile this code])
190 AC_EGREP_CPP([ok], [
191 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
192 ok
193 #endif
8b8ab21c 194 ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to gcc-2.95 or above]))
c470c17d
BK
195 AC_MSG_RESULT($gpp_satisfactory)
196])
197
198
199dnl
200dnl Test for newer compiler features, or features that are present in newer
d3a12960
BK
201dnl compiler version but not older compiler versions should be placed
202dnl here.
b2dad0e3 203dnl
c470c17d
BK
204dnl Define WFMT_FLAGS='-fdiagnostics-show-location=once' if possible
205dnl
7f586614
BK
206dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
207dnl new inlining code or the new system_header pragma will die on -Werror.
208dnl Leave it out by default and use maint-mode to use it.
b2dad0e3 209dnl
c470c17d
BK
210dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
211dnl compiler supports it.
212dnl GLIBCPP_CHECK_COMPILER_FEATURES
213AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
a4e99046
PE
214 # All these tests are for C++; save the language and the compiler flags.
215 # The CXXFLAGS thing is suspicious, but based on similar bits
216 # found in GLIBCPP_CONFIGURE.
217 AC_LANG_SAVE
218 AC_LANG_CPLUSPLUS
219 ac_test_CXXFLAGS="${CXXFLAGS+set}"
220 ac_save_CXXFLAGS="$CXXFLAGS"
a4e99046 221
7f586614
BK
222 # Check for maintainer-mode bits.
223 if test x"$USE_MAINTAINER_MODE" = xno; then
224 WERROR=''
8bd636c5 225 else
7f586614 226 WERROR='-Werror'
8bd636c5
PE
227 fi
228
d3a12960
BK
229 # Check for more sophisticated diagnostic control.
230 AC_MSG_CHECKING([for g++ that supports -fdiagnostics-show-location=once])
0517cb99 231 CXXFLAGS='-Werror -fdiagnostics-show-location=once'
a4e99046
PE
232 AC_TRY_COMPILE(, [int foo;
233 ], [ac_gabydiags=yes], [ac_gabydiags=no])
234 if test "$ac_test_CXXFLAGS" = set; then
235 CXXFLAGS="$ac_save_CXXFLAGS"
236 else
237 # this is the suspicious part
238 CXXFLAGS=''
239 fi
240 if test "$ac_gabydiags" = "yes"; then
c470c17d 241 WFMT_FLAGS='-fdiagnostics-show-location=once'
a4e99046
PE
242 fi
243 AC_MSG_RESULT($ac_gabydiags)
244
c470c17d
BK
245 # Check for -ffunction-sections -fdata-sections
246 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
0517cb99 247 CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
c470c17d
BK
248 AC_TRY_COMPILE(, [int foo;
249 ], [ac_fdsections=yes], [ac_fdsections=no])
250 if test "$ac_test_CXXFLAGS" = set; then
251 CXXFLAGS="$ac_save_CXXFLAGS"
252 else
253 # this is the suspicious part
254 CXXFLAGS=''
255 fi
256 if test "$ac_fdsections" = "yes"; then
257 SECTION_FLAGS='-ffunction-sections -fdata-sections'
258 fi
259 AC_MSG_RESULT($ac_fdsections)
260
a4e99046 261 AC_LANG_RESTORE
8bd636c5 262 AC_SUBST(WERROR)
c470c17d
BK
263 AC_SUBST(WFMT_FLAGS)
264 AC_SUBST(SECTION_FLAGS)
b2dad0e3
BK
265])
266
c470c17d
BK
267
268dnl
421173e6
PE
269dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
270dnl the native linker is in use, all variables will be defined to something
271dnl safe (like an empty string).
272dnl
273dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
274dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
c470c17d 275dnl
c470c17d
BK
276dnl GLIBCPP_CHECK_LINKER_FEATURES
277AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
421173e6
PE
278 # If we're not using GNU ld, then there's no point in even trying these
279 # tests. Check for that first. We should have already tested for gld
280 # by now (in libtool), but require it now just to be safe...
a9117427
BK
281 SECTION_LDFLAGS=''
282 OPT_LDFLAGS=''
421173e6 283 AC_REQUIRE([AC_PROG_LD])
e7140677
BK
284
285 # Set --gc-sections.
286 if test "$ac_cv_prog_gnu_ld" = "broken"; then
a9117427 287 # GNU ld it is! Joy and bunny rabbits!
421173e6
PE
288
289 # All these tests are for C++; save the language and the compiler flags.
290 # Need to do this so that g++ won't try to link in libstdc++
291 ac_test_CFLAGS="${CFLAGS+set}"
292 ac_save_CFLAGS="$CFLAGS"
e7140677 293 CFLAGS='-x c++ -Wl,--gc-sections'
421173e6
PE
294
295 # Check for -Wl,--gc-sections
e466dc8a
BK
296 # XXX This test is broken at the moment, as symbols required for
297 # linking are now in libsupc++ (not built yet.....). In addition,
a9117427
BK
298 # this test has cored on solaris in the past. In addition,
299 # --gc-sections doesn't really work at the moment (keeps on discarding
300 # used sections, first .eh_frame and now some of the glibc sections for
301 # iconv). Bzzzzt. Thanks for playing, maybe next time.
421173e6
PE
302 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
303 AC_TRY_RUN([
304 int main(void)
305 {
a9117427
BK
306 try { throw 1; }
307 catch (...) { };
421173e6
PE
308 return 0;
309 }
e466dc8a 310 ], [ac_sectionLDflags=yes],[ac_sectionLFflags=no], [ac_sectionLDflags=yes])
421173e6
PE
311 if test "$ac_test_CFLAGS" = set; then
312 CFLAGS="$ac_save_CFLAGS"
313 else
314 # this is the suspicious part
315 CFLAGS=''
316 fi
317 if test "$ac_sectionLDflags" = "yes"; then
e7140677 318 SECTION_LDFLAGS='-Wl,--gc-sections'
421173e6
PE
319 fi
320 AC_MSG_RESULT($ac_sectionLDflags)
e7140677 321 fi
a9117427 322
e7140677
BK
323 # Set linker optimization flags.
324 if test "$ac_cv_prog_gnu_ld" = "yes"; then
421173e6 325 OPT_LDFLAGS='-Wl,-O1'
421173e6 326 fi
e7140677 327
c470c17d 328 AC_SUBST(SECTION_LDFLAGS)
421173e6 329 AC_SUBST(OPT_LDFLAGS)
c470c17d
BK
330])
331
332
b2dad0e3 333dnl
11fc1858 334dnl Check to see if the (math function) argument passed is
38bd7296
BK
335dnl 1) declared when using the c++ compiler
336dnl 2) has "C" linkage
337dnl
338dnl Define HAVE_CARGF etc if "cargf" is declared and links
339dnl
340dnl argument 1 is name of function to check
341dnl
342dnl ASSUMES argument is a math function with ONE parameter
343dnl
344dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
345AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
38bd7296 346 AC_MSG_CHECKING([for $1 declaration])
421173e6
PE
347 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
348 AC_LANG_SAVE
349 AC_LANG_CPLUSPLUS
350 AC_TRY_COMPILE([#include <math.h>],
351 [ $1(0);],
352 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
353 AC_LANG_RESTORE
354 ])
355 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
356 if test x$glibcpp_cv_func_$1_use = x"yes"; then
38bd7296
BK
357 AC_CHECK_FUNCS($1)
358 fi
359])
360
361
362dnl
11fc1858 363dnl Check to see if the (math function) argument passed is
38bd7296
BK
364dnl 1) declared when using the c++ compiler
365dnl 2) has "C" linkage
366dnl
367dnl Define HAVE_CARGF etc if "cargf" is declared and links
368dnl
369dnl argument 1 is name of function to check
370dnl
371dnl ASSUMES argument is a math function with TWO parameters
372dnl
373dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
374AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
38bd7296 375 AC_MSG_CHECKING([for $1 declaration])
421173e6
PE
376 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
377 AC_LANG_SAVE
378 AC_LANG_CPLUSPLUS
379 AC_TRY_COMPILE([#include <math.h>],
380 [ $1(0, 0);],
381 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
382 AC_LANG_RESTORE
383 ])
384 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
385 if test x$glibcpp_cv_func_$1_use = x"yes"; then
38bd7296
BK
386 AC_CHECK_FUNCS($1)
387 fi
388])
389
390
391dnl
11fc1858 392dnl Check to see if the (math function) argument passed is
38bd7296
BK
393dnl 1) declared when using the c++ compiler
394dnl 2) has "C" linkage
395dnl
396dnl Define HAVE_CARGF etc if "cargf" is declared and links
397dnl
398dnl argument 1 is name of function to check
399dnl
400dnl ASSUMES argument is a math function with THREE parameters
401dnl
402dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
403AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
38bd7296 404 AC_MSG_CHECKING([for $1 declaration])
421173e6
PE
405 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
406 AC_LANG_SAVE
407 AC_LANG_CPLUSPLUS
408 AC_TRY_COMPILE([#include <math.h>],
409 [ $1(0, 0, 0);],
410 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
411 AC_LANG_RESTORE
412 ])
413 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
414 if test x$glibcpp_cv_func_$1_use = x"yes"; then
38bd7296
BK
415 AC_CHECK_FUNCS($1)
416 fi
417])
418
419
e7140677
BK
420dnl
421dnl Check to see if the (stdlib function) argument passed is
422dnl 1) declared when using the c++ compiler
423dnl 2) has "C" linkage
424dnl
425dnl Define HAVE_STRTOLD if "strtold" is declared and links
426dnl Define HAVE_STRTOF if "strtof" is declared and links
427dnl
428dnl argument 1 is name of function to check
429dnl
430dnl ASSUMES argument is a math function with TWO parameters
431dnl
432dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
433AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
434 AC_MSG_CHECKING([for $1 declaration])
435 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
436 AC_LANG_SAVE
437 AC_LANG_CPLUSPLUS
438 AC_TRY_COMPILE([#include <stdlib.h>],
439 [ $1(0, 0);],
440 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
441 AC_LANG_RESTORE
442 ])
443 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
444 if test x$glibcpp_cv_func_$1_use = x"yes"; then
445 AC_CHECK_FUNCS($1)
446 fi
447])
448
449
11fc1858
BK
450dnl
451dnl Because the builtins are picky picky picky about the arguments they take,
452dnl do an explict linkage tests here.
453dnl Check to see if the (math function) argument passed is
454dnl 1) declared when using the c++ compiler
455dnl 2) has "C" linkage
456dnl
457dnl Define HAVE_CARGF etc if "cargf" is declared and links
458dnl
459dnl argument 1 is name of function to check
460dnl
461dnl ASSUMES argument is a math function with ONE parameter
462dnl
463dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
464AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
11fc1858 465 AC_MSG_CHECKING([for $1 declaration])
421173e6
PE
466 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
467 AC_LANG_SAVE
468 AC_LANG_CPLUSPLUS
469 AC_TRY_COMPILE([#include <math.h>],
470 [ $1(0);],
471 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
472 AC_LANG_RESTORE
473 ])
474 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
475 if test x$glibcpp_cv_func_$1_use = x"yes"; then
11fc1858 476 AC_MSG_CHECKING([for $1 linkage])
421173e6 477 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
11fc1858 478 AC_TRY_LINK([#include <math.h>],
421173e6
PE
479 [ $1(0);],
480 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
481 ])
482 AC_MSG_RESULT($glibcpp_cv_func_$1_link)
483 if test x$glibcpp_cv_func_$1_link = x"yes"; then
11fc1858
BK
484 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
485 AC_DEFINE_UNQUOTED(${ac_tr_func})
486 fi
487 fi
488])
489
490
491dnl
492dnl Check to see what builtin math functions are supported
493dnl
494dnl check for __builtin_abs
495dnl check for __builtin_fabsf
496dnl check for __builtin_fabs
497dnl check for __builtin_fabl
498dnl check for __builtin_labs
499dnl check for __builtin_sqrtf
500dnl check for __builtin_sqrtl
501dnl check for __builtin_fsqrt
502dnl check for __builtin_sinf
503dnl check for __builtin_sin
504dnl check for __builtin_sinl
505dnl check for __builtin_cosf
506dnl check for __builtin_cos
507dnl check for __builtin_cosl
508dnl
509dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
510AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
511 dnl Test for builtin math functions.
512 dnl These are made in gcc/c-common.c
513 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
514 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
515 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
516 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
517 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
518
519 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
520 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fsqrt)
521 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
522
523 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
524 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
525 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
526
527 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
528 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
529 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
530
531 dnl There is, without a doubt, a more elegant way to have these
532 dnl names exported so that they won't be stripped out of acconfig.h by
533 dnl autoheader. I leave this as an exercise to somebody less frustrated
534 dnl than I.... please email the libstdc++ list if you can figure out a
535 dnl more elegant approach (see autoconf/acgen.m4 and specifically
536 dnl AC_CHECK_FUNC for things to steal.)
537 dummyvar=no
538 if test x$dummyvar = x"yes"; then
539 AC_DEFINE(HAVE___BUILTIN_ABS)
540 AC_DEFINE(HAVE___BUILTIN_LABS)
541 AC_DEFINE(HAVE___BUILTIN_COS)
542 AC_DEFINE(HAVE___BUILTIN_COSF)
543 AC_DEFINE(HAVE___BUILTIN_COSL)
544 AC_DEFINE(HAVE___BUILTIN_FABS)
545 AC_DEFINE(HAVE___BUILTIN_FABSF)
546 AC_DEFINE(HAVE___BUILTIN_FABSL)
547 AC_DEFINE(HAVE___BUILTIN_SIN)
548 AC_DEFINE(HAVE___BUILTIN_SINF)
549 AC_DEFINE(HAVE___BUILTIN_SINL)
550 AC_DEFINE(HAVE___BUILTIN_FSQRT)
551 AC_DEFINE(HAVE___BUILTIN_SQRTF)
552 AC_DEFINE(HAVE___BUILTIN_SQRTL)
553 fi
554])
555
556
e7140677
BK
557dnl
558dnl Check to see what the underlying c library
559dnl These checks need to do two things:
560dnl 1) make sure the name is declared when using the c++ compiler
561dnl 2) make sure the name has "C" linkage
562dnl This might seem like overkill but experience has shown that it's not...
563dnl
564dnl Define HAVE_STRTOF etc if "strtof" is found.
565dnl Define HAVE_STRTOLD etc if "strtold" is found.
566dnl
567dnl GLIBCPP_CHECK_STDLIB_SUPPORT
568AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
569 ac_test_CXXFLAGS="${CXXFLAGS+set}"
570 ac_save_CXXFLAGS="$CXXFLAGS"
571 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
572
573 AC_CHECK_FUNCS(strtof)
574 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
575
576 CXXFLAGS="$ac_save_CXXFLAGS"
577])
578
579
2f103494
BK
580dnl
581dnl Check to see what the underlying c library or math library is like.
38bd7296
BK
582dnl These checks need to do two things:
583dnl 1) make sure the name is declared when using the c++ compiler
584dnl 2) make sure the name has "C" linkage
585dnl This might seem like overkill but experience has shown that it's not...
2f103494
BK
586dnl
587dnl Define HAVE_CARGF etc if "cargf" is found.
588dnl
589dnl GLIBCPP_CHECK_MATH_SUPPORT
590AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
38bd7296
BK
591 ac_test_CXXFLAGS="${CXXFLAGS+set}"
592 ac_save_CXXFLAGS="$CXXFLAGS"
4f76382d 593 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
aac350aa
BK
594
595 dnl Check libm
2f103494 596 AC_CHECK_LIB(m, sin, libm="-lm")
38bd7296 597 ac_save_LIBS="$LIBS"
2f103494
BK
598 LIBS="$LIBS $libm"
599
38bd7296
BK
600 dnl Check to see if certain C math functions exist.
601 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
602 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
603 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
604 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
605 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
606 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
607 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
608
609 dnl Check to see if basic C math functions have float versions.
610 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
611 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
612 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(acosf)
613 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(asinf)
614 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(atanf)
615 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
616 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(ceilf)
617 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(cosf)
618 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(coshf)
619 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expf)
620 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
621 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(floorf)
622 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
623 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
624 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
625 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
626 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
627 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
628 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
629 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinf)
630 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinhf)
631 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
632 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanf)
633 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanhf)
634 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
635 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
636
637 dnl Check to see if basic C math functions have long double versions.
638 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
639 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
11fc1858 640 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
38bd7296
BK
641 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(acosl)
642 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(asinl)
643 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(atanl)
644 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
645 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(ceill)
646 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(cosl)
647 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(coshl)
648 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
649 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
650 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(floorl)
651 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
652 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
653 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
654 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
655 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
656 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
657 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
11fc1858 658 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinl)
38bd7296
BK
659 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinhl)
660 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
661 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanl)
662 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanhl)
663 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
664 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
665
666 dnl Some runtimes have these functions with a preceding underscore. Please
667 dnl keep this sync'd with the one above. And if you add any new symbol,
668 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
669 dnl Check to see if certain C math functions exist.
38bd7296
BK
670 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinf)
671 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnan)
672 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finite)
673 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_copysign)
674 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincos)
675 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fpclass)
676 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_qfpclass)
677
678 dnl Check to see if basic C math functions have float versions.
679 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnanf)
680 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinff)
681 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_acosf)
682 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_asinf)
683 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_atanf)
684 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_atan2f)
685 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_ceilf)
686 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_cosf)
687 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_coshf)
688 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_expf)
689 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fabsf)
690 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_floorf)
691 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_fmodf)
692 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_frexpf)
693 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_ldexpf)
694 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_logf)
695 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_log10f)
696 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_modff)
697 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_powf)
698 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinf)
699 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinhf)
700 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sqrtf)
701 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanf)
702 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanhf)
703 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincosf)
704 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finitef)
705
706 dnl Check to see if basic C math functions have long double versions.
707 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnanl)
708 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinfl)
11fc1858 709 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_copysignl)
38bd7296
BK
710 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_acosl)
711 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_asinl)
712 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_atanl)
713 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_atan2l)
714 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_ceill)
715 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_cosl)
716 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_coshl)
717 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_expl)
718 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fabsl)
719 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_floorl)
720 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_fmodl)
721 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_frexpl)
722 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_ldexpl)
723 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_logl)
724 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_log10l)
725 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_modfl)
726 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_powl)
11fc1858 727 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinl)
38bd7296
BK
728 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinhl)
729 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sqrtl)
730 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanl)
731 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanhl)
732 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincosl)
733 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finitel)
734
735 LIBS="$ac_save_LIBS"
736 CXXFLAGS="$ac_save_CXXFLAGS"
2f103494
BK
737])
738
739
740dnl
741dnl Check to see if there is native support for complex
742dnl
743dnl Don't compile bits in math/* if native support exits.
744dnl
8b8ab21c 745dnl Define USE_COMPLEX_LONG_DOUBLE etc if "atan2l/copysignl" is found.
2f103494
BK
746dnl
747dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
748AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
749 dnl Check for complex versions of math functions of platform.
750 AC_CHECK_HEADERS([complex.h])
b4b2a487
MM
751 AC_CHECK_LIB(m, main)
752 AC_REPLACE_MATHFUNCS(cabs cabsf ccos ccosf ccosh ccoshf cexp cexpf \
753 c_log c_logf clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt \
754 csqrtf ctan ctanf ctanh ctanhf carg cargf nan hypot hypotf atan2f expf \
755 copysignf)
11fc1858
BK
756
757 dnl Compile the long double complex functions only if the function
758 dnl provides the non-complex long double functions that are needed.
759 dnl Currently this includes copysignl and atan2l, which should be
760 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
761 USE_COMPLEX_LONG_DOUBLE=no
762 if test x$ac_cv_func_atan2l = x"yes" \
763 && test x$ac_cv_func_copysignl = x"yes"; then
764 USE_COMPLEX_LONG_DOUBLE=yes
b4b2a487 765 AC_REPLACE_MATHFUNCS(cabsl ccoshl ccosl cexpl cpowl csinhl csinl \
11fc1858
BK
766 csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l)
767 fi
768
2f103494
BK
769 AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
770])
771
54fa7415 772
d0941a31
PE
773dnl Check to see what architecture and operating system we are compiling
774dnl for. Also, if architecture- or OS-specific flags are required for
775dnl compilation, pick them up here.
e974e9cc 776dnl
d0941a31
PE
777dnl GLIBCPP_CHECK_TARGET
778AC_DEFUN(GLIBCPP_CHECK_TARGET, [
779 . [$]{glibcpp_basedir}/configure.target
780 AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
781 AC_MSG_RESULT(OS config directory is $os_include_dir)
5e53dba6 782 AC_LINK_FILES($os_include_dir/bits/os_defines.h, include/bits/os_defines.h)
e974e9cc
BK
783])
784
785
b2dad0e3
BK
786dnl
787dnl Check to see what the underlying c library's interface to ctype looks
788dnl like. Bits of locale rely on things like isspace, toupper, etc. This
789dnl stuff makes sure the right bits from the clibrary get called.
790dnl
791dnl Depending on what is found, select various configure/*/bits/ctype_base.h
792dnl Depending on what is found, select various configure/*/ctype.cc
793dnl
e7140677
BK
794dnl GLIBCPP_CHECK_CTYPE_SUPPORT
795AC_DEFUN(GLIBCPP_CHECK_CTYPE_SUPPORT, [
b2dad0e3
BK
796 AC_CHECK_HEADER(ctype.h, [
797
798 dnl If doesn't match any specified, go with defaults.
799 ctype_default=yes
800
9a200b0a
PE
801 dnl Test for <ctype> functionality -- GNU/Linux
802 AC_MSG_CHECKING([<ctype> for GNU/Linux])
b2dad0e3
BK
803 AC_TRY_COMPILE([#include <ctype.h>],
804 [int
805 foo (int a)
806 { return _ISspace + _ISprint + _IScntrl + _ISupper + _ISlower + _ISalpha \
8b8ab21c
BK
807 + _ISdigit + _ISpunct + _ISxdigit + _ISalnum + _ISgraph \
808 + __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];}], \
b2dad0e3
BK
809 ctype_linux=yes, ctype_linux=no)
810 AC_MSG_RESULT($ctype_linux)
811 if test $ctype_linux = "yes"; then
e974e9cc 812 ctype_include_dir="config/os/gnu-linux"
b2dad0e3
BK
813 ctype_default=no
814 fi
815
6ad50467 816 dnl Test for <ctype> functionality -- FreeBSD 4.0
65dd21b7 817 if test $ctype_default = "yes"; then
9a200b0a 818 AC_MSG_CHECKING([<ctype> for FreeBSD 4.0])
7b267e3e
BK
819 AC_TRY_COMPILE([#include <ctype.h>],
820 [int
821 foo (int a)
822 { return _CTYPE_S + _CTYPE_R + _CTYPE_C + _CTYPE_U + _CTYPE_L + _CTYPE_A \
8b8ab21c 823 + _CTYPE_D + _CTYPE_P + _CTYPE_X + _CTYPE_G ;}], \
7b267e3e
BK
824 ctype_bsd=yes, ctype_bsd=no)
825 AC_MSG_RESULT($ctype_bsd)
826 if test $ctype_bsd = "yes"; then
e974e9cc 827 ctype_include_dir="config/os/bsd"
6ad50467
BK
828 ctype_default=no
829 fi
65dd21b7 830 fi
6ad50467
BK
831
832 dnl Test for <ctype> functionality -- FreeBSD 3.4
65dd21b7 833 if test $ctype_default = "yes"; then
9a200b0a 834 AC_MSG_CHECKING([<ctype> for FreeBSD 3.4])
6ad50467
BK
835 AC_TRY_COMPILE([#include <ctype.h>],
836 [int
837 foo (int a)
838 { return _S + _R + _C + _U + _L + _A \
839 + _D + _P + _X + _G + __istype (a, 0);}], \
840 ctype_freebsd34=yes, ctype_freebsd34=no)
841 AC_MSG_RESULT($ctype_freebsd34)
842 if test $ctype_freebsd34 = "yes"; then
e974e9cc 843 ctype_include_dir="config/os/bsd"
7b267e3e
BK
844 ctype_default=no
845 fi
65dd21b7 846 fi
7b267e3e 847
9a200b0a 848 dnl Test for <ctype> functionality -- Solaris 2.6 and up
b2dad0e3 849 if test $ctype_default = "yes"; then
9a200b0a 850 AC_MSG_CHECKING([<ctype> for Solaris 2.6,7,8])
b2dad0e3
BK
851 AC_TRY_COMPILE([#include <ctype.h>],
852 [int
853 foo (int a)
854 { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
8b8ab21c
BK
855 + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
856 + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}], \
b2dad0e3
BK
857 ctype_solaris=yes, ctype_solaris=no)
858 AC_MSG_RESULT($ctype_solaris)
859
860 if test $ctype_solaris = "yes"; then
861 AC_MSG_CHECKING([ for version])
862 AC_LANG_CPLUSPLUS
863 AC_TRY_COMPILE([#include <ctype.h>],
864 [typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;],\
865 ctype_solaris26=yes, ctype_solaris26=no)
866 AC_LANG_C
867 if test $ctype_solaris26 = "yes"; then
e974e9cc 868 ctype_include_dir="config/os/solaris/solaris2.6"
9a200b0a 869 AC_MSG_RESULT([Solaris 2.6])
b2dad0e3
BK
870 ctype_default=no
871 else
e974e9cc 872 ctype_include_dir="config/os/solaris/solaris2.7"
9a200b0a 873 AC_MSG_RESULT([Solaris 7,8])
b2dad0e3
BK
874 ctype_default=no
875 fi
876 fi
877 fi
878
9a200b0a 879 dnl Test for <ctype> functionality -- Solaris 2.5.1
b2dad0e3 880 if test $ctype_default = "yes"; then
9a200b0a 881 AC_MSG_CHECKING([<ctype> for Solaris 2.5.1])
b2dad0e3
BK
882 AC_TRY_COMPILE([#include <ctype.h>],
883 [int
884 foo (int a)
885 { return _U + _L + _N + _S + _P + _C + _X + _B \
8b8ab21c 886 + __ctype[a];}], \
b2dad0e3
BK
887 ctype_solaris25=yes, ctype_solaris25=no)
888 AC_MSG_RESULT($ctype_solaris25)
889 if test $ctype_solaris25 = "yes"; then
e974e9cc 890 ctype_include_dir="config/os/solaris/solaris2.5"
b2dad0e3
BK
891 ctype_default=no
892 fi
893 fi
894
9a200b0a 895 dnl Test for <ctype> functionality -- AIX
b2dad0e3 896 if test $ctype_default = "yes"; then
9a200b0a 897 AC_MSG_CHECKING([<ctype> for AIX])
b2dad0e3
BK
898 AC_TRY_COMPILE([#include <ctype.h>],
899 [int
900 foo (int a)
901 { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
8b8ab21c
BK
902 + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
903 + _VALC('a') + _IS('c', 0);}], \
b2dad0e3
BK
904 ctype_aix=yes, ctype_aix=no)
905 AC_MSG_RESULT($ctype_aix)
906 if test $ctype_aix = "yes"; then
e974e9cc 907 ctype_include_dir="config/os/aix"
b2dad0e3
BK
908 ctype_default=no
909 fi
910 fi
911
dbf5ba31 912 dnl Test for <ctype> functionality -- IRIX
f73bbdca 913 if test $ctype_default = "yes"; then
dbf5ba31
MM
914 AC_MSG_CHECKING([<ctype> for IRIX])
915 AC_TRY_COMPILE([#include <ctype.h>],
916 [int
917 foo (int a)
918 { return _U + _L + _N + _S + _P + _C + _B + _X + \
919 _A + _PR + _G + _BL;}], \
920 ctype_irix=yes, ctype_irix=no)
921 AC_MSG_RESULT($ctype_irix)
922 if test $ctype_irix = "yes"; then
923 ctype_include_dir="config/os/irix"
924 ctype_default=no
925 fi
926 fi
927
b2dad0e3
BK
928 dnl Test for <ctype> functionality -- newlib
929 if test $ctype_default = "yes"; then
9a200b0a 930 AC_MSG_CHECKING([<ctype> for newlib])
b2dad0e3
BK
931 AC_TRY_COMPILE([#include <ctype.h>],
932 [int
933 foo (int a)
934 { return _U + _L + _N + _S + _P + _C + _X + _B \
8b8ab21c 935 + _ctype_[a];}], \
b2dad0e3
BK
936 ctype_newlib=yes, ctype_newlib=no)
937 AC_MSG_RESULT($ctype_newlib)
938 if test $ctype_newlib = "yes"; then
939 ctype_include_dir="config/newlib"
940 ctype_default=no
941 fi
942 fi
943
944 if test $ctype_default = "yes"; then
e974e9cc 945 ctype_include_dir="config/os/generic"
b2dad0e3
BK
946 AC_MSG_WARN("Using default ctype headers.")
947 fi
e974e9cc 948
5e53dba6
BK
949 AC_LINK_FILES($ctype_include_dir/bits/ctype_base.h,
950 include/bits/ctype_base.h)
951 AC_LINK_FILES($ctype_include_dir/bits/ctype_inline.h,
952 include/bits/ctype_inline.h)
e974e9cc 953 AC_LINK_FILES($ctype_include_dir/bits/ctype_noninline.h, \
5e53dba6 954 include/bits/ctype_noninline.h)
b2dad0e3
BK
955 ])
956])
957
958
b2dad0e3
BK
959dnl
960dnl Check to see if this target can enable the wchar_t parts of libstdc++.
8b8ab21c
BK
961dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
962dnl must have been previously checked.)
b2dad0e3
BK
963dnl
964dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
965dnl Define _GLIBCPP_NEED_MBSTATE_T if mbstate_t is not in wchar.h
b2dad0e3
BK
966dnl
967dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
968AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
8b8ab21c
BK
969 if test x$enable_c_mbchar != xno; then
970
971 dnl Sanity check for existence of ISO C9X headers for extended encoding.
972 AC_CHECK_HEADER(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
973 AC_CHECK_HEADER(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
974
975 dnl Only continue checking if the ISO C9X headers exist.
976 if test x"$ac_has_wchar_h" = xyes && test x"$ac_has_wctype_h" = xyes; then
b2dad0e3 977
8b8ab21c
BK
978 dnl Test wchar.h for mbstate_t, which is needed for char_traits
979 dnl and others.
980 AC_MSG_CHECKING([for mbstate_t])
981 AC_TRY_COMPILE([#include <wchar.h>],
982 [mbstate_t teststate;],
983 use_native_mbstatet=yes, use_native_mbstatet=no)
984 AC_MSG_RESULT($use_native_mbstatet)
985 if test x"$use_native_mbstatet" = xno; then
986 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
987 fi
988
989 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
990 dnl numeric_limits can instantiate type_traits<wchar_t>
991 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
992 AC_TRY_COMPILE([#include <wchar.h>],
993 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
994 has_wchar_minmax=yes, has_wchar_minmax=no)
995 AC_MSG_RESULT($has_wchar_minmax)
996
997 dnl Test wchar.h for WEOF, which is what we use to determine whether
998 dnl to specialize for char_traits<wchar_t> or not.
999 AC_MSG_CHECKING([for WEOF])
1000 AC_TRY_COMPILE([
1001 #include <wchar.h>
1002 #include <stddef.h>],
1003 [wint_t i = WEOF;],
1004 has_weof=yes, has_weof=no)
1005 AC_MSG_RESULT($has_weof)
1006
1007 dnl Tests for wide character functions used in char_traits<wchar_t>.
1008 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset \
1009 wcsrtombs mbsrtowcs, ac_wfuncs=yes, ac_wfuncs=no)
1010
1011 AC_MSG_CHECKING([for ISO C9X wchar_t support])
1012 if test x"$has_weof" = xyes && test x"$has_wchar_minmax" = xyes \
1013 && test x"$ac_wfuncs" = xyes; then
1014 ac_isoC9X_wchar_t=yes
1015 else
1016 ac_isoC9X_wchar_t=no
1017 fi
1018 AC_MSG_RESULT($ac_isoC9X_wchar_t)
1019
1020 dnl Use iconv for wchar_t to char conversions. As such, check for
1021 dnl X/Open Portability Guide, version 2 features (XPG2).
1022 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
1023 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
b72554f1
APB
1024
1025 dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
1026 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
1027 ac_save_LIBS="$LIBS"
1028 LIBS="$LIBS $libiconv"
1029
8b8ab21c
BK
1030 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
1031 ac_XPG2funcs=yes, ac_XPG2funcs=no)
1032
5b20f7a0
BK
1033 LIBS="$ac_save_LIBS"
1034
8b8ab21c
BK
1035 AC_MSG_CHECKING([for XPG2 wchar_t support])
1036 if test x"$ac_has_iconv_h" = xyes && test x"$ac_has_langinfo_h" = xyes \
1037 && test x"$ac_XPG2funcs" = xyes; then
1038 ac_XPG2_wchar_t=yes
1039 else
1040 ac_XPG2_wchar_t=no
1041 fi
1042 AC_MSG_RESULT($ac_XPG2_wchar_t)
1043
1044 dnl At the moment, only enable wchar_t specializations if all the
1045 dnl above support is present.
1046 AC_MSG_CHECKING([for enabled wchar_t specializations])
1047 if test x"$ac_isoC9X_wchar_t" = xyes \
1048 && test x"$ac_XPG2_wchar_t" = xyes; then
1049 libinst_wstring_la="libinst-wstring.la"
1050 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
1051 AC_MSG_RESULT("yes")
1052 else
1053 libinst_wstring_la=""
1054 AC_MSG_RESULT("no")
1055 fi
1056 AC_SUBST(libinst_wstring_la)
b2dad0e3 1057
3840fa2a 1058 else
8b8ab21c
BK
1059 AC_MSG_WARN([<wchar.h> not found])
1060 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
3840fa2a 1061 fi
3840fa2a 1062
b2dad0e3 1063 else
8b8ab21c
BK
1064 dnl Wide characters disabled by the user. Maybe print a warning?
1065 :
b2dad0e3 1066 fi
b2dad0e3
BK
1067])
1068
1069
1070dnl
1071dnl Check to see if this version of GNU C++ is afflicted by bugs in
1072dnl __complex__ float support.
1073dnl
1074dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
1075dnl
2f103494
BK
1076dnl Check to see if this version of GNU C++ is afflicted by bugs in
1077dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
1078dnl gcc-2.95.x when using the library, unless we define the default copy
1079dnl ctor in the specializations of complex<>.
1080dnl
1081dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
1082dnl GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT
1083AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT, [
b2dad0e3 1084 AC_REQUIRE([AC_PROG_CXX])
2f103494
BK
1085
1086 AC_MSG_CHECKING([for GNU C++ __complex__ support])
1087 AC_CACHE_VAL(glibcpp_cv_complex, [
1088 AC_LANG_SAVE
1089 AC_LANG_CPLUSPLUS
1090 AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
8b8ab21c
BK
1091 dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
1092 [ dcomplex x; f(x); ],
2f103494
BK
1093 glibcpp_cv_complex=ok,
1094 glibcpp_cv_complex=buggy
1095 )
1096 AC_LANG_RESTORE
1097 ])
1098 AC_MSG_RESULT($glibcpp_cv_complex)
1099 if test $glibcpp_cv_complex = buggy; then
1100 AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
1101 fi
1102
b2dad0e3
BK
1103 AC_MSG_CHECKING([for GNU C++ __complex__ float support])
1104 AC_CACHE_VAL(glibcpp_cv_float_complex, [
1105 AC_LANG_SAVE
1106 AC_LANG_CPLUSPLUS
1107 rm -f conftest.h
1108 cat > conftest.h <<EOB
1109 //
1110 // Check for buggy __complex__ that causes ICE in most versions of egcs
1111 // and gcc-2.95.x on certain platforms (eg., x86-win32).
1112 //
747dcaf1 1113 // See http://gcc.gnu.org/ml/gcc-bugs/1999-07n/msg00845.html for
b2dad0e3
BK
1114 // more info on the bug itself.
1115 //
1116 struct
1117 float_complex
1118 {
1119 __complex__ float m_value;
1120 float_complex (float = 0.0f, float = 0.0f);
1121 float_complex (__complex__ float val) : m_value (val) {}
1122 float_complex foo (const float_complex &val)
1123 { return float_complex (~val.m_value); }
1124 };
1125EOB
1126 AC_TRY_COMPILE([#include "conftest.h"], ,
1127 glibcpp_cv_float_complex=ok,
1128 glibcpp_cv_float_complex=buggy
1129 )
1130 AC_LANG_RESTORE
1131 ])
1132 AC_MSG_RESULT($glibcpp_cv_float_complex)
1133 if test $glibcpp_cv_float_complex = buggy; then
1134 AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
1135 fi
1136])
1137
1138
b2dad0e3 1139dnl
8bd636c5 1140dnl Check for special debugging mode; not for production use.
b2dad0e3
BK
1141dnl
1142dnl GLIBCPP_ENABLE_DEBUG
34791641 1143dnl --enable-debug sets '-ggdb3 -O0'.
b2dad0e3
BK
1144dnl --disable-debug sets '-g' and whatever optimization options the
1145dnl compiler can handle.
7f586614 1146dnl + --enable-maintainer-mode automatically defaults this to on.
b2dad0e3
BK
1147dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
1148dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
1149dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1150dnl defaults to `no'.
1151AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
1152define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
1153AC_ARG_ENABLE(debug,
1154changequote(<<, >>)dnl
1155<< --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
1156changequote([, ])dnl
5780a46b 1157[case "${enableval}" in
b2dad0e3
BK
1158 yes) enable_debug=yes ;;
1159 no) enable_debug=no ;;
1160 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
1161 esac],
1162enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
5780a46b 1163
b2dad0e3 1164dnl Option parsed, now set things appropriately
5780a46b 1165case "${enable_debug}" in
cde28f0d 1166 yes)
34791641 1167 DEBUG_FLAGS='-O0 -ggdb3'
8b8ab21c 1168 ;;
f3b004d8 1169 no)
8b8ab21c 1170 DEBUG_FLAGS='-g'
f3b004d8 1171 ;;
b2dad0e3 1172esac
c470c17d 1173AC_SUBST(DEBUG_FLAGS)
b2dad0e3
BK
1174])
1175
1176
dcfa0bc8
PE
1177dnl
1178dnl Check for "unusual" flags to pass to the compiler while building.
1179dnl
1180dnl GLIBCPP_ENABLE_CXX_FLAGS
1181dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1182dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1183dnl Somehow this same set of flags must be passed when [re]building
1184dnl libgcc.
1185dnl --disable-cxx-flags passes nothing.
32a4595e
PE
1186dnl + See http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00131.html
1187dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00284.html
1188dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00035.html
dcfa0bc8 1189dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
32a4595e
PE
1190dnl If "default flags" is an empty string (or "none"), the effect is
1191dnl the same as --disable or --enable=no.
dcfa0bc8
PE
1192AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1193define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1194AC_ARG_ENABLE(cxx-flags,
1195changequote(<<, >>)dnl
1196<< --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
1197 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1198changequote([, ])dnl
1199[case "x$enableval" in
5780a46b 1200 xyes)
8b8ab21c 1201 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
5780a46b 1202 xno|x)
8b8ab21c 1203 enable_cxx_flags='' ;;
5780a46b 1204 *)
8b8ab21c 1205 enable_cxx_flags="$enableval" ;;
dcfa0bc8 1206 esac],
5780a46b
BK
1207enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
1208
32a4595e 1209dnl Thinko on my part during design. This kludge is the workaround.
5780a46b
BK
1210if test "$enable_cxx_flags" = "none"; then
1211 enable_cxx_flags='';
1212fi
1213
32a4595e
PE
1214dnl Run through flags (either default or command-line) and set anything
1215dnl extra (e.g., #defines) that must accompany particular g++ options.
dcfa0bc8
PE
1216if test -n "$enable_cxx_flags"; then
1217 for f in $enable_cxx_flags; do
1218 case "$f" in
991a40fc 1219 -fhonor-std) ;;
dcfa0bc8
PE
1220 -*) ;;
1221 *) # and we're trying to pass /what/ exactly?
1222 AC_MSG_ERROR([compiler flags start with a -]) ;;
1223 esac
1224 done
1225fi
1226EXTRA_CXX_FLAGS="$enable_cxx_flags"
1227AC_SUBST(EXTRA_CXX_FLAGS)
1228])
1229
1230
b2dad0e3 1231dnl
8bd636c5 1232dnl Check for which I/O library to use: libio, or something specific.
b2dad0e3
BK
1233dnl
1234dnl GLIBCPP_ENABLE_CSTDIO
1235dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
1236dnl
1237dnl default is libio
1238dnl
1239AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1240 AC_MSG_CHECKING([for cstdio to use])
1241 AC_ARG_ENABLE(cstdio,
1fd2f510
BK
1242 [ --enable-cstdio enable GNU libio for target io package. (default)
1243 --enable-cstdio=LIB use LIB target-speific io package.],
b2dad0e3 1244 if test x$enable_cstdio = xno; then
8b8ab21c 1245 enable_cstdio=libio
b2dad0e3
BK
1246 fi,
1247 enable_cstdio=libio)
1248
1249 enable_cstdio_flag=$enable_cstdio
1250
8b8ab21c 1251 dnl Check if a valid I/O package
b2dad0e3 1252 case x${enable_cstdio_flag} in
e26cb7ab 1253 xlibio)
dd75251f
BK
1254 CSTDIO_H=config/c_io_libio.h
1255 CSTDIO_CC=config/c_io_libio.cc
1256 AC_MSG_RESULT(libio)
1257
1258 # see if we are on a system with libio native (ie, linux)
1259 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1260
1261 # Need to check and see what version of glibc is being used. If
1262 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1263 # compile most of libio for linux systems.
1264 if test x$has_libio = x"yes"; then
1265 case "$target" in
1266 *-*-linux*)
8b8ab21c
BK
1267 AC_MSG_CHECKING([for glibc version >= 2.2])
1268 AC_EGREP_CPP([ok], [
1269 #include <features.h>
1270 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1271 ok
1272 #endif
1273 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1274 AC_MSG_RESULT($glibc_satisfactory)
1275 ;;
dd75251f
BK
1276 esac
1277
8b8ab21c 1278 # XXX at the moment, admit defeat and force the recompilation
f133a43e 1279 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
8b8ab21c
BK
1280 glibc_satisfactory=no
1281
1282 if test x$glibc_satisfactory = x"yes"; then
1283 need_libio=no
8b8ab21c
BK
1284 need_wlibio=no
1285 else
1286 need_libio=yes
8b8ab21c
BK
1287 # bkoz XXX need to add checks to enable this
1288 # pme XXX here's a first pass at such a check
1289 if test x$enable_c_mbchar != xno; then
1290 need_wlibio=yes
1291 else
1292 need_wlibio=no
1293 fi
1294 fi
dd75251f 1295
dd75251f 1296 else
e7140677 1297 # Using libio, but <libio.h> doesn't exist on the target system. . .
8b8ab21c 1298 need_libio=yes
8b8ab21c
BK
1299 # bkoz XXX need to add checks to enable this
1300 # pme XXX here's a first pass at such a check
1301 if test x$enable_c_mbchar != xno; then
1302 need_wlibio=yes
1303 else
1304 need_wlibio=no
1305 fi
dd75251f
BK
1306 fi
1307 ;;
e26cb7ab
MM
1308 xstdio | x | xno | xnone | xyes)
1309 # default
9717c75c
BK
1310 CSTDIO_H=config/c_io_stdio.h
1311 CSTDIO_CC=config/c_io_stdio.cc
1312 AC_MSG_RESULT(stdio)
1313
e26cb7ab 1314 # We're not using stdio.
dd75251f 1315 need_libio=no
e26cb7ab
MM
1316 need_wlibio=no
1317 # Wide characters are not supported with this package.
1318 enable_c_mbchar=no
dd75251f
BK
1319 ;;
1320 *)
1321 echo "$enable_cstdio is an unknown io package" 1>&2
1322 exit 1
1323 ;;
b2dad0e3 1324 esac
5e53dba6 1325 AC_LINK_FILES($CSTDIO_H, include/bits/c++io.h)
c4561450 1326 AC_LINK_FILES($CSTDIO_CC, src/c++io.cc)
8901ac21
BK
1327
1328 # 2000-08-04 bkoz hack
1329 CCODECVT_C=config/c_io_libio_codecvt.c
1330 AC_LINK_FILES($CCODECVT_C, libio/c_codecvt.c)
1331 # 2000-08-04 bkoz hack
8b8ab21c 1332
b2dad0e3 1333 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
20427c6b 1334 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
c4d3f801
MM
1335 if test "$need_libio" = yes || test "$need_wlibio" = yes; then
1336 libio_la=../libio/libio.la
1337 else
1338 libio_la=
1339 fi
1340 AC_SUBST(libio_la)
b2dad0e3
BK
1341])
1342
1343
1344dnl
8bd636c5 1345dnl Check for which threading library to use.
b2dad0e3
BK
1346dnl
1347dnl GLIBCPP_ENABLE_THREADS
1348dnl --enable-threads=posix sets config/threads-posix.h et. al.
1349dnl
8b8ab21c
BK
1350dnl Default is no threads, which also disables _IO_MTSAFE_IO in
1351dnl libio. Any actual thread package will enable it.
b2dad0e3
BK
1352dnl
1353AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1354 dnl Note this comes from the gcc/config.in and libjava/config.in
1355 dnl Efforts should be made to keep this in sync.
1356 AC_MSG_CHECKING([for threads package to use])
1357 AC_ARG_ENABLE(threads,
1358 [ --enable-threads enable thread usage for target GCC.
1fd2f510 1359 --enable-threads=LIB use LIB thread package for target GCC.],
b2dad0e3
BK
1360 if test x$enable_threads = xno; then
1361 enable_threads=''
1362 fi,
1363 enable_threads='')
1364
1365 enable_threads_flag=$enable_threads
1366
1367 dnl Check if a valid thread package
1368 case x${enable_threads_flag} in
8b8ab21c
BK
1369 x | xno | xnone)
1370 # No threads
1371 target_thread_file='single'
1372 ;;
1373 xyes)
1374 # default
d0941a31 1375 target_thread_file='posix'
8b8ab21c
BK
1376 ;;
1377 xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
1378 xsolaris | xwin32 | xdce | xvxworks)
1379 target_thread_file=$enable_threads_flag
1380 ;;
1381 *)
1382 echo "$enable_threads is an unknown thread package" 1>&2
1383 exit 1
1384 ;;
b2dad0e3
BK
1385 esac
1386
1387 dnl Check for thread package actually supported in libstdc++
e974e9cc 1388 THREADH=
b2dad0e3
BK
1389 case "$target_thread_file" in
1390 no | none | single)
e974e9cc 1391 THREADH=threads-no.h
b2dad0e3
BK
1392 ;;
1393 posix | pthreads)
e974e9cc 1394 THREADH=threads-posix.h
b2dad0e3
BK
1395 ;;
1396 decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
1397 AC_MSG_ERROR(thread package $THREADS not yet supported)
1398 ;;
1399 *)
d0941a31 1400 AC_MSG_ERROR($THREADS is an unsupported/unknown thread package)
b2dad0e3
BK
1401 ;;
1402 esac
e974e9cc 1403 AC_MSG_RESULT($THREADH)
b2dad0e3 1404
5e53dba6 1405 AC_LINK_FILES(config/$THREADH, include/bits/c++threads.h)
8b8ab21c
BK
1406 if test $THREADH != threads-no.h; then
1407 AC_DEFINE(_GLIBCPP_USE_THREADS)
1408 fi
b2dad0e3
BK
1409])
1410
1411
e974e9cc
BK
1412dnl Enable atomic locking
1413dnl GLIBCPP_ENABLE_ATOMICITY
1414AC_DEFUN(GLIBCPP_ENABLE_ATOMICITY, [
1415 AC_MSG_CHECKING([for atomicity.h])
6414587c
PE
1416 # We have ATOMICITY already from GLIBCPP_CONFIGURE
1417 if test "$ATOMICITYH" = "config/cpu/generic"; then
1418 AC_MSG_WARN([No ATOMICITY settings found, using generic atomic ops.])
1419 fi
e974e9cc 1420 AC_MSG_RESULT($ATOMICITYH/bits/atomicity.h)
5e53dba6 1421 AC_LINK_FILES($ATOMICITYH/bits/atomicity.h, include/bits/atomicity.h)
e974e9cc
BK
1422])
1423
1424
b2dad0e3 1425dnl
8bd636c5 1426dnl Check for template specializations for the 'long long' type extension.
b2dad0e3
BK
1427dnl
1428dnl GLIBCPP_ENABLE_LONG_LONG
1429dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1430dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1431dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1432dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1433dnl defaults to `no'.
0137be2d 1434dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
b2dad0e3
BK
1435dnl
1436dnl GLIBCPP_ENABLE_LONG_LONG
1437AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1438 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
209fe19b 1439
b2dad0e3
BK
1440 AC_ARG_ENABLE(long-long,
1441 changequote(<<, >>)dnl
d0d88ce3 1442 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
b2dad0e3
BK
1443 changequote([, ])dnl
1444 [case "$enableval" in
1445 yes) enable_long_long=yes ;;
1446 no) enable_long_long=no ;;
1447 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1448 esac],
1449 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
209fe19b
BK
1450
1451 # Check for the existance of functions used if long long is enabled.
1452 AC_CHECK_FUNC(strtoll,,ac_strtoll=no)
1453 AC_CHECK_FUNC(strtoull,,ac_strtoull=no)
1454
3840fa2a 1455 AC_MSG_CHECKING([for enabled long long])
209fe19b 1456 if test x"$ac_strtoll" = xno || test x"$ac_strtoull" = xno; then
3840fa2a
BK
1457 enable_long_long=no;
1458 fi;
d0d88ce3 1459 AC_MSG_RESULT($enable_long_long)
3840fa2a 1460
b2dad0e3 1461 dnl Option parsed, now set things appropriately
dcc41852
BK
1462 if test x"$enable_long_long" = xyes; then
1463 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1464 fi
b2dad0e3
BK
1465])
1466
1467
99246c90 1468dnl
8bd636c5 1469dnl Check for whether or not to do shadowed C headers.
99246c90
PE
1470dnl
1471dnl GLIBCPP_ENABLE_SHADOW
d0d88ce3
BK
1472dnl --enable-cshadow-headers [does stuff].
1473dnl --disable-cshadow-headers [does not do stuff].
99246c90
PE
1474dnl + This will eventually need to be on by default.
1475dnl + Usage: GLIBCPP_ENABLE_SHADOW[(DEFAULT)]
1476dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1477dnl defaults to `no'.
1478AC_DEFUN(GLIBCPP_ENABLE_SHADOW, [dnl
1479define([GLIBCPP_ENABLE_SHADOW_DEFAULT], ifelse($1, yes, yes, no))dnl
d0d88ce3
BK
1480AC_MSG_CHECKING([for enabled cshadow headers])
1481AC_ARG_ENABLE(cshadow-headers,
99246c90 1482changequote(<<, >>)dnl
d0d88ce3
BK
1483<< --enable-cshadow-headers construct "shadowed" C header files for
1484 g++ [default=>>GLIBCPP_ENABLE_SHADOW_DEFAULT],
5780a46b
BK
1485changequote([, ])
1486 [case "$enableval" in
1487 yes) enable_cshadow_headers=yes
8b8ab21c 1488 ;;
5780a46b 1489 no) enable_cshadow_headers=no
8b8ab21c 1490 ;;
5780a46b 1491 *) AC_MSG_ERROR([Unknown argument to enable/disable shadowed C headers])
8b8ab21c 1492 ;;
5780a46b
BK
1493 esac],
1494 enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)
1495 AC_MSG_RESULT($enable_cshadow_headers)
1496
1497 dnl Option parsed, now set things appropriately
0517cb99 1498 dnl NB: these things may be duplicated in c++config.h as well.
5780a46b 1499 case "$enable_cshadow_headers" in
99246c90 1500 yes)
8b8ab21c
BK
1501 CSHADOW_FLAGS="-fno-builtin"
1502 C_INCLUDE_DIR='${top_srcdir}/include/c_std'
0517cb99 1503 AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
8b8ab21c 1504 ;;
99246c90 1505 no)
8b8ab21c
BK
1506 CSHADOW_FLAGS=""
1507 C_INCLUDE_DIR='${top_srcdir}/include/c'
99246c90 1508 ;;
5780a46b 1509 esac
5b80666b 1510
e466dc8a
BK
1511 AC_SUBST(CSHADOW_FLAGS)
1512 AC_SUBST(C_INCLUDE_DIR)
5780a46b 1513 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cshadow_headers" = yes)
99246c90 1514])
b2dad0e3 1515
8b8ab21c
BK
1516
1517dnl
1518dnl Check for wide character support. Has the same effect as the option
1519dnl in gcc's configure, but in a form that autoconf can mess with.
1520dnl
1521dnl GLIBCPP_ENABLE_C_MBCHAR
1522dnl --enable-c-mbchar requests all the wchar_t stuff.
1523dnl --disable-c-mbchar doesn't.
1524dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1525dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1526dnl defaults to `no'.
1527AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1528define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1529AC_ARG_ENABLE(c-mbchar,
1530changequote(<<, >>)dnl
1531<< --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1532changequote([, ])dnl
1533[case "$enableval" in
1534 yes) enable_c_mbchar=yes ;;
1535 no) enable_c_mbchar=no ;;
1536 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1537 esac],
1538enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1539dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1540])
1541
1542
e466dc8a
BK
1543dnl
1544dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1545dnl
1546dnl GLIBCPP_INCLUDE_DIR
1547dnl C_INCLUDE_DIR
1548dnl TOPLEVEL_INCLUDES
1549dnl LIBMATH_INCLUDES
1550dnl LIBSUPCXX_INCLUDES
1551dnl LIBIO_INCLUDES
1552dnl CSHADOW_INCLUDES
1553dnl
1554dnl GLIBCPP_EXPORT_INCLUDE
1555AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1556 # Root level of the include sources.
1557 GLIBCPP_INCLUDE_DIR='$(top_srcdir)/include'
1558
1559 # Can either use include/c or include/c_std to grab "C" headers. This
1560 # variable is set to the include directory currently in use.
1561 # set with C_INCLUDE_DIR in GLIBCPP_ENABLE_SHADOW
1562
9f935979
BK
1563 # Passed down for canadian crosses.
1564 if test x"$CANADIAN" = xyes; then
1565 TOPLEVEL_INCLUDES='-I$(includedir)'
1566 fi
e466dc8a
BK
1567
1568 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1569
1570 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1571
1572 #if GLIBCPP_NEED_LIBIO
1573 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1574 #else
1575 #LIBIO_INCLUDES='-I$(top_srcdir)/libio'
1576 #endif
1577
1578 #if GLIBCPP_USE_CSHADOW
1579 # CSHADOW_INCLUDES='-I$(GLIBCPP_INCLUDE_DIR)/std -I$(C_INCLUDE_DIR) \
1580 # -I$(top_blddir)/cshadow'
1581 #else
1582 CSHADOW_INCLUDES='-I$(GLIBCPP_INCLUDE_DIR)/std -I$(C_INCLUDE_DIR)'
1583 #endif
1584
1585 # Now, export this to all the little Makefiles....
1586 AC_SUBST(GLIBCPP_INCLUDE_DIR)
1587 AC_SUBST(TOPLEVEL_INCLUDES)
1588 AC_SUBST(LIBMATH_INCLUDES)
1589 AC_SUBST(LIBSUPCXX_INCLUDES)
1590 AC_SUBST(LIBIO_INCLUDES)
1591 AC_SUBST(CSHADOW_INCLUDES)
1592])
1593
1594
1595dnl
1596dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1597dnl
1598AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1599 # Optimization flags that are probably a good idea for thrill-seekers. Just
1600 # uncomment the lines below and make, everything else is ready to go...
1601 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1602 OPTIMIZE_CXXFLAGS=
1603 AC_SUBST(OPTIMIZE_CXXFLAGS)
1604
1605 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1606 AC_SUBST(WARN_FLAGS)
1607])
1608
b2dad0e3 1609
af9fe0d1
BK
1610# Check whether LC_MESSAGES is available in <locale.h>.
1611# Ulrich Drepper <drepper@cygnus.com>, 1995.
1612#
1613# This file file be copied and used freely without restrictions. It can
1614# be used in projects which are not available under the GNU Public License
1615# but which still want to provide support for the GNU gettext functionality.
1616# Please note that the actual code is *not* freely available.
1617
1618# serial 1
1619
1620AC_DEFUN(AC_LC_MESSAGES,
1621 [if test $ac_cv_header_locale_h = yes; then
1622 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1623 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1624 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1625 if test $ac_cv_val_LC_MESSAGES = yes; then
1626 AC_DEFINE(HAVE_LC_MESSAGES)
1627 fi
1628 fi])
1629
1630
1631# Check for functions in math library.
1632# Ulrich Drepper <drepper@cygnus.com>, 1998.
1633#
1634# This file can be copied and used freely without restrictions. It can
1635# be used in projects which are not available under the GNU Public License
1636# but which still want to provide support for the GNU gettext functionality.
1637# Please note that the actual code is *not* freely available.
1638
1639# serial 1
1640
1641dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1642AC_DEFUN(AC_REPLACE_MATHFUNCS,
1643[AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1644AC_SUBST(LIBMATHOBJS)dnl
1645])
1646
1647
1648# Check for string functions.
1649# Ulrich Drepper <drepper@cygnus.com>, 1998.
1650#
1651# This file can be copied and used freely without restrictions. It can
1652# be used in projects which are not available under the GNU Public License
1653# but which still want to provide support for the GNU gettext functionality.
1654# Please note that the actual code is *not* freely available.
1655
1656# serial 1
1657
1658dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1659AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1660[AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1661AC_SUBST(LIBSTRINGOBJS)dnl
1662])
b2dad0e3 1663
29bd52c8
PE
1664
1665dnl This macro searches for a GNU version of make. If a match is found, the
1666dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
99b51359 1667dnl set to "#". This is useful for including a special features in a Makefile,
29bd52c8
PE
1668dnl which cannot be handled by other versions of make. The variable
1669dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1670dnl the empty string otherwise.
1671dnl
1672dnl Here is an example of its use:
1673dnl
1674dnl Makefile.in might contain:
1675dnl
1676dnl # A failsafe way of putting a dependency rule into a makefile
1677dnl $(DEPEND):
1678dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1679dnl
1680dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1681dnl @ifGNUmake@ include $(DEPEND)
1682dnl @ifGNUmake@ endif
1683dnl
1684dnl Then configure.in would normally contain:
1685dnl
1686dnl CHECK_GNU_MAKE()
1687dnl AC_OUTPUT(Makefile)
1688dnl
1689dnl Then perhaps to cause gnu make to override any other make, we could do
1690dnl something like this (note that GNU make always looks for GNUmakefile first):
1691dnl
1692dnl if ! test x$_cv_gnu_make_command = x ; then
1693dnl mv Makefile GNUmakefile
1694dnl echo .DEFAULT: > Makefile ;
1695dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1696dnl fi
1697dnl
1698dnl Then, if any (well almost any) other make is called, and GNU make also
1699dnl exists, then the other make wraps the GNU make.
1700dnl
1701dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
421173e6 1702dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
29bd52c8
PE
1703dnl
1704dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1705dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
79f5e38e
BC
1706dnl #### conditional's subshell (" --version" is not a command), using a
1707dnl #### different option to grep(1).
29bd52c8
PE
1708dnl #### -pme
1709AC_DEFUN(
1710 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1711 _cv_gnu_make_command='' ;
1712dnl Search all the common names for GNU make
1713 for a in "${MAKE:-make}" make gmake gnumake ; do
626d8f0a 1714 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
79f5e38e 1715 then
29bd52c8
PE
1716 _cv_gnu_make_command=$a ;
1717 break;
1718 fi
1719 done ;
1720 ) ;
1721dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1722dnl string, '#' otherwise
1723 if test "x$_cv_gnu_make_command" != "x" ; then
1724 ifGNUmake='' ;
1725 else
1726 ifGNUmake='#' ;
1727 fi
1728 AC_SUBST(ifGNUmake)
1729])
1730
3df64633
AO
1731sinclude(../libtool.m4)
1732dnl The lines below arrange for aclocal not to bring an installed
1733dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1734dnl add a definition of LIBTOOL to Makefile.in.
1735ifelse(,,,[AC_SUBST(LIBTOOL)
1736AC_DEFUN([AM_PROG_LIBTOOL])
1737AC_DEFUN([AC_LIBTOOL_DLOPEN])
1738AC_DEFUN([AC_PROG_LD])
1739])
7f586614 1740
9a200b0a 1741
b2dad0e3
BK
1742# Do all the work for Automake. This macro actually does too much --
1743# some checks are only needed if your package does certain things.
1744# But this isn't really a big deal.
1745
1746# serial 1
1747
1748dnl Usage:
1749dnl AM_INIT_AUTOMAKE(package,version, [no-define])
1750
1751AC_DEFUN(AM_INIT_AUTOMAKE,
1752[AC_REQUIRE([AC_PROG_INSTALL])
1753PACKAGE=[$1]
1754AC_SUBST(PACKAGE)
1755VERSION=[$2]
1756AC_SUBST(VERSION)
1757dnl test to see if srcdir already configured
1758if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
1759 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1760fi
1761ifelse([$3],,
1762AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
1763AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
1764AC_REQUIRE([AM_SANITY_CHECK])
1765AC_REQUIRE([AC_ARG_PROGRAM])
1766dnl FIXME This is truly gross.
1767missing_dir=`cd $ac_aux_dir && pwd`
1768AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
1769AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
1770AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
1771AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
1772AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
1773AC_REQUIRE([AC_PROG_MAKE_SET])])
1774
1775#
1776# Check to make sure that the build environment is sane.
1777#
1778
1779AC_DEFUN(AM_SANITY_CHECK,
1780[AC_MSG_CHECKING([whether build environment is sane])
1781# Just in case
1782sleep 1
1783echo timestamp > conftestfile
1784# Do `set' in a subshell so we don't clobber the current shell's
1785# arguments. Must try -L first in case configure is actually a
1786# symlink; some systems play weird games with the mod time of symlinks
1787# (eg FreeBSD returns the mod time of the symlink's containing
1788# directory).
1789if (
1790 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
1791 if test "[$]*" = "X"; then
1792 # -L didn't work.
1793 set X `ls -t $srcdir/configure conftestfile`
1794 fi
1795 if test "[$]*" != "X $srcdir/configure conftestfile" \
1796 && test "[$]*" != "X conftestfile $srcdir/configure"; then
1797
1798 # If neither matched, then we have a broken ls. This can happen
1799 # if, for instance, CONFIG_SHELL is bash and it inherits a
1800 # broken ls alias from the environment. This has actually
1801 # happened. Such a system could not be considered "sane".
1802 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
1803alias in your environment])
1804 fi
1805
1806 test "[$]2" = conftestfile
1807 )
1808then
1809 # Ok.
1810 :
1811else
1812 AC_MSG_ERROR([newly created file is older than distributed files!
1813Check your system clock])
1814fi
1815rm -f conftest*
1816AC_MSG_RESULT(yes)])
1817
1818dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
1819dnl The program must properly implement --version.
1820AC_DEFUN(AM_MISSING_PROG,
1821[AC_MSG_CHECKING(for working $2)
1822# Run test in a subshell; some versions of sh will print an error if
1823# an executable is not found, even if stderr is redirected.
1824# Redirect stdin to placate older versions of autoconf. Sigh.
1825if ($2 --version) < /dev/null > /dev/null 2>&1; then
1826 $1=$2
1827 AC_MSG_RESULT(found)
1828else
1829 $1="$3/missing $2"
1830 AC_MSG_RESULT(missing)
1831fi
1832AC_SUBST($1)])
1833
1834# Add --enable-maintainer-mode option to configure.
1835# From Jim Meyering
1836
1837# serial 1
1838
1839AC_DEFUN(AM_MAINTAINER_MODE,
1840[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1841 dnl maintainer-mode is disabled by default
1842 AC_ARG_ENABLE(maintainer-mode,
1843[ --enable-maintainer-mode enable make rules and dependencies not useful
1844 (and sometimes confusing) to the casual installer],
1845 USE_MAINTAINER_MODE=$enableval,
1846 USE_MAINTAINER_MODE=no)
1847 AC_MSG_RESULT($USE_MAINTAINER_MODE)
1848 AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
1849 MAINT=$MAINTAINER_MODE_TRUE
1850 AC_SUBST(MAINT)dnl
1851]
1852)
1853
1854# Define a conditional.
1855
1856AC_DEFUN(AM_CONDITIONAL,
1857[AC_SUBST($1_TRUE)
1858AC_SUBST($1_FALSE)
1859if $2; then
1860 $1_TRUE=
1861 $1_FALSE='#'
1862else
1863 $1_TRUE='#'
1864 $1_FALSE=
1865fi])
1866
b2dad0e3
BK
1867# Like AC_CONFIG_HEADER, but automatically create stamp file.
1868
1869AC_DEFUN(AM_CONFIG_HEADER,
1870[AC_PREREQ([2.12])
1871AC_CONFIG_HEADER([$1])
1872dnl When config.status generates a header, we must update the stamp-h file.
1873dnl This file resides in the same directory as the config header
1874dnl that is generated. We must strip everything past the first ":",
1875dnl and everything past the last "/".
1876AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
1877ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
1878<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
1879<<am_indx=1
1880for am_file in <<$1>>; do
1881 case " <<$>>CONFIG_HEADERS " in
1882 *" <<$>>am_file "*<<)>>
1883 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
1884 ;;
1885 esac
1886 am_indx=`expr "<<$>>am_indx" + 1`
1887done<<>>dnl>>)
1888changequote([,]))])
1889