]> gcc.gnu.org Git - gcc.git/blame - libstdc++-v3/aclocal.m4
ia64.c (ia64_register_move_cost): Add mode arguemnt.
[gcc.git] / libstdc++-v3 / aclocal.m4
CommitLineData
b2dad0e3
BK
1dnl aclocal.m4 generated automatically by aclocal 1.4
2
e7140677 3dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
b2dad0e3
BK
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13dnl
14dnl Initialize configure bits.
15dnl
b2dad0e3
BK
16dnl GLIBCPP_CONFIGURE
17AC_DEFUN(GLIBCPP_CONFIGURE, [
18 dnl Default to --enable-multilib
19 AC_ARG_ENABLE(multilib,
20 [ --enable-multilib build hella library versions (default)],
21 [case "${enableval}" in
22 yes) multilib=yes ;;
23 no) multilib=no ;;
24 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
25 esac], [multilib=yes])dnl
26
33590f13
BK
27# When building with srcdir == objdir, links to the source files will
28# be created in directories within the target_subdir. We have to
29# adjust toplevel_srcdir accordingly, so that configure finds
30# install-sh and other auxiliary files that live in the top-level
31# source directory.
32if test "${srcdir}" = "."; then
33 if test -z "${with_target_subdir}"; then
34 toprel=".."
35 else
36 if test "${with_target_subdir}" != "."; then
37 toprel="${with_multisrctop}../.."
38 else
39 toprel="${with_multisrctop}.."
40 fi
41 fi
42else
43 toprel=".."
44fi
45AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
46toplevel_srcdir=\${top_srcdir}/$toprel
47AC_SUBST(toplevel_srcdir)
48
49# Export build and source directories.
50# These need to be absolute paths, yet at the same time need to
51# canonicalize only relative paths, because then amd will not unmount
52# drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
53glibcpp_builddir=`pwd`
54case $srcdir in
55[\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
56*) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
57esac
58AC_SUBST(glibcpp_builddir)
59AC_SUBST(glibcpp_srcdir)
60
61dnl This is here just to satisfy automake.
62ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)])
63
64# Will set LN_S to either 'ln -s' or 'ln'. With autoconf 2.50+, can also
65# be 'cp -p' if linking isn't available.
66#ac_cv_prog_LN_S='cp -p'
67AC_PROG_LN_S
68
69# We use these options to decide which functions to include.
70AC_ARG_WITH(target-subdir,
71[ --with-target-subdir=SUBDIR
72 configuring in a subdirectory])
73AC_ARG_WITH(cross-host,
74[ --with-cross-host=HOST configuring with a cross compiler])
75
1de9b822 76 glibcpp_basedir=$srcdir/$toprel/$1/libstdc++-v3
b2dad0e3
BK
77 AC_SUBST(glibcpp_basedir)
78
28861379
BK
79 # Never versions of autoconf add an underscore to these functions.
80 # Prevent future problems ...
81 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
82 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
83 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
84 ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
5780a46b
BK
85
86# AC_PROG_CC
87
b2dad0e3
BK
88# FIXME: We temporarily define our own version of AC_PROG_CC. This is
89# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
90# are probably using a cross compiler, which will not be able to fully
91# link an executable. This should really be fixed in autoconf
92# itself.
93
94AC_DEFUN(LIB_AC_PROG_CC,
95[AC_BEFORE([$0], [AC_PROG_CPP])dnl
96dnl Fool anybody using AC_PROG_CC.
97AC_PROVIDE([AC_PROG_CC])
98AC_CHECK_PROG(CC, gcc, gcc)
99if test -z "$CC"; then
100 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
101 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
102fi
103
104AC_PROG_CC_GNU
105
106if test $ac_cv_prog_gcc = yes; then
107 GCC=yes
108dnl Check whether -g works, even if CFLAGS is set, in case the package
109dnl plays around with CFLAGS (such as to build both debugging and
110dnl normal versions of a library), tasteless as that idea is.
111 ac_test_CFLAGS="${CFLAGS+set}"
112 ac_save_CFLAGS="$CFLAGS"
113 CFLAGS=
114 AC_PROG_CC_G
115 if test "$ac_test_CFLAGS" = set; then
116 CFLAGS="$ac_save_CFLAGS"
117 elif test $ac_cv_prog_cc_g = yes; then
118 CFLAGS="-g -O2"
119 else
120 CFLAGS="-O2"
121 fi
122else
123 GCC=
124 test "${CFLAGS+set}" = set || CFLAGS="-g"
125fi
126])
127
128LIB_AC_PROG_CC
129
5780a46b
BK
130# Can't just call these here as g++ requires libstc++ to be built....
131# AC_PROG_CXX
132
b2dad0e3
BK
133# Likewise for AC_PROG_CXX.
134AC_DEFUN(LIB_AC_PROG_CXX,
135[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
136dnl Fool anybody using AC_PROG_CXX.
137AC_PROVIDE([AC_PROG_CXX])
46840bcd 138# Use glibcpp_CXX so that we do not cause CXX to be cached with the
de9aefe0 139# flags that come in CXX while configuring libstdc++. They're different
bb4127f8
MM
140# from those used for all other target libraries. If CXX is set in
141# the environment, respect that here.
46840bcd
BK
142glibcpp_CXX=$CXX
143AC_CHECK_PROGS(glibcpp_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
144AC_SUBST(glibcpp_CXX)
337187ff 145CXX=$glibcpp_CXX
46840bcd 146test -z "$glibcpp_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
b2dad0e3
BK
147
148AC_PROG_CXX_GNU
149
150if test $ac_cv_prog_gxx = yes; then
151 GXX=yes
152dnl Check whether -g works, even if CXXFLAGS is set, in case the package
153dnl plays around with CXXFLAGS (such as to build both debugging and
154dnl normal versions of a library), tasteless as that idea is.
155 ac_test_CXXFLAGS="${CXXFLAGS+set}"
156 ac_save_CXXFLAGS="$CXXFLAGS"
157 CXXFLAGS=
158 AC_PROG_CXX_G
159 if test "$ac_test_CXXFLAGS" = set; then
160 CXXFLAGS="$ac_save_CXXFLAGS"
161 elif test $ac_cv_prog_cxx_g = yes; then
162 CXXFLAGS="-g -O2"
163 else
164 CXXFLAGS="-O2"
165 fi
166else
167 GXX=
168 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
169fi
170])
171
172LIB_AC_PROG_CXX
173
33590f13
BK
174 # For some reason, gettext needs this.
175 AC_ISC_POSIX
176
5780a46b
BK
177 AC_CHECK_TOOL(AS, as)
178 AC_CHECK_TOOL(AR, ar)
46840bcd 179 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
5780a46b 180 AC_PROG_INSTALL
b2dad0e3 181
5780a46b 182 AM_MAINTAINER_MODE
b2dad0e3 183
5780a46b
BK
184 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
185 # at least currently, we never actually build a program, so we never
186 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
187 # fails, because we are probably configuring with a cross compiler
188 # which cant create executables. So we include AC_EXEEXT to keep
189 # automake happy, but we dont execute it, since we dont care about
190 # the result.
191 if false; then
61c71946
BK
192 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
193 # to nothing, so nothing would remain between `then' and `fi' if it
194 # were not for the `:' below.
195 :
5780a46b
BK
196 AC_EXEEXT
197 fi
b2dad0e3 198
5780a46b
BK
199 . [$]{glibcpp_basedir}/configure.host
200
201 case [$]{glibcpp_basedir} in
6f87af20 202 /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
5780a46b
BK
203 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
204 esac
b2dad0e3 205
d0941a31 206 # This does for the target what configure.host does for the host. In
5e3cbe0b 207 # addition to possibly modifying the same flags, it also sets up symlinks.
d0941a31 208 GLIBCPP_CHECK_TARGET
33590f13
BK
209
210 #
b2dad0e3
BK
211])
212
213
214dnl
8bd636c5 215dnl Check to see if g++ can compile this library, and if so, if any version-
c470c17d
BK
216dnl specific precautions need to be taken.
217dnl
218dnl GLIBCPP_CHECK_COMPILER_VERSION
219AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
44382959
BK
220if test ! -f stamp-sanity-compiler; then
221 AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3])
222 AC_LANG_SAVE
223 AC_LANG_CPLUSPLUS
1d855e87
BK
224 AC_TRY_COMPILE(, [
225 #if __GNUC__ < 3
226 not_ok
c470c17d 227 #endif
6a163d7c 228 ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to GCC 3.0 or above]))
44382959 229 AC_LANG_RESTORE
c470c17d 230 AC_MSG_RESULT($gpp_satisfactory)
44382959
BK
231 touch stamp-sanity-compiler
232fi
c470c17d
BK
233])
234
235
236dnl
52b55e7d
PE
237dnl Tests for newer compiler features, or features that are present in newer
238dnl compiler versions but not older compiler versions still in use, should
239dnl be placed here.
b2dad0e3 240dnl
7f586614
BK
241dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
242dnl new inlining code or the new system_header pragma will die on -Werror.
243dnl Leave it out by default and use maint-mode to use it.
b2dad0e3 244dnl
c470c17d 245dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
c21b6f87
PE
246dnl compiler supports it and the user has not requested debug mode.
247dnl
c470c17d
BK
248dnl GLIBCPP_CHECK_COMPILER_FEATURES
249AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
a4e99046 250 # All these tests are for C++; save the language and the compiler flags.
52b55e7d 251 # The CXXFLAGS thing is suspicious, but based on similar bits previously
a4e99046
PE
252 # found in GLIBCPP_CONFIGURE.
253 AC_LANG_SAVE
254 AC_LANG_CPLUSPLUS
255 ac_test_CXXFLAGS="${CXXFLAGS+set}"
256 ac_save_CXXFLAGS="$CXXFLAGS"
a4e99046 257
7f586614
BK
258 # Check for maintainer-mode bits.
259 if test x"$USE_MAINTAINER_MODE" = xno; then
260 WERROR=''
8bd636c5 261 else
7f586614 262 WERROR='-Werror'
8bd636c5
PE
263 fi
264
c470c17d
BK
265 # Check for -ffunction-sections -fdata-sections
266 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
0517cb99 267 CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
c470c17d
BK
268 AC_TRY_COMPILE(, [int foo;
269 ], [ac_fdsections=yes], [ac_fdsections=no])
270 if test "$ac_test_CXXFLAGS" = set; then
271 CXXFLAGS="$ac_save_CXXFLAGS"
272 else
273 # this is the suspicious part
274 CXXFLAGS=''
275 fi
a0cb1aa7
PE
276 if test x"$ac_fdsections" = x"yes" &&
277 test x"$enable_debug" = x"no"; then
c470c17d
BK
278 SECTION_FLAGS='-ffunction-sections -fdata-sections'
279 fi
280 AC_MSG_RESULT($ac_fdsections)
281
a4e99046 282 AC_LANG_RESTORE
8bd636c5 283 AC_SUBST(WERROR)
c470c17d 284 AC_SUBST(SECTION_FLAGS)
b2dad0e3
BK
285])
286
c470c17d
BK
287
288dnl
421173e6
PE
289dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
290dnl the native linker is in use, all variables will be defined to something
291dnl safe (like an empty string).
292dnl
293dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
294dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
c470c17d 295dnl
c470c17d
BK
296dnl GLIBCPP_CHECK_LINKER_FEATURES
297AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
421173e6
PE
298 # If we're not using GNU ld, then there's no point in even trying these
299 # tests. Check for that first. We should have already tested for gld
300 # by now (in libtool), but require it now just to be safe...
a9117427
BK
301 SECTION_LDFLAGS=''
302 OPT_LDFLAGS=''
421173e6 303 AC_REQUIRE([AC_PROG_LD])
e7140677
BK
304
305 # Set --gc-sections.
f4c79fef 306 if test "$ac_cv_prog_gnu_ld" = "notbroken"; then
a9117427 307 # GNU ld it is! Joy and bunny rabbits!
421173e6
PE
308
309 # All these tests are for C++; save the language and the compiler flags.
310 # Need to do this so that g++ won't try to link in libstdc++
311 ac_test_CFLAGS="${CFLAGS+set}"
312 ac_save_CFLAGS="$CFLAGS"
e7140677 313 CFLAGS='-x c++ -Wl,--gc-sections'
421173e6
PE
314
315 # Check for -Wl,--gc-sections
e466dc8a
BK
316 # XXX This test is broken at the moment, as symbols required for
317 # linking are now in libsupc++ (not built yet.....). In addition,
a9117427
BK
318 # this test has cored on solaris in the past. In addition,
319 # --gc-sections doesn't really work at the moment (keeps on discarding
320 # used sections, first .eh_frame and now some of the glibc sections for
321 # iconv). Bzzzzt. Thanks for playing, maybe next time.
421173e6
PE
322 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
323 AC_TRY_RUN([
324 int main(void)
325 {
a9117427
BK
326 try { throw 1; }
327 catch (...) { };
421173e6
PE
328 return 0;
329 }
e466dc8a 330 ], [ac_sectionLDflags=yes],[ac_sectionLFflags=no], [ac_sectionLDflags=yes])
421173e6
PE
331 if test "$ac_test_CFLAGS" = set; then
332 CFLAGS="$ac_save_CFLAGS"
333 else
334 # this is the suspicious part
335 CFLAGS=''
336 fi
337 if test "$ac_sectionLDflags" = "yes"; then
e7140677 338 SECTION_LDFLAGS='-Wl,--gc-sections'
421173e6
PE
339 fi
340 AC_MSG_RESULT($ac_sectionLDflags)
e7140677 341 fi
a9117427 342
e7140677 343 # Set linker optimization flags.
a0cb1aa7
PE
344 if test x"$ac_cv_prog_gnu_ld" = x"yes" &&
345 test x"$enable_debug" = x"no"; then
421173e6 346 OPT_LDFLAGS='-Wl,-O1'
421173e6 347 fi
e7140677 348
c470c17d 349 AC_SUBST(SECTION_LDFLAGS)
421173e6 350 AC_SUBST(OPT_LDFLAGS)
c470c17d
BK
351])
352
353
b2dad0e3 354dnl
11fc1858 355dnl Check to see if the (math function) argument passed is
f8db4f20 356dnl declared when using the c++ compiler
38bd7296
BK
357dnl ASSUMES argument is a math function with ONE parameter
358dnl
f8db4f20
BK
359dnl GLIBCPP_CHECK_MATH_DECL_1
360AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [
38bd7296 361 AC_MSG_CHECKING([for $1 declaration])
f84ef7fb
PE
362 if test x${glibcpp_cv_func_$1_use+set} != xset; then
363 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
364 AC_LANG_SAVE
365 AC_LANG_CPLUSPLUS
01a49191
RB
366 AC_TRY_COMPILE([#include <math.h>
367 #ifdef HAVE_IEEEFP_H
368 #include <ieeefp.h>
369 #endif
370 ],
f84ef7fb
PE
371 [ $1(0);],
372 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
373 AC_LANG_RESTORE
374 ])
375 fi
421173e6 376 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
f8db4f20
BK
377])
378
379dnl
380dnl Check to see if the (math function) argument passed is
381dnl 1) declared when using the c++ compiler
382dnl 2) has "C" linkage
383dnl 3) if not, see if 1) and 2) for argument prepended with '_'
384dnl
385dnl Define HAVE_CARGF etc if "cargf" is declared and links
386dnl
387dnl argument 1 is name of function to check
388dnl
389dnl ASSUMES argument is a math function with ONE parameter
390dnl
391dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
392AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
393 GLIBCPP_CHECK_MATH_DECL_1($1)
421173e6 394 if test x$glibcpp_cv_func_$1_use = x"yes"; then
38bd7296 395 AC_CHECK_FUNCS($1)
f8db4f20
BK
396 else
397 GLIBCPP_CHECK_MATH_DECL_1(_$1)
398 if test x$glibcpp_cv_func__$1_use = x"yes"; then
399 AC_CHECK_FUNCS(_$1)
a0cb1aa7 400 fi
38bd7296
BK
401 fi
402])
403
f8db4f20 404
20b11783
MM
405dnl
406dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
407dnl of functions at once. It's an all-or-nothing check -- either
9b8fd32c 408dnl HAVE_XYZ is defined for each of the functions, or for none of them.
20b11783
MM
409dnl Doing it this way saves significant configure time.
410AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [
411 AC_MSG_CHECKING([for $1 functions])
412 AC_CACHE_VAL(glibcpp_cv_func_$2_use, [
413 AC_LANG_SAVE
414 AC_LANG_CPLUSPLUS
415 AC_TRY_COMPILE([#include <math.h>],
416 [ `for x in $3; do echo "$x (0);"; done` ],
9b8fd32c
PE
417 [glibcpp_cv_func_$2_use=yes],
418 [glibcpp_cv_func_$2_use=no])
20b11783
MM
419 AC_LANG_RESTORE])
420 AC_MSG_RESULT($glibcpp_cv_func_$2_use)
421 if test x$glibcpp_cv_func_$2_use = x"yes"; then
422 AC_CHECK_FUNCS($3)
423 fi
424])
38bd7296
BK
425
426dnl
11fc1858 427dnl Check to see if the (math function) argument passed is
f8db4f20 428dnl declared when using the c++ compiler
52b55e7d 429dnl ASSUMES argument is a math function with TWO parameters
38bd7296 430dnl
f8db4f20
BK
431dnl GLIBCPP_CHECK_MATH_DECL_2
432AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [
38bd7296 433 AC_MSG_CHECKING([for $1 declaration])
f84ef7fb
PE
434 if test x${glibcpp_cv_func_$1_use+set} != xset; then
435 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
436 AC_LANG_SAVE
437 AC_LANG_CPLUSPLUS
438 AC_TRY_COMPILE([#include <math.h>],
439 [ $1(0, 0);],
440 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
441 AC_LANG_RESTORE
442 ])
443 fi
421173e6 444 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
38bd7296
BK
445])
446
38bd7296 447dnl
11fc1858 448dnl Check to see if the (math function) argument passed is
38bd7296
BK
449dnl 1) declared when using the c++ compiler
450dnl 2) has "C" linkage
451dnl
452dnl Define HAVE_CARGF etc if "cargf" is declared and links
453dnl
454dnl argument 1 is name of function to check
455dnl
f8db4f20 456dnl ASSUMES argument is a math function with TWO parameters
38bd7296 457dnl
f8db4f20
BK
458dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
459AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
460 GLIBCPP_CHECK_MATH_DECL_2($1)
461 if test x$glibcpp_cv_func_$1_use = x"yes"; then
462 AC_CHECK_FUNCS($1)
463 else
464 GLIBCPP_CHECK_MATH_DECL_2(_$1)
465 if test x$glibcpp_cv_func__$1_use = x"yes"; then
466 AC_CHECK_FUNCS(_$1)
a0cb1aa7 467 fi
f8db4f20
BK
468 fi
469])
470
471
472dnl
473dnl Check to see if the (math function) argument passed is
474dnl declared when using the c++ compiler
52b55e7d 475dnl ASSUMES argument is a math function with THREE parameters
f8db4f20
BK
476dnl
477dnl GLIBCPP_CHECK_MATH_DECL_3
478AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [
38bd7296 479 AC_MSG_CHECKING([for $1 declaration])
f84ef7fb
PE
480 if test x${glibcpp_cv_func_$1_use+set} != xset; then
481 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
482 AC_LANG_SAVE
483 AC_LANG_CPLUSPLUS
484 AC_TRY_COMPILE([#include <math.h>],
485 [ $1(0, 0, 0);],
486 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
487 AC_LANG_RESTORE
488 ])
489 fi
421173e6 490 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
f8db4f20
BK
491])
492
493dnl
494dnl Check to see if the (math function) argument passed is
495dnl 1) declared when using the c++ compiler
496dnl 2) has "C" linkage
497dnl
498dnl Define HAVE_CARGF etc if "cargf" is declared and links
499dnl
500dnl argument 1 is name of function to check
501dnl
502dnl ASSUMES argument is a math function with THREE parameters
503dnl
504dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
505AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
506 GLIBCPP_CHECK_MATH_DECL_3($1)
421173e6 507 if test x$glibcpp_cv_func_$1_use = x"yes"; then
38bd7296 508 AC_CHECK_FUNCS($1)
f8db4f20
BK
509 else
510 GLIBCPP_CHECK_MATH_DECL_3(_$1)
511 if test x$glibcpp_cv_func__$1_use = x"yes"; then
512 AC_CHECK_FUNCS(_$1)
a0cb1aa7 513 fi
38bd7296
BK
514 fi
515])
516
517
e7140677
BK
518dnl
519dnl Check to see if the (stdlib function) argument passed is
520dnl 1) declared when using the c++ compiler
521dnl 2) has "C" linkage
522dnl
e7140677
BK
523dnl argument 1 is name of function to check
524dnl
525dnl ASSUMES argument is a math function with TWO parameters
526dnl
527dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
528AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
529 AC_MSG_CHECKING([for $1 declaration])
f84ef7fb
PE
530 if test x${glibcpp_cv_func_$1_use+set} != xset; then
531 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
532 AC_LANG_SAVE
533 AC_LANG_CPLUSPLUS
534 AC_TRY_COMPILE([#include <stdlib.h>],
535 [ $1(0, 0);],
536 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
537 AC_LANG_RESTORE
538 ])
539 fi
e7140677
BK
540 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
541 if test x$glibcpp_cv_func_$1_use = x"yes"; then
542 AC_CHECK_FUNCS($1)
543 fi
544])
545
546
11fc1858
BK
547dnl
548dnl Because the builtins are picky picky picky about the arguments they take,
549dnl do an explict linkage tests here.
550dnl Check to see if the (math function) argument passed is
551dnl 1) declared when using the c++ compiler
552dnl 2) has "C" linkage
553dnl
554dnl Define HAVE_CARGF etc if "cargf" is declared and links
555dnl
556dnl argument 1 is name of function to check
557dnl
558dnl ASSUMES argument is a math function with ONE parameter
559dnl
560dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
561AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
11fc1858 562 AC_MSG_CHECKING([for $1 declaration])
f84ef7fb
PE
563 if test x${glibcpp_cv_func_$1_use+set} != xset; then
564 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
565 AC_LANG_SAVE
566 AC_LANG_CPLUSPLUS
567 AC_TRY_COMPILE([#include <math.h>],
568 [ $1(0);],
569 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
570 AC_LANG_RESTORE
571 ])
572 fi
421173e6
PE
573 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
574 if test x$glibcpp_cv_func_$1_use = x"yes"; then
11fc1858 575 AC_MSG_CHECKING([for $1 linkage])
f84ef7fb
PE
576 if test x${glibcpp_cv_func_$1_link+set} != xset; then
577 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
578 AC_TRY_LINK([#include <math.h>],
579 [ $1(0);],
580 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
581 ])
582 fi
421173e6
PE
583 AC_MSG_RESULT($glibcpp_cv_func_$1_link)
584 if test x$glibcpp_cv_func_$1_link = x"yes"; then
11fc1858
BK
585 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
586 AC_DEFINE_UNQUOTED(${ac_tr_func})
587 fi
588 fi
589])
590
591
592dnl
593dnl Check to see what builtin math functions are supported
594dnl
595dnl check for __builtin_abs
596dnl check for __builtin_fabsf
597dnl check for __builtin_fabs
598dnl check for __builtin_fabl
599dnl check for __builtin_labs
600dnl check for __builtin_sqrtf
601dnl check for __builtin_sqrtl
602dnl check for __builtin_fsqrt
603dnl check for __builtin_sinf
604dnl check for __builtin_sin
605dnl check for __builtin_sinl
606dnl check for __builtin_cosf
607dnl check for __builtin_cos
608dnl check for __builtin_cosl
609dnl
610dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
611AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
612 dnl Test for builtin math functions.
613 dnl These are made in gcc/c-common.c
614 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
615 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
616 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
617 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
618 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
619
620 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
621 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fsqrt)
622 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
623
624 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
625 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
626 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
627
628 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
629 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
630 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
631
632 dnl There is, without a doubt, a more elegant way to have these
633 dnl names exported so that they won't be stripped out of acconfig.h by
634 dnl autoheader. I leave this as an exercise to somebody less frustrated
635 dnl than I.... please email the libstdc++ list if you can figure out a
636 dnl more elegant approach (see autoconf/acgen.m4 and specifically
637 dnl AC_CHECK_FUNC for things to steal.)
638 dummyvar=no
639 if test x$dummyvar = x"yes"; then
640 AC_DEFINE(HAVE___BUILTIN_ABS)
641 AC_DEFINE(HAVE___BUILTIN_LABS)
642 AC_DEFINE(HAVE___BUILTIN_COS)
643 AC_DEFINE(HAVE___BUILTIN_COSF)
644 AC_DEFINE(HAVE___BUILTIN_COSL)
645 AC_DEFINE(HAVE___BUILTIN_FABS)
646 AC_DEFINE(HAVE___BUILTIN_FABSF)
647 AC_DEFINE(HAVE___BUILTIN_FABSL)
648 AC_DEFINE(HAVE___BUILTIN_SIN)
649 AC_DEFINE(HAVE___BUILTIN_SINF)
650 AC_DEFINE(HAVE___BUILTIN_SINL)
651 AC_DEFINE(HAVE___BUILTIN_FSQRT)
652 AC_DEFINE(HAVE___BUILTIN_SQRTF)
653 AC_DEFINE(HAVE___BUILTIN_SQRTL)
654 fi
655])
656
657
e7140677
BK
658dnl
659dnl Check to see what the underlying c library
660dnl These checks need to do two things:
661dnl 1) make sure the name is declared when using the c++ compiler
662dnl 2) make sure the name has "C" linkage
663dnl This might seem like overkill but experience has shown that it's not...
664dnl
7cda84dc
BK
665dnl Define HAVE_STRTOLD if "strtold" is declared and links
666dnl Define HAVE_STRTOF if "strtof" is declared and links
667dnl Define HAVE_DRAND48 if "drand48" is declared and links
e7140677
BK
668dnl
669dnl GLIBCPP_CHECK_STDLIB_SUPPORT
670AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
671 ac_test_CXXFLAGS="${CXXFLAGS+set}"
672 ac_save_CXXFLAGS="$CXXFLAGS"
673 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
674
e7140677 675 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
7cda84dc 676 AC_CHECK_FUNCS(drand48)
e7140677
BK
677
678 CXXFLAGS="$ac_save_CXXFLAGS"
679])
680
681
2f103494
BK
682dnl
683dnl Check to see what the underlying c library or math library is like.
38bd7296
BK
684dnl These checks need to do two things:
685dnl 1) make sure the name is declared when using the c++ compiler
686dnl 2) make sure the name has "C" linkage
687dnl This might seem like overkill but experience has shown that it's not...
2f103494
BK
688dnl
689dnl Define HAVE_CARGF etc if "cargf" is found.
690dnl
691dnl GLIBCPP_CHECK_MATH_SUPPORT
692AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
38bd7296
BK
693 ac_test_CXXFLAGS="${CXXFLAGS+set}"
694 ac_save_CXXFLAGS="$CXXFLAGS"
4f76382d 695 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
aac350aa
BK
696
697 dnl Check libm
2f103494 698 AC_CHECK_LIB(m, sin, libm="-lm")
38bd7296 699 ac_save_LIBS="$LIBS"
2f103494
BK
700 LIBS="$LIBS $libm"
701
38bd7296
BK
702 dnl Check to see if certain C math functions exist.
703 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
704 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
705 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
706 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
707 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
708 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
709 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
d38cd8ae 710 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypot)
38bd7296
BK
711
712 dnl Check to see if basic C math functions have float versions.
20b11783 713 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig,
9b8fd32c
PE
714 float_trig,
715 acosf asinf atanf \
20b11783 716 cosf sinf tanf \
9b8fd32c 717 coshf sinhf tanhf)
20b11783 718 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
9b8fd32c 719 float_round,
20b11783 720 ceilf floorf)
38bd7296
BK
721 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
722 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
d38cd8ae 723 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
38bd7296 724 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
38bd7296
BK
725 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
726 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
d38cd8ae 727 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf)
38bd7296
BK
728 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
729 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
730 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
731 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
732 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
38bd7296 733 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
38bd7296
BK
734 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
735 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
736
737 dnl Check to see if basic C math functions have long double versions.
20b11783 738 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig,
9b8fd32c
PE
739 long_double_trig,
740 acosl asinl atanl \
20b11783 741 cosl sinl tanl \
9b8fd32c 742 coshl sinhl tanhl)
20b11783 743 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round,
9b8fd32c 744 long_double_round,
20b11783 745 ceill floorl)
38bd7296
BK
746 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
747 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
11fc1858 748 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
38bd7296 749 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
38bd7296
BK
750 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
751 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
38bd7296
BK
752 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
753 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
d38cd8ae 754 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl)
38bd7296
BK
755 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
756 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
757 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
758 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
759 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
38bd7296 760 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
38bd7296
BK
761 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
762 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
763
764 dnl Some runtimes have these functions with a preceding underscore. Please
765 dnl keep this sync'd with the one above. And if you add any new symbol,
766 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
767 dnl Check to see if certain C math functions exist.
38bd7296
BK
768
769 dnl Check to see if basic C math functions have float versions.
20b11783 770 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
9b8fd32c
PE
771 _float_trig,
772 _acosf _asinf _atanf \
20b11783 773 _cosf _sinf _tanf \
9b8fd32c 774 _coshf _sinhf _tanhf)
20b11783 775 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
9b8fd32c 776 _float_round,
20b11783 777 _ceilf _floorf)
38bd7296
BK
778
779 dnl Check to see if basic C math functions have long double versions.
20b11783 780 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
9b8fd32c
PE
781 _long_double_trig,
782 _acosl _asinl _atanl \
20b11783 783 _cosl _sinl _tanl \
9b8fd32c 784 _coshl _sinhl _tanhl)
20b11783 785 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
9b8fd32c 786 _long_double_round,
20b11783 787 _ceill _floorl)
38bd7296
BK
788
789 LIBS="$ac_save_LIBS"
790 CXXFLAGS="$ac_save_CXXFLAGS"
2f103494
BK
791])
792
793
794dnl
795dnl Check to see if there is native support for complex
796dnl
797dnl Don't compile bits in math/* if native support exits.
798dnl
d38cd8ae 799dnl Define USE_COMPLEX_LONG_DOUBLE etc if "copysignl" is found.
2f103494
BK
800dnl
801dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
802AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
803 dnl Check for complex versions of math functions of platform.
b4b2a487 804 AC_CHECK_LIB(m, main)
d38cd8ae 805 AC_REPLACE_MATHFUNCS(nan copysignf)
11fc1858
BK
806
807 dnl Compile the long double complex functions only if the function
808 dnl provides the non-complex long double functions that are needed.
d38cd8ae 809 dnl Currently this includes copysignl, which should be
11fc1858
BK
810 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
811 USE_COMPLEX_LONG_DOUBLE=no
d38cd8ae 812 if test x$ac_cv_func_copysignl = x"yes"; then
11fc1858 813 USE_COMPLEX_LONG_DOUBLE=yes
d38cd8ae 814 AC_REPLACE_MATHFUNCS(signbitl)
11fc1858
BK
815 fi
816
2f103494
BK
817 AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
818])
819
54fa7415 820
d0941a31
PE
821dnl Check to see what architecture and operating system we are compiling
822dnl for. Also, if architecture- or OS-specific flags are required for
823dnl compilation, pick them up here.
e974e9cc 824dnl
d0941a31
PE
825dnl GLIBCPP_CHECK_TARGET
826AC_DEFUN(GLIBCPP_CHECK_TARGET, [
827 . [$]{glibcpp_basedir}/configure.target
828 AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
829 AC_MSG_RESULT(OS config directory is $os_include_dir)
e974e9cc
BK
830])
831
832
b2dad0e3
BK
833dnl
834dnl Check to see if this target can enable the wchar_t parts of libstdc++.
8b8ab21c
BK
835dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
836dnl must have been previously checked.)
b2dad0e3
BK
837dnl
838dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
7b331228 839dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h
b2dad0e3
BK
840dnl
841dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
842AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
7b331228
BK
843
844 dnl Test wchar.h for mbstate_t, which is needed for char_traits and
845 dnl others even if wchar_t support is not on.
846 AC_MSG_CHECKING([for mbstate_t])
847 AC_TRY_COMPILE([#include <wchar.h>],
848 [mbstate_t teststate;],
849 have_mbstate_t=yes, have_mbstate_t=no)
850 AC_MSG_RESULT($have_mbstate_t)
851 if test x"$have_mbstate_t" = xyes; then
852 AC_DEFINE(HAVE_MBSTATE_T)
853 fi
854
855 dnl Sanity check for existence of ISO C99 headers for extended encoding.
856 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
857 AC_CHECK_HEADER(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
b2dad0e3 858
7b331228 859 dnl Only continue checking if the ISO C99 headers exist and support is on.
a0cb1aa7
PE
860 if test x"$ac_has_wchar_h" = xyes &&
861 test x"$ac_has_wctype_h" = xyes &&
862 test x"$enable_c_mbchar" != xno; then
7b331228
BK
863
864 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
865 dnl numeric_limits can instantiate type_traits<wchar_t>
866 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
867 AC_TRY_COMPILE([#include <wchar.h>],
868 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
869 has_wchar_minmax=yes, has_wchar_minmax=no)
870 AC_MSG_RESULT($has_wchar_minmax)
8b8ab21c 871
7b331228
BK
872 dnl Test wchar.h for WEOF, which is what we use to determine whether
873 dnl to specialize for char_traits<wchar_t> or not.
874 AC_MSG_CHECKING([for WEOF])
875 AC_TRY_COMPILE([
876 #include <wchar.h>
877 #include <stddef.h>],
878 [wint_t i = WEOF;],
879 has_weof=yes, has_weof=no)
880 AC_MSG_RESULT($has_weof)
8b8ab21c 881
7b331228 882 dnl Tests for wide character functions used in char_traits<wchar_t>.
68fe6226
BK
883 ac_wfuncs=yes
884 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset,, \
885 ac_wfuncs=no)
8b8ab21c 886
68fe6226
BK
887 dnl Checks for names injected into std:: by the c_std headers.
888 AC_CHECK_FUNCS(btowc wctob fgetwc fgetwc fgetws fputwc fputws fwide \
889 fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
890 vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
891 mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
892 wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
893 wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \
894 ac_wfuncs=no)
df7b1359 895
7b331228 896 AC_MSG_CHECKING([for ISO C99 wchar_t support])
a0cb1aa7
PE
897 if test x"$has_weof" = xyes &&
898 test x"$has_wchar_minmax" = xyes &&
899 test x"$ac_wfuncs" = xyes; then
7b331228
BK
900 ac_isoC99_wchar_t=yes
901 else
902 ac_isoC99_wchar_t=no
903 fi
904 AC_MSG_RESULT($ac_isoC99_wchar_t)
8b8ab21c 905
7b331228
BK
906 dnl Use iconv for wchar_t to char conversions. As such, check for
907 dnl X/Open Portability Guide, version 2 features (XPG2).
908 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
909 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
910
911 dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
912 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
913 ac_save_LIBS="$LIBS"
914 LIBS="$LIBS $libiconv"
915
916 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
917 ac_XPG2funcs=yes, ac_XPG2funcs=no)
8b8ab21c 918
7b331228 919 LIBS="$ac_save_LIBS"
5b20f7a0 920
7b331228 921 AC_MSG_CHECKING([for XPG2 wchar_t support])
a0cb1aa7
PE
922 if test x"$ac_has_iconv_h" = xyes &&
923 test x"$ac_has_langinfo_h" = xyes &&
924 test x"$ac_XPG2funcs" = xyes; then
7b331228
BK
925 ac_XPG2_wchar_t=yes
926 else
927 ac_XPG2_wchar_t=no
928 fi
929 AC_MSG_RESULT($ac_XPG2_wchar_t)
b2dad0e3 930
7b331228
BK
931 dnl At the moment, only enable wchar_t specializations if all the
932 dnl above support is present.
933 AC_MSG_CHECKING([for enabled wchar_t specializations])
a0cb1aa7
PE
934 if test x"$ac_isoC99_wchar_t" = xyes &&
935 test x"$ac_XPG2_wchar_t" = xyes; then
7b331228
BK
936 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
937 AC_MSG_RESULT("yes")
3840fa2a 938 else
7b331228 939 AC_MSG_RESULT("no")
3840fa2a 940 fi
b2dad0e3 941 else
7b331228
BK
942 dnl Wide characters disabled by the user.
943 AC_MSG_WARN([wchar_t support disabled.])
b2dad0e3 944 fi
b2dad0e3
BK
945])
946
947
b2dad0e3 948dnl
8bd636c5 949dnl Check for special debugging mode; not for production use.
b2dad0e3
BK
950dnl
951dnl GLIBCPP_ENABLE_DEBUG
34791641 952dnl --enable-debug sets '-ggdb3 -O0'.
b2dad0e3
BK
953dnl --disable-debug sets '-g' and whatever optimization options the
954dnl compiler can handle.
7f586614 955dnl + --enable-maintainer-mode automatically defaults this to on.
b2dad0e3
BK
956dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
957dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
958dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
959dnl defaults to `no'.
960AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
961define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
962AC_ARG_ENABLE(debug,
963changequote(<<, >>)dnl
964<< --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
965changequote([, ])dnl
5780a46b 966[case "${enableval}" in
b2dad0e3
BK
967 yes) enable_debug=yes ;;
968 no) enable_debug=no ;;
969 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
970 esac],
971enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
5780a46b 972
b2dad0e3 973dnl Option parsed, now set things appropriately
5780a46b 974case "${enable_debug}" in
cde28f0d 975 yes)
34791641 976 DEBUG_FLAGS='-O0 -ggdb3'
6abd2230 977 ;;
f3b004d8 978 no)
8b8ab21c 979 DEBUG_FLAGS='-g'
f3b004d8 980 ;;
b2dad0e3 981esac
c470c17d 982AC_SUBST(DEBUG_FLAGS)
b2dad0e3
BK
983])
984
985
dcfa0bc8
PE
986dnl
987dnl Check for "unusual" flags to pass to the compiler while building.
988dnl
989dnl GLIBCPP_ENABLE_CXX_FLAGS
990dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
991dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
992dnl Somehow this same set of flags must be passed when [re]building
993dnl libgcc.
994dnl --disable-cxx-flags passes nothing.
a9ab8db1
JM
995dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
996dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
997dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
dcfa0bc8 998dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
32a4595e
PE
999dnl If "default flags" is an empty string (or "none"), the effect is
1000dnl the same as --disable or --enable=no.
dcfa0bc8
PE
1001AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1002define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1003AC_ARG_ENABLE(cxx-flags,
1004changequote(<<, >>)dnl
1005<< --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
1006 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1007changequote([, ])dnl
1008[case "x$enableval" in
5780a46b 1009 xyes)
8b8ab21c 1010 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
5780a46b 1011 xno|x)
8b8ab21c 1012 enable_cxx_flags='' ;;
5780a46b 1013 *)
8b8ab21c 1014 enable_cxx_flags="$enableval" ;;
dcfa0bc8 1015 esac],
5780a46b
BK
1016enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
1017
32a4595e 1018dnl Thinko on my part during design. This kludge is the workaround.
5780a46b
BK
1019if test "$enable_cxx_flags" = "none"; then
1020 enable_cxx_flags='';
1021fi
1022
32a4595e
PE
1023dnl Run through flags (either default or command-line) and set anything
1024dnl extra (e.g., #defines) that must accompany particular g++ options.
dcfa0bc8
PE
1025if test -n "$enable_cxx_flags"; then
1026 for f in $enable_cxx_flags; do
1027 case "$f" in
991a40fc 1028 -fhonor-std) ;;
dcfa0bc8
PE
1029 -*) ;;
1030 *) # and we're trying to pass /what/ exactly?
1031 AC_MSG_ERROR([compiler flags start with a -]) ;;
1032 esac
1033 done
1034fi
1035EXTRA_CXX_FLAGS="$enable_cxx_flags"
1036AC_SUBST(EXTRA_CXX_FLAGS)
1037])
1038
1039
0214010c
BK
1040dnl
1041dnl Check for which locale library to use: gnu or generic.
1042dnl
1043dnl GLIBCPP_ENABLE_CLOCALE
33590f13
BK
1044dnl --enable-clocale=gnu sets config/locale/c_locale_gnu.cc and friends
1045dnl --enable-clocale=generic sets config/locale/c_locale_generic.cc and friends
0214010c
BK
1046dnl
1047dnl default is generic
1048dnl
1049AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
1050 AC_MSG_CHECKING([for clocale to use])
1051 AC_ARG_ENABLE(clocale,
572051a2
PE
1052 [ --enable-clocale enable model for target locale package.
1053 --enable-clocale=MODEL use MODEL target-speific locale package. [default=generic]
0214010c
BK
1054 ],
1055 if test x$enable_clocale = xno; then
1056 enable_clocale=generic
1057 fi,
1058 enable_clocale=generic)
1059
1060 enable_clocale_flag=$enable_clocale
1061
1062 dnl Check if a valid locale package
1063 case x${enable_clocale_flag} in
33590f13
BK
1064 xgeneric)
1065 AC_MSG_RESULT(generic)
1066
1067 # Don't use gettext.
1068 USE_NLS=no
33590f13
BK
1069
1070 CLOCALE_H=config/locale/c_locale_generic.h
1071 CLOCALE_CC=config/locale/c_locale_generic.cc
1072 CCODECVT_H=config/locale/codecvt_specializations_generic.h
1073 CMESSAGES_H=config/locale/messages_members_generic.h
1074 CMESSAGES_CC=config/locale/messages_members_generic.cc
ea0c0b6e 1075 CCOLLATE_CC=config/locale/collate_specializations_generic.cc
33590f13 1076 ;;
0214010c 1077 xgnu)
0214010c 1078 AC_MSG_RESULT(gnu)
33590f13
BK
1079
1080 # Declare intention to use gettext, and add support for specific
1081 # languages.
1082 # For some reason, ALL_LINGUAS has to be before AM_GNU_GETTEXT
1083 ALL_LINGUAS="de fr"
4e10943d
BK
1084 # Don't call AM_GNU_GETTEXT here. Instead, assume glibc.
1085 # Need to deal with MSGFMT, USE_NLS, and glibcpp_[P,M]OFILES
1086 USE_NLS=yes
33590f13
BK
1087
1088 # Export the build objects.
1089 for ling in $ALL_LINGUAS; do \
1090 glibcpp_MOFILES="$glibcpp_MOFILES $ling.mo"; \
4e10943d 1091 glibcpp_POFILES="$glibcpp_POFILES $ling.po"; \
33590f13
BK
1092 done
1093 AC_SUBST(glibcpp_MOFILES)
4e10943d 1094 AC_SUBST(glibcpp_POFILES)
33590f13
BK
1095
1096 CLOCALE_H=config/locale/c_locale_gnu.h
1097 CLOCALE_CC=config/locale/c_locale_gnu.cc
1098 CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
1099 CMESSAGES_H=config/locale/messages_members_gnu.h
1100 CMESSAGES_CC=config/locale/messages_members_gnu.cc
ea0c0b6e 1101 CCOLLATE_CC=config/locale/collate_specializations_gnu.cc
0214010c 1102 ;;
33590f13 1103 xieee_1003.1)
0214010c 1104 AC_MSG_RESULT(generic)
33590f13
BK
1105
1106 # Don't use gettext.
1107 USE_NLS=no
33590f13
BK
1108
1109 CLOCALE_H=config/locale/c_locale_ieee_1003.1-200x.h
1110 CLOCALE_CC=config/locale/c_locale_ieee_1003.1-200x.cc
1111 CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
1112 CMESSAGES_H=config/locale/messages_members_ieee_1003.1-200x.h
1113 CMESSAGES_CC=config/locale/messages_members_ieee_1003.1-200x.cc
ea0c0b6e 1114 CCOLLATE_CC=config/locale/collate_specializations_generic.cc
0214010c
BK
1115 ;;
1116 *)
1117 echo "$enable_clocale is an unknown locale package" 1>&2
1118 exit 1
1119 ;;
1120 esac
1121
33590f13
BK
1122 # This is where the testsuite looks for locale catalogs, using the
1123 # -DLOCALEDIR define during testsuite compilation.
1124 glibcpp_localedir=${glibcpp_builddir}/po/share/locale
1125 AC_SUBST(glibcpp_localedir)
1126
4e10943d 1127 AC_SUBST(USE_NLS)
4a9d5109 1128 AC_SUBST(CLOCALE_H)
33590f13
BK
1129 AC_SUBST(CCODECVT_H)
1130 AC_SUBST(CMESSAGES_H)
0214010c 1131 AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
ea0c0b6e
BK
1132 AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
1133 AC_LINK_FILES($CCOLLATE_CC, src/collate.cc)
0214010c
BK
1134])
1135
1136
b2dad0e3 1137dnl
8bd636c5 1138dnl Check for which I/O library to use: libio, or something specific.
b2dad0e3
BK
1139dnl
1140dnl GLIBCPP_ENABLE_CSTDIO
33590f13 1141dnl --enable-cstdio=libio sets config/io/c_io_libio.h and friends
b2dad0e3 1142dnl
8e2d9424 1143dnl default is stdio
b2dad0e3
BK
1144dnl
1145AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1146 AC_MSG_CHECKING([for cstdio to use])
1147 AC_ARG_ENABLE(cstdio,
572051a2
PE
1148 [ --enable-cstdio enable stdio for target io package.
1149 --enable-cstdio=LIB use LIB target-speific io package. [default=stdio]
36e40658 1150 ],
b2dad0e3 1151 if test x$enable_cstdio = xno; then
8e2d9424 1152 enable_cstdio=stdio
b2dad0e3 1153 fi,
8e2d9424 1154 enable_cstdio=stdio)
b2dad0e3
BK
1155
1156 enable_cstdio_flag=$enable_cstdio
1157
8b8ab21c 1158 dnl Check if a valid I/O package
b2dad0e3 1159 case x${enable_cstdio_flag} in
e26cb7ab 1160 xlibio)
33590f13
BK
1161 CSTDIO_H=config/io/c_io_libio.h
1162 BASIC_FILE_H=config/io/basic_file_libio.h
1163 BASIC_FILE_CC=config/io/basic_file_libio.cc
dd75251f
BK
1164 AC_MSG_RESULT(libio)
1165
1166 # see if we are on a system with libio native (ie, linux)
1167 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1168
1169 # Need to check and see what version of glibc is being used. If
1170 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1171 # compile most of libio for linux systems.
1172 if test x$has_libio = x"yes"; then
1173 case "$target" in
1174 *-*-linux*)
8b8ab21c
BK
1175 AC_MSG_CHECKING([for glibc version >= 2.2])
1176 AC_EGREP_CPP([ok], [
1177 #include <features.h>
1178 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1179 ok
1180 #endif
1181 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1182 AC_MSG_RESULT($glibc_satisfactory)
1183 ;;
dd75251f
BK
1184 esac
1185
8b8ab21c 1186 # XXX at the moment, admit defeat and force the recompilation
f133a43e 1187 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
8b8ab21c
BK
1188 glibc_satisfactory=no
1189
1190 if test x$glibc_satisfactory = x"yes"; then
1191 need_libio=no
8b8ab21c
BK
1192 need_wlibio=no
1193 else
1194 need_libio=yes
8b8ab21c
BK
1195 # bkoz XXX need to add checks to enable this
1196 # pme XXX here's a first pass at such a check
1197 if test x$enable_c_mbchar != xno; then
1198 need_wlibio=yes
1199 else
1200 need_wlibio=no
1201 fi
1202 fi
dd75251f 1203
dd75251f 1204 else
e7140677 1205 # Using libio, but <libio.h> doesn't exist on the target system. . .
8b8ab21c 1206 need_libio=yes
8b8ab21c
BK
1207 # bkoz XXX need to add checks to enable this
1208 # pme XXX here's a first pass at such a check
1209 if test x$enable_c_mbchar != xno; then
1210 need_wlibio=yes
1211 else
1212 need_wlibio=no
1213 fi
dd75251f
BK
1214 fi
1215 ;;
e26cb7ab
MM
1216 xstdio | x | xno | xnone | xyes)
1217 # default
33590f13
BK
1218 CSTDIO_H=config/io/c_io_stdio.h
1219 BASIC_FILE_H=config/io/basic_file_stdio.h
1220 BASIC_FILE_CC=config/io/basic_file_stdio.cc
9717c75c
BK
1221 AC_MSG_RESULT(stdio)
1222
e26cb7ab 1223 # We're not using stdio.
dd75251f 1224 need_libio=no
e26cb7ab 1225 need_wlibio=no
dd75251f
BK
1226 ;;
1227 *)
1228 echo "$enable_cstdio is an unknown io package" 1>&2
1229 exit 1
1230 ;;
b2dad0e3 1231 esac
4a9d5109
SW
1232 AC_SUBST(CSTDIO_H)
1233 AC_SUBST(BASIC_FILE_H)
c0a26060 1234 AC_LINK_FILES($BASIC_FILE_CC, src/basic_file.cc)
8901ac21
BK
1235
1236 # 2000-08-04 bkoz hack
33590f13 1237 CCODECVT_C=config/io/c_io_libio_codecvt.c
4a9d5109 1238 AC_SUBST(CCODECVT_C)
8901ac21 1239 # 2000-08-04 bkoz hack
8b8ab21c 1240
85a011b0
PE
1241 AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO,
1242 test "$need_libio" = yes || test "$need_wlibio" = yes)
b2dad0e3 1243 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
20427c6b 1244 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
c4d3f801 1245 if test "$need_libio" = yes || test "$need_wlibio" = yes; then
4c07386b 1246 libio_la=../libio/libio.la
c4d3f801 1247 else
4c07386b 1248 libio_la=
c4d3f801
MM
1249 fi
1250 AC_SUBST(libio_la)
b2dad0e3
BK
1251])
1252
1253
1254dnl
5e218033
LR
1255dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
1256dnl We must stage the required headers so that they will be installed
1257dnl with the library (unlike libgcc, the STL implementation is provided
1258dnl solely within headers). Since we must not inject random user-space
1259dnl macro names into user-provided C++ code, we first stage into <file>-in
1260dnl and process to <file> with an output command. The reason for a two-
1261dnl stage process here is to correctly handle $srcdir!=$objdir without
1262dnl having to write complex code (the sed commands to clean the macro
3a5e0e62
LR
1263dnl namespace are complex and fragile enough as it is). We must also
1264dnl add a relative path so that -I- is supported properly.
b2dad0e3
BK
1265dnl
1266AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
ede74510
AO
1267 AC_MSG_CHECKING([for thread model used by GCC])
1268 target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
1269 AC_MSG_RESULT([$target_thread_file])
b2dad0e3 1270
5e218033
LR
1271 if test $target_thread_file != single; then
1272 AC_DEFINE(HAVE_GTHR_DEFAULT)
1273 AC_DEFINE(_GLIBCPP_SUPPORTS_WEAK, __GXX_WEAK__)
8b8ab21c 1274 fi
4a9d5109
SW
1275
1276 glibcpp_thread_h=gthr-$target_thread_file.h
1277 AC_SUBST(glibcpp_thread_h)
b2dad0e3
BK
1278])
1279
1280
52a11cbf
RH
1281dnl
1282dnl Check for exception handling support. If an explicit enable/disable
1283dnl sjlj exceptions is given, we don't have to detect. Otherwise the
1284dnl target may or may not support call frame exceptions.
1285dnl
1286dnl GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
1287dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
1288dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1289dnl
1290dnl Define _GLIBCPP_SJLJ_EXCEPTIONS if the compiler is configured for it.
1291dnl
1292AC_DEFUN(GLIBCPP_ENABLE_SJLJ_EXCEPTIONS, [
1293 AC_MSG_CHECKING([for exception model to use])
1294 AC_LANG_SAVE
1295 AC_LANG_CPLUSPLUS
1296 AC_ARG_ENABLE(sjlj-exceptions,
1297 [ --enable-sjlj-exceptions force use of builtin_setjmp for exceptions],
1298 [:],
1299 [dnl Botheration. Now we've got to detect the exception model.
1300 dnl Link tests against libgcc.a are problematic since -- at least
1301 dnl as of this writing -- we've not been given proper -L bits for
1302 dnl single-tree newlib and libgloss.
1303 dnl
1304 dnl This is what AC_TRY_COMPILE would do if it didn't delete the
1305 dnl conftest files before we got a change to grep them first.
1306 cat > conftest.$ac_ext << EOF
1307[#]line __oline__ "configure"
1308struct S { ~S(); };
1309void bar();
1310void foo()
1311{
1312 S s;
1313 bar();
1314}
1315EOF
1316 old_CXXFLAGS="$CXXFLAGS"
1317 CXXFLAGS=-S
1318 if AC_TRY_EVAL(ac_compile); then
1319 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
1320 enable_sjlj_exceptions=yes
1321 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
1322 enable_sjlj_exceptions=no
1323 fi
1324 fi
1325 CXXFLAGS="$old_CXXFLAGS"
1326 rm -f conftest*])
1327 if test x$enable_sjlj_exceptions = xyes; then
1328 AC_DEFINE(_GLIBCPP_SJLJ_EXCEPTIONS, 1,
a0cb1aa7 1329 [Define if the compiler is configured for setjmp/longjmp exceptions.])
52a11cbf
RH
1330 ac_exception_model_name=sjlj
1331 elif test x$enable_sjlj_exceptions = xno; then
1332 ac_exception_model_name="call frame"
1333 else
1334 AC_MSG_ERROR([unable to detect exception model])
1335 fi
1336 AC_LANG_RESTORE
1337 AC_MSG_RESULT($ac_exception_model_name)
1338])
1339
1340
7cda84dc
BK
1341dnl
1342dnl Check for ISO/IEC 9899:1999 "C99" support.
1343dnl
1344dnl GLIBCPP_ENABLE_C99
1345dnl --enable-c99 defines _GLIBCPP_USE_C99
1346dnl --disable-c99 leaves _GLIBCPP_USE_C99 undefined
1347dnl + Usage: GLIBCPP_ENABLE_C99[(DEFAULT)]
1348dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1349dnl defaults to `no'.
1350dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
1351dnl
1352dnl GLIBCPP_ENABLE_C99
1353AC_DEFUN(GLIBCPP_ENABLE_C99, [dnl
1354 define([GLIBCPP_ENABLE_C99_DEFAULT], ifelse($1, yes, yes, no))dnl
209fe19b 1355
7cda84dc
BK
1356 AC_ARG_ENABLE(c99,
1357 changequote(<<, >>)dnl
1358 <<--enable-c99 turns on 'ISO/IEC 9899:1999 support' [default=>>GLIBCPP_ENABLE_C99_DEFAULT],
1359 changequote([, ])dnl
1360 [case "$enableval" in
1361 yes) enable_c99=yes ;;
1362 no) enable_c99=no ;;
1363 *) AC_MSG_ERROR([Unknown argument to enable/disable C99]) ;;
1364 esac],
1365 enable_c99=GLIBCPP_ENABLE_C99_DEFAULT)dnl
1366
1367 AC_LANG_SAVE
1368 AC_LANG_CPLUSPLUS
209fe19b 1369
7cda84dc 1370 # Check for the existence of <math.h> functions used if C99 is enabled.
bd937d50 1371 ac_c99_math=yes;
54eb01be 1372 AC_MSG_CHECKING([for ISO C99 support in <math.h>])
7cda84dc
BK
1373 AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no])
1374 AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no])
1375 AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no])
1376 AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no])
1377 AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no])
1378 AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no])
337187ff
BK
1379 AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no])
1380 AC_TRY_COMPILE([#include <math.h>],
bd937d50 1381 [isgreaterequal(0.0,0.0);],, [ac_c99_math=no])
337187ff
BK
1382 AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no])
1383 AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no])
1384 AC_TRY_COMPILE([#include <math.h>],
bd937d50 1385 [islessgreater(0.0,0.0);],, [ac_c99_math=no])
337187ff 1386 AC_TRY_COMPILE([#include <math.h>],
bd937d50 1387 [isunordered(0.0,0.0);],, [ac_c99_math=no])
bd937d50 1388 AC_MSG_RESULT($ac_c99_math)
7cda84dc 1389
61c71946
BK
1390 # Check for the existence in <stdio.h> of vscanf, et. al.
1391 ac_c99_stdio=yes;
1392 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
1393 AC_TRY_COMPILE([#include <stdio.h>],
1394 [snprintf("12", 0, "%i");],, [ac_c99_stdio=no])
1395 AC_TRY_COMPILE([#include <stdio.h>
1396 #include <stdarg.h>
1397 void foo(char* fmt, ...)
1398 {va_list args; va_start(args, fmt);
1399 vfscanf(stderr, "%i", args);}],
a0cb1aa7 1400 [],, [ac_c99_stdio=no])
61c71946
BK
1401 AC_TRY_COMPILE([#include <stdio.h>
1402 #include <stdarg.h>
1403 void foo(char* fmt, ...)
1404 {va_list args; va_start(args, fmt);
1405 vscanf("%i", args);}],
1406 [],, [ac_c99_stdio=no])
1407 AC_TRY_COMPILE([#include <stdio.h>
1408 #include <stdarg.h>
1409 void foo(char* fmt, ...)
1410 {va_list args; va_start(args, fmt);
1411 vsnprintf(fmt, 0, "%i", args);}],
1412 [],, [ac_c99_stdio=no])
1413 AC_TRY_COMPILE([#include <stdio.h>
1414 #include <stdarg.h>
1415 void foo(char* fmt, ...)
1416 {va_list args; va_start(args, fmt);
1417 vsscanf(fmt, "%i", args);}],
1418 [],, [ac_c99_stdio=no])
1419 AC_MSG_RESULT($ac_c99_stdio)
1420
7cda84dc 1421 # Check for the existence in <stdlib.h> of lldiv_t, et. al.
bd937d50 1422 ac_c99_stdlib=yes;
f4c79fef 1423 AC_MSG_CHECKING([for lldiv_t declaration])
7cda84dc
BK
1424 AC_CACHE_VAL(ac_c99_lldiv_t, [
1425 AC_TRY_COMPILE([#include <stdlib.h>],
f4c79fef 1426 [ lldiv_t mydivt;],
7cda84dc 1427 [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no])
f4c79fef 1428 ])
7cda84dc 1429 AC_MSG_RESULT($ac_c99_lldiv_t)
54eb01be
PE
1430
1431 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
61c71946
BK
1432 AC_TRY_COMPILE([#include <stdlib.h>],
1433 [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no])
1434 AC_TRY_COMPILE([#include <stdlib.h>],
1435 [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no])
54eb01be
PE
1436 AC_TRY_COMPILE([#include <stdlib.h>],
1437 [char* tmp; strtoll("gnu", &tmp, 10);],, [ac_c99_stdlib=no])
1438 AC_TRY_COMPILE([#include <stdlib.h>],
1439 [char* tmp; strtoull("gnu", &tmp, 10);],, [ac_c99_stdlib=no])
1440 AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no])
1441 AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no])
1442 AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no])
61c71946 1443 AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no])
7cda84dc
BK
1444 if test x"$ac_c99_lldiv_t" = x"no"; then
1445 ac_c99_stdlib=no;
1446 fi;
bd937d50 1447 AC_MSG_RESULT($ac_c99_stdlib)
7cda84dc
BK
1448
1449 # Check for the existence of <wchar.h> functions used if C99 is enabled.
68fe6226 1450 # XXX the wchar.h checks should be rolled into the general C99 bits.
bd937d50 1451 ac_c99_wchar=yes;
68fe6226 1452 AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>])
bd937d50
BK
1453 AC_TRY_COMPILE([#include <wchar.h>],
1454 [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no])
1455 AC_TRY_COMPILE([#include <wchar.h>],
1456 [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no])
1457 AC_TRY_COMPILE([#include <wchar.h>],
1458 [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no])
bd937d50 1459 AC_MSG_RESULT($ac_c99_wchar)
f4c79fef 1460
7cda84dc 1461 AC_MSG_CHECKING([for enabled ISO C99 support])
a0cb1aa7
PE
1462 if test x"$ac_c99_math" = x"no" ||
1463 test x"$ac_c99_stdio" = x"no" ||
1464 test x"$ac_c99_stdlib" = x"no" ||
1465 test x"$ac_c99_wchar" = x"no"; then
7cda84dc 1466 enable_c99=no;
3840fa2a 1467 fi;
7cda84dc 1468 AC_MSG_RESULT($enable_c99)
3840fa2a 1469
f4c79fef 1470 # Option parsed, now set things appropriately
7cda84dc
BK
1471 if test x"$enable_c99" = x"yes"; then
1472 AC_DEFINE(_GLIBCPP_USE_C99)
dcc41852 1473 fi
4c07386b 1474
7cda84dc 1475 AC_LANG_RESTORE
b2dad0e3
BK
1476])
1477
1478
6c3a9f72
BK
1479dnl
1480dnl Check for template specializations for the 'long long' type extension.
1481dnl NB: Must check for C99 support before calling _GLIBCPP_ENABLE_LONG_LONG
1482dnl
1483dnl GLIBCPP_ENABLE_LONG_LONG
1484dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1485dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1486dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1487dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1488dnl defaults to `no'.
1489dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1490dnl
1491dnl GLIBCPP_ENABLE_LONG_LONG
1492AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1493 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1494
1495 AC_ARG_ENABLE(long-long,
1496 changequote(<<, >>)dnl
1497 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1498 changequote([, ])dnl
1499 [case "$enableval" in
1500 yes) enable_long_long=yes ;;
1501 no) enable_long_long=no ;;
1502 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1503 esac],
1504 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1505
1506 # iostreams require strtoll, strtoull to compile. If the
1507 # GLIBCPP_ENABLE_C99 tests found these, and if C99 support is enabled,
1508 # go ahead and allow long long to be used.
1509 if test x"$enable_c99" = x"no"; then
1510 enable_long_long=no;
1511 fi
1512
1513 # Option parsed, now set things appropriately
1514 AC_MSG_CHECKING([for enabled long long support])
1515 if test x"$enable_long_long" = xyes; then
1516 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1517 fi
1518 AC_MSG_RESULT($enable_long_long)
1519])
1520
1521
99246c90 1522dnl
e3123ab3
BK
1523dnl Check for what kind of C headers to use.
1524dnl
1525dnl GLIBCPP_ENABLE_CHEADERS
1526dnl --enable-cheaders= [does stuff].
1527dnl --disable-cheaders [does not do anything, really].
1528dnl + This will eventually need to be 'c_shadow' by default.
1529dnl + Usage: GLIBCPP_ENABLE_CHEADERS[(DEFAULT)]
1530dnl Where DEFAULT is either `c' or `c_std' or 'c_shadow'.
1531dnl If ommitted, it defaults to `c_std'.
1532AC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl
1533define([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl
1534AC_MSG_CHECKING([for c header strategy to use])
1535AC_ARG_ENABLE(cheaders,
99246c90 1536changequote(<<, >>)dnl
572051a2 1537<< --enable-cheaders construct "C" header files for g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT],
5780a46b
BK
1538changequote([, ])
1539 [case "$enableval" in
e3123ab3 1540 c)
9b8fd32c 1541 enable_cheaders=c
8b8ab21c 1542 ;;
e3123ab3 1543 c_std)
9b8fd32c 1544 enable_cheaders=c_std
8b8ab21c 1545 ;;
e3123ab3 1546 c_shadow)
9b8fd32c 1547 enable_cheaders=c_shadow
e3123ab3
BK
1548 ;;
1549 *) AC_MSG_ERROR([Unknown argument to enable/disable "C" headers])
8b8ab21c 1550 ;;
5780a46b 1551 esac],
e3123ab3
BK
1552 enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT)
1553 AC_MSG_RESULT($enable_cheaders)
5780a46b
BK
1554
1555 dnl Option parsed, now set things appropriately
e3123ab3
BK
1556 case "$enable_cheaders" in
1557 c_shadow)
8b8ab21c 1558 CSHADOW_FLAGS="-fno-builtin"
fb124b99 1559 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_shadow'
0517cb99 1560 AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
8b8ab21c 1561 ;;
e3123ab3
BK
1562 c_std)
1563 CSHADOW_FLAGS=""
fb124b99 1564 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_std'
e3123ab3
BK
1565 ;;
1566 c)
8b8ab21c 1567 CSHADOW_FLAGS=""
fb124b99 1568 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c'
99246c90 1569 ;;
5780a46b 1570 esac
5b80666b 1571
e466dc8a
BK
1572 AC_SUBST(CSHADOW_FLAGS)
1573 AC_SUBST(C_INCLUDE_DIR)
e3123ab3 1574 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cheaders" = c_shadow)
99246c90 1575])
b2dad0e3 1576
8b8ab21c
BK
1577
1578dnl
1579dnl Check for wide character support. Has the same effect as the option
1580dnl in gcc's configure, but in a form that autoconf can mess with.
1581dnl
1582dnl GLIBCPP_ENABLE_C_MBCHAR
1583dnl --enable-c-mbchar requests all the wchar_t stuff.
1584dnl --disable-c-mbchar doesn't.
1585dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1586dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1587dnl defaults to `no'.
1588AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1589define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1590AC_ARG_ENABLE(c-mbchar,
1591changequote(<<, >>)dnl
1592<< --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1593changequote([, ])dnl
1594[case "$enableval" in
1595 yes) enable_c_mbchar=yes ;;
1596 no) enable_c_mbchar=no ;;
1597 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1598 esac],
1599enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1600dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1601])
1602
1603
e466dc8a
BK
1604dnl
1605dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1606dnl
e466dc8a
BK
1607dnl TOPLEVEL_INCLUDES
1608dnl LIBMATH_INCLUDES
1609dnl LIBSUPCXX_INCLUDES
1610dnl LIBIO_INCLUDES
1611dnl CSHADOW_INCLUDES
1612dnl
4a9d5109 1613dnl GLIBCPP_EXPORT_INCLUDES
e466dc8a 1614AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
4a9d5109
SW
1615 # Root level of the build directory include sources.
1616 GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include"
e466dc8a 1617
9f935979 1618 # Passed down for canadian crosses.
4a9d5109 1619 if test x"$CANADIAN" = xyes; then
9f935979
BK
1620 TOPLEVEL_INCLUDES='-I$(includedir)'
1621 fi
e466dc8a
BK
1622
1623 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1624
1625 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1626
4a9d5109
SW
1627 if test x"$need_libio" = xyes; then
1628 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1629 AC_SUBST(LIBIO_INCLUDES)
1630 fi
e466dc8a
BK
1631
1632 # Now, export this to all the little Makefiles....
4a9d5109 1633 AC_SUBST(GLIBCPP_INCLUDES)
e466dc8a
BK
1634 AC_SUBST(TOPLEVEL_INCLUDES)
1635 AC_SUBST(LIBMATH_INCLUDES)
1636 AC_SUBST(LIBSUPCXX_INCLUDES)
e466dc8a
BK
1637])
1638
1639
1640dnl
1641dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1642dnl
1643AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1644 # Optimization flags that are probably a good idea for thrill-seekers. Just
1645 # uncomment the lines below and make, everything else is ready to go...
1646 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1647 OPTIMIZE_CXXFLAGS=
1648 AC_SUBST(OPTIMIZE_CXXFLAGS)
1649
1650 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1651 AC_SUBST(WARN_FLAGS)
1652])
1653
72ed2836 1654dnl
43ba4a58
BK
1655dnl GLIBCPP_EXPORT_INSTALL_INFO
1656dnl calculates gxx_install_dir
72ed2836
BK
1657dnl exports glibcpp_toolexecdir
1658dnl exports glibcpp_toolexeclibdir
572051a2 1659dnl exports glibcpp_prefixdir
72ed2836
BK
1660dnl
1661dnl Assumes cross_compiling bits already done, and with_cross_host in
1662dnl particular
43ba4a58 1663dnl
72ed2836 1664dnl GLIBCPP_EXPORT_INSTALL_INFO
43ba4a58 1665AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
33590f13
BK
1666# Assumes glibcpp_builddir, glibcpp_srcdir are alreay set up and
1667# exported correctly in GLIBCPP_CONFIGURE.
72ed2836
BK
1668glibcpp_toolexecdir=no
1669glibcpp_toolexeclibdir=no
bd937d50 1670glibcpp_prefixdir=${prefix}
c6192d88 1671
43ba4a58
BK
1672AC_MSG_CHECKING([for interface version number])
1673libstdcxx_interface=$INTERFACE
1674AC_MSG_RESULT($libstdcxx_interface)
1675
1676# Process the option --with-gxx-include-dir=<path to include-files directory>
1677AC_MSG_CHECKING([for --with-gxx-include-dir])
1678AC_ARG_WITH(gxx-include-dir,
572051a2 1679[ --with-gxx-include-dir the installation directory for include files],
43ba4a58
BK
1680[case "${withval}" in
1681 yes)
1682 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
1683 gxx_include_dir=no
1684 ;;
1685 no)
1686 gxx_include_dir=no
1687 ;;
1688 *)
1689 gxx_include_dir=${withval}
1690 ;;
1691esac], [gxx_include_dir=no])
1692AC_MSG_RESULT($gxx_include_dir)
1693
1694# Process the option "--enable-version-specific-runtime-libs"
1695AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
1696AC_ARG_ENABLE(version-specific-runtime-libs,
1697[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
1698[ version_specific_libs=yes
1699# Need the gcc compiler version to know where to install libraries
1700# and header files if --enable-version-specific-runtime-libs option
1701# is selected.
1702changequote(,)dnl
72ed2836
BK
1703gcc_version_trigger=${srcdir}/../gcc/version.c
1704gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'`
1705gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
1706gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/g++
1707glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
f34f2346 1708glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
43ba4a58 1709changequote([,])dnl
43ba4a58
BK
1710],version_specific_libs=no)
1711AC_MSG_RESULT($version_specific_libs)
1712
72ed2836 1713# Default case for install directory for include files.
43ba4a58 1714if test x"$version_specific_libs" = x"no" \
c53cf0fe 1715 && test x"$gxx_include_dir" = x"no"; then
72ed2836
BK
1716 gxx_include_dir='$(prefix)'/include/g++-${libstdcxx_interface}
1717fi
1718
1719# Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
1720# Install a library built with a cross compiler in tooldir, not libdir.
1721if test x"$glibcpp_toolexecdir" = x"no"; then
a0cb1aa7
PE
1722 if test -n "$with_cross_host" &&
1723 test x"$with_cross_host" != x"no"; then
72ed2836
BK
1724 glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
1725 glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)'
1726 else
1727 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1728 glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)'
1729 fi
43ba4a58 1730fi
72ed2836
BK
1731
1732AC_MSG_CHECKING([for install location])
43ba4a58 1733AC_MSG_RESULT($gxx_include_dir)
72ed2836 1734
c6192d88 1735AC_SUBST(glibcpp_prefixdir)
43ba4a58 1736AC_SUBST(gxx_include_dir)
72ed2836
BK
1737AC_SUBST(glibcpp_toolexecdir)
1738AC_SUBST(glibcpp_toolexeclibdir)
43ba4a58
BK
1739])
1740
1741
af9fe0d1
BK
1742# Check for functions in math library.
1743# Ulrich Drepper <drepper@cygnus.com>, 1998.
1744#
1745# This file can be copied and used freely without restrictions. It can
1746# be used in projects which are not available under the GNU Public License
1747# but which still want to provide support for the GNU gettext functionality.
1748# Please note that the actual code is *not* freely available.
1749
1750# serial 1
1751
1752dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1753AC_DEFUN(AC_REPLACE_MATHFUNCS,
1754[AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1755AC_SUBST(LIBMATHOBJS)dnl
1756])
1757
1758
29bd52c8
PE
1759
1760dnl This macro searches for a GNU version of make. If a match is found, the
1761dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
99b51359 1762dnl set to "#". This is useful for including a special features in a Makefile,
29bd52c8
PE
1763dnl which cannot be handled by other versions of make. The variable
1764dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1765dnl the empty string otherwise.
1766dnl
1767dnl Here is an example of its use:
1768dnl
1769dnl Makefile.in might contain:
1770dnl
1771dnl # A failsafe way of putting a dependency rule into a makefile
1772dnl $(DEPEND):
1773dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1774dnl
1775dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1776dnl @ifGNUmake@ include $(DEPEND)
1777dnl @ifGNUmake@ endif
1778dnl
1779dnl Then configure.in would normally contain:
1780dnl
1781dnl CHECK_GNU_MAKE()
1782dnl AC_OUTPUT(Makefile)
1783dnl
1784dnl Then perhaps to cause gnu make to override any other make, we could do
1785dnl something like this (note that GNU make always looks for GNUmakefile first):
1786dnl
1787dnl if ! test x$_cv_gnu_make_command = x ; then
1788dnl mv Makefile GNUmakefile
1789dnl echo .DEFAULT: > Makefile ;
1790dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1791dnl fi
1792dnl
1793dnl Then, if any (well almost any) other make is called, and GNU make also
1794dnl exists, then the other make wraps the GNU make.
1795dnl
1796dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
421173e6 1797dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
29bd52c8
PE
1798dnl
1799dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1800dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
79f5e38e
BC
1801dnl #### conditional's subshell (" --version" is not a command), using a
1802dnl #### different option to grep(1).
29bd52c8 1803dnl #### -pme
57d278be
MS
1804dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not
1805dnl #### ${MAKE:-make}).
1806dnl #### -msokolov
29bd52c8
PE
1807AC_DEFUN(
1808 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1809 _cv_gnu_make_command='' ;
1810dnl Search all the common names for GNU make
57d278be 1811 for a in "${MAKE-make}" make gmake gnumake ; do
626d8f0a 1812 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
79f5e38e 1813 then
29bd52c8
PE
1814 _cv_gnu_make_command=$a ;
1815 break;
1816 fi
1817 done ;
1818 ) ;
1819dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1820dnl string, '#' otherwise
1821 if test "x$_cv_gnu_make_command" != "x" ; then
1822 ifGNUmake='' ;
1823 else
1824 ifGNUmake='#' ;
1825 fi
1826 AC_SUBST(ifGNUmake)
1827])
1828
fe413112
PE
1829
1830dnl Check for headers for, and arguments to, the setrlimit() function.
1831dnl Used only in testsuite_hooks.h.
1832AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT_ancilliary, [
1833 AC_TRY_COMPILE([#include <sys/resource.h>
1834 #include <unistd.h>
1835 ], [ int f = RLIMIT_$1 ; ],
1836 [glibcpp_mresult=1], [glibcpp_mresult=0])
1837 AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcpp_mresult,
1838 [Only used in build directory testsuite_hooks.h.])
1839])
1840AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT, [
58b08ac3 1841 setrlimit_have_headers=yes
fe413112
PE
1842 AC_CHECK_HEADERS(sys/resource.h unistd.h,
1843 [],
58b08ac3 1844 setrlimit_have_headers=no)
fe413112
PE
1845 # If don't have the headers, then we can't run the tests now, and we
1846 # won't be seeing any of these during testsuite compilation.
58b08ac3 1847 if test $setrlimit_have_headers = yes; then
fe413112
PE
1848 # Can't do these in a loop, else the resulting syntax is wrong.
1849 GLIBCPP_CHECK_SETRLIMIT_ancilliary(DATA)
1850 GLIBCPP_CHECK_SETRLIMIT_ancilliary(RSS)
1851 GLIBCPP_CHECK_SETRLIMIT_ancilliary(VMEM)
1852 GLIBCPP_CHECK_SETRLIMIT_ancilliary(AS)
58b08ac3
BK
1853
1854 # Check for rlimit, setrlimit.
1855 AC_CACHE_VAL(ac_setrlimit, [
1856 AC_TRY_COMPILE([#include <sys/resource.h>
1857 #include <unistd.h>
1858 ],
1859 [ struct rlimit r; setrlimit(0, &r);],
1860 [ac_setrlimit=yes], [ac_setrlimit=no])
1861 ])
1862 fi
1863
1864 AC_MSG_CHECKING([for testsuite memory limit support])
1865 if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then
1866 ac_mem_limits=yes
1867 AC_DEFINE(_GLIBCPP_MEM_LIMITS)
1868 else
1869 ac_mem_limits=no
fe413112 1870 fi
58b08ac3 1871 AC_MSG_RESULT($ac_mem_limits)
fe413112
PE
1872])
1873
1874
1875dnl
1876dnl Does any necessary configuration of the testsuite directory. Generates
1877dnl the testsuite_hooks.h header.
1878dnl
1879dnl GLIBCPP_CONFIGURE_TESTSUITE [no args]
1880AC_DEFUN(GLIBCPP_CONFIGURE_TESTSUITE, [
1881 GLIBCPP_CHECK_SETRLIMIT
1882])
1883
1884
3df64633
AO
1885sinclude(../libtool.m4)
1886dnl The lines below arrange for aclocal not to bring an installed
1887dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1888dnl add a definition of LIBTOOL to Makefile.in.
1889ifelse(,,,[AC_SUBST(LIBTOOL)
1890AC_DEFUN([AM_PROG_LIBTOOL])
1891AC_DEFUN([AC_LIBTOOL_DLOPEN])
1892AC_DEFUN([AC_PROG_LD])
1893])
7f586614 1894
9a200b0a 1895
33590f13
BK
1896# Check whether LC_MESSAGES is available in <locale.h>.
1897# Ulrich Drepper <drepper@cygnus.com>, 1995.
1898#
1899# This file file be copied and used freely without restrictions. It can
1900# be used in projects which are not available under the GNU Public License
1901# but which still want to provide support for the GNU gettext functionality.
1902# Please note that the actual code is *not* freely available.
1903
1904# serial 1
1905
1906AC_DEFUN(AC_LC_MESSAGES, [
1907 AC_CHECK_HEADER(locale.h, [
1908 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1909 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1910 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1911 if test $ac_cv_val_LC_MESSAGES = yes; then
1912 AC_DEFINE(HAVE_LC_MESSAGES)
1913 fi
1914 ])
1915])
1916
1917
1918# Add --enable-maintainer-mode option to configure.
1919# From Jim Meyering
1920
1921# serial 1
1922
1923AC_DEFUN(AM_MAINTAINER_MODE,
1924[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1925 dnl maintainer-mode is disabled by default
1926 AC_ARG_ENABLE(maintainer-mode,
1927[ --enable-maintainer-mode enable make rules and dependencies not useful
1928 (and sometimes confusing) to the casual installer],
1929 USE_MAINTAINER_MODE=$enableval,
1930 USE_MAINTAINER_MODE=no)
1931 AC_MSG_RESULT($USE_MAINTAINER_MODE)
1932 AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
1933 MAINT=$MAINTAINER_MODE_TRUE
1934 AC_SUBST(MAINT)dnl
1935]
1936)
1937
1938# Define a conditional.
1939
1940AC_DEFUN(AM_CONDITIONAL,
1941[AC_SUBST($1_TRUE)
1942AC_SUBST($1_FALSE)
1943if $2; then
1944 $1_TRUE=
1945 $1_FALSE='#'
1946else
1947 $1_TRUE='#'
1948 $1_FALSE=
1949fi])
1950
1951# Macro to add for using GNU gettext.
1952# Ulrich Drepper <drepper@cygnus.com>, 1995.
1953#
1954# This file can be copied and used freely without restrictions. It can
1955# be used in projects which are not available under the GNU Public License
1956# but which still want to provide support for the GNU gettext functionality.
1957# Please note that the actual code is *not* freely available.
1958
1959# serial 5
1960
1961AC_DEFUN(AM_WITH_NLS,
1962 [AC_MSG_CHECKING([whether NLS is requested])
1963 dnl Default is enabled NLS
1964 AC_ARG_ENABLE(nls,
1965 [ --disable-nls do not use Native Language Support],
1966 USE_NLS=$enableval, USE_NLS=yes)
1967 AC_MSG_RESULT($USE_NLS)
1968 AC_SUBST(USE_NLS)
1969
1970 USE_INCLUDED_LIBINTL=no
1971
1972 dnl If we use NLS figure out what method
1973 if test "$USE_NLS" = "yes"; then
1974 AC_DEFINE(ENABLE_NLS)
1975 AC_MSG_CHECKING([whether included gettext is requested])
1976 AC_ARG_WITH(included-gettext,
1977 [ --with-included-gettext use the GNU gettext library included here],
1978 nls_cv_force_use_gnu_gettext=$withval,
1979 nls_cv_force_use_gnu_gettext=no)
1980 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
1981
1982 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
1983 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
1984 dnl User does not insist on using GNU NLS library. Figure out what
1985 dnl to use. If gettext or catgets are available (in this order) we
1986 dnl use this. Else we have to fall back to GNU NLS library.
1987 dnl catgets is only used if permitted by option --with-catgets.
1988 nls_cv_header_intl=
1989 nls_cv_header_libgt=
1990 CATOBJEXT=NONE
1991
1992 AC_CHECK_HEADER(libintl.h,
1993 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
1994 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
1995 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
1996
1997 if test "$gt_cv_func_gettext_libc" != "yes"; then
1998 AC_CHECK_LIB(intl, bindtextdomain,
1999 [AC_CACHE_CHECK([for gettext in libintl],
2000 gt_cv_func_gettext_libintl,
2001 [AC_CHECK_LIB(intl, gettext,
2002 gt_cv_func_gettext_libintl=yes,
2003 gt_cv_func_gettext_libintl=no)],
2004 gt_cv_func_gettext_libintl=no)])
2005 fi
2006
2007 if test "$gt_cv_func_gettext_libc" = "yes" \
2008 || test "$gt_cv_func_gettext_libintl" = "yes"; then
2009 AC_DEFINE(HAVE_GETTEXT)
2010 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2011 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
2012 if test "$MSGFMT" != "no"; then
2013 AC_CHECK_FUNCS(dcgettext)
2014 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2015 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2016 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2017 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
2018 return _nl_msg_cat_cntr],
2019 [CATOBJEXT=.gmo
2020 DATADIRNAME=share],
2021 [CATOBJEXT=.mo
2022 DATADIRNAME=lib])
2023 INSTOBJEXT=.mo
2024 fi
2025 fi
2026 ])
2027
2028 if test "$CATOBJEXT" = "NONE"; then
2029 AC_MSG_CHECKING([whether catgets can be used])
2030 AC_ARG_WITH(catgets,
2031 [ --with-catgets use catgets functions if available],
2032 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
2033 AC_MSG_RESULT($nls_cv_use_catgets)
2034
2035 if test "$nls_cv_use_catgets" = "yes"; then
2036 dnl No gettext in C library. Try catgets next.
2037 AC_CHECK_LIB(i, main)
2038 AC_CHECK_FUNC(catgets,
2039 [AC_DEFINE(HAVE_CATGETS)
2040 INTLOBJS="\$(CATOBJS)"
2041 AC_PATH_PROG(GENCAT, gencat, no)dnl
2042 if test "$GENCAT" != "no"; then
2043 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
2044 if test "$GMSGFMT" = "no"; then
2045 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
2046 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
2047 fi
2048 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2049 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2050 USE_INCLUDED_LIBINTL=yes
2051 CATOBJEXT=.cat
2052 INSTOBJEXT=.cat
2053 DATADIRNAME=lib
2054 INTLDEPS='$(top_builddir)/intl/libintl.a'
2055 INTLLIBS=$INTLDEPS
2056 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
2057 nls_cv_header_intl=intl/libintl.h
2058 nls_cv_header_libgt=intl/libgettext.h
2059 fi])
2060 fi
2061 fi
2062
2063 if test "$CATOBJEXT" = "NONE"; then
2064 dnl Neither gettext nor catgets in included in the C library.
2065 dnl Fall back on GNU gettext library.
2066 nls_cv_use_gnu_gettext=yes
2067 fi
2068 fi
2069
2070 if test "$nls_cv_use_gnu_gettext" = "yes"; then
2071 dnl Mark actions used to generate GNU NLS library.
2072 INTLOBJS="\$(GETTOBJS)"
2073 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2074 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
2075 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2076 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2077 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2078 AC_SUBST(MSGFMT)
2079 USE_INCLUDED_LIBINTL=yes
2080 CATOBJEXT=.gmo
2081 INSTOBJEXT=.mo
2082 DATADIRNAME=share
2083 INTLDEPS='$(top_builddir)/intl/libintl.a'
2084 INTLLIBS=$INTLDEPS
2085 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
2086 nls_cv_header_intl=intl/libintl.h
2087 nls_cv_header_libgt=intl/libgettext.h
2088 fi
2089
2090 dnl Test whether we really found GNU xgettext.
2091 if test "$XGETTEXT" != ":"; then
2092 dnl If it is no GNU xgettext we define it as : so that the
2093 dnl Makefiles still can work.
2094 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
2095 : ;
2096 else
2097 AC_MSG_RESULT(
2098 [found xgettext program is not GNU xgettext; ignore it])
2099 XGETTEXT=":"
2100 fi
2101 fi
2102
2103 # We need to process the po/ directory.
2104 POSUB=po
2105 else
2106 DATADIRNAME=share
2107 nls_cv_header_intl=intl/libintl.h
2108 nls_cv_header_libgt=intl/libgettext.h
2109 fi
2110 AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
2111 AC_OUTPUT_COMMANDS(
2112 [case "$CONFIG_FILES" in *po/Makefile.in*)
2113 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
2114 esac])
2115
2116
2117 # If this is used in GNU gettext we have to set USE_NLS to `yes'
2118 # because some of the sources are only built for this goal.
2119 if test "$PACKAGE" = gettext; then
2120 USE_NLS=yes
2121 USE_INCLUDED_LIBINTL=yes
2122 fi
2123
2124 dnl These rules are solely for the distribution goal. While doing this
2125 dnl we only have to keep exactly one list of the available catalogs
2126 dnl in configure.in.
2127 for lang in $ALL_LINGUAS; do
2128 GMOFILES="$GMOFILES $lang.gmo"
2129 POFILES="$POFILES $lang.po"
2130 done
2131
2132 dnl Make all variables we use known to autoconf.
2133 AC_SUBST(USE_INCLUDED_LIBINTL)
2134 AC_SUBST(CATALOGS)
2135 AC_SUBST(CATOBJEXT)
2136 AC_SUBST(DATADIRNAME)
2137 AC_SUBST(GMOFILES)
2138 AC_SUBST(INSTOBJEXT)
2139 AC_SUBST(INTLDEPS)
2140 AC_SUBST(INTLLIBS)
2141 AC_SUBST(INTLOBJS)
2142 AC_SUBST(POFILES)
2143 AC_SUBST(POSUB)
2144 ])
2145
2146AC_DEFUN(AM_GNU_GETTEXT,
2147 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2148 AC_REQUIRE([AC_PROG_CC])dnl
2149 AC_REQUIRE([AC_PROG_RANLIB])dnl
2150 AC_REQUIRE([AC_ISC_POSIX])dnl
2151 AC_REQUIRE([AC_HEADER_STDC])dnl
2152 AC_REQUIRE([AC_C_CONST])dnl
2153 AC_REQUIRE([AC_C_INLINE])dnl
2154 AC_REQUIRE([AC_TYPE_OFF_T])dnl
2155 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2156 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2157 AC_REQUIRE([AC_FUNC_MMAP])dnl
2158
2159 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
2160unistd.h sys/param.h])
2161 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
2162strdup __argz_count __argz_stringify __argz_next])
2163
2164 if test "${ac_cv_func_stpcpy+set}" != "set"; then
2165 AC_CHECK_FUNCS(stpcpy)
2166 fi
2167 if test "${ac_cv_func_stpcpy}" = "yes"; then
2168 AC_DEFINE(HAVE_STPCPY)
2169 fi
2170
2171 AM_LC_MESSAGES
2172 AM_WITH_NLS
2173
2174 if test "x$CATOBJEXT" != "x"; then
2175 if test "x$ALL_LINGUAS" = "x"; then
2176 LINGUAS=
2177 else
2178 AC_MSG_CHECKING(for catalogs to be installed)
2179 NEW_LINGUAS=
2180 for lang in ${LINGUAS=$ALL_LINGUAS}; do
2181 case "$ALL_LINGUAS" in
2182 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
2183 esac
2184 done
2185 LINGUAS=$NEW_LINGUAS
2186 AC_MSG_RESULT($LINGUAS)
2187 fi
2188
2189 dnl Construct list of names of catalog files to be constructed.
2190 if test -n "$LINGUAS"; then
2191 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
2192 fi
2193 fi
2194
2195 dnl The reference to <locale.h> in the installed <libintl.h> file
2196 dnl must be resolved because we cannot expect the users of this
2197 dnl to define HAVE_LOCALE_H.
2198 if test $ac_cv_header_locale_h = yes; then
2199 INCLUDE_LOCALE_H="#include <locale.h>"
2200 else
2201 INCLUDE_LOCALE_H="\
2202/* The system does not provide the header <locale.h>. Take care yourself. */"
2203 fi
2204 AC_SUBST(INCLUDE_LOCALE_H)
2205
2206 dnl Determine which catalog format we have (if any is needed)
2207 dnl For now we know about two different formats:
2208 dnl Linux libc-5 and the normal X/Open format
2209 test -d intl || mkdir intl
2210 if test "$CATOBJEXT" = ".cat"; then
2211 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
2212
2213 dnl Transform the SED scripts while copying because some dumb SEDs
2214 dnl cannot handle comments.
2215 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
2216 fi
2217 dnl po2tbl.sed is always needed.
2218 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
2219 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
2220
2221 dnl In the intl/Makefile.in we have a special dependency which makes
2222 dnl only sense for gettext. We comment this out for non-gettext
2223 dnl packages.
2224 if test "$PACKAGE" = "gettext"; then
2225 GT_NO="#NO#"
2226 GT_YES=
2227 else
2228 GT_NO=
2229 GT_YES="#YES#"
2230 fi
2231 AC_SUBST(GT_NO)
2232 AC_SUBST(GT_YES)
2233
2234 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
2235 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
2236 dnl Try to locate is.
2237 MKINSTALLDIRS=
2238 if test -n "$ac_aux_dir"; then
2239 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
2240 fi
2241 if test -z "$MKINSTALLDIRS"; then
2242 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
2243 fi
2244 AC_SUBST(MKINSTALLDIRS)
2245
2246 dnl *** For now the libtool support in intl/Makefile is not for real.
2247 l=
2248 AC_SUBST(l)
2249
2250 dnl Generate list of files to be processed by xgettext which will
2251 dnl be included in po/Makefile.
2252 test -d po || mkdir po
2253 if test "x$srcdir" != "x."; then
2254 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
2255 posrcprefix="$srcdir/"
2256 else
2257 posrcprefix="../$srcdir/"
2258 fi
2259 else
2260 posrcprefix="../"
2261 fi
2262 rm -f po/POTFILES
2263 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
2264 < $srcdir/po/POTFILES.in > po/POTFILES
2265 ])
2266
2267# Search path for a program which passes the given test.
2268# Ulrich Drepper <drepper@cygnus.com>, 1996.
2269#
2270# This file can be copied and used freely without restrictions. It can
2271# be used in projects which are not available under the GNU Public License
2272# but which still want to provide support for the GNU gettext functionality.
2273# Please note that the actual code is *not* freely available.
2274
2275# serial 1
2276
2277dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2278dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2279AC_DEFUN(AM_PATH_PROG_WITH_TEST,
2280[# Extract the first word of "$2", so it can be a program name with args.
2281set dummy $2; ac_word=[$]2
2282AC_MSG_CHECKING([for $ac_word])
2283AC_CACHE_VAL(ac_cv_path_$1,
2284[case "[$]$1" in
2285 /*)
2286 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2287 ;;
2288 *)
2289 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
2290 for ac_dir in ifelse([$5], , $PATH, [$5]); do
2291 test -z "$ac_dir" && ac_dir=.
2292 if test -f $ac_dir/$ac_word; then
2293 if [$3]; then
2294 ac_cv_path_$1="$ac_dir/$ac_word"
2295 break
2296 fi
2297 fi
2298 done
2299 IFS="$ac_save_ifs"
2300dnl If no 4th arg is given, leave the cache variable unset,
2301dnl so AC_PATH_PROGS will keep looking.
2302ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2303])dnl
2304 ;;
2305esac])dnl
2306$1="$ac_cv_path_$1"
2307if test -n "[$]$1"; then
2308 AC_MSG_RESULT([$]$1)
2309else
2310 AC_MSG_RESULT(no)
2311fi
2312AC_SUBST($1)dnl
2313])
2314
2315# Check whether LC_MESSAGES is available in <locale.h>.
2316# Ulrich Drepper <drepper@cygnus.com>, 1995.
2317#
2318# This file can be copied and used freely without restrictions. It can
2319# be used in projects which are not available under the GNU Public License
2320# but which still want to provide support for the GNU gettext functionality.
2321# Please note that the actual code is *not* freely available.
2322
2323# serial 1
2324
2325AC_DEFUN(AM_LC_MESSAGES,
2326 [if test $ac_cv_header_locale_h = yes; then
2327 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2328 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2329 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2330 if test $am_cv_val_LC_MESSAGES = yes; then
2331 AC_DEFINE(HAVE_LC_MESSAGES)
2332 fi
2333 fi])
7cda84dc 2334
b2dad0e3
BK
2335# Do all the work for Automake. This macro actually does too much --
2336# some checks are only needed if your package does certain things.
2337# But this isn't really a big deal.
2338
2339# serial 1
2340
2341dnl Usage:
2342dnl AM_INIT_AUTOMAKE(package,version, [no-define])
2343
2344AC_DEFUN(AM_INIT_AUTOMAKE,
2345[AC_REQUIRE([AC_PROG_INSTALL])
2346PACKAGE=[$1]
2347AC_SUBST(PACKAGE)
2348VERSION=[$2]
2349AC_SUBST(VERSION)
2350dnl test to see if srcdir already configured
2351if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
2352 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2353fi
2354ifelse([$3],,
2355AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
2356AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
2357AC_REQUIRE([AM_SANITY_CHECK])
2358AC_REQUIRE([AC_ARG_PROGRAM])
2359dnl FIXME This is truly gross.
2360missing_dir=`cd $ac_aux_dir && pwd`
2361AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
2362AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
2363AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
2364AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
2365AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
2366AC_REQUIRE([AC_PROG_MAKE_SET])])
2367
2368#
2369# Check to make sure that the build environment is sane.
2370#
2371
2372AC_DEFUN(AM_SANITY_CHECK,
2373[AC_MSG_CHECKING([whether build environment is sane])
2374# Just in case
2375sleep 1
2376echo timestamp > conftestfile
2377# Do `set' in a subshell so we don't clobber the current shell's
2378# arguments. Must try -L first in case configure is actually a
2379# symlink; some systems play weird games with the mod time of symlinks
2380# (eg FreeBSD returns the mod time of the symlink's containing
2381# directory).
2382if (
2383 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
2384 if test "[$]*" = "X"; then
2385 # -L didn't work.
2386 set X `ls -t $srcdir/configure conftestfile`
2387 fi
2388 if test "[$]*" != "X $srcdir/configure conftestfile" \
2389 && test "[$]*" != "X conftestfile $srcdir/configure"; then
2390
2391 # If neither matched, then we have a broken ls. This can happen
2392 # if, for instance, CONFIG_SHELL is bash and it inherits a
2393 # broken ls alias from the environment. This has actually
2394 # happened. Such a system could not be considered "sane".
2395 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
2396alias in your environment])
2397 fi
2398
2399 test "[$]2" = conftestfile
2400 )
2401then
2402 # Ok.
2403 :
2404else
2405 AC_MSG_ERROR([newly created file is older than distributed files!
2406Check your system clock])
2407fi
2408rm -f conftest*
2409AC_MSG_RESULT(yes)])
2410
2411dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
2412dnl The program must properly implement --version.
2413AC_DEFUN(AM_MISSING_PROG,
2414[AC_MSG_CHECKING(for working $2)
2415# Run test in a subshell; some versions of sh will print an error if
2416# an executable is not found, even if stderr is redirected.
2417# Redirect stdin to placate older versions of autoconf. Sigh.
2418if ($2 --version) < /dev/null > /dev/null 2>&1; then
2419 $1=$2
2420 AC_MSG_RESULT(found)
2421else
2422 $1="$3/missing $2"
2423 AC_MSG_RESULT(missing)
2424fi
2425AC_SUBST($1)])
2426
b2dad0e3
BK
2427# Like AC_CONFIG_HEADER, but automatically create stamp file.
2428
2429AC_DEFUN(AM_CONFIG_HEADER,
2430[AC_PREREQ([2.12])
2431AC_CONFIG_HEADER([$1])
2432dnl When config.status generates a header, we must update the stamp-h file.
2433dnl This file resides in the same directory as the config header
2434dnl that is generated. We must strip everything past the first ":",
2435dnl and everything past the last "/".
2436AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
2437ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
2438<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
2439<<am_indx=1
2440for am_file in <<$1>>; do
2441 case " <<$>>CONFIG_HEADERS " in
2442 *" <<$>>am_file "*<<)>>
2443 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
2444 ;;
2445 esac
2446 am_indx=`expr "<<$>>am_indx" + 1`
2447done<<>>dnl>>)
2448changequote([,]))])
2449
This page took 0.492002 seconds and 5 git commands to generate.