]> www.ginac.de Git - ginac.git/blob - aclocal.m4
* _function suffix only for cmath functions and conjugate().
[ginac.git] / 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 Additional macros used to configure GiNaC.  We don't start our own 
15 dnl additions' names with AC_ but with GINAC_ in order to steer clear of
16 dnl future trouble.
17 dnl ===========================================================================
18
19 dnl Generally, it is a bad idea to put specialized header files for a library
20 dnl into a generic directory like /usr/local/include/.  Instead, one should put
21 dnl them into a subdirectory.  GiNaC does it, NTL does it.  Unfortunately, CLN
22 dnl doesn't do so but some people choose to do it by hand.  In these cases we
23 dnl need to #include <CLN/cln.h>, otherwise #include <cln.h>.  This macro
24 dnl tries to be clever and find out the correct way by defining the variable
25 dnl HAVE_CLN_CLN_H in config.h:
26 AC_DEFUN(GINAC_CHECK_CLN_H,
27     [AC_PROVIDE([$0])
28     AC_CHECK_HEADERS(CLN/cln.h, ,
29         AC_CHECK_HEADERS(cln.h, ,
30             AC_MSG_ERROR([cannot find header for Bruno Haible's CLN]);
31         )
32     )
33 ])
34
35 dnl This macro is needed because the generic AC_CHECK_LIB doesn't work because
36 dnl C++ is more strongly typed than C.  Therefore we need to work with the 
37 dnl more fundamental AC_TRY_LINK instead.
38 AC_DEFUN(GINAC_CHECK_LIBCLN,
39     [AC_PROVIDE([$0])
40     AC_MSG_CHECKING([how to link with libcln])
41     saved_LIBS="${LIBS}"
42     AC_CACHE_VAL(ginac_cv_lib_cln_link,
43         [LIBS="-lcln"
44         case "${ac_cv_header_CLN_cln_h}" in
45         "yes")
46             AC_TRY_LINK([#include <CLN/cln.h>],
47                 [factorial(1);],
48                 ginac_cv_lib_cln_link="-lcln",
49                 ginac_cv_lib_cln_link="fail")
50             ;;
51         *)
52             AC_TRY_LINK([#include <cln.h>],
53                 [factorial(1);],
54                 ginac_cv_lib_cln_link="-lcln",
55                 ginac_cv_lib_cln_link="fail")
56             ;;
57         esac
58     ])
59     case "${ginac_cv_lib_cln_link}" in
60 dnl linking worked:
61     "-lcln")
62         LIBS="-lcln ${saved_LIBS}"
63         AC_MSG_RESULT([-lcln])
64         GINAC_CHECK_LIBCLN_SANITY
65     ;;
66 dnl linking failed:
67     "fail")
68         LIBS="${saved_LIBS}"
69         AC_MSG_RESULT([])
70         AC_MSG_ERROR([linking with libcln failed, maybe need to set \$LDFLAGS?])
71     ;;
72 dnl should never ever get here:
73     *)
74         LIBS="${saved_LIBS}"
75     ;;
76     esac
77 ])
78
79 dnl Check if the CLN library suits our needs, i.e. if it is new enough, by
80 dnl trying to run into a little bug which was present till version 1.0.1 and
81 dnl then removed.
82 AC_DEFUN(GINAC_CHECK_LIBCLN_SANITY,
83     [AC_PROVIDE([$0])
84     AC_MSG_CHECKING([whether libcln behaves sane])
85     AC_CACHE_VAL(ginac_cv_lib_cln_integrity,
86         [
87         case "${ac_cv_header_CLN_cln_h}" in
88         "yes")
89             AC_TRY_RUN([#include <CLN/cln.h>
90 int main() {
91 cl_RA q(3); q = q/2; cl_RA p(3); p = p/2;
92 if (q+p != 3) return 1; else return 0;
93 }],
94                 ginac_cv_lib_cln_integrity="sane",
95                 ginac_cv_lib_cln_integrity="insane",
96                 ginac_cv_lib_cln_integrity="guessing sane")
97             ;;
98         *)
99             AC_TRY_RUN([#include <cln.h>
100 int main() {
101 cl_RA q(3); q = q/2; cl_RA p(3); p = p/2;
102 if (q+p != 3) return 1; else return 0;
103 }],
104                 ginac_cv_lib_cln_integrity="sane",
105                 ginac_cv_lib_cln_integrity="insane",
106                 ginac_cv_lib_cln_integrity="guessing sane")
107             ;;
108         esac
109     ])
110     case "${ginac_cv_lib_cln_integrity}" in
111 dnl exit status was 0:
112     "sane")
113         AC_MSG_RESULT([yes])
114     ;;
115 dnl exit status was not 0:
116     "insane")
117         AC_MSG_RESULT([no])
118         AC_MSG_WARN([maybe version of libcln is older than 1.0.2?])
119     ;;
120 dnl test-program was not run because we are cross-compiling:
121     "guessing sane")
122         AC_MSG_RESULT([hopefully])
123     ;;
124 dnl should never ever get here:
125     *)
126         AC_MSG_WARN([you found a bug in the configure script!])
127     ;;
128     esac
129 ])
130
131 # Like AC_CONFIG_HEADER, but automatically create stamp file.
132
133 AC_DEFUN(AM_CONFIG_HEADER,
134 [AC_PREREQ([2.12])
135 AC_CONFIG_HEADER([$1])
136 dnl When config.status generates a header, we must update the stamp-h file.
137 dnl This file resides in the same directory as the config header
138 dnl that is generated.  We must strip everything past the first ":",
139 dnl and everything past the last "/".
140 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
141 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
142 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
143 <<am_indx=1
144 for am_file in <<$1>>; do
145   case " <<$>>CONFIG_HEADERS " in
146   *" <<$>>am_file "*<<)>>
147     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
148     ;;
149   esac
150   am_indx=`expr "<<$>>am_indx" + 1`
151 done<<>>dnl>>)
152 changequote([,]))])
153
154 # Do all the work for Automake.  This macro actually does too much --
155 # some checks are only needed if your package does certain things.
156 # But this isn't really a big deal.
157
158 # serial 1
159
160 dnl Usage:
161 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
162
163 AC_DEFUN(AM_INIT_AUTOMAKE,
164 [AC_REQUIRE([AC_PROG_INSTALL])
165 PACKAGE=[$1]
166 AC_SUBST(PACKAGE)
167 VERSION=[$2]
168 AC_SUBST(VERSION)
169 dnl test to see if srcdir already configured
170 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
171   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
172 fi
173 ifelse([$3],,
174 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
175 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
176 AC_REQUIRE([AM_SANITY_CHECK])
177 AC_REQUIRE([AC_ARG_PROGRAM])
178 dnl FIXME This is truly gross.
179 missing_dir=`cd $ac_aux_dir && pwd`
180 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
181 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
182 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
183 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
184 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
185 AC_REQUIRE([AC_PROG_MAKE_SET])])
186
187 #
188 # Check to make sure that the build environment is sane.
189 #
190
191 AC_DEFUN(AM_SANITY_CHECK,
192 [AC_MSG_CHECKING([whether build environment is sane])
193 # Just in case
194 sleep 1
195 echo timestamp > conftestfile
196 # Do `set' in a subshell so we don't clobber the current shell's
197 # arguments.  Must try -L first in case configure is actually a
198 # symlink; some systems play weird games with the mod time of symlinks
199 # (eg FreeBSD returns the mod time of the symlink's containing
200 # directory).
201 if (
202    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
203    if test "[$]*" = "X"; then
204       # -L didn't work.
205       set X `ls -t $srcdir/configure conftestfile`
206    fi
207    if test "[$]*" != "X $srcdir/configure conftestfile" \
208       && test "[$]*" != "X conftestfile $srcdir/configure"; then
209
210       # If neither matched, then we have a broken ls.  This can happen
211       # if, for instance, CONFIG_SHELL is bash and it inherits a
212       # broken ls alias from the environment.  This has actually
213       # happened.  Such a system could not be considered "sane".
214       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
215 alias in your environment])
216    fi
217
218    test "[$]2" = conftestfile
219    )
220 then
221    # Ok.
222    :
223 else
224    AC_MSG_ERROR([newly created file is older than distributed files!
225 Check your system clock])
226 fi
227 rm -f conftest*
228 AC_MSG_RESULT(yes)])
229
230 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
231 dnl The program must properly implement --version.
232 AC_DEFUN(AM_MISSING_PROG,
233 [AC_MSG_CHECKING(for working $2)
234 # Run test in a subshell; some versions of sh will print an error if
235 # an executable is not found, even if stderr is redirected.
236 # Redirect stdin to placate older versions of autoconf.  Sigh.
237 if ($2 --version) < /dev/null > /dev/null 2>&1; then
238    $1=$2
239    AC_MSG_RESULT(found)
240 else
241    $1="$3/missing $2"
242    AC_MSG_RESULT(missing)
243 fi
244 AC_SUBST($1)])
245
246 # Add --enable-maintainer-mode option to configure.
247 # From Jim Meyering
248
249 # serial 1
250
251 AC_DEFUN(AM_MAINTAINER_MODE,
252 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
253   dnl maintainer-mode is disabled by default
254   AC_ARG_ENABLE(maintainer-mode,
255 [  --enable-maintainer-mode enable make rules and dependencies not useful
256                           (and sometimes confusing) to the casual installer],
257       USE_MAINTAINER_MODE=$enableval,
258       USE_MAINTAINER_MODE=no)
259   AC_MSG_RESULT($USE_MAINTAINER_MODE)
260   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
261   MAINT=$MAINTAINER_MODE_TRUE
262   AC_SUBST(MAINT)dnl
263 ]
264 )
265
266 # Define a conditional.
267
268 AC_DEFUN(AM_CONDITIONAL,
269 [AC_SUBST($1_TRUE)
270 AC_SUBST($1_FALSE)
271 if $2; then
272   $1_TRUE=
273   $1_FALSE='#'
274 else
275   $1_TRUE='#'
276   $1_FALSE=
277 fi])
278
279
280 # serial 40 AC_PROG_LIBTOOL
281 AC_DEFUN(AC_PROG_LIBTOOL,
282 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
283
284 # Save cache, so that ltconfig can load it
285 AC_CACHE_SAVE
286
287 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
288 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
289 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
290 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
291 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
292 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
293 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
294 || AC_MSG_ERROR([libtool configure failed])
295
296 # Reload cache, that may have been modified by ltconfig
297 AC_CACHE_LOAD
298
299 # This can be used to rebuild libtool when needed
300 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
301
302 # Always use our own libtool.
303 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
304 AC_SUBST(LIBTOOL)dnl
305
306 # Redirect the config.log output again, so that the ltconfig log is not
307 # clobbered by the next message.
308 exec 5>>./config.log
309 ])
310
311 AC_DEFUN(AC_LIBTOOL_SETUP,
312 [AC_PREREQ(2.13)dnl
313 AC_REQUIRE([AC_ENABLE_SHARED])dnl
314 AC_REQUIRE([AC_ENABLE_STATIC])dnl
315 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
316 AC_REQUIRE([AC_CANONICAL_HOST])dnl
317 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
318 AC_REQUIRE([AC_PROG_RANLIB])dnl
319 AC_REQUIRE([AC_PROG_CC])dnl
320 AC_REQUIRE([AC_PROG_LD])dnl
321 AC_REQUIRE([AC_PROG_NM])dnl
322 AC_REQUIRE([AC_PROG_LN_S])dnl
323 dnl
324
325 # Check for any special flags to pass to ltconfig.
326 #
327 # the following will cause an existing older ltconfig to fail, so
328 # we ignore this at the expense of the cache file... Checking this 
329 # will just take longer ... bummer!
330 #libtool_flags="--cache-file=$cache_file"
331 #
332 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
333 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
334 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
335 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
336 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
337 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
338 [libtool_flags="$libtool_flags --enable-dlopen"])
339 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
340 [libtool_flags="$libtool_flags --enable-win32-dll"])
341 AC_ARG_ENABLE(libtool-lock,
342   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
343 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
344 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
345
346 # Some flags need to be propagated to the compiler or linker for good
347 # libtool support.
348 case "$host" in
349 *-*-irix6*)
350   # Find out which ABI we are using.
351   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
352   if AC_TRY_EVAL(ac_compile); then
353     case "`/usr/bin/file conftest.o`" in
354     *32-bit*)
355       LD="${LD-ld} -32"
356       ;;
357     *N32*)
358       LD="${LD-ld} -n32"
359       ;;
360     *64-bit*)
361       LD="${LD-ld} -64"
362       ;;
363     esac
364   fi
365   rm -rf conftest*
366   ;;
367
368 *-*-sco3.2v5*)
369   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
370   SAVE_CFLAGS="$CFLAGS"
371   CFLAGS="$CFLAGS -belf"
372   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
373     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
374   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
375     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
376     CFLAGS="$SAVE_CFLAGS"
377   fi
378   ;;
379
380 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
381 [*-*-cygwin* | *-*-mingw*)
382   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
383   AC_CHECK_TOOL(AS, as, false)
384   AC_CHECK_TOOL(OBJDUMP, objdump, false)
385   ;;
386 ])
387 esac
388 ])
389
390 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
391 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
392
393 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
394 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
395
396 # AC_ENABLE_SHARED - implement the --enable-shared flag
397 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
398 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
399 #   `yes'.
400 AC_DEFUN(AC_ENABLE_SHARED, [dnl
401 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
402 AC_ARG_ENABLE(shared,
403 changequote(<<, >>)dnl
404 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
405 changequote([, ])dnl
406 [p=${PACKAGE-default}
407 case "$enableval" in
408 yes) enable_shared=yes ;;
409 no) enable_shared=no ;;
410 *)
411   enable_shared=no
412   # Look at the argument we got.  We use all the common list separators.
413   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
414   for pkg in $enableval; do
415     if test "X$pkg" = "X$p"; then
416       enable_shared=yes
417     fi
418   done
419   IFS="$ac_save_ifs"
420   ;;
421 esac],
422 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
423 ])
424
425 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
426 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
427 AC_ENABLE_SHARED(no)])
428
429 # AC_ENABLE_STATIC - implement the --enable-static flag
430 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
431 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
432 #   `yes'.
433 AC_DEFUN(AC_ENABLE_STATIC, [dnl
434 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
435 AC_ARG_ENABLE(static,
436 changequote(<<, >>)dnl
437 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
438 changequote([, ])dnl
439 [p=${PACKAGE-default}
440 case "$enableval" in
441 yes) enable_static=yes ;;
442 no) enable_static=no ;;
443 *)
444   enable_static=no
445   # Look at the argument we got.  We use all the common list separators.
446   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
447   for pkg in $enableval; do
448     if test "X$pkg" = "X$p"; then
449       enable_static=yes
450     fi
451   done
452   IFS="$ac_save_ifs"
453   ;;
454 esac],
455 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
456 ])
457
458 # AC_DISABLE_STATIC - set the default static flag to --disable-static
459 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
460 AC_ENABLE_STATIC(no)])
461
462
463 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
464 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
465 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
466 #   `yes'.
467 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
468 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
469 AC_ARG_ENABLE(fast-install,
470 changequote(<<, >>)dnl
471 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
472 changequote([, ])dnl
473 [p=${PACKAGE-default}
474 case "$enableval" in
475 yes) enable_fast_install=yes ;;
476 no) enable_fast_install=no ;;
477 *)
478   enable_fast_install=no
479   # Look at the argument we got.  We use all the common list separators.
480   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
481   for pkg in $enableval; do
482     if test "X$pkg" = "X$p"; then
483       enable_fast_install=yes
484     fi
485   done
486   IFS="$ac_save_ifs"
487   ;;
488 esac],
489 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
490 ])
491
492 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
493 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
494 AC_ENABLE_FAST_INSTALL(no)])
495
496 # AC_PROG_LD - find the path to the GNU or non-GNU linker
497 AC_DEFUN(AC_PROG_LD,
498 [AC_ARG_WITH(gnu-ld,
499 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
500 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
501 AC_REQUIRE([AC_PROG_CC])dnl
502 AC_REQUIRE([AC_CANONICAL_HOST])dnl
503 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
504 ac_prog=ld
505 if test "$ac_cv_prog_gcc" = yes; then
506   # Check if gcc -print-prog-name=ld gives a path.
507   AC_MSG_CHECKING([for ld used by GCC])
508   ac_prog=`($CC -print-prog-name=ld) 2>&5`
509   case "$ac_prog" in
510     # Accept absolute paths.
511 changequote(,)dnl
512     [\\/]* | [A-Za-z]:[\\/]*)
513       re_direlt='/[^/][^/]*/\.\./'
514 changequote([,])dnl
515       # Canonicalize the path of ld
516       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
517       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
518         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
519       done
520       test -z "$LD" && LD="$ac_prog"
521       ;;
522   "")
523     # If it fails, then pretend we aren't using GCC.
524     ac_prog=ld
525     ;;
526   *)
527     # If it is relative, then search for the first ld in PATH.
528     with_gnu_ld=unknown
529     ;;
530   esac
531 elif test "$with_gnu_ld" = yes; then
532   AC_MSG_CHECKING([for GNU ld])
533 else
534   AC_MSG_CHECKING([for non-GNU ld])
535 fi
536 AC_CACHE_VAL(ac_cv_path_LD,
537 [if test -z "$LD"; then
538   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
539   for ac_dir in $PATH; do
540     test -z "$ac_dir" && ac_dir=.
541     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
542       ac_cv_path_LD="$ac_dir/$ac_prog"
543       # Check to see if the program is GNU ld.  I'd rather use --version,
544       # but apparently some GNU ld's only accept -v.
545       # Break only if it was the GNU/non-GNU ld that we prefer.
546       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
547         test "$with_gnu_ld" != no && break
548       else
549         test "$with_gnu_ld" != yes && break
550       fi
551     fi
552   done
553   IFS="$ac_save_ifs"
554 else
555   ac_cv_path_LD="$LD" # Let the user override the test with a path.
556 fi])
557 LD="$ac_cv_path_LD"
558 if test -n "$LD"; then
559   AC_MSG_RESULT($LD)
560 else
561   AC_MSG_RESULT(no)
562 fi
563 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
564 AC_SUBST(LD)
565 AC_PROG_LD_GNU
566 ])
567
568 AC_DEFUN(AC_PROG_LD_GNU,
569 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
570 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
571 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
572   ac_cv_prog_gnu_ld=yes
573 else
574   ac_cv_prog_gnu_ld=no
575 fi])
576 ])
577
578 # AC_PROG_NM - find the path to a BSD-compatible name lister
579 AC_DEFUN(AC_PROG_NM,
580 [AC_MSG_CHECKING([for BSD-compatible nm])
581 AC_CACHE_VAL(ac_cv_path_NM,
582 [if test -n "$NM"; then
583   # Let the user override the test.
584   ac_cv_path_NM="$NM"
585 else
586   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
587   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
588     test -z "$ac_dir" && ac_dir=.
589     if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
590       # Check to see if the nm accepts a BSD-compat flag.
591       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
592       #   nm: unknown option "B" ignored
593       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
594         ac_cv_path_NM="$ac_dir/nm -B"
595         break
596       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
597         ac_cv_path_NM="$ac_dir/nm -p"
598         break
599       else
600         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
601         continue # so that we can try to find one that supports BSD flags
602       fi
603     fi
604   done
605   IFS="$ac_save_ifs"
606   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
607 fi])
608 NM="$ac_cv_path_NM"
609 AC_MSG_RESULT([$NM])
610 AC_SUBST(NM)
611 ])
612
613 # AC_CHECK_LIBM - check for math library
614 AC_DEFUN(AC_CHECK_LIBM,
615 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
616 LIBM=
617 case "$host" in
618 *-*-beos* | *-*-cygwin*)
619   # These system don't have libm
620   ;;
621 *-ncr-sysv4.3*)
622   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
623   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
624   ;;
625 *)
626   AC_CHECK_LIB(m, main, LIBM="-lm")
627   ;;
628 esac
629 ])
630
631 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
632 # the libltdl convenience library, adds --enable-ltdl-convenience to
633 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
634 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
635 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
636 # '${top_builddir}/' (note the single quotes!) if your package is not
637 # flat, and, if you're not using automake, define top_builddir as
638 # appropriate in the Makefiles.
639 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
640   case "$enable_ltdl_convenience" in
641   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
642   "") enable_ltdl_convenience=yes
643       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
644   esac
645   LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
646   INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
647 ])
648
649 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
650 # the libltdl installable library, and adds --enable-ltdl-install to
651 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
652 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
653 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
654 # '${top_builddir}/' (note the single quotes!) if your package is not
655 # flat, and, if you're not using automake, define top_builddir as
656 # appropriate in the Makefiles.
657 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
658 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
659   AC_CHECK_LIB(ltdl, main,
660   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
661   [if test x"$enable_ltdl_install" = xno; then
662      AC_MSG_WARN([libltdl not installed, but installation disabled])
663    else
664      enable_ltdl_install=yes
665    fi
666   ])
667   if test x"$enable_ltdl_install" = x"yes"; then
668     ac_configure_args="$ac_configure_args --enable-ltdl-install"
669     LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
670     INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
671   else
672     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
673     LIBLTDL="-lltdl"
674     INCLTDL=
675   fi
676 ])
677
678 dnl old names
679 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
680 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
681 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
682 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
683 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
684 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
685 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
686
687 dnl This is just to silence aclocal about the macro not being used
688 ifelse([AC_DISABLE_FAST_INSTALL])dnl
689
690
691 dnl AM_PROG_LEX
692 dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
693 AC_DEFUN(AM_PROG_LEX,
694 [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
695 AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
696 AC_PROG_LEX
697 AC_DECL_YYTEXT])
698