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