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