]> www.ginac.de Git - ginac.git/blob - aclocal.m4
289b92e74df69f63b32be6022c1e9b108473d538
[ginac.git] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.3
2
3 dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
4 dnl This Makefile.in 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 additions' names
15 dnl with AC_ but with GINAC_ in order to avoid future trouble.
16 dnl ===========================================================================
17
18 dnl Generally, it is a bad idea to put specialized header files for a library
19 dnl into a generic directory like /usr/local/include/.  Instead, one should put
20 dnl them into a subdirectory.  GiNaC does it, NTL does it.  Unfortunately, CLN
21 dnl doesn't do so but some people choose to do it by hand.  In these cases we
22 dnl need to #include <CLN/cln.h>, otherwise #include <cln.h>.  This macro
23 dnl tries to be clever and find out the correct way by defining the variable
24 dnl HAVE_CLN_CLN_H in config.h:
25 AC_DEFUN(GINAC_CHECK_CLN_H,
26     [AC_PROVIDE([$0])
27     AC_CHECK_HEADERS(CLN/cln.h, ,
28         AC_CHECK_HEADERS(cln.h, ,
29             AC_MSG_ERROR([cannot find header for Bruno Haible's CLN]);
30         )
31     )
32 ])
33
34 dnl This macro is needed because the generic AC_CHECK_LIB doesn't work because
35 dnl C++ is more strongly typed than C.  Therefore we need to work with the 
36 dnl more fundamental AC_TRY_LINK instead.
37 AC_DEFUN(GINAC_CHECK_LIBCLN,
38     [AC_PROVIDE([$0])
39     AC_MSG_CHECKING([how to link with libcln])
40     saved_LIBS="${LIBS}"
41     AC_CACHE_VAL(ginac_cv_lib_cln_link,
42         [LIBS="-lcln"
43         case "${ac_cv_header_CLN_cln_h}" in
44         "yes")
45             AC_TRY_LINK([#include <CLN/cln.h>],
46                 [factorial(1);],
47                 ginac_cv_lib_cln_link="-lcln",
48                 ginac_cv_lib_cln_link="fail")
49             ;;
50         *)
51             AC_TRY_LINK([#include <cln.h>],
52                 [factorial(1);],
53                 ginac_cv_lib_cln_link="-lcln",
54                 ginac_cv_lib_cln_link="fail")
55             ;;
56         esac
57     ])
58     case "${ginac_cv_lib_cln_link}" in
59 dnl linking worked:
60     "-lcln")
61         LIBS="-lcln ${saved_LIBS}"
62         AC_MSG_RESULT([-lcln])
63         GINAC_CHECK_LIBCLN_SANITY
64     ;;
65 dnl linking failed:
66     "fail")
67         LIBS="${saved_LIBS}"
68         AC_MSG_RESULT([])
69         AC_MSG_WARN([linking with libcln failed])
70     ;;
71 dnl should never ever get here:
72     *)
73         LIBS="${saved_LIBS}"
74     ;;
75     esac
76 ])
77
78 dnl Check if the CLN library suits our needs, i.e. if it is new enough, by
79 dnl trying to run into a little bug which was present till version 1.0.1 and
80 dnl then removed.
81 AC_DEFUN(GINAC_CHECK_LIBCLN_SANITY,
82     [AC_PROVIDE([$0])
83     AC_MSG_CHECKING([whether libcln behaves sane])
84     AC_CACHE_VAL(ginac_cv_lib_cln_integrity,
85         [
86         case "${ac_cv_header_CLN_cln_h}" in
87         "yes")
88             AC_TRY_RUN([#include <CLN/cln.h>
89 int main() {
90 cl_RA q(3); q = q/2; cl_RA p(3); p = p/2;
91 if (q+p != 3) return 1; else return 0;
92 }],
93                 ginac_cv_lib_cln_integrity="sane",
94                 ginac_cv_lib_cln_integrity="insane",
95                 ginac_cv_lib_cln_integrity="guessing sane")
96             ;;
97         *)
98             AC_TRY_RUN([#include <cln.h>
99 int main() {
100 cl_RA q(3); q = q/2; cl_RA p(3); p = p/2;
101 if (q+p != 3) return 1; else return 0;
102 }],
103                 ginac_cv_lib_cln_integrity="sane",
104                 ginac_cv_lib_cln_integrity="insane",
105                 ginac_cv_lib_cln_integrity="guessing sane")
106             ;;
107         esac
108     ])
109     case "${ginac_cv_lib_cln_integrity}" in
110 dnl exit status was 0:
111     "sane")
112         AC_MSG_RESULT([yes])
113     ;;
114 dnl exit status was not 0:
115     "insane")
116         AC_MSG_RESULT([no])
117         AC_MSG_WARN([maybe version of libcln is older than 1.0.2?])
118     ;;
119 dnl test-program was not run because we are cross-compiling:
120     "guessing sane")
121         AC_MSG_RESULT([hopefully])
122     ;;
123 dnl should never ever get here:
124     *)
125         AC_MSG_WARN([you found a bug in the configure script!])
126     ;;
127     esac
128 ])
129
130 # Like AC_CONFIG_HEADER, but automatically create stamp file.
131
132 AC_DEFUN(AM_CONFIG_HEADER,
133 [AC_PREREQ([2.12])
134 AC_CONFIG_HEADER([$1])
135 dnl When config.status generates a header, we must update the stamp-h file.
136 dnl This file resides in the same directory as the config header
137 dnl that is generated.  We must strip everything past the first ":",
138 dnl and everything past the last "/".
139 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
140 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
141 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
142 <<am_indx=1
143 for am_file in <<$1>>; do
144   case " <<$>>CONFIG_HEADERS " in
145   *" <<$>>am_file "*<<)>>
146     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
147     ;;
148   esac
149   am_indx=`expr "<<$>>am_indx" + 1`
150 done<<>>dnl>>)
151 changequote([,]))])
152
153 # Do all the work for Automake.  This macro actually does too much --
154 # some checks are only needed if your package does certain things.
155 # But this isn't really a big deal.
156
157 # serial 1
158
159 dnl Usage:
160 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
161
162 AC_DEFUN(AM_INIT_AUTOMAKE,
163 [AC_REQUIRE([AM_PROG_INSTALL])
164 PACKAGE=[$1]
165 AC_SUBST(PACKAGE)
166 VERSION=[$2]
167 AC_SUBST(VERSION)
168 dnl test to see if srcdir already configured
169 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
170   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
171 fi
172 ifelse([$3],,
173 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
174 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
175 AC_REQUIRE([AM_SANITY_CHECK])
176 AC_REQUIRE([AC_ARG_PROGRAM])
177 dnl FIXME This is truly gross.
178 missing_dir=`cd $ac_aux_dir && pwd`
179 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
180 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
181 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
182 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
183 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
184 AC_REQUIRE([AC_PROG_MAKE_SET])])
185
186
187 # serial 1
188
189 AC_DEFUN(AM_PROG_INSTALL,
190 [AC_REQUIRE([AC_PROG_INSTALL])
191 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
192 AC_SUBST(INSTALL_SCRIPT)dnl
193 ])
194
195 #
196 # Check to make sure that the build environment is sane.
197 #
198
199 AC_DEFUN(AM_SANITY_CHECK,
200 [AC_MSG_CHECKING([whether build environment is sane])
201 # Just in case
202 sleep 1
203 echo timestamp > conftestfile
204 # Do `set' in a subshell so we don't clobber the current shell's
205 # arguments.  Must try -L first in case configure is actually a
206 # symlink; some systems play weird games with the mod time of symlinks
207 # (eg FreeBSD returns the mod time of the symlink's containing
208 # directory).
209 if (
210    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
211    if test "[$]*" = "X"; then
212       # -L didn't work.
213       set X `ls -t $srcdir/configure conftestfile`
214    fi
215    if test "[$]*" != "X $srcdir/configure conftestfile" \
216       && test "[$]*" != "X conftestfile $srcdir/configure"; then
217
218       # If neither matched, then we have a broken ls.  This can happen
219       # if, for instance, CONFIG_SHELL is bash and it inherits a
220       # broken ls alias from the environment.  This has actually
221       # happened.  Such a system could not be considered "sane".
222       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
223 alias in your environment])
224    fi
225
226    test "[$]2" = conftestfile
227    )
228 then
229    # Ok.
230    :
231 else
232    AC_MSG_ERROR([newly created file is older than distributed files!
233 Check your system clock])
234 fi
235 rm -f conftest*
236 AC_MSG_RESULT(yes)])
237
238 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
239 dnl The program must properly implement --version.
240 AC_DEFUN(AM_MISSING_PROG,
241 [AC_MSG_CHECKING(for working $2)
242 # Run test in a subshell; some versions of sh will print an error if
243 # an executable is not found, even if stderr is redirected.
244 # Redirect stdin to placate older versions of autoconf.  Sigh.
245 if ($2 --version) < /dev/null > /dev/null 2>&1; then
246    $1=$2
247    AC_MSG_RESULT(found)
248 else
249    $1="$3/missing $2"
250    AC_MSG_RESULT(missing)
251 fi
252 AC_SUBST($1)])
253
254 # Add --enable-maintainer-mode option to configure.
255 # From Jim Meyering
256
257 # serial 1
258
259 AC_DEFUN(AM_MAINTAINER_MODE,
260 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
261   dnl maintainer-mode is disabled by default
262   AC_ARG_ENABLE(maintainer-mode,
263 [  --enable-maintainer-mode enable make rules and dependencies not useful
264                           (and sometimes confusing) to the casual installer],
265       USE_MAINTAINER_MODE=$enableval,
266       USE_MAINTAINER_MODE=no)
267   AC_MSG_RESULT($USE_MAINTAINER_MODE)
268   if test $USE_MAINTAINER_MODE = yes; then
269     MAINT=
270   else
271     MAINT='#M#'
272   fi
273   AC_SUBST(MAINT)dnl
274 ]
275 )
276
277
278 # serial 24 AM_PROG_LIBTOOL
279 AC_DEFUN(AM_PROG_LIBTOOL,
280 [AC_REQUIRE([AM_ENABLE_SHARED])dnl
281 AC_REQUIRE([AM_ENABLE_STATIC])dnl
282 AC_REQUIRE([AC_CANONICAL_HOST])dnl
283 AC_REQUIRE([AC_PROG_RANLIB])dnl
284 AC_REQUIRE([AC_PROG_CC])dnl
285 AC_REQUIRE([AM_PROG_LD])dnl
286 AC_REQUIRE([AM_PROG_NM])dnl
287 AC_REQUIRE([AC_PROG_LN_S])dnl
288 dnl
289 # Always use our own libtool.
290 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
291 AC_SUBST(LIBTOOL)dnl
292
293 # Check for any special flags to pass to ltconfig.
294 libtool_flags=
295 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
296 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
297 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
298 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
299 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
300
301 # Some flags need to be propagated to the compiler or linker for good
302 # libtool support.
303 case "$host" in
304 *-*-irix6*)
305   # Find out which ABI we are using.
306   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
307   if AC_TRY_EVAL(ac_compile); then
308     case "`/usr/bin/file conftest.o`" in
309     *32-bit*)
310       LD="${LD-ld} -32"
311       ;;
312     *N32*)
313       LD="${LD-ld} -n32"
314       ;;
315     *64-bit*)
316       LD="${LD-ld} -64"
317       ;;
318     esac
319   fi
320   rm -rf conftest*
321   ;;
322
323 *-*-sco3.2v5*)
324   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
325   CFLAGS="$CFLAGS -belf"
326   ;;
327 esac
328
329 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
330 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
331 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
332 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
333 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
334 || AC_MSG_ERROR([libtool configure failed])
335 ])
336
337 # AM_ENABLE_SHARED - implement the --enable-shared flag
338 # Usage: AM_ENABLE_SHARED[(DEFAULT)]
339 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
340 #   `yes'.
341 AC_DEFUN(AM_ENABLE_SHARED,
342 [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
343 AC_ARG_ENABLE(shared,
344 changequote(<<, >>)dnl
345 <<  --enable-shared         build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT]
346 changequote([, ])dnl
347 [  --enable-shared=PKGS    only build shared libraries if the current package
348                           appears as an element in the PKGS list],
349 [p=${PACKAGE-default}
350 case "$enableval" in
351 yes) enable_shared=yes ;;
352 no) enable_shared=no ;;
353 *)
354   enable_shared=no
355   # Look at the argument we got.  We use all the common list separators.
356   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
357   for pkg in $enableval; do
358     if test "X$pkg" = "X$p"; then
359       enable_shared=yes
360     fi
361   done
362   IFS="$ac_save_ifs"
363   ;;
364 esac],
365 enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
366 ])
367
368 # AM_DISABLE_SHARED - set the default shared flag to --disable-shared
369 AC_DEFUN(AM_DISABLE_SHARED,
370 [AM_ENABLE_SHARED(no)])
371
372 # AM_DISABLE_STATIC - set the default static flag to --disable-static
373 AC_DEFUN(AM_DISABLE_STATIC,
374 [AM_ENABLE_STATIC(no)])
375
376 # AM_ENABLE_STATIC - implement the --enable-static flag
377 # Usage: AM_ENABLE_STATIC[(DEFAULT)]
378 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
379 #   `yes'.
380 AC_DEFUN(AM_ENABLE_STATIC,
381 [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
382 AC_ARG_ENABLE(static,
383 changequote(<<, >>)dnl
384 <<  --enable-static         build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT]
385 changequote([, ])dnl
386 [  --enable-static=PKGS    only build shared libraries if the current package
387                           appears as an element in the PKGS list],
388 [p=${PACKAGE-default}
389 case "$enableval" in
390 yes) enable_static=yes ;;
391 no) enable_static=no ;;
392 *)
393   enable_static=no
394   # Look at the argument we got.  We use all the common list separators.
395   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
396   for pkg in $enableval; do
397     if test "X$pkg" = "X$p"; then
398       enable_static=yes
399     fi
400   done
401   IFS="$ac_save_ifs"
402   ;;
403 esac],
404 enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
405 ])
406
407
408 # AM_PROG_LD - find the path to the GNU or non-GNU linker
409 AC_DEFUN(AM_PROG_LD,
410 [AC_ARG_WITH(gnu-ld,
411 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
412 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
413 AC_REQUIRE([AC_PROG_CC])
414 ac_prog=ld
415 if test "$ac_cv_prog_gcc" = yes; then
416   # Check if gcc -print-prog-name=ld gives a path.
417   AC_MSG_CHECKING([for ld used by GCC])
418   ac_prog=`($CC -print-prog-name=ld) 2>&5`
419   case "$ac_prog" in
420   # Accept absolute paths.
421   /* | [A-Za-z]:\\*)
422     test -z "$LD" && LD="$ac_prog"
423     ;;
424   "")
425     # If it fails, then pretend we aren't using GCC.
426     ac_prog=ld
427     ;;
428   *)
429     # If it is relative, then search for the first ld in PATH.
430     with_gnu_ld=unknown
431     ;;
432   esac
433 elif test "$with_gnu_ld" = yes; then
434   AC_MSG_CHECKING([for GNU ld])
435 else
436   AC_MSG_CHECKING([for non-GNU ld])
437 fi
438 AC_CACHE_VAL(ac_cv_path_LD,
439 [if test -z "$LD"; then
440   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
441   for ac_dir in $PATH; do
442     test -z "$ac_dir" && ac_dir=.
443     if test -f "$ac_dir/$ac_prog"; then
444       ac_cv_path_LD="$ac_dir/$ac_prog"
445       # Check to see if the program is GNU ld.  I'd rather use --version,
446       # but apparently some GNU ld's only accept -v.
447       # Break only if it was the GNU/non-GNU ld that we prefer.
448       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
449         test "$with_gnu_ld" != no && break
450       else
451         test "$with_gnu_ld" != yes && break
452       fi
453     fi
454   done
455   IFS="$ac_save_ifs"
456 else
457   ac_cv_path_LD="$LD" # Let the user override the test with a path.
458 fi])
459 LD="$ac_cv_path_LD"
460 if test -n "$LD"; then
461   AC_MSG_RESULT($LD)
462 else
463   AC_MSG_RESULT(no)
464 fi
465 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
466 AC_SUBST(LD)
467 AM_PROG_LD_GNU
468 ])
469
470 AC_DEFUN(AM_PROG_LD_GNU,
471 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
472 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
473 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
474   ac_cv_prog_gnu_ld=yes
475 else
476   ac_cv_prog_gnu_ld=no
477 fi])
478 ])
479
480 # AM_PROG_NM - find the path to a BSD-compatible name lister
481 AC_DEFUN(AM_PROG_NM,
482 [AC_MSG_CHECKING([for BSD-compatible nm])
483 AC_CACHE_VAL(ac_cv_path_NM,
484 [case "$NM" in
485 /* | [A-Za-z]:\\*)
486   ac_cv_path_NM="$NM" # Let the user override the test with a path.
487   ;;
488 *)
489   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
490   for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
491     test -z "$ac_dir" && ac_dir=.
492     if test -f $ac_dir/nm; then
493       # Check to see if the nm accepts a BSD-compat flag.
494       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
495       #   nm: unknown option "B" ignored
496       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
497         ac_cv_path_NM="$ac_dir/nm -B"
498       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
499         ac_cv_path_NM="$ac_dir/nm -p"
500       else
501         ac_cv_path_NM="$ac_dir/nm"
502       fi
503       break
504     fi
505   done
506   IFS="$ac_save_ifs"
507   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
508   ;;
509 esac])
510 NM="$ac_cv_path_NM"
511 AC_MSG_RESULT([$NM])
512 AC_SUBST(NM)
513 ])
514
515
516 dnl AM_PROG_LEX
517 dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
518 AC_DEFUN(AM_PROG_LEX,
519 [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
520 AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
521 AC_PROG_LEX
522 AC_DECL_YYTEXT])
523