OSDN Git Service

2000-06-01 Benjamin Kosnik <bkoz@gnu.org>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / acinclude.m4
1 dnl
2 dnl Initialize configure bits.
3 dnl
4 dnl Define OPTLEVEL='-O2' if new inlining code present.
5 dnl
6 dnl GLIBCPP_CONFIGURE
7 AC_DEFUN(GLIBCPP_CONFIGURE, [
8   dnl Default to --enable-multilib
9   AC_ARG_ENABLE(multilib,
10   [  --enable-multilib       build hella library versions (default)],
11   [case "${enableval}" in
12     yes) multilib=yes ;;
13     no)  multilib=no ;;
14     *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
15    esac], [multilib=yes])dnl
16
17   dnl We may get other options which we dont document:
18   dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
19   if test "[$]{srcdir}" = "."; then
20     if test "[$]{with_target_subdir}" != "."; then
21       glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
22     else
23       glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
24     fi
25   else
26     glibcpp_basedir="[$]{srcdir}/$1"
27   fi
28   AC_SUBST(glibcpp_basedir)
29
30   AC_CANONICAL_HOST
31
32   AM_INIT_AUTOMAKE(libstdc++, 2.90.8)
33
34 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
35 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
36 # are probably using a cross compiler, which will not be able to fully
37 # link an executable.  This should really be fixed in autoconf
38 # itself.
39
40 AC_DEFUN(LIB_AC_PROG_CC,
41 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
42 dnl Fool anybody using AC_PROG_CC.
43 AC_PROVIDE([AC_PROG_CC])
44 AC_CHECK_PROG(CC, gcc, gcc)
45 if test -z "$CC"; then
46   AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
47   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
48 fi
49
50 AC_PROG_CC_GNU
51
52 if test $ac_cv_prog_gcc = yes; then
53   GCC=yes
54 dnl Check whether -g works, even if CFLAGS is set, in case the package
55 dnl plays around with CFLAGS (such as to build both debugging and
56 dnl normal versions of a library), tasteless as that idea is.
57   ac_test_CFLAGS="${CFLAGS+set}"
58   ac_save_CFLAGS="$CFLAGS"
59   CFLAGS=
60   AC_PROG_CC_G
61   if test "$ac_test_CFLAGS" = set; then
62     CFLAGS="$ac_save_CFLAGS"
63   elif test $ac_cv_prog_cc_g = yes; then
64     CFLAGS="-g -O2"
65   else
66     CFLAGS="-O2"
67   fi
68 else
69   GCC=
70   test "${CFLAGS+set}" = set || CFLAGS="-g"
71 fi
72 ])
73
74 LIB_AC_PROG_CC
75
76 # Likewise for AC_PROG_CXX.
77 AC_DEFUN(LIB_AC_PROG_CXX,
78 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
79 dnl Fool anybody using AC_PROG_CXX.
80 AC_PROVIDE([AC_PROG_CXX])
81 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
82 test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
83
84 AC_PROG_CXX_GNU
85
86 if test $ac_cv_prog_gxx = yes; then
87   GXX=yes
88 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
89 dnl plays around with CXXFLAGS (such as to build both debugging and
90 dnl normal versions of a library), tasteless as that idea is.
91   ac_test_CXXFLAGS="${CXXFLAGS+set}"
92   ac_save_CXXFLAGS="$CXXFLAGS"
93   CXXFLAGS=
94   AC_PROG_CXX_G
95   if test "$ac_test_CXXFLAGS" = set; then
96     CXXFLAGS="$ac_save_CXXFLAGS"
97   elif test $ac_cv_prog_cxx_g = yes; then
98     CXXFLAGS="-g -O2"
99   else
100     CXXFLAGS="-O2"
101   fi
102 else
103   GXX=
104   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
105 fi
106 ])
107
108 LIB_AC_PROG_CXX
109
110 # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we dont
111 # run it explicitly here, it will be run implicitly before
112 # LIBGCJ_CONFIGURE, which doesn't work because that means that it will
113 # be run before AC_CANONICAL_HOST.
114 AC_CANONICAL_BUILD
115
116 AC_CHECK_TOOL(AS, as)
117 AC_CHECK_TOOL(AR, ar)
118 AC_CHECK_TOOL(RANLIB, ranlib, :)
119
120 AC_PROG_INSTALL
121
122 AM_MAINTAINER_MODE
123
124 # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
125 # at least currently, we never actually build a program, so we never
126 # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
127 # fails, because we are probably configuring with a cross compiler
128 # which cant create executables.  So we include AC_EXEEXT to keep
129 # automake happy, but we dont execute it, since we dont care about
130 # the result.
131 if false; then
132   AC_EXEEXT
133 fi
134
135 # configure.host sets the following important variables
136 #       glibcpp_cflags    - host specific C compiler flags
137 #       glibcpp_cxxflags  - host specific C++ compiler flags
138
139 glibcpp_cflags=
140 glibcpp_cxxflags=
141
142 . [$]{glibcpp_basedir}/configure.host
143
144 case [$]{glibcpp_basedir} in
145 /* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
146 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
147 esac
148
149 GLIBCPP_CFLAGS="[$]{glibcpp_cflags}"
150 GLIBCPP_CXXFLAGS="[$]{glibcpp_cxxflags}"
151 AC_SUBST(GLIBCPP_CFLAGS)
152 AC_SUBST(GLIBCPP_CXXFLAGS)
153 ])
154
155
156 dnl
157 dnl Check to see if g++ can compile this library, and if so, if any version-
158 dnl specific precautions need to be taken. In particular, test for
159 dnl newer compiler features, or features that are present in newer
160 dnl compiler version but not older compiler versions should be placed
161 dnl here.
162 dnl
163 dnl Define FMTFLAGS='-fdiagnostics-show-location=once' if possible
164 dnl Define WERROR='-Werror' if possible; g++'s that lack the new inlining
165 dnl    code or the new system_header pragma will die.  Other options dealing
166 dnl    with warnings, errors, and compiler complaints may be folded into
167 dnl    the WERROR variable.
168 dnl
169 dnl GLIBCPP_CHECK_COMPILER_VERSION
170 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
171   # All these tests are for C++; save the language and the compiler flags.
172   # The CXXFLAGS thing is suspicious, but based on similar bits 
173   # found in GLIBCPP_CONFIGURE.
174   AC_LANG_SAVE
175   AC_LANG_CPLUSPLUS
176   ac_test_CXXFLAGS="${CXXFLAGS+set}"
177   ac_save_CXXFLAGS="$CXXFLAGS"
178   WERROR='-Werror'
179
180   # Sanity check that g++ is capable of dealing with v-3.
181   AC_MSG_CHECKING([for g++ that will successfully compile this code])
182   AC_EGREP_CPP([ok], [
183   #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) 
184     ok
185   #endif
186   ], gpp_satisfactory=yes, AC_MSG_ERROR("please upgrade to gcc-2.95 or above"))
187   AC_MSG_RESULT($gpp_satisfactory)
188
189   # Check for pragma system_header.
190   AC_MSG_CHECKING([for g++ that supports pragma system_header])
191   CXXFLAGS='-Wunknown-pragmas -Werror'
192   AC_TRY_COMPILE([#pragma system_header], [int foo;
193   ], [ac_newpragma=yes], [ac_newpragma=no])
194   if test "$ac_test_CXXFLAGS" = set; then
195     CXXFLAGS="$ac_save_CXXFLAGS"
196   else
197     # this is the suspicious part
198     CXXFLAGS=''
199   fi
200   if test "$ac_newpragma" = "no"; then
201     WERROR="$WERROR -Wno-unknown-pragmas"
202   fi
203   AC_MSG_RESULT($ac_newpragma)
204
205   # Check for more sophisticated diagnostic control.
206   AC_MSG_CHECKING([for g++ that supports -fdiagnostics-show-location=once])
207   CXXFLAGS='-fdiagnostics-show-location=once'
208   AC_TRY_COMPILE(, [int foo;
209   ], [ac_gabydiags=yes], [ac_gabydiags=no])
210   if test "$ac_test_CXXFLAGS" = set; then
211     CXXFLAGS="$ac_save_CXXFLAGS"
212   else
213     # this is the suspicious part
214     CXXFLAGS=''
215   fi
216   if test "$ac_gabydiags" = "yes"; then
217     FMTFLAGS='-fdiagnostics-show-location=once'
218   fi
219   AC_MSG_RESULT($ac_gabydiags)
220
221   AC_LANG_RESTORE
222   AC_SUBST(WERROR)
223   AC_SUBST(FMTFLAGS)
224 ])
225
226
227 dnl
228 dnl Check to see what builtin math functions are supported
229 dnl
230 dnl Define _GLIBCPP_HAS_BUILTIN_SINF if __builtin_sinf
231 dnl Define _GLIBCPP_HAS_BUILTIN_COSF if __builtin_cosf
232 dnl Define _GLIBCPP_HAS_BUILTIN_FABSF if __builtin_fabsf
233 dnl Define _GLIBCPP_HAS_BUILTIN_SQRTF if __builtin_sqrtf
234 dnl
235 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
236 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
237   dnl Test for builtin math functions.
238   AC_MSG_CHECKING([for __builtin_sinf])
239   AC_TRY_COMPILE([#include <math.h>], 
240   [float foo(void) { __builtin_sinf(0.0); }], 
241   use_builtin_sinf=yes, use_builtin_sinf=no)
242   AC_MSG_RESULT($use_builtin_sinf)
243   if test $use_builtin_sinf = "yes"; then
244     AC_DEFINE(_GLIBCPP_HAS_BUILTIN_SINF)
245   fi
246
247   AC_MSG_CHECKING([for __builtin_cosf])
248   AC_TRY_COMPILE([#include <math.h>], 
249   [float foo(void) { __builtin_cosf(0.0); }], 
250   use_builtin_cosf=yes, use_builtin_cosf=no)
251   AC_MSG_RESULT($use_builtin_cosf)
252   if test $use_builtin_cosf = "yes"; then
253     AC_DEFINE(_GLIBCPP_HAS_BUILTIN_COSF)
254   fi
255
256   AC_MSG_CHECKING([for __builtin_fabsf])
257   AC_TRY_COMPILE([#include <math.h>], 
258   [float foo(void) { __builtin_fabsf(0.0); }], 
259   use_builtin_fabsf=yes, use_builtin_fabsf=no)
260   AC_MSG_RESULT($use_builtin_fabsf)
261   if test $use_builtin_fabsf = "yes"; then
262     AC_DEFINE(_GLIBCPP_HAS_BUILTIN_FABSF)
263   fi
264
265   AC_MSG_CHECKING([for __builtin_sqrtf])
266   AC_TRY_COMPILE([#include <math.h>], 
267   [float foo(void) { __builtin_sqrtf(0.0); }], 
268   use_builtin_sqrtf=yes, use_builtin_sqrtf=no)
269   AC_MSG_RESULT($use_builtin_sqrtf)
270   if test $use_builtin_sqrtf = "yes"; then
271     AC_DEFINE(_GLIBCPP_HAS_BUILTIN_SQRTF)
272   fi
273 ])
274
275
276 dnl Check to see what architecture we are compiling for. If it's
277 dnl supported, use special hand-crafted routines to provide thread
278 dnl primitives. Also, if architecture-specific flags are required for 
279 dnl compilation, add them here.
280 dnl 
281 dnl Depending on what is found, select configure/cpu/*/bits/atomicity.h 
282 dnl If not found, select configure/cpu/generic/bits/atomicity.h
283 dnl
284 dnl GLIBCPP_CHECK_CPU
285 AC_DEFUN(GLIBCPP_CHECK_CPU, [
286     AC_MSG_CHECKING([for cpu primitives directory])
287     CPUFLAGS=                   
288     case "$target_cpu" in
289       alpha*)
290         cpu_include_dir="config/cpu/alpha"
291         ;;
292       arm*)
293         cpu_include_dir="config/cpu/arm"
294         ;;
295       i386)
296         cpu_include_dir="config/cpu/i386"
297         ;;
298       i486 | i586 | i686 | i786)
299         cpu_include_dir="config/cpu/i486"
300         ;;
301       powerpc | rs6000)
302         cpu_include_dir="config/cpu/powerpc"
303         CPUFLAGS='-mcpu=powerpc'
304         ;;
305       sparc64 | ultrasparc)
306         cpu_include_dir="config/cpu/sparc/sparc64"
307         ;;
308       sparc*)
309         cpu_include_dir="config/cpu/sparc/sparc32"
310         ;;
311       *)
312         cpu_include_dir="config/cpu/generic"
313         ;;
314     esac
315     AC_MSG_RESULT($cpu_include_dir)
316     AC_SUBST(cpu_include_dir)
317     AC_SUBST(CPUFLAGS)
318 ])
319
320  
321 dnl
322 dnl Check to see what the underlying c library's interface to ctype looks
323 dnl like. Bits of locale rely on things like isspace, toupper, etc. This
324 dnl stuff makes sure the right bits from the clibrary get called.
325 dnl 
326 dnl Depending on what is found, select various configure/*/bits/ctype_base.h 
327 dnl Depending on what is found, select various configure/*/ctype.cc
328 dnl
329 dnl GLIBCPP_CHECK_CTYPE
330 AC_DEFUN(GLIBCPP_CHECK_CTYPE, [
331   AC_CHECK_HEADER(ctype.h, [
332     
333     dnl If doesn't match any specified, go with defaults.
334     ctype_default=yes
335
336     dnl Test for <ctype> functionality -- gnu-linux
337     AC_MSG_CHECKING([<ctype> for gnu-linux ])
338     AC_TRY_COMPILE([#include <ctype.h>],
339     [int
340     foo (int a)
341     { return _ISspace + _ISprint + _IScntrl + _ISupper + _ISlower + _ISalpha \
342         + _ISdigit + _ISpunct + _ISxdigit + _ISalnum + _ISgraph \
343         + __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];}], \
344     ctype_linux=yes, ctype_linux=no)
345     AC_MSG_RESULT($ctype_linux)
346     if test $ctype_linux = "yes"; then
347       ctype_include_dir="config/gnu-linux"
348       ctype_default=no
349     fi
350
351     dnl Test for <ctype> functionality -- FreeBSD 4.0
352     if test $ctype_default = "yes"; then
353     AC_MSG_CHECKING([<ctype> for freebsd 4.0 ])
354     AC_TRY_COMPILE([#include <ctype.h>],
355     [int
356     foo (int a)
357     { return _CTYPE_S + _CTYPE_R + _CTYPE_C + _CTYPE_U + _CTYPE_L + _CTYPE_A \
358         + _CTYPE_D + _CTYPE_P + _CTYPE_X + _CTYPE_G ;}], \
359     ctype_bsd=yes, ctype_bsd=no)
360     AC_MSG_RESULT($ctype_bsd)
361     if test $ctype_bsd = "yes"; then
362       ctype_include_dir="config/bsd"
363       ctype_default=no
364     fi
365     fi
366
367     dnl Test for <ctype> functionality -- FreeBSD 3.4
368     if test $ctype_default = "yes"; then
369     AC_MSG_CHECKING([<ctype> for freebsd 3.4 ])
370     AC_TRY_COMPILE([#include <ctype.h>],
371     [int
372     foo (int a)
373     { return _S + _R + _C + _U + _L + _A \
374       + _D + _P + _X + _G + __istype (a, 0);}], \
375     ctype_freebsd34=yes, ctype_freebsd34=no)
376     AC_MSG_RESULT($ctype_freebsd34)
377     if test $ctype_freebsd34 = "yes"; then
378       ctype_include_dir="config/bsd"
379       ctype_default=no
380     fi
381     fi
382
383     dnl Test for <ctype> functionality -- solaris 2.6 and 2.7
384     if test $ctype_default = "yes"; then
385     AC_MSG_CHECKING([<ctype> for solaris 2.[6,7,8] ])
386     AC_TRY_COMPILE([#include <ctype.h>],
387     [int
388     foo (int a)
389     { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
390         + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
391         + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}], \
392     ctype_solaris=yes, ctype_solaris=no)
393     AC_MSG_RESULT($ctype_solaris)
394
395     if test $ctype_solaris = "yes"; then
396       AC_MSG_CHECKING([  for version])
397       AC_LANG_CPLUSPLUS 
398       AC_TRY_COMPILE([#include <ctype.h>],
399       [typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;],\
400       ctype_solaris26=yes, ctype_solaris26=no)
401       AC_LANG_C
402       if test $ctype_solaris26 = "yes"; then
403         ctype_include_dir="config/solaris/solaris2.6"
404         AC_MSG_RESULT("solaris2.6")
405         ctype_default=no
406       else
407         ctype_include_dir="config/solaris/solaris2.7"
408         AC_MSG_RESULT("solaris2.[7,8]")
409         ctype_default=no
410       fi
411     fi
412     fi  
413
414     dnl Test for <ctype> functionality -- solaris 2.5.1
415     if test $ctype_default = "yes"; then
416     AC_MSG_CHECKING([<ctype> for solaris 2.5.1 ])
417     AC_TRY_COMPILE([#include <ctype.h>],
418     [int
419     foo (int a)
420     { return _U + _L + _N + _S + _P + _C + _X + _B \
421         + __ctype[a];}], \
422     ctype_solaris25=yes, ctype_solaris25=no)
423     AC_MSG_RESULT($ctype_solaris25)
424     if test $ctype_solaris25 = "yes"; then
425       ctype_include_dir="config/solaris/solaris2.5"
426       ctype_default=no
427     fi
428     fi
429
430     dnl Test for <ctype> functionality -- aix
431     if test $ctype_default = "yes"; then
432     AC_MSG_CHECKING([<ctype> for aix ])
433     AC_TRY_COMPILE([#include <ctype.h>],
434     [int
435     foo (int a)
436     { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
437         + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
438         + _VALC('a') + _IS('c', 0);}], \
439     ctype_aix=yes, ctype_aix=no)
440     AC_MSG_RESULT($ctype_aix)
441     if test $ctype_aix = "yes"; then
442       ctype_include_dir="config/aix"
443       ctype_default=no
444     fi
445     fi
446
447     dnl Test for <ctype> functionality -- newlib
448     if test $ctype_default = "yes"; then
449     AC_MSG_CHECKING([<ctype> for newlib ])
450     AC_TRY_COMPILE([#include <ctype.h>],
451     [int
452     foo (int a)
453     { return _U + _L + _N + _S + _P + _C + _X + _B \
454         + _ctype_[a];}], \
455     ctype_newlib=yes, ctype_newlib=no)
456     AC_MSG_RESULT($ctype_newlib)
457     if test $ctype_newlib = "yes"; then
458       ctype_include_dir="config/newlib"
459       ctype_default=no
460     fi
461     fi
462
463     if test $ctype_default = "yes"; then
464       ctype_include_dir="config/generic"
465       AC_MSG_WARN("Using default ctype headers.")
466     fi
467     AC_SUBST(ctype_include_dir)
468   ])
469 ])
470
471
472 dnl
473 dnl Check to see what the underlying c library or math library is like.
474 dnl
475 dnl Define HAVE_CARGF etc if "cargf" is found.
476 dnl
477 dnl GLIBCPP_CHECK_MATH_SUPPORT
478 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
479   AC_CHECK_LIB(m, sin, libm="-lm")
480   save_LIBS="$LIBS"
481   LIBS="$LIBS $libm"
482
483   dnl Check for complex versions of math functions of platform.
484   AC_CHECK_HEADERS([complex.h])
485   AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf c_log c_logf \
486   clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt csqrtf \
487   ctan ctanf ctanh ctanhf \
488   carg cargf nan hypot hypotf atan2f expf copysignf)
489
490   dnl We compile the long double complex functions only if the function 
491   dnl provides the non-complex long double functions.
492   USE_LONG_DOUBLE=no
493   AC_CHECK_FUNC(copysignl,
494   USE_LONG_DOUBLE=yes
495   AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl cpowl csinhl csinl \
496   csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l))
497   AC_SUBST(USE_LONG_DOUBLE)
498
499   dnl Check to see if basic C math functions have faster float versions.
500   AC_CHECK_FUNCS(modf isnan isnanf isnanl isinf isinff isinfl copysign \
501   copysignl cosf coshf logf log10f powf sinf sinhf sqrtf tanf tanhf \
502   strtof strtold fabsf sincos sincosf sincosl finite finite fqfinite \
503   fpclass qfpclass)
504
505 #Some runtimes have these functions with a preceding underscore. Please
506 # keep this sync'd with the one above. And if you add any new symbol,
507 # please add the corresponding block in the @BOTTOM@ section of
508 # acconfig.h.
509 AC_CHECK_FUNCS(_modf _isnan _isnanf _isnanl _isinf _isinff _isinfl _copysign \
510 _copysignl _cosf _coshf _logf _log10f _powf _sinf _sinhf _sqrtf _tanf _tanhf \
511 _strtof _strtold _fabsf _sincos _sincosf _sincosl _finite _finitef _qfinite \
512 _fpclass _qfpclass)
513
514 LIBS="$save_LIBS"
515 ])
516
517
518 dnl
519 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
520 dnl
521 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found 
522 dnl Define _GLIBCPP_NEED_MBSTATE_T if mbstate_t is not in wchar.h
523 dnl
524 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
525 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
526
527   dnl Sanity check for existence of ISO C9X headers for extended encoding.
528   AC_CHECK_HEADER(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
529   AC_CHECK_HEADER(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
530         
531   dnl Only continue checking if the ISO C9X headers exist.
532   if test x"$ac_has_wchar_h" = xyes && test x"$ac_has_wctype_h" = xyes; then
533
534     dnl Test wchar.h for mbstate_t, which is needed for char_traits and others.
535     AC_MSG_CHECKING([for mbstate_t])
536     AC_TRY_COMPILE([#include <wchar.h>],
537     [mbstate_t teststate;], 
538     use_native_mbstatet=yes, use_native_mbstatet=no)
539     AC_MSG_RESULT($use_native_mbstatet)
540     if test x"$use_native_mbstatet" = xno; then
541       AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
542     fi
543   
544     dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
545     dnl numeric_limits can instantiate type_traits<wchar_t>
546     AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
547     AC_TRY_COMPILE([#include <wchar.h>],
548     [int i = WCHAR_MIN; int j = WCHAR_MAX;], 
549     has_wchar_minmax=yes, has_wchar_minmax=no)
550     AC_MSG_RESULT($has_wchar_minmax)
551   
552     dnl Test wchar.h for WEOF, which is what we use to determine whether
553     dnl to specialize for char_traits<wchar_t> or not.
554     AC_MSG_CHECKING([for WEOF])
555     AC_TRY_COMPILE([
556       #include <wchar.h>
557       #include <stddef.h>],
558     [wint_t i = WEOF;],
559     has_weof=yes, has_weof=no)
560     AC_MSG_RESULT($has_weof)
561
562     dnl Tests for wide character functions used in char_traits<wchar_t>.
563     AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset, ac_wfuncs=yes, ac_wfuncs=no)
564
565     AC_MSG_CHECKING([for ISO C9X wchar_t support])
566     if test x"$has_weof" = xyes && test x"$has_wchar_minmax" = xyes && test x"$ac_wfuncs" = xyes; then
567       ac_isoC9X_wchar_t=yes
568     else
569       ac_isoC9X_wchar_t=no
570     fi
571     AC_MSG_RESULT($ac_isoC9X_wchar_t)
572
573     dnl Use iconv for wchar_t to char conversions. As such, check for 
574     dnl X/Open Portability Guide, version 2 features (XPG2).
575     AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
576     AC_CHECK_FUNCS(iconv_open iconv_close iconv, ac_XPG2funcs=yes, ac_XPG2funcs=no)
577
578     AC_MSG_CHECKING([for XPG2 wchar_t support])
579     if test x"$ac_has_iconv_h" = xyes && test x"$ac_XPG2funcs" = xyes; then
580       ac_XPG2_wchar_t=yes
581     else
582       ac_XPG2_wchar_t=no
583     fi
584     AC_MSG_RESULT($ac_XPG2_wchar_t)
585
586     dnl At the moment, only enable wchar_t specializations if all the
587     dnl above support is present.
588     AC_MSG_CHECKING([for enabled wchar_t specializations])
589     if test x"$ac_isoC9X_wchar_t" = xyes && test x"$ac_XPG2_wchar_t" = xyes; then
590       libinst_wstring_la="libinst-wstring.la"
591       AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
592       AC_MSG_RESULT("yes")
593     else
594       libinst_wstring_la=""
595       AC_MSG_RESULT("no")
596     fi
597     AC_SUBST(libinst_wstring_la)
598
599   else
600     AC_MSG_WARN([<wchar.h> not found])
601     AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
602   fi
603 ])
604
605
606 dnl
607 dnl Check to see if this version of GNU C++ is afflicted by bugs in
608 dnl __complex__ float support.
609 dnl
610 dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
611 dnl
612 dnl GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT
613 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT, [
614   AC_REQUIRE([AC_PROG_CXX])
615   AC_MSG_CHECKING([for GNU C++ __complex__ float support])
616   AC_CACHE_VAL(glibcpp_cv_float_complex, [
617     AC_LANG_SAVE
618     AC_LANG_CPLUSPLUS
619     rm -f conftest.h
620     cat > conftest.h <<EOB
621       //
622       // Check for buggy __complex__ that causes ICE in most versions of egcs
623       // and gcc-2.95.x on certain platforms (eg., x86-win32).
624       //
625       // See http://egcs.cygnus.com/ml/gcc-bugs/1999-07/msg00845.html for
626       // more info on the bug itself.
627       //
628       struct
629       float_complex
630       {
631        __complex__ float m_value;
632        float_complex (float = 0.0f, float = 0.0f);
633        float_complex (__complex__ float val) : m_value (val) {}
634        float_complex foo (const float_complex &val)
635          { return float_complex (~val.m_value); }
636       };
637 EOB
638     AC_TRY_COMPILE([#include "conftest.h"], ,
639       glibcpp_cv_float_complex=ok,
640       glibcpp_cv_float_complex=buggy
641     )
642     AC_LANG_RESTORE
643   ])
644   AC_MSG_RESULT($glibcpp_cv_float_complex)
645   if test $glibcpp_cv_float_complex = buggy; then
646     AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
647   fi
648 ])
649
650
651 dnl
652 dnl 
653 dnl Check to see if this version of GNU C++ is afflicted by bugs in 
654 dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
655 dnl gcc-2.95.x when using the library, unless we define the default copy
656 dnl ctor in the specializations of complex<>. 
657 dnl 
658 dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
659 dnl
660 dnl GLIBCPP_CHECK_COMPLEX_SUPPORT
661 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_SUPPORT, [
662   AC_REQUIRE([AC_PROG_CXX])
663   AC_MSG_CHECKING([for GNU C++ __complex__ support])
664   AC_CACHE_VAL(glibcpp_cv_complex, [
665     AC_LANG_SAVE
666     AC_LANG_CPLUSPLUS
667     AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
668                     dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
669                     [ dcomplex x; f(x); ],
670       glibcpp_cv_complex=ok,
671       glibcpp_cv_complex=buggy
672     )
673     AC_LANG_RESTORE
674   ])
675   AC_MSG_RESULT($glibcpp_cv_complex)
676   if test $glibcpp_cv_complex = buggy; then
677     AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
678   fi
679 ])
680
681
682 dnl
683 dnl Check for special debugging mode; not for production use.
684 dnl
685 dnl GLIBCPP_ENABLE_DEBUG
686 dnl --enable-debug sets '-ggdb -O0'.
687 dnl --disable-debug sets '-g' and whatever optimization options the
688 dnl     compiler can handle.
689 dnl  +  Perhaps --enable-maintainer-mode should automatically turn this on?
690 dnl  +  Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
691 dnl  +  Usage:  GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
692 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
693 dnl       defaults to `no'.
694 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
695 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
696 AC_ARG_ENABLE(debug,
697 changequote(<<, >>)dnl
698 <<  --enable-debug          extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
699 changequote([, ])dnl
700 [case "$enableval" in
701  yes) enable_debug=yes ;;
702  no)  enable_debug=no ;;
703  *)   AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
704  esac],
705 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
706 dnl Option parsed, now set things appropriately
707 case "$enable_debug" in
708     yes) 
709         DEBUGFLAGS='-O0 -ggdb'                  
710         ;;
711     no)   
712         DEBUGFLAGS='-g'
713         ;;
714 esac
715 AC_SUBST(DEBUGFLAGS)
716 ])
717
718
719 dnl
720 dnl Check for "unusual" flags to pass to the compiler while building.
721 dnl
722 dnl GLIBCPP_ENABLE_CXX_FLAGS
723 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
724 dnl     experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
725 dnl     Somehow this same set of flags must be passed when [re]building
726 dnl     libgcc.
727 dnl --disable-cxx-flags passes nothing.
728 dnl  +  See http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00131.html
729 dnl         http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00284.html
730 dnl         http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00035.html
731 dnl  +  Usage:  GLIBCPP_ENABLE_CXX_FLAGS(default flags)
732 dnl       If "default flags" is an empty string (or "none"), the effect is
733 dnl       the same as --disable or --enable=no.
734 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
735 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
736 AC_ARG_ENABLE(cxx-flags,
737 changequote(<<, >>)dnl
738 <<  --enable-cxx-flags=FLAGS      pass compiler FLAGS when building library;
739                                 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
740 changequote([, ])dnl
741 [case "x$enableval" in
742  xyes)   AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
743  xno|x)  enable_cxx_flags='' ;;
744  *)      enable_cxx_flags="$enableval" ;;
745  esac],
746 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')dnl
747 dnl Thinko on my part during design.  This kludge is the workaround.
748 if test "$enable_cxx_flags" = "none"; then enable_cxx_flags=''; fi
749 dnl Run through flags (either default or command-line) and set anything
750 dnl extra (e.g., #defines) that must accompany particular g++ options.
751 if test -n "$enable_cxx_flags"; then
752     for f in $enable_cxx_flags; do
753         case "$f" in
754             -fhonor-std)  ;;
755             -*)  ;;
756             *)   # and we're trying to pass /what/ exactly?
757                  AC_MSG_ERROR([compiler flags start with a -]) ;;
758         esac
759     done
760 fi
761 EXTRA_CXX_FLAGS="$enable_cxx_flags"
762 AC_SUBST(EXTRA_CXX_FLAGS)
763 ])
764
765
766 dnl
767 dnl Check for instructions to automatically rebuild libgcc.a.  Requires,
768 dnl of course, the location of the gcc objdir.  Note that if --disable-
769 dnl namespaces is in effect, rebuilding libgcc.a is an expensive no-op.
770 dnl
771 dnl GLIBCPP_ENABLE_RELIBGCC
772 dnl --enable-libgcc-rebuild=/absolute/path/to/gcc/objdir sets GCC_OBJDIR
773 dnl     (presumably in the top-level Makefile) to /absol.../objdir
774 dnl --disable-libgcc-rebuild will not touch libgcc.a at all (maybe print
775 dnl     a warning if this is given along with --enable-namespaces), by
776 dnl     setting GCC_OBJDIR to `no'.
777 dnl  +  Doing this by default is going to be interesting.  What default
778 dnl     "on" value can there be?
779 dnl  +  Usage:  GLIBCPP_ENABLE_RELIBGCC[(DEFAULT)]
780 dnl       The default path should be ../.. if bundled with GCC source.
781 dnl       If ommitted, it defaults to `no'.
782 dnl
783 AC_DEFUN(GLIBCPP_ENABLE_RELIBGCC, [dnl
784 define([GLIBCPP_ENABLE_RELIBGCC_DEFAULT], ifelse($1,, no, $1))dnl
785 AC_ARG_ENABLE(libgcc-rebuild,
786 changequote(<<, >>)dnl
787 <<  --enable-libgcc-rebuild=DIR     also rebuild libgcc.a; DIR is
788                                   the GCC objdir; see install.html>>,
789 changequote([, ])dnl
790 [case "$enableval" in
791  yes) AC_MSG_ERROR([--enable-libgcc-rebuild needs a pathname]) ;;
792  no)  enable_libgcc_rebuild=no ;;
793  *)   if test -d "$enableval" && test -d "${enableval}/gcc" && \
794          test -d "${enableval}/libiberty"
795       then
796          enable_libgcc_rebuild="$enableval"
797       else
798          AC_MSG_ERROR(["$enableval" does not appear to be the GCC objdir])
799       fi
800       ;;
801  esac],
802 enable_libgcc_rebuild=GLIBCPP_ENABLE_RELIBGCC_DEFAULT)dnl
803 GCC_OBJDIR="$enable_libgcc_rebuild"
804 AC_SUBST(GCC_OBJDIR)
805 ])
806
807
808 dnl
809 dnl Check for which I/O library to use:  libio, or something specific.
810 dnl
811 dnl GLIBCPP_ENABLE_CSTDIO
812 dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
813 dnl 
814 dnl default is libio
815 dnl
816 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
817   AC_MSG_CHECKING([for cstdio to use])
818   AC_ARG_ENABLE(cstdio,
819   [  --enable-cstdio         enable GNU libio for target io package. (default)
820   --enable-cstdio=LIB     use LIB target-speific io package.], 
821   if test x$enable_cstdio = xno; then
822     enable_cstdio=libio
823   fi,
824      enable_cstdio=libio)
825
826   enable_cstdio_flag=$enable_cstdio
827
828   dnl Check if a valid thread package
829   case x${enable_cstdio_flag} in
830         xlibio | x | xno | xnone | xyes)
831                 # default
832                 CSTDIO_H=c_io_libio.h
833                 CSTDIO_CC=c_io_libio.cc
834                 AC_MSG_RESULT(libio)
835
836                 # see if we are on a system with libio native (ie, linux)
837                 AC_CHECK_HEADER(libio.h,  has_libio=yes, has_libio=no)
838                 if test $has_libio = "yes"; then
839                   BUILD_LIBIO_INCLUDE=
840                   need_libio=no
841                 else
842                   BUILD_LIBIO_INCLUDE='-I../libio'
843                   need_libio=yes
844                 fi
845                 AC_SUBST(BUILD_LIBIO_INCLUDE)
846
847                 # see if the _G_config.h header needs to be built. 
848                 # NB: This replaces the _G_CONFIG_H machinery in libio-v2
849                 AC_CHECK_HEADER(_G_config.h,  has_gconf_h=yes, has_gconf_h=no)
850                 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO_CONFIG_H, test "$has_gconf_h" = no)
851                 ;;
852         xwince)
853                 CSTDIO_H=c_io_wince.h
854                 CSTDIO_CC=c_io_wince.cc
855                 AC_MSG_RESULT(wince)
856
857                 need_libio=no
858                 BUILD_LIBIO_INCLUDE=
859                 AC_SUBST(BUILD_LIBIO_INCLUDE)
860                 ;;
861         *)
862                 echo "$enable_cstdio is an unknown io package" 1>&2
863                 exit 1
864                 ;;
865   esac
866   AC_SUBST(CSTDIO_H)
867   AC_SUBST(CSTDIO_CC)
868   AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
869 ])
870
871
872 dnl
873 dnl Check for which threading library to use.
874 dnl
875 dnl GLIBCPP_ENABLE_THREADS
876 dnl --enable-threads=posix sets config/threads-posix.h et. al.
877 dnl 
878 dnl default is no threads
879 dnl
880 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
881   dnl Note this comes from the gcc/config.in and libjava/config.in
882   dnl Efforts should be made to keep this in sync.
883   AC_MSG_CHECKING([for threads package to use])
884   AC_ARG_ENABLE(threads,
885   [  --enable-threads        enable thread usage for target GCC.
886   --enable-threads=LIB    use LIB thread package for target GCC.],
887   if test x$enable_threads = xno; then
888     enable_threads=''
889   fi,
890     enable_threads='')
891
892   enable_threads_flag=$enable_threads
893
894   dnl Check if a valid thread package
895   case x${enable_threads_flag} in
896         x | xno | xnone)
897                 # No threads
898                 target_thread_file='single'
899                 ;;
900         xyes)
901                 # default
902                 target_thread_file=''
903                 ;;
904         xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
905         xsolaris | xwin32 | xdce | xvxworks)
906                 target_thread_file=$enable_threads_flag
907                 ;;
908         *)
909                 echo "$enable_threads is an unknown thread package" 1>&2
910                 exit 1
911                 ;;
912   esac
913
914   dnl Check for thread package actually supported in libstdc++ 
915   case "$target_thread_file" in
916     no | none | single)
917       THREADS=none
918       ;;
919     posix | pthreads)
920       THREADS=posix
921       case "$host" in
922         *-*-linux*)
923         ;;
924       esac
925       ;;
926     decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
927       AC_MSG_ERROR(thread package $THREADS not yet supported)
928       ;;
929     *)
930       AC_MSG_ERROR($THREADS is an unknown thread package)
931       ;;
932   esac
933   AC_MSG_RESULT($THREADS)
934
935   THREADLIBS=
936   THREADINCS=
937   THREADDEPS=
938   THREADOBJS=
939   THREADH=
940   THREADSPEC=
941   case "$THREADS" in
942     posix)
943       AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
944       THREADLIBS=-lpthread
945       THREADSPEC=-lpthread
946       dnl Not presently used
947       dnl THREADOBJS=threads-posix.lo
948       THREADH=threads-posix.h
949       ;;
950     none)
951       dnl Not presently used
952       dnl THREADOBJS=threads-no.lo
953       THREADH=threads-no.h
954       ;;
955   esac
956   AC_SUBST(THREADLIBS)
957   AC_SUBST(THREADINCS)
958   AC_SUBST(THREADDEPS)
959   AC_SUBST(THREADOBJS)
960   AC_SUBST(THREADSPEC)
961 ])
962
963
964 dnl
965 dnl Check for template specializations for the 'long long' type extension.
966 dnl
967 dnl GLIBCPP_ENABLE_LONG_LONG
968 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
969 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
970 dnl  +  Usage:  GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
971 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
972 dnl       defaults to `no'.
973 dnl  +  If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
974 dnl
975 dnl GLIBCPP_ENABLE_LONG_LONG
976 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
977   define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
978
979   AC_ARG_ENABLE(long-long,
980   changequote(<<, >>)dnl
981   <<--enable-long-long      turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
982   changequote([, ])dnl
983   [case "$enableval" in
984    yes) enable_long_long=yes ;;
985    no)  enable_long_long=no ;;
986    *)   AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
987    esac],
988   enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
989
990   # Check for the existance of functions used if long long is enabled.
991   AC_CHECK_FUNC(strtoll,,ac_strtoll=no)
992   AC_CHECK_FUNC(strtoull,,ac_strtoull=no)
993
994   AC_MSG_CHECKING([for enabled long long])
995   if test x"$ac_strtoll" = xno || test x"$ac_strtoull" = xno; then 
996     enable_long_long=no; 
997   fi; 
998   AC_MSG_RESULT($enable_long_long)
999
1000   dnl Option parsed, now set things appropriately
1001   case "$enable_long_long" in
1002     yes)  AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1003           ;;
1004   esac
1005 ])
1006
1007
1008 dnl
1009 dnl Check for whether or not to do shadowed C headers.
1010 dnl
1011 dnl GLIBCPP_ENABLE_SHADOW
1012 dnl --enable-cshadow-headers [does stuff].
1013 dnl --disable-cshadow-headers [does not do stuff].
1014 dnl  +  This will eventually need to be on by default.
1015 dnl  +  Usage:  GLIBCPP_ENABLE_SHADOW[(DEFAULT)]
1016 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
1017 dnl       defaults to `no'.
1018 AC_DEFUN(GLIBCPP_ENABLE_SHADOW, [dnl
1019 define([GLIBCPP_ENABLE_SHADOW_DEFAULT], ifelse($1, yes, yes, no))dnl
1020 AC_MSG_CHECKING([for enabled cshadow headers])
1021 AC_ARG_ENABLE(cshadow-headers,
1022 changequote(<<, >>)dnl
1023 <<  --enable-cshadow-headers construct "shadowed" C header files for
1024                            g++ [default=>>GLIBCPP_ENABLE_SHADOW_DEFAULT],
1025 changequote([, ])dnl
1026 [case "$enableval" in
1027  yes) enable_cshadow_headers=yes 
1028         ;;
1029  no)  enable_cshadow_headers=no 
1030         ;;
1031  *)   AC_MSG_ERROR([Unknown argument to enable/disable shadowed C headers]) 
1032         ;;
1033  esac],
1034 enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)dnl
1035 AC_MSG_RESULT($enable_cshadow_headers)
1036 dnl Option parsed, now set things appropriately
1037 case "$enable_cshadow_headers" in
1038     yes) 
1039         CSHADOWFLAGS="-D_ISOC9X_SOURCE"
1040         CSHADOW_INCLUDES=" -I$srcdir/shadow -I$blddir/cshadow"
1041         ;;
1042     no)   
1043         CSHADOWFLAGS=""
1044         CSHADOW_INCLUDES=""
1045         ;;
1046 esac
1047
1048 AC_SUBST(CSHADOWFLAGS)
1049 AC_SUBST(CSHADOW_INCLUDES)
1050 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cshadow_headers" = yes)
1051 ])
1052
1053
1054 # Check whether LC_MESSAGES is available in <locale.h>.
1055 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1056 #
1057 # This file file be copied and used freely without restrictions.  It can
1058 # be used in projects which are not available under the GNU Public License
1059 # but which still want to provide support for the GNU gettext functionality.
1060 # Please note that the actual code is *not* freely available.
1061
1062 # serial 1
1063
1064 AC_DEFUN(AC_LC_MESSAGES,
1065   [if test $ac_cv_header_locale_h = yes; then
1066     AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1067       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1068        ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1069     if test $ac_cv_val_LC_MESSAGES = yes; then
1070       AC_DEFINE(HAVE_LC_MESSAGES)
1071     fi
1072   fi])
1073
1074
1075 # Check for functions in math library.
1076 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1077 #
1078 # This file can be copied and used freely without restrictions.  It can
1079 # be used in projects which are not available under the GNU Public License
1080 # but which still want to provide support for the GNU gettext functionality.
1081 # Please note that the actual code is *not* freely available.
1082
1083 # serial 1
1084
1085 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1086 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1087 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1088 AC_SUBST(LIBMATHOBJS)dnl
1089 ])
1090
1091
1092 # Check for string functions.
1093 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1094 #
1095 # This file can be copied and used freely without restrictions.  It can
1096 # be used in projects which are not available under the GNU Public License
1097 # but which still want to provide support for the GNU gettext functionality.
1098 # Please note that the actual code is *not* freely available.
1099
1100 # serial 1
1101
1102 dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1103 AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1104 [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1105 AC_SUBST(LIBSTRINGOBJS)dnl
1106 ])