OSDN Git Service

Replace inclusion of <stdio.h> with "system.h"
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4
2
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 dnl
14 dnl Initialize configure bits.
15 dnl
16 dnl Define OPTLEVEL='-O2' if new inlining code present.
17 dnl
18 dnl GLIBCPP_CONFIGURE
19 AC_DEFUN(GLIBCPP_CONFIGURE, [
20   dnl Default to --enable-multilib
21   AC_ARG_ENABLE(multilib,
22   [  --enable-multilib       build hella library versions (default)],
23   [case "${enableval}" in
24     yes) multilib=yes ;;
25     no)  multilib=no ;;
26     *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
27    esac], [multilib=yes])dnl
28
29   dnl We may get other options which we dont document:
30   dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
31   if test "[$]{srcdir}" = "."; then
32     if test "[$]{with_target_subdir}" != "."; then
33       glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
34     else
35       glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
36     fi
37   else
38     glibcpp_basedir="[$]{srcdir}/$1"
39   fi
40   AC_SUBST(glibcpp_basedir)
41
42   AC_CANONICAL_HOST
43
44   AM_INIT_AUTOMAKE(libstdc++, 2.90.8)
45
46 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
47 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
48 # are probably using a cross compiler, which will not be able to fully
49 # link an executable.  This should really be fixed in autoconf
50 # itself.
51
52 AC_DEFUN(LIB_AC_PROG_CC,
53 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
54 dnl Fool anybody using AC_PROG_CC.
55 AC_PROVIDE([AC_PROG_CC])
56 AC_CHECK_PROG(CC, gcc, gcc)
57 if test -z "$CC"; then
58   AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
59   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
60 fi
61
62 AC_PROG_CC_GNU
63
64 if test $ac_cv_prog_gcc = yes; then
65   GCC=yes
66 dnl Check whether -g works, even if CFLAGS is set, in case the package
67 dnl plays around with CFLAGS (such as to build both debugging and
68 dnl normal versions of a library), tasteless as that idea is.
69   ac_test_CFLAGS="${CFLAGS+set}"
70   ac_save_CFLAGS="$CFLAGS"
71   CFLAGS=
72   AC_PROG_CC_G
73   if test "$ac_test_CFLAGS" = set; then
74     CFLAGS="$ac_save_CFLAGS"
75   elif test $ac_cv_prog_cc_g = yes; then
76     CFLAGS="-g -O2"
77   else
78     CFLAGS="-O2"
79   fi
80 else
81   GCC=
82   test "${CFLAGS+set}" = set || CFLAGS="-g"
83 fi
84 ])
85
86 LIB_AC_PROG_CC
87
88 # Likewise for AC_PROG_CXX.
89 AC_DEFUN(LIB_AC_PROG_CXX,
90 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
91 dnl Fool anybody using AC_PROG_CXX.
92 AC_PROVIDE([AC_PROG_CXX])
93 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
94 test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
95
96 AC_PROG_CXX_GNU
97
98 if test $ac_cv_prog_gxx = yes; then
99   GXX=yes
100 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
101 dnl plays around with CXXFLAGS (such as to build both debugging and
102 dnl normal versions of a library), tasteless as that idea is.
103   ac_test_CXXFLAGS="${CXXFLAGS+set}"
104   ac_save_CXXFLAGS="$CXXFLAGS"
105   CXXFLAGS=
106   AC_PROG_CXX_G
107   if test "$ac_test_CXXFLAGS" = set; then
108     CXXFLAGS="$ac_save_CXXFLAGS"
109   elif test $ac_cv_prog_cxx_g = yes; then
110     CXXFLAGS="-g -O2"
111   else
112     CXXFLAGS="-O2"
113   fi
114 else
115   GXX=
116   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
117 fi
118 ])
119
120 LIB_AC_PROG_CXX
121
122 # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we dont
123 # run it explicitly here, it will be run implicitly before
124 # LIBGCJ_CONFIGURE, which doesn't work because that means that it will
125 # be run before AC_CANONICAL_HOST.
126 AC_CANONICAL_BUILD
127
128 AC_CHECK_TOOL(AS, as)
129 AC_CHECK_TOOL(AR, ar)
130 AC_CHECK_TOOL(RANLIB, ranlib, :)
131
132 AC_PROG_INSTALL
133
134 AM_MAINTAINER_MODE
135
136 # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
137 # at least currently, we never actually build a program, so we never
138 # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
139 # fails, because we are probably configuring with a cross compiler
140 # which cant create executables.  So we include AC_EXEEXT to keep
141 # automake happy, but we dont execute it, since we dont care about
142 # the result.
143 if false; then
144   AC_EXEEXT
145 fi
146
147 # configure.host sets the following important variables
148 #       glibcpp_cflags    - host specific C compiler flags
149 #       glibcpp_cxxflags  - host specific C++ compiler flags
150
151 glibcpp_cflags=
152 glibcpp_cxxflags=
153
154 . [$]{glibcpp_basedir}/configure.host
155
156 case [$]{glibcpp_basedir} in
157 /* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
158 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
159 esac
160
161 GLIBCPP_CFLAGS="[$]{glibcpp_cflags}"
162 GLIBCPP_CXXFLAGS="[$]{glibcpp_cxxflags}"
163 AC_SUBST(GLIBCPP_CFLAGS)
164 AC_SUBST(GLIBCPP_CXXFLAGS)
165 ])
166
167
168 dnl
169 dnl Check to see if g++ can compile this library. 
170 dnl
171 dnl Define OPTLEVEL='-O2' if new inlining code present.
172 dnl
173 dnl GLIBCPP_CHECK_COMPILER_VERSION
174 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
175   AC_MSG_CHECKING([for g++ that will successfullly compile this code])
176   AC_EGREP_CPP([ok], [
177   #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) 
178     ok
179   #endif
180   ], gpp_satisfactory=yes, AC_MSG_ERROR("please upgrade to gcc-2.95 or above"))
181   AC_MSG_RESULT($gpp_satisfactory)
182
183   AC_MSG_CHECKING([for g++ that supports new inlining mechanism])
184   AC_EGREP_CPP([ok], [
185   #if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
186     ok
187   #endif
188   ], [OPTLEVEL='-O2'
189       WERRORSUPPRESS=
190   ], [OPTLEVEL=
191       WERRORSUPPRESS=-Wno-error
192   ])
193   if test "$OPTLEVEL" = ""; then
194     AC_MSG_RESULT(no)
195   else
196     AC_MSG_RESULT(yes)
197   fi
198   AC_SUBST(OPTLEVEL)
199   AC_SUBST(WERRORSUPPRESS)
200 ])
201
202
203 dnl
204 dnl Check to see what builtin math functions are supported
205 dnl
206 dnl Define _GLIBCPP_HAS_BUILTIN_SINF if __builtin_sinf
207 dnl Define _GLIBCPP_HAS_BUILTIN_COSF if __builtin_cosf
208 dnl Define _GLIBCPP_HAS_BUILTIN_FABSF if __builtin_fabsf
209 dnl Define _GLIBCPP_HAS_BUILTIN_SQRTF if __builtin_sqrtf
210 dnl
211 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
212 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
213   dnl Test for builtin math functions.
214   AC_MSG_CHECKING([for __builtin_sinf])
215   AC_TRY_COMPILE([#include <math.h>], 
216   [float foo(void) { __builtin_sinf(0.0); }], 
217   use_builtin_sinf=yes, use_builtin_sinf=no)
218   AC_MSG_RESULT($use_builtin_sinf)
219   if test $use_builtin_sinf = "yes"; then
220     AC_DEFINE(_GLIBCPP_HAS_BUILTIN_SINF)
221   fi
222
223   AC_MSG_CHECKING([for __builtin_cosf])
224   AC_TRY_COMPILE([#include <math.h>], 
225   [float foo(void) { __builtin_cosf(0.0); }], 
226   use_builtin_cosf=yes, use_builtin_cosf=no)
227   AC_MSG_RESULT($use_builtin_cosf)
228   if test $use_builtin_cosf = "yes"; then
229     AC_DEFINE(_GLIBCPP_HAS_BUILTIN_COSF)
230   fi
231
232   AC_MSG_CHECKING([for __builtin_fabsf])
233   AC_TRY_COMPILE([#include <math.h>], 
234   [float foo(void) { __builtin_fabsf(0.0); }], 
235   use_builtin_fabsf=yes, use_builtin_fabsf=no)
236   AC_MSG_RESULT($use_builtin_fabsf)
237   if test $use_builtin_fabsf = "yes"; then
238     AC_DEFINE(_GLIBCPP_HAS_BUILTIN_FABSF)
239   fi
240
241   AC_MSG_CHECKING([for __builtin_sqrtf])
242   AC_TRY_COMPILE([#include <math.h>], 
243   [float foo(void) { __builtin_sqrtf(0.0); }], 
244   use_builtin_sqrtf=yes, use_builtin_sqrtf=no)
245   AC_MSG_RESULT($use_builtin_sqrtf)
246   if test $use_builtin_sqrtf = "yes"; then
247     AC_DEFINE(_GLIBCPP_HAS_BUILTIN_SQRTF)
248   fi
249 ])
250
251
252 dnl
253
254 dnl Check to see what architecture we are compiling for. If it's
255 dnl supported, use special hand-crafted routines to provide thread
256 dnl primitives. Also, if architecture-specific flags are required for 
257 dnl compilation, add them here.
258 dnl 
259 dnl Depending on what is found, select configure/cpu/*/bits/atomicity.h 
260 dnl If not found, select configure/cpu/generic/bits/atomicity.h
261 dnl
262 dnl GLIBCPP_CHECK_CPU
263 AC_DEFUN(GLIBCPP_CHECK_CPU, [
264     AC_MSG_CHECKING([for cpu primitives directory])
265     CPUFLAGS=                   
266     case "$target_cpu" in
267       alpha*)
268         cpu_include_dir="config/cpu/alpha"
269         ;;
270       arm*)
271         cpu_include_dir="config/cpu/arm"
272         ;;
273       i486 | i586 | i686 | i786)
274         cpu_include_dir="config/cpu/i386"
275         ;;
276       powerpc | rs6000)
277         cpu_include_dir="config/cpu/powerpc"
278         CPUFLAGS='-mnew-mnemonics -Wa,-mppc -mpowerpc'
279         ;;
280       sparc64 | ultrasparc)
281         cpu_include_dir="config/cpu/sparc/sparc64"
282         ;;
283       sparc*)
284         cpu_include_dir="config/cpu/sparc/sparc32"
285         ;;
286       *)
287         cpu_include_dir="config/cpu/generic"
288         ;;
289     esac
290     AC_MSG_RESULT($cpu_include_dir)
291     AC_SUBST(cpu_include_dir)
292     AC_SUBST(CPUFLAGS)
293 ])
294
295  
296 dnl
297 dnl Check to see what the underlying c library's interface to ctype looks
298 dnl like. Bits of locale rely on things like isspace, toupper, etc. This
299 dnl stuff makes sure the right bits from the clibrary get called.
300 dnl 
301 dnl Depending on what is found, select various configure/*/bits/ctype_base.h 
302 dnl Depending on what is found, select various configure/*/ctype.cc
303 dnl
304 dnl GLIBCPP_CHECK_CTYPE
305 AC_DEFUN(GLIBCPP_CHECK_CTYPE, [
306   AC_CHECK_HEADER(ctype.h, [
307     
308     dnl If doesn't match any specified, go with defaults.
309     ctype_default=yes
310
311     dnl Test for <ctype> functionality -- gnu-linux
312     AC_MSG_CHECKING([for gnu-linux <ctype>])
313     AC_TRY_COMPILE([#include <ctype.h>],
314     [int
315     foo (int a)
316     { return _ISspace + _ISprint + _IScntrl + _ISupper + _ISlower + _ISalpha \
317         + _ISdigit + _ISpunct + _ISxdigit + _ISalnum + _ISgraph \
318         + __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];}], \
319     ctype_linux=yes, ctype_linux=no)
320     AC_MSG_RESULT($ctype_linux)
321     if test $ctype_linux = "yes"; then
322       ctype_include_dir="config/gnu-linux"
323       ctype_default=no
324     fi
325
326     dnl Test for <ctype> functionality -- solaris 2.6 and 2.7
327     if test $ctype_default = "yes"; then
328     AC_MSG_CHECKING([for solaris 2.6 or 2.7 <ctype>])
329     AC_TRY_COMPILE([#include <ctype.h>],
330     [int
331     foo (int a)
332     { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
333         + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
334         + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}], \
335     ctype_solaris=yes, ctype_solaris=no)
336     AC_MSG_RESULT($ctype_solaris)
337
338     if test $ctype_solaris = "yes"; then
339       AC_MSG_CHECKING([  for version])
340       AC_LANG_CPLUSPLUS 
341       AC_TRY_COMPILE([#include <ctype.h>],
342       [typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;],\
343       ctype_solaris26=yes, ctype_solaris26=no)
344       AC_LANG_C
345       if test $ctype_solaris26 = "yes"; then
346         ctype_include_dir="config/solaris/solaris2.6"
347         AC_MSG_RESULT("solaris2.6")
348         ctype_default=no
349       else
350         ctype_include_dir="config/solaris/solaris2.7"
351         AC_MSG_RESULT("solaris2.7")
352         ctype_default=no
353       fi
354     fi
355     fi  
356
357     dnl Test for <ctype> functionality -- solaris 2.5.1
358     if test $ctype_default = "yes"; then
359     AC_MSG_CHECKING([for solaris 2.5.1 <ctype>])
360     AC_TRY_COMPILE([#include <ctype.h>],
361     [int
362     foo (int a)
363     { return _U + _L + _N + _S + _P + _C + _X + _B \
364         + __ctype[a];}], \
365     ctype_solaris25=yes, ctype_solaris25=no)
366     AC_MSG_RESULT($ctype_solaris25)
367     if test $ctype_solaris25 = "yes"; then
368       ctype_include_dir="config/solaris/solaris2.5"
369       ctype_default=no
370     fi
371     fi
372
373     dnl Test for <ctype> functionality -- aix
374     if test $ctype_default = "yes"; then
375     AC_MSG_CHECKING([for aix <ctype>])
376     AC_TRY_COMPILE([#include <ctype.h>],
377     [int
378     foo (int a)
379     { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
380         + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
381         + _VALC('a') + _IS('c', 0);}], \
382     ctype_aix=yes, ctype_aix=no)
383     AC_MSG_RESULT($ctype_aix)
384     if test $ctype_aix = "yes"; then
385       ctype_include_dir="config/aix"
386       ctype_default=no
387     fi
388     fi
389
390     dnl Test for <ctype> functionality -- newlib
391     if test $ctype_default = "yes"; then
392     AC_MSG_CHECKING([for newlib <ctype>])
393     AC_TRY_COMPILE([#include <ctype.h>],
394     [int
395     foo (int a)
396     { return _U + _L + _N + _S + _P + _C + _X + _B \
397         + _ctype_[a];}], \
398     ctype_newlib=yes, ctype_newlib=no)
399     AC_MSG_RESULT($ctype_newlib)
400     if test $ctype_newlib = "yes"; then
401       ctype_include_dir="config/newlib"
402       ctype_default=no
403     fi
404     fi
405
406     if test $ctype_default = "yes"; then
407       ctype_include_dir="config/generic"
408       AC_MSG_WARN("Using default ctype headers.")
409     fi
410     AC_SUBST(ctype_include_dir)
411   ])
412 ])
413
414
415 dnl
416 dnl Check to see what the underlying c library or math library is like.
417 dnl
418 dnl Define HAVE_CARGF etc if "cargf" is found.
419 dnl
420 dnl GLIBCPP_CHECK_MATH_SUPPORT
421 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
422   AC_CHECK_LIB(m, sin, libm="-lm")
423   save_LIBS="$LIBS"
424   LIBS="$LIBS $libm"
425
426   dnl Check for complex versions of math functions of platform.
427   AC_CHECK_HEADERS([complex.h])
428   AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf c_log c_logf \
429   clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt csqrtf \
430   ctan ctanf ctanh ctanhf \
431   carg cargf nan hypot hypotf atan2f expf copysignf)
432
433   dnl We compile the long double complex functions only if the function 
434   dnl provides the non-complex long double functions.
435   USE_LONG_DOUBLE=no
436   AC_CHECK_FUNC(copysignl,
437   USE_LONG_DOUBLE=yes
438   AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl cpowl csinhl csinl \
439   csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l))
440   AC_SUBST(USE_LONG_DOUBLE)
441
442   dnl Check to see if basic C math functions have faster float versions.
443   AC_CHECK_FUNCS(modf isnan isnanf isnanl isinf isinff isinfl copysign \
444   copysignl cosf coshf logf log10f powf sinf sinhf sqrtf tanf tanhf \
445   strtof strtold fabsf sincos sincosf sincosl finite finite fqfinite \
446   fpclass qfpclass)
447
448 #Some runtimes have these functions with a preceding underscore. Please
449 # keep this sync'd with the one above. And if you add any new symbol,
450 # please add the corresponding block in the @BOTTOM@ section of
451 # acconfig.h.
452 AC_CHECK_FUNCS(_modf _isnan _isnanf _isnanl _isinf _isinff _isinfl _copysign \
453 _copysignl _cosf _coshf _logf _log10f _powf _sinf _sinhf _sqrtf _tanf _tanhf \
454 _strtof _strtold _fabsf _sincos _sincosf _sincosl _finite _finitef _qfinite \
455 _fpclass _qfpclass)
456
457 LIBS="$save_LIBS"
458 ])
459
460
461 dnl
462 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
463 dnl
464 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found 
465 dnl Define _GLIBCPP_NEED_MBSTATE_T if mbstate_t is not in wchar.h
466 dnl Define _GLIBCPP_HAS_WCHAR_MIN_MAX if WCHAR_MIN, WCHAR_MAX in wchar.h
467 dnl
468 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
469 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
470   AC_CHECK_HEADER(wchar.h,[
471   dnl Test wchar.h for mbstate_t, which is needed for char_traits and others.
472   AC_MSG_CHECKING([for native mbstate_t])
473   AC_TRY_COMPILE([#include <wchar.h>],
474   [mbstate_t teststate;], 
475   use_native_mbstatet=yes, use_native_mbstatet=no)
476   AC_MSG_RESULT($use_native_mbstatet)
477   if test $use_native_mbstatet = "no"; then
478     AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
479   fi
480   
481   dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
482   dnl numeric_limits can instantiate type_traits<wchar_t>
483   AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
484   AC_TRY_COMPILE([#include <wchar.h>],
485   [int i = WCHAR_MIN; int j = WCHAR_MAX;], 
486   has_wchar_minmax=yes, has_wchar_minmax=no)
487   AC_MSG_RESULT($has_wchar_minmax)
488   if test $has_wchar_minmax = "yes"; then
489     AC_DEFINE(_GLIBCPP_HAS_WCHAR_MIN_MAX)
490   fi
491   
492   # Test wchar.h for WEOF, which is what we use to determine whether
493   # to specialize for wchar_t or not.
494   AC_MSG_CHECKING([for WEOF])
495   AC_TRY_COMPILE([
496     #include <wchar.h>
497     #include <stddef.h>],
498   [wint_t i = WEOF;],
499   has_weof=yes, has_weof=no)
500   AC_MSG_RESULT($has_weof)
501
502   dnl Tests for wide character functions.
503   AC_REPLACE_STRINGFUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset)
504   AC_SUBST(libinst_wstring_la)
505
506   AC_MSG_CHECKING([for wide character support])
507   if test $has_weof = "yes" && test $has_wchar_minmax = "yes"; then
508     libinst_wstring_la="libinst-wstring.la"
509     AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
510     AC_MSG_RESULT(ok)
511   else
512     libinst_wstring_la=""
513     AC_MSG_RESULT("not specializing for wchar_t")
514   fi
515   ],[
516   AC_MSG_WARN([<wchar.h> not found])
517   AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
518   ])
519 ])
520
521
522 dnl
523 dnl Check to see if this version of GNU C++ is afflicted by bugs in
524 dnl __complex__ float support.
525 dnl
526 dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
527 dnl
528 dnl GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT
529 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT, [
530   AC_REQUIRE([AC_PROG_CXX])
531   AC_MSG_CHECKING([for GNU C++ __complex__ float support])
532   AC_CACHE_VAL(glibcpp_cv_float_complex, [
533     AC_LANG_SAVE
534     AC_LANG_CPLUSPLUS
535     rm -f conftest.h
536     cat > conftest.h <<EOB
537       //
538       // Check for buggy __complex__ that causes ICE in most versions of egcs
539       // and gcc-2.95.x on certain platforms (eg., x86-win32).
540       //
541       // See http://egcs.cygnus.com/ml/gcc-bugs/1999-07/msg00845.html for
542       // more info on the bug itself.
543       //
544       struct
545       float_complex
546       {
547        __complex__ float m_value;
548        float_complex (float = 0.0f, float = 0.0f);
549        float_complex (__complex__ float val) : m_value (val) {}
550        float_complex foo (const float_complex &val)
551          { return float_complex (~val.m_value); }
552       };
553 EOB
554     AC_TRY_COMPILE([#include "conftest.h"], ,
555       glibcpp_cv_float_complex=ok,
556       glibcpp_cv_float_complex=buggy
557     )
558     AC_LANG_RESTORE
559   ])
560   AC_MSG_RESULT($glibcpp_cv_float_complex)
561   if test $glibcpp_cv_float_complex = buggy; then
562     AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
563   fi
564 ])
565
566
567 dnl
568 dnl 
569 dnl Check to see if this version of GNU C++ is afflicted by bugs in 
570 dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
571 dnl gcc-2.95.x when using the library, unless we define the default copy
572 dnl ctor in the specializations of complex<>. 
573 dnl 
574 dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
575 dnl
576 dnl GLIBCPP_CHECK_COMPLEX_SUPPORT
577 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_SUPPORT, [
578   AC_REQUIRE([AC_PROG_CXX])
579   AC_MSG_CHECKING([for GNU C++ __complex__ support])
580   AC_CACHE_VAL(glibcpp_cv_complex, [
581     AC_LANG_SAVE
582     AC_LANG_CPLUSPLUS
583     AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
584                     dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
585                     [ dcomplex x; f(x); ],
586       glibcpp_cv_complex=ok,
587       glibcpp_cv_complex=buggy
588     )
589     AC_LANG_RESTORE
590   ])
591   AC_MSG_RESULT($glibcpp_cv_complex)
592   if test $glibcpp_cv_complex = buggy; then
593     AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
594   fi
595 ])
596
597
598 dnl
599 dnl Check for certain special build configurations.
600 dnl
601 dnl GLIBCPP_ENABLE_DEBUG
602 dnl --enable-debug sets '-ggdb -O0'.
603 dnl --disable-debug sets '-g' and whatever optimization options the
604 dnl     compiler can handle.
605 dnl  +  Perhaps --enable-maintainer-mode should automatically turn this on?
606 dnl  +  Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
607 dnl  +  Usage:  GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
608 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
609 dnl       defaults to `no'.
610 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
611 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
612 AC_ARG_ENABLE(debug,
613 changequote(<<, >>)dnl
614 <<  --enable-debug          extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
615 changequote([, ])dnl
616 [case "$enableval" in
617  yes) enable_debug=yes ;;
618  no)  enable_debug=no ;;
619  *)   AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
620  esac],
621 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
622 dnl Option parsed, now set things appropriately
623 case "$enable_debug" in
624     yes) 
625         DEBUGFLAGS='-O0 -ggdb'                  
626         ;;
627     no)   
628         DEBUGFLAGS='-g'
629         ;;
630 esac
631 AC_SUBST(DEBUGFLAGS)
632 ])
633
634
635 dnl
636 dnl Check for certain special build configurations.
637 dnl
638 dnl GLIBCPP_ENABLE_NAMESPACES
639 dnl --enable-namespaces sets '-fhonor-std' and defines _GLIBCPP_USE_NAMESPACES
640 dnl --disable-namespaces sets '-fno-honor-std' (the macro should be
641 dnl     undefined by default in whatever.h.in).
642 dnl  +  Eventually, this will go away.
643 dnl  +  Usage:  GLIBCPP_ENABLE_NAMESPACES[(DEFAULT)]
644 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
645 dnl       defaults to `no'.
646 AC_DEFUN(GLIBCPP_ENABLE_NAMESPACES, [dnl
647 define([GLIBCPP_ENABLE_NAMESPACES_DEFAULT], ifelse($1, yes, yes, no))dnl
648 AC_ARG_ENABLE(namespaces,
649 changequote(<<, >>)dnl
650 <<  --enable-namespaces     turns on 'std' [default=>>GLIBCPP_ENABLE_NAMESPACES_DEFAULT],
651 changequote([, ])dnl
652 [case "$enableval" in
653  yes) enable_namespaces=yes ;;
654  no)  enable_namespaces=no ;;
655  *)   AC_MSG_ERROR([Unknown argument to enable/disable namespaces]) ;;
656  esac],
657 enable_namespaces=GLIBCPP_ENABLE_NAMESPACES_DEFAULT)dnl
658 dnl Option parsed, now set things appropriately
659 case "$enable_namespaces" in
660     yes)  NAMESPACES='-fhonor-std'
661           AC_DEFINE(_GLIBCPP_USE_NAMESPACES)
662           ;;
663     no)   NAMESPACES='-fno-honor-std'
664           ;;
665 esac
666 AC_SUBST(NAMESPACES)
667 ])
668
669
670 dnl
671 dnl Check for instructions to automatically rebuild libgcc.a.  Requires,
672 dnl of course, the location of the gcc objdir.  Note that if --disable-
673 dnl namespaces is in effect, rebuilding libgcc.a is an expensive no-op.
674 dnl
675 dnl GLIBCPP_ENABLE_RELIBGCC
676 dnl --enable-libgcc-rebuild=/absolute/path/to/gcc/objdir sets GCC_OBJDIR
677 dnl     (presumably in the top-level Makefile) to /absol.../objdir
678 dnl --disable-libgcc-rebuild will not touch libgcc.a at all (maybe print
679 dnl     a warning if this is given along with --enable-namespaces), by
680 dnl     setting GCC_OBJDIR to `no'.
681 dnl  +  Doing this by default is going to be interesting.  What default
682 dnl     "on" value can there be?
683 dnl  +  Usage:  GLIBCPP_ENABLE_RELIBGCC[(DEFAULT)]
684 dnl       The default path should be ../.. if bundled with GCC source.
685 dnl       If ommitted, it defaults to `no'.
686 dnl
687 AC_DEFUN(GLIBCPP_ENABLE_RELIBGCC, [dnl
688 define([GLIBCPP_ENABLE_RELIBGCC_DEFAULT], ifelse($1,, no, $1))dnl
689 AC_ARG_ENABLE(libgcc-rebuild,
690 changequote(<<, >>)dnl
691 <<  --enable-libgcc-rebuild=DIR     also rebuild libgcc.a; DIR is
692                                   the GCC objdir; see install.html>>,
693 changequote([, ])dnl
694 [case "$enableval" in
695  yes) AC_MSG_ERROR([--enable-libgcc-rebuild needs a pathname]) ;;
696  no)  enable_libgcc_rebuild=no ;;
697  *)   if test -d "$enableval" && test -d "${enableval}/gcc" && \
698          test -d "${enableval}/libiberty"
699       then
700          enable_libgcc_rebuild="$enableval"
701       else
702          AC_MSG_ERROR(["$enableval" does not appear to be the GCC objdir])
703       fi
704       ;;
705  esac],
706 enable_libgcc_rebuild=GLIBCPP_ENABLE_RELIBGCC_DEFAULT)dnl
707 GCC_OBJDIR="$enable_libgcc_rebuild"
708 AC_SUBST(GCC_OBJDIR)
709 ])
710
711
712 dnl
713 dnl Check for certain special build configurations.
714 dnl
715 dnl GLIBCPP_ENABLE_CSTDIO
716 dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
717 dnl 
718 dnl default is libio
719 dnl
720 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
721   AC_MSG_CHECKING([for cstdio to use])
722   AC_ARG_ENABLE(cstdio,
723   [  --enable-cstdio         enable GNU libio for target io package. (default)
724   --enable-cstdio=LIB     use LIB target-speific io package.], 
725   if test x$enable_cstdio = xno; then
726     enable_cstdio=libio
727   fi,
728      enable_cstdio=libio)
729
730   enable_cstdio_flag=$enable_cstdio
731
732   dnl Check if a valid thread package
733   case x${enable_cstdio_flag} in
734         xlibio | x | xno | xnone | xyes)
735                 # default
736                 CSTDIO_H=c_io_libio.h
737                 CSTDIO_CC=c_io_libio.cc
738                 AC_MSG_RESULT(libio)
739
740                 # see if we are on a system with libio native (ie, linux)
741                 AC_CHECK_HEADER(libio.h,  has_libio=yes, has_libio=no)
742                 if test $has_libio = "yes"; then
743                   BUILD_LIBIO_INCLUDE=
744                   need_libio=no
745                 else
746                   BUILD_LIBIO_INCLUDE='-I../libio'
747                   need_libio=yes
748                 fi
749                 AC_SUBST(BUILD_LIBIO_INCLUDE)
750
751                 # see if the _G_config.h header needs to be built. 
752                 # NB: This replaces the _G_CONFIG_H machinery in libio-v2
753                 AC_CHECK_HEADER(_G_config.h,  has_gconf_h=yes, has_gconf_h=no)
754                 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO_CONFIG_H, test "$has_gconf_h" = no)
755                 ;;
756         xwince)
757                 CSTDIO_H=c_io_wince.h
758                 CSTDIO_CC=c_io_wince.cc
759                 AC_MSG_RESULT(wince)
760
761                 need_libio=no
762                 BUILD_LIBIO_INCLUDE=
763                 AC_SUBST(BUILD_LIBIO_INCLUDE)
764                 ;;
765         *)
766                 echo "$enable_cstdio is an unknown io package" 1>&2
767                 exit 1
768                 ;;
769   esac
770   AC_SUBST(CSTDIO_H)
771   AC_SUBST(CSTDIO_CC)
772   AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
773 ])
774
775
776 dnl
777 dnl Check for certain special build configurations.
778 dnl
779 dnl GLIBCPP_ENABLE_THREADS
780 dnl --enable-threads=posix sets config/threads-posix.h et. al.
781 dnl 
782 dnl default is no threads
783 dnl
784 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
785   dnl Note this comes from the gcc/config.in and libjava/config.in
786   dnl Efforts should be made to keep this in sync.
787   AC_MSG_CHECKING([for threads package to use])
788   AC_ARG_ENABLE(threads,
789   [  --enable-threads        enable thread usage for target GCC.
790   --enable-threads=LIB    use LIB thread package for target GCC.],
791   if test x$enable_threads = xno; then
792     enable_threads=''
793   fi,
794     enable_threads='')
795
796   enable_threads_flag=$enable_threads
797
798   dnl Check if a valid thread package
799   case x${enable_threads_flag} in
800         x | xno | xnone)
801                 # No threads
802                 target_thread_file='single'
803                 ;;
804         xyes)
805                 # default
806                 target_thread_file=''
807                 ;;
808         xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
809         xsolaris | xwin32 | xdce | xvxworks)
810                 target_thread_file=$enable_threads_flag
811                 ;;
812         *)
813                 echo "$enable_threads is an unknown thread package" 1>&2
814                 exit 1
815                 ;;
816   esac
817
818   dnl Check for thread package actually supported in libstdc++ 
819   case "$target_thread_file" in
820     no | none | single)
821       THREADS=none
822       ;;
823     posix | pthreads)
824       THREADS=posix
825       case "$host" in
826         *-*-linux*)
827         ;;
828       esac
829       ;;
830     decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
831       AC_MSG_ERROR(thread package $THREADS not yet supported)
832       ;;
833     *)
834       AC_MSG_ERROR($THREADS is an unknown thread package)
835       ;;
836   esac
837   AC_MSG_RESULT($THREADS)
838
839   THREADLIBS=
840   THREADINCS=
841   THREADDEPS=
842   THREADOBJS=
843   THREADH=
844   THREADSPEC=
845   case "$THREADS" in
846     posix)
847       AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
848       THREADLIBS=-lpthread
849       THREADSPEC=-lpthread
850       dnl Not presently used
851       dnl THREADOBJS=threads-posix.lo
852       THREADH=threads-posix.h
853       ;;
854     none)
855       dnl Not presently used
856       dnl THREADOBJS=threads-no.lo
857       THREADH=threads-no.h
858       ;;
859   esac
860   AC_SUBST(THREADLIBS)
861   AC_SUBST(THREADINCS)
862   AC_SUBST(THREADDEPS)
863   AC_SUBST(THREADOBJS)
864   AC_SUBST(THREADSPEC)
865 ])
866
867
868 dnl
869 dnl Check for certain special build configurations.
870 dnl
871 dnl GLIBCPP_ENABLE_LONG_LONG
872 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
873 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
874 dnl  +  Usage:  GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
875 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
876 dnl       defaults to `no'.
877 dnl
878 dnl GLIBCPP_ENABLE_LONG_LONG
879 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
880   define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
881   AC_ARG_ENABLE(long-long,
882   changequote(<<, >>)dnl
883   <<--enable-long_long      turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
884   changequote([, ])dnl
885   [case "$enableval" in
886    yes) enable_long_long=yes ;;
887    no)  enable_long_long=no ;;
888    *)   AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
889    esac],
890   enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
891   dnl Option parsed, now set things appropriately
892   case "$enable_long_long" in
893     yes)  AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
894           ;;
895   esac
896 ])
897
898
899
900
901
902
903
904
905
906
907
908
909
910 # Do all the work for Automake.  This macro actually does too much --
911 # some checks are only needed if your package does certain things.
912 # But this isn't really a big deal.
913
914 # serial 1
915
916 dnl Usage:
917 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
918
919 AC_DEFUN(AM_INIT_AUTOMAKE,
920 [AC_REQUIRE([AC_PROG_INSTALL])
921 PACKAGE=[$1]
922 AC_SUBST(PACKAGE)
923 VERSION=[$2]
924 AC_SUBST(VERSION)
925 dnl test to see if srcdir already configured
926 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
927   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
928 fi
929 ifelse([$3],,
930 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
931 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
932 AC_REQUIRE([AM_SANITY_CHECK])
933 AC_REQUIRE([AC_ARG_PROGRAM])
934 dnl FIXME This is truly gross.
935 missing_dir=`cd $ac_aux_dir && pwd`
936 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
937 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
938 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
939 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
940 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
941 AC_REQUIRE([AC_PROG_MAKE_SET])])
942
943 #
944 # Check to make sure that the build environment is sane.
945 #
946
947 AC_DEFUN(AM_SANITY_CHECK,
948 [AC_MSG_CHECKING([whether build environment is sane])
949 # Just in case
950 sleep 1
951 echo timestamp > conftestfile
952 # Do `set' in a subshell so we don't clobber the current shell's
953 # arguments.  Must try -L first in case configure is actually a
954 # symlink; some systems play weird games with the mod time of symlinks
955 # (eg FreeBSD returns the mod time of the symlink's containing
956 # directory).
957 if (
958    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
959    if test "[$]*" = "X"; then
960       # -L didn't work.
961       set X `ls -t $srcdir/configure conftestfile`
962    fi
963    if test "[$]*" != "X $srcdir/configure conftestfile" \
964       && test "[$]*" != "X conftestfile $srcdir/configure"; then
965
966       # If neither matched, then we have a broken ls.  This can happen
967       # if, for instance, CONFIG_SHELL is bash and it inherits a
968       # broken ls alias from the environment.  This has actually
969       # happened.  Such a system could not be considered "sane".
970       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
971 alias in your environment])
972    fi
973
974    test "[$]2" = conftestfile
975    )
976 then
977    # Ok.
978    :
979 else
980    AC_MSG_ERROR([newly created file is older than distributed files!
981 Check your system clock])
982 fi
983 rm -f conftest*
984 AC_MSG_RESULT(yes)])
985
986 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
987 dnl The program must properly implement --version.
988 AC_DEFUN(AM_MISSING_PROG,
989 [AC_MSG_CHECKING(for working $2)
990 # Run test in a subshell; some versions of sh will print an error if
991 # an executable is not found, even if stderr is redirected.
992 # Redirect stdin to placate older versions of autoconf.  Sigh.
993 if ($2 --version) < /dev/null > /dev/null 2>&1; then
994    $1=$2
995    AC_MSG_RESULT(found)
996 else
997    $1="$3/missing $2"
998    AC_MSG_RESULT(missing)
999 fi
1000 AC_SUBST($1)])
1001
1002 # Add --enable-maintainer-mode option to configure.
1003 # From Jim Meyering
1004
1005 # serial 1
1006
1007 AC_DEFUN(AM_MAINTAINER_MODE,
1008 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1009   dnl maintainer-mode is disabled by default
1010   AC_ARG_ENABLE(maintainer-mode,
1011 [  --enable-maintainer-mode enable make rules and dependencies not useful
1012                           (and sometimes confusing) to the casual installer],
1013       USE_MAINTAINER_MODE=$enableval,
1014       USE_MAINTAINER_MODE=no)
1015   AC_MSG_RESULT($USE_MAINTAINER_MODE)
1016   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
1017   MAINT=$MAINTAINER_MODE_TRUE
1018   AC_SUBST(MAINT)dnl
1019 ]
1020 )
1021
1022 # Define a conditional.
1023
1024 AC_DEFUN(AM_CONDITIONAL,
1025 [AC_SUBST($1_TRUE)
1026 AC_SUBST($1_FALSE)
1027 if $2; then
1028   $1_TRUE=
1029   $1_FALSE='#'
1030 else
1031   $1_TRUE='#'
1032   $1_FALSE=
1033 fi])
1034
1035 # Check for functions in math library.
1036 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1037 #
1038 # This file can be copied and used freely without restrictions.  It can
1039 # be used in projects which are not available under the GNU Public License
1040 # but which still want to provide support for the GNU gettext functionality.
1041 # Please note that the actual code is *not* freely available.
1042
1043 # serial 1
1044
1045 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1046 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1047 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1048 AC_SUBST(LIBMATHOBJS)dnl
1049 ])
1050
1051 # Check for string functions.
1052 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1053 #
1054 # This file can be copied and used freely without restrictions.  It can
1055 # be used in projects which are not available under the GNU Public License
1056 # but which still want to provide support for the GNU gettext functionality.
1057 # Please note that the actual code is *not* freely available.
1058
1059 # serial 1
1060
1061 dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1062 AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1063 [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1064 AC_SUBST(LIBSTRINGOBJS)dnl
1065 ])
1066
1067
1068 # serial 40 AC_PROG_LIBTOOL
1069 AC_DEFUN(AC_PROG_LIBTOOL,
1070 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
1071
1072 # Save cache, so that ltconfig can load it
1073 AC_CACHE_SAVE
1074
1075 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
1076 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
1077 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
1078 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
1079 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
1080 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
1081 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
1082 || AC_MSG_ERROR([libtool configure failed])
1083
1084 # Reload cache, that may have been modified by ltconfig
1085 AC_CACHE_LOAD
1086
1087 # This can be used to rebuild libtool when needed
1088 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
1089
1090 # Always use our own libtool.
1091 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
1092 AC_SUBST(LIBTOOL)dnl
1093
1094 # Redirect the config.log output again, so that the ltconfig log is not
1095 # clobbered by the next message.
1096 exec 5>>./config.log
1097 ])
1098
1099 AC_DEFUN(AC_LIBTOOL_SETUP,
1100 [AC_PREREQ(2.13)dnl
1101 AC_REQUIRE([AC_ENABLE_SHARED])dnl
1102 AC_REQUIRE([AC_ENABLE_STATIC])dnl
1103 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
1104 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1105 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
1106 AC_REQUIRE([AC_PROG_RANLIB])dnl
1107 AC_REQUIRE([AC_PROG_CC])dnl
1108 AC_REQUIRE([AC_PROG_LD])dnl
1109 AC_REQUIRE([AC_PROG_NM])dnl
1110 AC_REQUIRE([AC_PROG_LN_S])dnl
1111 dnl
1112
1113 case "$target" in
1114 NONE) lt_target="$host" ;;
1115 *) lt_target="$target" ;;
1116 esac
1117
1118 # Check for any special flags to pass to ltconfig.
1119 libtool_flags="--cache-file=$cache_file"
1120 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
1121 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
1122 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
1123 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
1124 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
1125 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
1126 [libtool_flags="$libtool_flags --enable-dlopen"])
1127 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
1128 [libtool_flags="$libtool_flags --enable-win32-dll"])
1129 AC_ARG_ENABLE(libtool-lock,
1130   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
1131 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
1132 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
1133
1134 # Some flags need to be propagated to the compiler or linker for good
1135 # libtool support.
1136 case "$lt_target" in
1137 *-*-irix6*)
1138   # Find out which ABI we are using.
1139   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
1140   if AC_TRY_EVAL(ac_compile); then
1141     case "`/usr/bin/file conftest.o`" in
1142     *32-bit*)
1143       LD="${LD-ld} -32"
1144       ;;
1145     *N32*)
1146       LD="${LD-ld} -n32"
1147       ;;
1148     *64-bit*)
1149       LD="${LD-ld} -64"
1150       ;;
1151     esac
1152   fi
1153   rm -rf conftest*
1154   ;;
1155
1156 *-*-sco3.2v5*)
1157   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
1158   SAVE_CFLAGS="$CFLAGS"
1159   CFLAGS="$CFLAGS -belf"
1160   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
1161     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
1162   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
1163     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
1164     CFLAGS="$SAVE_CFLAGS"
1165   fi
1166   ;;
1167
1168 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
1169 [*-*-cygwin* | *-*-mingw*)
1170   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
1171   AC_CHECK_TOOL(AS, as, false)
1172   AC_CHECK_TOOL(OBJDUMP, objdump, false)
1173   ;;
1174 ])
1175 esac
1176 ])
1177
1178 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
1179 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
1180
1181 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
1182 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
1183
1184 # AC_ENABLE_SHARED - implement the --enable-shared flag
1185 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
1186 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1187 #   `yes'.
1188 AC_DEFUN(AC_ENABLE_SHARED, [dnl
1189 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
1190 AC_ARG_ENABLE(shared,
1191 changequote(<<, >>)dnl
1192 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
1193 changequote([, ])dnl
1194 [p=${PACKAGE-default}
1195 case "$enableval" in
1196 yes) enable_shared=yes ;;
1197 no) enable_shared=no ;;
1198 *)
1199   enable_shared=no
1200   # Look at the argument we got.  We use all the common list separators.
1201   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1202   for pkg in $enableval; do
1203     if test "X$pkg" = "X$p"; then
1204       enable_shared=yes
1205     fi
1206   done
1207   IFS="$ac_save_ifs"
1208   ;;
1209 esac],
1210 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
1211 ])
1212
1213 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
1214 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1215 AC_ENABLE_SHARED(no)])
1216
1217 # AC_ENABLE_STATIC - implement the --enable-static flag
1218 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
1219 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1220 #   `yes'.
1221 AC_DEFUN(AC_ENABLE_STATIC, [dnl
1222 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
1223 AC_ARG_ENABLE(static,
1224 changequote(<<, >>)dnl
1225 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
1226 changequote([, ])dnl
1227 [p=${PACKAGE-default}
1228 case "$enableval" in
1229 yes) enable_static=yes ;;
1230 no) enable_static=no ;;
1231 *)
1232   enable_static=no
1233   # Look at the argument we got.  We use all the common list separators.
1234   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1235   for pkg in $enableval; do
1236     if test "X$pkg" = "X$p"; then
1237       enable_static=yes
1238     fi
1239   done
1240   IFS="$ac_save_ifs"
1241   ;;
1242 esac],
1243 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
1244 ])
1245
1246 # AC_DISABLE_STATIC - set the default static flag to --disable-static
1247 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1248 AC_ENABLE_STATIC(no)])
1249
1250
1251 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
1252 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
1253 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1254 #   `yes'.
1255 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
1256 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
1257 AC_ARG_ENABLE(fast-install,
1258 changequote(<<, >>)dnl
1259 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
1260 changequote([, ])dnl
1261 [p=${PACKAGE-default}
1262 case "$enableval" in
1263 yes) enable_fast_install=yes ;;
1264 no) enable_fast_install=no ;;
1265 *)
1266   enable_fast_install=no
1267   # Look at the argument we got.  We use all the common list separators.
1268   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1269   for pkg in $enableval; do
1270     if test "X$pkg" = "X$p"; then
1271       enable_fast_install=yes
1272     fi
1273   done
1274   IFS="$ac_save_ifs"
1275   ;;
1276 esac],
1277 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
1278 ])
1279
1280 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
1281 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1282 AC_ENABLE_FAST_INSTALL(no)])
1283
1284 # AC_PROG_LD - find the path to the GNU or non-GNU linker
1285 AC_DEFUN(AC_PROG_LD,
1286 [AC_ARG_WITH(gnu-ld,
1287 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
1288 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
1289 AC_REQUIRE([AC_PROG_CC])dnl
1290 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1291 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
1292 ac_prog=ld
1293 if test "$ac_cv_prog_gcc" = yes; then
1294   # Check if gcc -print-prog-name=ld gives a path.
1295   AC_MSG_CHECKING([for ld used by GCC])
1296   ac_prog=`($CC -print-prog-name=ld) 2>&5`
1297   case "$ac_prog" in
1298     # Accept absolute paths.
1299 changequote(,)dnl
1300     [\\/]* | [A-Za-z]:[\\/]*)
1301       re_direlt='/[^/][^/]*/\.\./'
1302 changequote([,])dnl
1303       # Canonicalize the path of ld
1304       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
1305       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
1306         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
1307       done
1308       test -z "$LD" && LD="$ac_prog"
1309       ;;
1310   "")
1311     # If it fails, then pretend we aren't using GCC.
1312     ac_prog=ld
1313     ;;
1314   *)
1315     # If it is relative, then search for the first ld in PATH.
1316     with_gnu_ld=unknown
1317     ;;
1318   esac
1319 elif test "$with_gnu_ld" = yes; then
1320   AC_MSG_CHECKING([for GNU ld])
1321 else
1322   AC_MSG_CHECKING([for non-GNU ld])
1323 fi
1324 AC_CACHE_VAL(ac_cv_path_LD,
1325 [if test -z "$LD"; then
1326   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1327   for ac_dir in $PATH; do
1328     test -z "$ac_dir" && ac_dir=.
1329     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
1330       ac_cv_path_LD="$ac_dir/$ac_prog"
1331       # Check to see if the program is GNU ld.  I'd rather use --version,
1332       # but apparently some GNU ld's only accept -v.
1333       # Break only if it was the GNU/non-GNU ld that we prefer.
1334       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
1335         test "$with_gnu_ld" != no && break
1336       else
1337         test "$with_gnu_ld" != yes && break
1338       fi
1339     fi
1340   done
1341   IFS="$ac_save_ifs"
1342 else
1343   ac_cv_path_LD="$LD" # Let the user override the test with a path.
1344 fi])
1345 LD="$ac_cv_path_LD"
1346 if test -n "$LD"; then
1347   AC_MSG_RESULT($LD)
1348 else
1349   AC_MSG_RESULT(no)
1350 fi
1351 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
1352 AC_PROG_LD_GNU
1353 ])
1354
1355 AC_DEFUN(AC_PROG_LD_GNU,
1356 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
1357 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
1358 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
1359   ac_cv_prog_gnu_ld=yes
1360 else
1361   ac_cv_prog_gnu_ld=no
1362 fi])
1363 ])
1364
1365 # AC_PROG_NM - find the path to a BSD-compatible name lister
1366 AC_DEFUN(AC_PROG_NM,
1367 [AC_MSG_CHECKING([for BSD-compatible nm])
1368 AC_CACHE_VAL(ac_cv_path_NM,
1369 [if test -n "$NM"; then
1370   # Let the user override the test.
1371   ac_cv_path_NM="$NM"
1372 else
1373   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1374   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
1375     test -z "$ac_dir" && ac_dir=.
1376     if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
1377       # Check to see if the nm accepts a BSD-compat flag.
1378       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
1379       #   nm: unknown option "B" ignored
1380       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
1381         ac_cv_path_NM="$ac_dir/nm -B"
1382         break
1383       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
1384         ac_cv_path_NM="$ac_dir/nm -p"
1385         break
1386       else
1387         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
1388         continue # so that we can try to find one that supports BSD flags
1389       fi
1390     fi
1391   done
1392   IFS="$ac_save_ifs"
1393   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
1394 fi])
1395 NM="$ac_cv_path_NM"
1396 AC_MSG_RESULT([$NM])
1397 ])
1398
1399 # AC_CHECK_LIBM - check for math library
1400 AC_DEFUN(AC_CHECK_LIBM,
1401 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
1402 LIBM=
1403 case "$lt_target" in
1404 *-*-beos* | *-*-cygwin*)
1405   # These system don't have libm
1406   ;;
1407 *-ncr-sysv4.3*)
1408   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
1409   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
1410   ;;
1411 *)
1412   AC_CHECK_LIB(m, main, LIBM="-lm")
1413   ;;
1414 esac
1415 ])
1416
1417 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
1418 # the libltdl convenience library, adds --enable-ltdl-convenience to
1419 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
1420 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
1421 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
1422 # '${top_builddir}/' (note the single quotes!) if your package is not
1423 # flat, and, if you're not using automake, define top_builddir as
1424 # appropriate in the Makefiles.
1425 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1426   case "$enable_ltdl_convenience" in
1427   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
1428   "") enable_ltdl_convenience=yes
1429       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
1430   esac
1431   LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
1432   INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
1433 ])
1434
1435 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
1436 # the libltdl installable library, and adds --enable-ltdl-install to
1437 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
1438 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
1439 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
1440 # '${top_builddir}/' (note the single quotes!) if your package is not
1441 # flat, and, if you're not using automake, define top_builddir as
1442 # appropriate in the Makefiles.
1443 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
1444 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1445   AC_CHECK_LIB(ltdl, main,
1446   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
1447   [if test x"$enable_ltdl_install" = xno; then
1448      AC_MSG_WARN([libltdl not installed, but installation disabled])
1449    else
1450      enable_ltdl_install=yes
1451    fi
1452   ])
1453   if test x"$enable_ltdl_install" = x"yes"; then
1454     ac_configure_args="$ac_configure_args --enable-ltdl-install"
1455     LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
1456     INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
1457   else
1458     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
1459     LIBLTDL="-lltdl"
1460     INCLTDL=
1461   fi
1462 ])
1463
1464 dnl old names
1465 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
1466 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
1467 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
1468 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
1469 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
1470 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
1471 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
1472
1473 dnl This is just to silence aclocal about the macro not being used
1474 ifelse([AC_DISABLE_FAST_INSTALL])dnl
1475
1476 # Like AC_CONFIG_HEADER, but automatically create stamp file.
1477
1478 AC_DEFUN(AM_CONFIG_HEADER,
1479 [AC_PREREQ([2.12])
1480 AC_CONFIG_HEADER([$1])
1481 dnl When config.status generates a header, we must update the stamp-h file.
1482 dnl This file resides in the same directory as the config header
1483 dnl that is generated.  We must strip everything past the first ":",
1484 dnl and everything past the last "/".
1485 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
1486 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
1487 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
1488 <<am_indx=1
1489 for am_file in <<$1>>; do
1490   case " <<$>>CONFIG_HEADERS " in
1491   *" <<$>>am_file "*<<)>>
1492     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
1493     ;;
1494   esac
1495   am_indx=`expr "<<$>>am_indx" + 1`
1496 done<<>>dnl>>)
1497 changequote([,]))])
1498
1499 # Check whether LC_MESSAGES is available in <locale.h>.
1500 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1501 #
1502 # This file file be copied and used freely without restrictions.  It can
1503 # be used in projects which are not available under the GNU Public License
1504 # but which still want to provide support for the GNU gettext functionality.
1505 # Please note that the actual code is *not* freely available.
1506
1507 # serial 1
1508
1509 AC_DEFUN(AC_LC_MESSAGES,
1510   [if test $ac_cv_header_locale_h = yes; then
1511     AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1512       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1513        ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1514     if test $ac_cv_val_LC_MESSAGES = yes; then
1515       AC_DEFINE(HAVE_LC_MESSAGES)
1516     fi
1517   fi])
1518