--- /dev/null
+## Process this file with automake to produce Makefile.in
+SUBDIRS = ginac check ginsh doc
-# This is the prototype Makefile for the GiNaC package.
+# Makefile.in generated automatically by automake 1.3 from Makefile.am
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
-# Not every make knows what CXX is, so we inherit it together with some other
-# values from configure which checks it anyways:
-CXX = @CXX@
-CXXFLAGS = @CXXFLAGS@
-CPPFLAGS = @CPPFLAGS@
-DEFS = @DEFS@
-LIBS = @LIBS@
-LDFLAGS = @LDFLAGS@
-# Here come the usual install directories in GNU-configure fashion:
+SHELL = /bin/sh
+
srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
+
bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
libdir = @libdir@
-includedir = @includedir@/GiNaC
-
-# This must be empty unless the user has called configure with --enable-shared:
-shared = @shared@
-
-# The version-number is tracked in configure.in only:
-LIBGINACVER = @LibGiNaC_Ver@
-
-# Autoconf macro AC_PROC_INSTALL sets these:
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-
-
-all: lib ginsh/ginsh
- echo "now type make install"
-
-src/libginac.la:
- cd src; ${MAKE} libginac.la
-
-src/.libs/libginac.a:
- cd src; ${MAKE} .libs/libginac.a
-
-lib:
- cd src; ${MAKE} all
-
-
-# Targets for making the GiNaC interactive shell (ginsh)
-ginsh: ginsh/ginsh
-
-ginsh/ginsh:
- if [ "${shared}" ]; then \
- ${MAKE} sharedginsh; \
- else \
- ${MAKE} staticginsh; \
- fi
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
-sharedginsh: src/libginac.la
- cd ginsh; ${MAKE} sharedginsh
+DISTDIR =
-staticginsh: src/.libs/libginac.a
- cd ginsh; ${MAKE} staticginsh
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
-# Target for running a test-suite across the library:
-check:
- if [ "${shared}" ]; then \
- ${MAKE} sharedcheck; \
- else \
- ${MAKE} staticcheck; \
- fi
-
-sharedcheck: src/libginac.la
- cd check; ${MAKE} sharedcheck
-
-staticcheck: src/.libs/libginac.a
- cd check; ${MAKE} staticcheck
-
-
-# Targets for installation in install directories. The user-visible target
-# `install' determines which one to call (static lib only or both shared and
-# static lib).
-install: installdirs
- @ if [ "${shared}" ]; then \
- ${MAKE} sharedinst; \
- else \
- ${MAKE} staticinst; \
- fi
- ${INSTALL_DATA} include/GiNaC/*.h ${includedir}/
- cd ginsh; ${MAKE} install
- cd doc; ${MAKE} install
-
-sharedinst: src/libginac.la
- ${LIBTOOL} install src/libginac.la ${libdir}/libginac.la
- ${LIBTOOL} -n --finish ${libdir}
-
-staticinst: src/.libs/libginac.a
- ${INSTALL_DATA} src/.libs/libginac.a ${libdir}/libginac.a
-
-installdirs:
- ./mkinstalldirs ${libdir} ${includedir}
-
-
-# Targets for cleaning up. (clean deletes files created by built, distclean
-# deletes files created by configuration, uninstall removes all files related
-# to GiNaC from the system.)
-clean:
- cd src; ${MAKE} clean
- cd check; ${MAKE} clean
- cd ginsh; ${MAKE} clean
-
-distclean: clean
- cd src; ${MAKE} distclean
- cd check; ${MAKE} distclean
- cd ginsh; ${MAKE} distclean
- rm -f config.status config.log config.cache config.h Makefile
-
-uninstall:
- rm -f ${libdir}/libginac.*
- rm -rf ${includedir}
- cd ginsh; ${MAKE} uninstall
- cd doc; ${MAKE} uninstall
-
-
-# Convenient targets for those who wish to extend on the documentation:
-doc:
- cd doc; ${MAKE} all
-reference:
- cd doc; ${MAKE} reference
-tutorial:
- cd doc; ${MAKE} tutorial
-
-
-# Special dummy targets:
-.PHONY: clean distclean all install installdirs uninstall check ginsh doc
-.SUFFIXES: .o .lo .cpp
-.SILENT: all check sharedcheck staticcheck doc reference tutorial
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+CC = @CC@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+DOXYGEN = @DOXYGEN@
+DVIPS = @DVIPS@
+FIG2DEV = @FIG2DEV@
+JADE = @JADE@
+JADETEX = @JADETEX@
+LATEX = @LATEX@
+LD = @LD@
+LEX = @LEX@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINDEX = @MAKEINDEX@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+VERSION = @VERSION@
+YACC = @YACC@
+
+SUBDIRS = ginac check ginsh doc
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
+Makefile.in NEWS acconfig.h acinclude.m4 aclocal.m4 config.guess \
+config.h.in config.sub configure configure.in install-sh ltconfig \
+ltmain.sh missing mkinstalldirs stamp-h.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP = --best
+all: all-recursive-am all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+$(ACLOCAL_M4): @MAINT@ configure.in acinclude.m4
+ cd $(srcdir) && $(ACLOCAL)
+
+config.status: $(srcdir)/configure
+ $(SHELL) ./config.status --recheck
+$(srcdir)/configure: @MAINT@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+ cd $(srcdir) && $(AUTOCONF)
+
+config.h: stamp-h
+ @:
+stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES= CONFIG_HEADERS=config.h \
+ $(SHELL) ./config.status
+ @echo timestamp > stamp-h
+$(srcdir)/config.h.in: @MAINT@$(srcdir)/stamp-h.in
+$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
+ cd $(top_srcdir) && $(AUTOHEADER)
+ @echo timestamp > $(srcdir)/stamp-h.in
+
+mostlyclean-hdr:
+
+clean-hdr:
+
+distclean-hdr:
+ -rm -f config.h
+
+maintainer-clean-hdr:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+
+@SET_MAKE@
+
+all-recursive install-data-recursive install-exec-recursive \
+installdirs-recursive install-recursive uninstall-recursive \
+check-recursive installcheck-recursive info-recursive dvi-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ target=`echo $@ | sed s/-recursive//`; \
+ echo "Making $$target in $$subdir"; \
+ (cd $$subdir && $(MAKE) $$target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
+ rev="$$subdir $$rev"; \
+ done; \
+ for subdir in $$rev; do \
+ target=`echo $@ | sed s/-recursive//`; \
+ echo "Making $$target in $$subdir"; \
+ (cd $$subdir && $(MAKE) $$target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ (cd $$subdir && $(MAKE) tags); \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ done; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ -rm -rf $(distdir)
+ GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz
+ mkdir $(distdir)/=build
+ mkdir $(distdir)/=inst
+ dc_install_base=`cd $(distdir)/=inst && pwd`; \
+ cd $(distdir)/=build \
+ && ../configure --srcdir=.. --prefix=$$dc_install_base \
+ && $(MAKE) \
+ && $(MAKE) dvi \
+ && $(MAKE) check \
+ && $(MAKE) install \
+ && $(MAKE) installcheck \
+ && $(MAKE) dist
+ -rm -rf $(distdir)
+ @echo "========================"; \
+ echo "$(distdir).tar.gz is ready for distribution"; \
+ echo "========================"
+dist: distdir
+ -chmod -R a+r $(distdir)
+ GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
+ -rm -rf $(distdir)
+dist-all: distdir
+ -chmod -R a+r $(distdir)
+ GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
+ -rm -rf $(distdir)
+distdir: $(DISTFILES)
+ -rm -rf $(distdir)
+ mkdir $(distdir)
+ -chmod 777 $(distdir)
+ here=`cd $(top_builddir) && pwd`; \
+ top_distdir=`cd $(distdir) && pwd`; \
+ distdir=`cd $(distdir) && pwd`; \
+ cd $(top_srcdir) \
+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file; \
+ done
+ for subdir in $(SUBDIRS); do \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ chmod 777 $(distdir)/$$subdir; \
+ (cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
+ || exit 1; \
+ done
+info: info-recursive
+dvi: dvi-recursive
+check: all-am
+ $(MAKE) check-recursive
+installcheck: installcheck-recursive
+all-recursive-am: config.h
+ $(MAKE) all-recursive
+
+all-am: Makefile config.h
+
+install-exec: install-exec-recursive
+ @$(NORMAL_INSTALL)
+
+install-data: install-data-recursive
+ @$(NORMAL_INSTALL)
+
+install: install-recursive
+ @:
+
+uninstall: uninstall-recursive
+
+install-strip:
+ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+installdirs: installdirs-recursive
+
+
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -rm -f Makefile $(DISTCLEANFILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
+
+clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
+
+distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
+
+maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
+ maintainer-clean-generic distclean-am
+
+mostlyclean: mostlyclean-recursive mostlyclean-am
+
+clean: clean-recursive clean-am
+
+distclean: distclean-recursive distclean-am
+ -rm -f config.status
+ -rm -f libtool
+
+maintainer-clean: maintainer-clean-recursive maintainer-clean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+ -rm -f config.status
+
+.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
+install-data-recursive uninstall-data-recursive install-exec-recursive \
+uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
+all-recursive check-recursive installcheck-recursive info-recursive \
+dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
+maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir info dvi \
+installcheck all-recursive-am all-am install-exec install-data install \
+uninstall all installdirs mostlyclean-generic distclean-generic \
+clean-generic maintainer-clean-generic clean mostlyclean distclean \
+maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- /dev/null
+dnl ===========================================================================
+dnl Additional macros used to configure GiNaC. We don't start additions' names
+dnl with AC_ but with GINAC_ in order to avoid future trouble.
+dnl ===========================================================================
+
+dnl Generally, it is a bad idea to put specialized header files for a library
+dnl into a generic directory like /usr/local/include/. Instead, one should put
+dnl them into a subdirectory. GiNaC does it, NTL does it. Unfortunately, CLN
+dnl doesn't do so but some people choose to do it by hand. In these cases we
+dnl need to #include <CLN/cln.h>, otherwise #include <cln.h>. This macro
+dnl tries to be clever and find out the correct way by defining the variable
+dnl HAVE_CLN_CLN_H in config.h:
+AC_DEFUN(GINAC_CHECK_CLN_H,
+ [AC_PROVIDE([$0])
+ AC_CHECK_HEADERS(CLN/cln.h, ,
+ AC_CHECK_HEADERS(cln.h, ,
+ AC_MSG_ERROR([cannot find header for Bruno Haible's CLN]);
+ )
+ )
+])
+
+dnl This macro is needed because the generic AC_CHECK_LIB doesn't work because
+dnl C++ is more strongly typed than C. Therefore we need to work with the
+dnl more fundamental AC_TRY_LINK instead.
+AC_DEFUN(GINAC_CHECK_LIBCLN,
+ [AC_PROVIDE([$0])
+ AC_MSG_CHECKING([how to link with libcln])
+ saved_LIBS="${LIBS}"
+ AC_CACHE_VAL(ginac_cv_lib_cln_link,
+ [LIBS="-lcln"
+ case "${ac_cv_header_CLN_cln_h}" in
+ "yes")
+ AC_TRY_LINK([#include <CLN/cln.h>],
+ [factorial(1);],
+ ginac_cv_lib_cln_link="-lcln",
+ ginac_cv_lib_cln_link="fail")
+ ;;
+ *)
+ AC_TRY_LINK([#include <cln.h>],
+ [factorial(1);],
+ ginac_cv_lib_cln_link="-lcln",
+ ginac_cv_lib_cln_link="fail")
+ ;;
+ esac
+ ])
+ case "${ginac_cv_lib_cln_link}" in
+dnl linking worked:
+ "-lcln")
+ LIBS="-lcln ${saved_LIBS}"
+ AC_MSG_RESULT([-lcln])
+ GINAC_CHECK_LIBCLN_SANITY
+ ;;
+dnl linking failed:
+ "fail")
+ LIBS="${saved_LIBS}"
+ AC_MSG_RESULT([])
+ AC_MSG_WARN([linking with libcln failed])
+ ;;
+dnl should never ever get here:
+ *)
+ LIBS="${saved_LIBS}"
+ ;;
+ esac
+])
+
+dnl Check if the CLN library suits our needs, i.e. if it is new enough, by
+dnl trying to run into a little bug which was present till version 1.0.1 and
+dnl then removed.
+AC_DEFUN(GINAC_CHECK_LIBCLN_SANITY,
+ [AC_PROVIDE([$0])
+ AC_MSG_CHECKING([whether libcln behaves sane])
+ AC_CACHE_VAL(ginac_cv_lib_cln_integrity,
+ [
+ case "${ac_cv_header_CLN_cln_h}" in
+ "yes")
+ AC_TRY_RUN([#include <CLN/cln.h>
+int main() {
+cl_RA q(3); q = q/2; cl_RA p(3); p = p/2;
+if (q+p != 3) return 1; else return 0;
+}],
+ ginac_cv_lib_cln_integrity="sane",
+ ginac_cv_lib_cln_integrity="insane",
+ ginac_cv_lib_cln_integrity="guessing sane")
+ ;;
+ *)
+ AC_TRY_RUN([#include <cln.h>
+int main() {
+cl_RA q(3); q = q/2; cl_RA p(3); p = p/2;
+if (q+p != 3) return 1; else return 0;
+}],
+ ginac_cv_lib_cln_integrity="sane",
+ ginac_cv_lib_cln_integrity="insane",
+ ginac_cv_lib_cln_integrity="guessing sane")
+ ;;
+ esac
+ ])
+ case "${ginac_cv_lib_cln_integrity}" in
+dnl exit status was 0:
+ "sane")
+ AC_MSG_RESULT([yes])
+ ;;
+dnl exit status was not 0:
+ "insane")
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([maybe version of libcln is older than 1.0.2?])
+ ;;
+dnl test-program was not run because we are cross-compiling:
+ "guessing sane")
+ AC_MSG_RESULT([hopefully])
+ ;;
+dnl should never ever get here:
+ *)
+ AC_MSG_WARN([you found a bug in the configure script!])
+ ;;
+ esac
+])
+dnl aclocal.m4 generated automatically by aclocal 1.3
+
+dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+dnl This Makefile.in is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
dnl ===========================================================================
dnl Additional macros used to configure GiNaC. We don't start additions' names
dnl with AC_ but with GINAC_ in order to avoid future trouble.
;;
esac
])
+
+# Like AC_CONFIG_HEADER, but automatically create stamp file.
+
+AC_DEFUN(AM_CONFIG_HEADER,
+[AC_PREREQ([2.12])
+AC_CONFIG_HEADER([$1])
+dnl When config.status generates a header, we must update the stamp-h file.
+dnl This file resides in the same directory as the config header
+dnl that is generated. We must strip everything past the first ":",
+dnl and everything past the last "/".
+AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
+ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
+<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
+<<am_indx=1
+for am_file in <<$1>>; do
+ case " <<$>>CONFIG_HEADERS " in
+ *" <<$>>am_file "*<<)>>
+ echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
+ ;;
+ esac
+ am_indx=`expr "<<$>>am_indx" + 1`
+done<<>>dnl>>)
+changequote([,]))])
+
+# Do all the work for Automake. This macro actually does too much --
+# some checks are only needed if your package does certain things.
+# But this isn't really a big deal.
+
+# serial 1
+
+dnl Usage:
+dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+
+AC_DEFUN(AM_INIT_AUTOMAKE,
+[AC_REQUIRE([AM_PROG_INSTALL])
+PACKAGE=[$1]
+AC_SUBST(PACKAGE)
+VERSION=[$2]
+AC_SUBST(VERSION)
+dnl test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+ifelse([$3],,
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
+AC_REQUIRE([AM_SANITY_CHECK])
+AC_REQUIRE([AC_ARG_PROGRAM])
+dnl FIXME This is truly gross.
+missing_dir=`cd $ac_aux_dir && pwd`
+AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
+AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
+AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
+AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
+AC_REQUIRE([AC_PROG_MAKE_SET])])
+
+
+# serial 1
+
+AC_DEFUN(AM_PROG_INSTALL,
+[AC_REQUIRE([AC_PROG_INSTALL])
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+AC_SUBST(INSTALL_SCRIPT)dnl
+])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+AC_DEFUN(AM_SANITY_CHECK,
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "[$]*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "[$]*" != "X $srcdir/configure conftestfile" \
+ && test "[$]*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "[$]2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+rm -f conftest*
+AC_MSG_RESULT(yes)])
+
+dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
+dnl The program must properly implement --version.
+AC_DEFUN(AM_MISSING_PROG,
+[AC_MSG_CHECKING(for working $2)
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if ($2 --version) < /dev/null > /dev/null 2>&1; then
+ $1=$2
+ AC_MSG_RESULT(found)
+else
+ $1="$3/missing $2"
+ AC_MSG_RESULT(missing)
+fi
+AC_SUBST($1)])
+
+# Add --enable-maintainer-mode option to configure.
+# From Jim Meyering
+
+# serial 1
+
+AC_DEFUN(AM_MAINTAINER_MODE,
+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+ dnl maintainer-mode is disabled by default
+ AC_ARG_ENABLE(maintainer-mode,
+[ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer],
+ USE_MAINTAINER_MODE=$enableval,
+ USE_MAINTAINER_MODE=no)
+ AC_MSG_RESULT($USE_MAINTAINER_MODE)
+ if test $USE_MAINTAINER_MODE = yes; then
+ MAINT=
+ else
+ MAINT='#M#'
+ fi
+ AC_SUBST(MAINT)dnl
+]
+)
+
+
+# serial 24 AM_PROG_LIBTOOL
+AC_DEFUN(AM_PROG_LIBTOOL,
+[AC_REQUIRE([AM_ENABLE_SHARED])dnl
+AC_REQUIRE([AM_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_RANLIB])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AM_PROG_LD])dnl
+AC_REQUIRE([AM_PROG_NM])dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+dnl
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags=
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$silent" = yes && libtool_flags="$libtool_flags --silent"
+test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case "$host" in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ CFLAGS="$CFLAGS -belf"
+ ;;
+esac
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
+|| AC_MSG_ERROR([libtool configure failed])
+])
+
+# AM_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AM_ENABLE_SHARED[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AM_ENABLE_SHARED,
+[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<< --enable-shared build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT]
+changequote([, ])dnl
+[ --enable-shared=PKGS only build shared libraries if the current package
+ appears as an element in the PKGS list],
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
+])
+
+# AM_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN(AM_DISABLE_SHARED,
+[AM_ENABLE_SHARED(no)])
+
+# AM_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN(AM_DISABLE_STATIC,
+[AM_ENABLE_STATIC(no)])
+
+# AM_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AM_ENABLE_STATIC[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AM_ENABLE_STATIC,
+[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<< --enable-static build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT]
+changequote([, ])dnl
+[ --enable-static=PKGS only build shared libraries if the current package
+ appears as an element in the PKGS list],
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
+])
+
+
+# AM_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN(AM_PROG_LD,
+[AC_ARG_WITH(gnu-ld,
+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])
+ac_prog=ld
+if test "$ac_cv_prog_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by GCC])
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+ /* | [A-Za-z]:\\*)
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(ac_cv_path_LD,
+[if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog"; then
+ ac_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ ac_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$ac_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_SUBST(LD)
+AM_PROG_LD_GNU
+])
+
+AC_DEFUN(AM_PROG_LD_GNU,
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ ac_cv_prog_gnu_ld=yes
+else
+ ac_cv_prog_gnu_ld=no
+fi])
+])
+
+# AM_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN(AM_PROG_NM,
+[AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(ac_cv_path_NM,
+[case "$NM" in
+/* | [A-Za-z]:\\*)
+ ac_cv_path_NM="$NM" # Let the user override the test with a path.
+ ;;
+*)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/nm; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -B"
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -p"
+ else
+ ac_cv_path_NM="$ac_dir/nm"
+ fi
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+ ;;
+esac])
+NM="$ac_cv_path_NM"
+AC_MSG_RESULT([$NM])
+AC_SUBST(NM)
+])
+
+
+dnl AM_PROG_LEX
+dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
+AC_DEFUN(AM_PROG_LEX,
+[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
+AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
+AC_PROG_LEX
+AC_DECL_YYTEXT])
+
--- /dev/null
+## Process this file with automake to produce Makefile.in
+noinst_PROGRAMS = check_ginac
+check_ginac_SOURCES = paranoia_check.cpp numeric_output.cpp numeric_consist.cpp \
+ powerlaws.cpp expand_subs.cpp inifcns_consist.cpp differentiation.cpp \
+ poly_gcd.cpp normalization.cpp lsolve_onedim.cpp matrix_checks.cpp \
+ series_expansion.cpp fcntimer.cpp main.cpp
+check_ginac_LDADD = ../ginac/libginac.la
+TESTS = run_checks
-# This is the Makefile for GiNaC's consistency checks.
+# Makefile.in generated automatically by automake 1.3 from Makefile.am
-# Not every make knows what CXX is, so we inherit it together with some other
-# values from configure which checks it anyways:
-CXX = @CXX@
-CXXFLAGS = @CXXFLAGS@
-CPPFLAGS = @CPPFLAGS@ -I../include
-DEFS = @DEFS@
-LIBS = @LIBS@
-LDFLAGS = @LDFLAGS@
+# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
-# Here come the usual install directories in GNU-configure fashion:
+
+SHELL = /bin/sh
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
includedir = @includedir@
+oldincludedir = /usr/include
+
+DISTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+CC = @CC@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+DOXYGEN = @DOXYGEN@
+DVIPS = @DVIPS@
+FIG2DEV = @FIG2DEV@
+JADE = @JADE@
+JADETEX = @JADETEX@
+LATEX = @LATEX@
+LD = @LD@
+LEX = @LEX@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINDEX = @MAKEINDEX@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+VERSION = @VERSION@
+YACC = @YACC@
+
+noinst_PROGRAMS = check_ginac
+check_ginac_SOURCES = paranoia_check.cpp numeric_output.cpp numeric_consist.cpp \
+ powerlaws.cpp expand_subs.cpp inifcns_consist.cpp differentiation.cpp \
+ poly_gcd.cpp normalization.cpp lsolve_onedim.cpp matrix_checks.cpp \
+ series_expansion.cpp fcntimer.cpp main.cpp
+check_ginac_LDADD = ../ginac/libginac.la
+TESTS = run_checks
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES =
+PROGRAMS = $(noinst_PROGRAMS)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I..
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+check_ginac_OBJECTS = paranoia_check.o numeric_output.o \
+numeric_consist.o powerlaws.o expand_subs.o inifcns_consist.o \
+differentiation.o poly_gcd.o normalization.o lsolve_onedim.o \
+matrix_checks.o series_expansion.o fcntimer.o main.o
+check_ginac_DEPENDENCIES = ../ginac/libginac.la
+check_ginac_LDFLAGS =
+CXXFLAGS = @CXXFLAGS@
+CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS)
+CXXLINK = $(LIBTOOL) --mode=link $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@
+DIST_COMMON = Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP = --best
+DEP_FILES = .deps/differentiation.P .deps/expand_subs.P \
+.deps/fcntimer.P .deps/inifcns_consist.P .deps/lsolve_onedim.P \
+.deps/main.P .deps/matrix_checks.P .deps/normalization.P \
+.deps/numeric_consist.P .deps/numeric_output.P .deps/paranoia_check.P \
+.deps/poly_gcd.P .deps/powerlaws.P .deps/series_expansion.P
+CXXMKDEP = $(CXX) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS)
+SOURCES = $(check_ginac_SOURCES)
+OBJECTS = $(check_ginac_OBJECTS)
+
+all: Makefile $(PROGRAMS)
+
+.SUFFIXES:
+.SUFFIXES: .S .c .cpp .lo .o .s
+$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu check/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-noinstPROGRAMS:
+
+clean-noinstPROGRAMS:
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+
+distclean-noinstPROGRAMS:
+
+maintainer-clean-noinstPROGRAMS:
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+
+clean-compile:
+
+distclean-compile:
+ -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+.s.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+.S.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+
+maintainer-clean-libtool:
+
+check_ginac: $(check_ginac_OBJECTS) $(check_ginac_DEPENDENCIES)
+ @rm -f check_ginac
+ $(CXXLINK) $(check_ginac_LDFLAGS) $(check_ginac_OBJECTS) $(check_ginac_LDADD) $(LIBS)
+.cpp.o:
+ $(CXXCOMPILE) -c $<
+.cpp.lo:
+ $(LTCXXCOMPILE) -c $<
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = check
+
+distdir: $(DISTFILES)
+ here=`cd $(top_builddir) && pwd`; \
+ top_distdir=`cd $(top_distdir) && pwd`; \
+ distdir=`cd $(distdir) && pwd`; \
+ cd $(top_srcdir) \
+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu check/Makefile
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file; \
+ done
+
+DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
+
+-include $(DEP_FILES)
+
+mostlyclean-depend:
+
+clean-depend:
+
+distclean-depend:
+
+maintainer-clean-depend:
+ -rm -rf .deps
+
+%.o: %.c
+ @echo '$(COMPILE) -c $<'; \
+ $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $<
+
+%.lo: %.c
+ @echo '$(LTCOMPILE) -c $<'; \
+ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $<
+ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
+ < .deps/$(*F).p > .deps/$(*F).P
+ @-rm -f .deps/$(*F).p
+
+%.o: %.cpp
+ @echo '$(CXXCOMPILE) -c $<'; \
+ $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).P -c $<
+
+%.lo: %.cpp
+ @echo '$(LTCXXCOMPILE) -c $<'; \
+ $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).p -c $<
+ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
+ < .deps/$(*F).p > .deps/$(*F).P
+ @-rm -f .deps/$(*F).p
+check-TESTS: $(TESTS)
+ @failed=0; all=0; \
+ srcdir=$(srcdir); export srcdir; \
+ for tst in $(TESTS); do \
+ if test -f $$tst; then dir=.; \
+ else dir="$(srcdir)"; fi; \
+ if $(TESTS_ENVIRONMENT) $$dir/$$tst; then \
+ all=`expr $$all + 1`; \
+ echo "PASS: $$tst"; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="$$failed of $$all tests failed"; \
+ fi; \
+ dashes=`echo "$$banner" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0
+info:
+dvi:
+check: all
+ $(MAKE) check-TESTS
+installcheck:
+install-exec:
+ @$(NORMAL_INSTALL)
+
+install-data:
+ @$(NORMAL_INSTALL)
+
+install: install-exec install-data all
+ @:
+
+uninstall:
+
+install-strip:
+ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+installdirs:
+
+
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -rm -f Makefile $(DISTCLEANFILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+mostlyclean: mostlyclean-noinstPROGRAMS mostlyclean-compile \
+ mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
+ mostlyclean-generic
+
+clean: clean-noinstPROGRAMS clean-compile clean-libtool clean-tags \
+ clean-depend clean-generic mostlyclean
+
+distclean: distclean-noinstPROGRAMS distclean-compile distclean-libtool \
+ distclean-tags distclean-depend distclean-generic clean
+ -rm -f config.status
+ -rm -f libtool
+
+maintainer-clean: maintainer-clean-noinstPROGRAMS \
+ maintainer-clean-compile maintainer-clean-libtool \
+ maintainer-clean-tags maintainer-clean-depend \
+ maintainer-clean-generic distclean
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+.PHONY: mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \
+clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile mostlyclean-libtool distclean-libtool \
+clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir \
+mostlyclean-depend distclean-depend clean-depend \
+maintainer-clean-depend check-TESTS info dvi installcheck install-exec \
+install-data install uninstall all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
+
-# This must be empty unless the user has called configure with --enable-shared:
-shared = @shared@
-
-OBJECTS = paranoia_check.o numeric_output.o numeric_consist.o powerlaws.o \
- expand_subs.o inifcns_consist.o differentiation.o poly_gcd.o \
- normalization.o lsolve_onedim.o matrix_checks.o series_expansion.o \
- fcntimer.o main.o
-
-all:
- echo "Please call it with 'make check' from top-level Makefile."
- echo "Alternatively, you can use this Makefile's targets {shared|static}check"
- echo "depending on your personal preferences and which library you built."
-
-sharedcheck: ${OBJECTS} ../src/.libs/libginac.so
- ${CXX} ${LDFLAGS} ${OBJECTS} -Wl,--rpath -Wl,../src/.libs -L../src/.libs -lginac ${LIBS} -o main
- @echo -n "Running "
- ./main 2> result.out
- @echo -n "comparing output: "
- cmp result.ref result.out
-
-staticcheck: ${OBJECTS} ../src/.libs/libginac.a
- ${CXX} ${LDFLAGS} ${OBJECTS} ../src/.libs/libginac.a ${LIBS} -o main
- @echo -n "Running "
- ./main 2> result.out
- @echo -n "comparing output: "
- cmp result.ref result.out
-
-# Special dummy targets:
-.PHONY: clean distclean all sharedcheck staticcheck
-.SUFFIXES: .o .cpp
-.SILENT: all
-
-clean:
- rm -f *.o main core result.out
-
-distclean: clean
- rm -f Makefile
-
-# Suffix rules:
-.cpp.o :
- ${CXX} ${CPPFLAGS} ${CXXFLAGS} ${DEFS} -c $<
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
// check/check.h
-#ifndef _CHECK_H_
-#define _CHECK_H_
+#ifndef CHECK_H
+#define CHECK_H
// fcntimer is defined in timer.cpp and used for timing check functions only:
unsigned fcntimer(unsigned fcn());
unsigned lsolve_onedim();
unsigned series_expansion();
-#endif // ndef _CHECK_H_
+#endif // ndef CHECK_H
/* Tests for symbolic differentiation, including various functions. */
-#include <GiNaC/ginac.h>
+#include <ginac/ginac.h>
static unsigned check_diff(const ex &e, const symbol &x,
const ex &d, unsigned nth=1)
* substitute a0 by -a1 in e
* after which e should return 0 (without expanding). */
-#include <GiNaC/ginac.h>
+#include <ginac/ginac.h>
#define VECSIZE 100
/* This test routine applies assorted tests on initially known higher level
* functions. */
-#include <GiNaC/ginac.h>
+#include <ginac/ginac.h>
/* Simple tests on the sine trigonometric function. */
static unsigned inifcns_consist_sin(void)
/* This test routine does some simple checks on solving a polynomial for a
* variable. */
-#include <GiNaC/ginac.h>
+#include <ginac/ginac.h>
unsigned lsolve_onedim(void)
{
// check/main.cpp
#include <stdexcept>
-#include <GiNaC/ginac.h>
+#include <ginac/ginac.h>
#include "check.h"
int main()
}
} catch (exception const & e) {
cout << "error: caught an exception: " << e.what() << endl;
+ result++;
}
if (result) {
/* Here we test manipulations on GiNaC's symbolic matrices. */
#include <stdexcept>
-#include <GiNaC/ginac.h>
+#include <ginac/ginac.h>
static unsigned matrix_determinants(void)
{
/* Rational function normalization test-suite. */
-#include <GiNaC/ginac.h>
+#include <ginac/ginac.h>
static symbol x("x"), y("y"), z("z");
* boolean tests on these numbers like is_integer() etc... */
#include <stdlib.h>
-#include <GiNaC/ginac.h>
+#include <ginac/ginac.h>
/* Simple and maybe somewhat pointless consistency tests of assorted tests and
* conversions. */
// check/numeric_output.cpp
-#include <GiNaC/ginac.h>
+#include <ginac/ginac.h>
unsigned numeric_output(void)
{
* a sick behaviour again. But since we are paranoic and we want to exclude
* that behaviour for good... */
-#include <GiNaC/ginac.h>
+#include <ginac/ginac.h>
// The very first pair of historic problems had its roots in power.cpp and was
// finally resolved on April 27th. (Fixing the first on April 23rd actually
/* Some test with polynomial GCD calculations. See also the checks for
* rational function normalization in normalization.cpp. */
-#include <GiNaC/ginac.h>
+#include <ginac/ginac.h>
const int MAX_VARIABLES = 5;
/* Tests for power laws. You shouldn't try to draw much inspiration from
* this code, it is a sanity check rather deeply rooted in GiNaC's classes. */
-#include <GiNaC/ginac.h>
+#include <ginac/ginac.h>
static unsigned powerlaws1(void)
{
--- /dev/null
+#! /bin/sh
+echo "Running checks..."
+./check_ginac 2>result.out
+echo "Comparing output..."
+cmp result.ref result.out
/* Series expansion test (Laurent and Taylor series). */
-#include <GiNaC/ginac.h>
+#include <ginac/ginac.h>
static symbol x("x");
/* config.h.in. Generated automatically from configure.in by autoheader. */
-/* Define if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
/* Define if lex declares yytext as a char * by default, not a char[]. */
#undef YYTEXT_POINTER
+/* Define to the name of the distribution. */
+#undef PACKAGE
+
+/* Define to the version of the distribution. */
+#undef VERSION
+
/* Define if you have the strdup function. */
#undef HAVE_STRDUP
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
+# Generated automatically using autoconf version 2.12
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
- --enable-shared build shared libraries [default=no]
- (a static library will still be built as well)"
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer"
+ac_help="$ac_help
+ --enable-shared build shared libraries [default=yes]
+ --enable-shared=PKGS only build shared libraries if the current package
+ appears as an element in the PKGS list"
+ac_help="$ac_help
+ --enable-static build static libraries [default=yes]
+ --enable-static=PKGS only build shared libraries if the current package
+ appears as an element in the PKGS list"
+ac_help="$ac_help
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]"
# Initialize some variables set by options.
# The variables have the same names as the options, with
# Initialize some other variables.
subdirs=
MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
# Maximum number of lines to put in a shell here document.
ac_max_here_lines=12
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
+ echo "configure generated by autoconf version 2.12"
exit 0 ;;
-with-* | --with-*)
# A filename unique to this package, relative to the directory that
# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=include/GiNaC/ginac.h
+ac_unique_file=ginac/basic.cpp
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
-ac_exeext=
-ac_objext=o
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
-GiNaC_Major_Version=0
-GiNaC_Minor_Version=0
-GiNaC_Micro_Version=40
-GiNaC_Version="${GiNaC_Major_Version}.${GiNaC_Minor_Version}.${GiNaC_Micro_Version}"
-LibGiNaC_Ver="${GiNaC_Major_Version}:${GiNaC_Micro_Version}:${GiNaC_Minor_Version}"
-# Check whether --enable-shared or --disable-shared was given.
-if test "${enable_shared+set}" = set; then
- enableval="$enable_shared"
- shared=${enableval}
+
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:570: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ for ac_prog in ginstall installbsd scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ # OSF/1 installbsd also uses dspmsg, but is usable.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
+echo "configure:623: checking whether build environment is sane" >&5
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "$*" != "X $srcdir/configure conftestfile" \
+ && test "$*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ { echo "configure: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" 1>&2; exit 1; }
+ fi
+
+ test "$2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ { echo "configure: error: newly created file is older than distributed files!
+Check your system clock" 1>&2; exit 1; }
+fi
+rm -f conftest*
+echo "$ac_t""yes" 1>&6
+if test "$program_transform_name" = s,x,x,; then
+ program_transform_name=
+else
+ # Double any \ or $. echo might interpret backslashes.
+ cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+ program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+ rm -f conftestsed
+fi
+test "$program_prefix" != NONE &&
+ program_transform_name="s,^,${program_prefix},; $program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+
+# sed with no file args requires a program.
+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:680: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+PACKAGE=GiNaC
+
+VERSION=0.4
+
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
+fi
+cat >> confdefs.h <<EOF
+#define PACKAGE "$PACKAGE"
+EOF
+
+cat >> confdefs.h <<EOF
+#define VERSION "$VERSION"
+EOF
+
+
+
+missing_dir=`cd $ac_aux_dir && pwd`
+echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
+echo "configure:726: checking for working aclocal" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (aclocal --version) < /dev/null > /dev/null 2>&1; then
+ ACLOCAL=aclocal
+ echo "$ac_t""found" 1>&6
+else
+ ACLOCAL="$missing_dir/missing aclocal"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
+echo "configure:739: checking for working autoconf" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (autoconf --version) < /dev/null > /dev/null 2>&1; then
+ AUTOCONF=autoconf
+ echo "$ac_t""found" 1>&6
+else
+ AUTOCONF="$missing_dir/missing autoconf"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working automake""... $ac_c" 1>&6
+echo "configure:752: checking for working automake" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (automake --version) < /dev/null > /dev/null 2>&1; then
+ AUTOMAKE=automake
+ echo "$ac_t""found" 1>&6
+else
+ AUTOMAKE="$missing_dir/missing automake"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
+echo "configure:765: checking for working autoheader" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (autoheader --version) < /dev/null > /dev/null 2>&1; then
+ AUTOHEADER=autoheader
+ echo "$ac_t""found" 1>&6
else
- shared="no"
+ AUTOHEADER="$missing_dir/missing autoheader"
+ echo "$ac_t""missing" 1>&6
fi
+echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
+echo "configure:778: checking for working makeinfo" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
+ MAKEINFO=makeinfo
+ echo "$ac_t""found" 1>&6
+else
+ MAKEINFO="$missing_dir/missing makeinfo"
+ echo "$ac_t""missing" 1>&6
+fi
+
+
+echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
+echo "configure:792: checking whether to enable maintainer-specific portions of Makefiles" >&5
+ # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+ enableval="$enable_maintainer_mode"
+ USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi
+
+ echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
+ if test $USE_MAINTAINER_MODE = yes; then
+ MAINT=
+ else
+ MAINT='#M#'
+ fi
+
+
-for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl
+for ac_prog in $CCC c++ g++ gcc CC cxx cc++
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:550: checking for $ac_word" >&5
+echo "configure:815: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CXX"; then
ac_cv_prog_CXX="$CXX" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_CXX="$ac_prog"
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:582: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:846: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross
-cat > conftest.$ac_ext << EOF
-
-#line 593 "configure"
+cat > conftest.$ac_ext <<EOF
+#line 856 "configure"
#include "confdefs.h"
-
-int main(){return(0);}
+main(){return(0);}
EOF
-if { (eval echo configure:598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
ac_cv_prog_cxx_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6
{ echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:624: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:886: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:629: checking whether we are using GNU C++" >&5
+echo "configure:891: checking whether we are using GNU C++" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
yes;
#endif
EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:638: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:900: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
if test $ac_cv_prog_gxx = yes; then
GXX=yes
-else
- GXX=
-fi
-
-ac_test_CXXFLAGS="${CXXFLAGS+set}"
-ac_save_CXXFLAGS="$CXXFLAGS"
-CXXFLAGS=
-echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:657: checking whether ${CXX-g++} accepts -g" >&5
+ ac_test_CXXFLAGS="${CXXFLAGS+set}"
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS=
+ echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
+echo "configure:915: checking whether ${CXX-g++} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6
-if test "$ac_test_CXXFLAGS" = set; then
- CXXFLAGS="$ac_save_CXXFLAGS"
-elif test $ac_cv_prog_cxx_g = yes; then
- if test "$GXX" = yes; then
+ if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ elif test $ac_cv_prog_cxx_g = yes; then
CXXFLAGS="-g -O2"
else
- CXXFLAGS="-g"
- fi
-else
- if test "$GXX" = yes; then
CXXFLAGS="-O2"
- else
- CXXFLAGS=
fi
+else
+ GXX=
+ test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
fi
echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
-echo "configure:689: checking how to run the C++ preprocessor" >&5
+echo "configure:943: checking how to run the C++ preprocessor" >&5
if test -z "$CXXCPP"; then
if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross
CXXCPP="${CXX-g++} -E"
cat > conftest.$ac_ext <<EOF
-#line 702 "configure"
+#line 956 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+{ (eval echo configure:961: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
else
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
fi
fi
CXXCPP="$ac_cv_prog_CXXCPP"
echo "$ac_t""$CXXCPP" 1>&6
-ac_ext=C
-# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cxx_cross
-echo $ac_n "checking for cout in -lstdc++""... $ac_c" 1>&6
-echo "configure:739: checking for cout in -lstdc++" >&5
-ac_lib_var=`echo stdc++'_'cout | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lstdc++ $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 747 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char cout();
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-int main() {
-cout()
-; return 0; }
-EOF
-if { (eval echo configure:761: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
+ enable_shared=yes
+fi
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval="$enable_static"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_static=yes
fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
+
+# Make sure we can run config.sub.
+if $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo stdc++ | sed -e 's/[^a-zA-Z0-9_]/_/g' \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
- LIBS="-lstdc++ $LIBS"
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:1041: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`$ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`$ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1064: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
else
echo "$ac_t""no" 1>&6
fi
-for ac_hdr in iostream vector map string list typeinfo iterator strstream stdexcept algorithm
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:792: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1093: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- cat > conftest.$ac_ext <<EOF
-#line 797 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
fi
-rm -f conftest*
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
else
echo "$ac_t""no" 1>&6
-{ echo "configure: error: need to have ANSI compliant headers" 1>&2; exit 1; }
fi
-done
-
- for ac_hdr in CLN/cln.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:834: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1122: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- cat > conftest.$ac_ext <<EOF
-#line 839 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:844: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ ac_prog_rejected=no
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
fi
-rm -f conftest*
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-for ac_hdr in cln.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:871: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 876 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:881: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
else
echo "$ac_t""no" 1>&6
-{ echo "configure: error: cannot find header for Bruno Haible's CLN" 1>&2; exit 1; };
-
fi
-done
-
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
fi
-done
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1170: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
- echo $ac_n "checking how to link with libcln""... $ac_c" 1>&6
-echo "configure:916: checking how to link with libcln" >&5
- saved_LIBS="${LIBS}"
- if eval "test \"`echo '$''{'ginac_cv_lib_cln_link'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- LIBS="-lcln"
- case "${ac_cv_header_CLN_cln_h}" in
- "yes")
- cat > conftest.$ac_ext <<EOF
-#line 925 "configure"
-#include "confdefs.h"
-#include <CLN/cln.h>
-int main() {
-factorial(1);
-; return 0; }
-EOF
-if { (eval echo configure:932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- ginac_cv_lib_cln_link="-lcln"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ginac_cv_lib_cln_link="fail"
-fi
-rm -f conftest*
- ;;
- *)
- cat > conftest.$ac_ext <<EOF
-#line 945 "configure"
+cat > conftest.$ac_ext <<EOF
+#line 1180 "configure"
#include "confdefs.h"
-#include <cln.h>
-int main() {
-factorial(1);
-; return 0; }
+main(){return(0);}
EOF
-if { (eval echo configure:952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- ginac_cv_lib_cln_link="-lcln"
+if { (eval echo configure:1184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
- rm -rf conftest*
- ginac_cv_lib_cln_link="fail"
+ ac_cv_prog_cc_works=no
fi
-rm -f conftest*
- ;;
- esac
-
+rm -fr conftest*
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1204: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
- case "${ginac_cv_lib_cln_link}" in
- "-lcln")
- LIBS="-lcln ${saved_LIBS}"
- echo "$ac_t""-lcln" 1>&6
-
- echo $ac_n "checking whether libcln behaves sane""... $ac_c" 1>&6
-echo "configure:973: checking whether libcln behaves sane" >&5
- if eval "test \"`echo '$''{'ginac_cv_lib_cln_integrity'+set}'`\" = set"; then
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1209: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
-
- case "${ac_cv_header_CLN_cln_h}" in
- "yes")
- if test "$cross_compiling" = yes; then
- ginac_cv_lib_cln_integrity="guessing sane"
-else
- cat > conftest.$ac_ext <<EOF
-#line 984 "configure"
-#include "confdefs.h"
-#ifdef __cplusplus
-extern "C" void exit(int);
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
#endif
-#include <CLN/cln.h>
-int main() {
-cl_RA q(3); q = q/2; cl_RA p(3); p = p/2;
-if (q+p != 3) return 1; else return 0;
-}
EOF
-if { (eval echo configure:995: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- ginac_cv_lib_cln_integrity="sane"
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1218: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ginac_cv_lib_cln_integrity="insane"
+ ac_cv_prog_gcc=no
fi
-rm -fr conftest*
fi
- ;;
- *)
- if test "$cross_compiling" = yes; then
- ginac_cv_lib_cln_integrity="guessing sane"
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=
+ echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1233: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1013 "configure"
-#include "confdefs.h"
-#ifdef __cplusplus
-extern "C" void exit(int);
-#endif
-#include <cln.h>
-int main() {
-cl_RA q(3); q = q/2; cl_RA p(3); p = p/2;
-if (q+p != 3) return 1; else return 0;
-}
-EOF
-if { (eval echo configure:1024: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- ginac_cv_lib_cln_integrity="sane"
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ginac_cv_lib_cln_integrity="insane"
+ ac_cv_prog_cc_g=no
fi
-rm -fr conftest*
+rm -f conftest*
+
fi
- ;;
- esac
-
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ elif test $ac_cv_prog_cc_g = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-O2"
+ fi
+else
+ GCC=
+ test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval="$with_gnu_ld"
+ test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
fi
- case "${ginac_cv_lib_cln_integrity}" in
- "sane")
- echo "$ac_t""yes" 1>&6
- ;;
- "insane")
- echo "$ac_t""no" 1>&6
- echo "configure: warning: maybe version of libcln is older than 1.0.2?" 1>&2
- ;;
- "guessing sane")
- echo "$ac_t""hopefully" 1>&6
- ;;
- *)
- echo "configure: warning: you found a bug in the configure script!" 1>&2
- ;;
- esac
+ac_prog=ld
+if test "$ac_cv_prog_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
+echo "configure:1273: checking for ld used by GCC" >&5
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+ /* | A-Za-z:\\*)
+ test -z "$LD" && LD="$ac_prog"
;;
- "fail")
- LIBS="${saved_LIBS}"
- echo "$ac_t""" 1>&6
- echo "configure: warning: linking with libcln failed" 1>&2
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
;;
- *)
- LIBS="${saved_LIBS}"
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
;;
- esac
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+ esac
+elif test "$with_gnu_ld" = yes; then
+ echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
+echo "configure:1291: checking for GNU ld" >&5
+else
+ echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+echo "configure:1294: checking for non-GNU ld" >&5
fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1099: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog"; then
+ ac_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
done
- IFS="$ac_save_IFS"
+ IFS="$ac_save_ifs"
+else
+ ac_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$ac_cv_path_LD"
+if test -n "$LD"; then
+ echo "$ac_t""$LD" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
+echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
+echo "configure:1330: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ ac_cv_prog_gnu_ld=yes
+else
+ ac_cv_prog_gnu_ld=no
fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
fi
-echo "$ac_t""$INSTALL" 1>&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-# Extract the first word of "makedepend", so it can be a program name with args.
-set dummy makedepend; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1154: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_MAKEDEPEND'+set}'`\" = set"; then
+echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
+echo "configure:1346: checking for BSD-compatible nm" >&5
+if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- case "$MAKEDEPEND" in
- /*)
- ac_cv_path_MAKEDEPEND="$MAKEDEPEND" # Let the user override the test with a path.
+ case "$NM" in
+/* | A-Za-z:\\*)
+ ac_cv_path_NM="$NM" # Let the user override the test with a path.
;;
- ?:/*)
- ac_cv_path_MAKEDEPEND="$MAKEDEPEND" # Let the user override the test with a dos path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
+*)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_path_MAKEDEPEND="$ac_dir/$ac_word"
+ if test -f $ac_dir/nm; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -B"
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -p"
+ else
+ ac_cv_path_NM="$ac_dir/nm"
+ fi
break
fi
done
IFS="$ac_save_ifs"
- test -z "$ac_cv_path_MAKEDEPEND" && ac_cv_path_MAKEDEPEND=""""
+ test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
;;
esac
fi
-MAKEDEPEND="$ac_cv_path_MAKEDEPEND"
-if test -n "$MAKEDEPEND"; then
- echo "$ac_t""$MAKEDEPEND" 1>&6
+
+NM="$ac_cv_path_NM"
+echo "$ac_t""$NM" 1>&6
+
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:1383: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ rm -f conftestdata
+if ln -s X conftestdata 2>/dev/null
+then
+ rm -f conftestdata
+ ac_cv_prog_LN_S="ln -s"
+else
+ ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+ echo "$ac_t""yes" 1>&6
else
echo "$ac_t""no" 1>&6
fi
-case "${shared}" in
-"yes"|"Yes"|"YES") # Default-enable ("yes") or user was nitpicking:
- shared="shlib";
- # Extract the first word of "libtool", so it can be a program name with args.
-set dummy libtool; ac_word=$2
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags=
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$silent" = yes && libtool_flags="$libtool_flags --silent"
+test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case "$host" in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line 1419 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:1420: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ CFLAGS="$CFLAGS -belf"
+ ;;
+esac
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
+|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1450: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1465 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1471: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1482 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1488: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+missing_dir=`cd $ac_aux_dir && pwd`
+for ac_prog in flex lex
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1193: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_LIBTOOL'+set}'`\" = set"; then
+echo "configure:1516: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- case "$LIBTOOL" in
- /*)
- ac_cv_path_LIBTOOL="$LIBTOOL" # Let the user override the test with a path.
- ;;
- ?:/*)
- ac_cv_path_LIBTOOL="$LIBTOOL" # Let the user override the test with a dos path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
+ if test -n "$LEX"; then
+ ac_cv_prog_LEX="$LEX" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
- ac_cv_path_LIBTOOL="$ac_dir/$ac_word"
+ ac_cv_prog_LEX="$ac_prog"
break
fi
done
IFS="$ac_save_ifs"
- test -z "$ac_cv_path_LIBTOOL" && ac_cv_path_LIBTOOL=""""
- ;;
-esac
fi
-LIBTOOL="$ac_cv_path_LIBTOOL"
-if test -n "$LIBTOOL"; then
- echo "$ac_t""$LIBTOOL" 1>&6
+fi
+LEX="$ac_cv_prog_LEX"
+if test -n "$LEX"; then
+ echo "$ac_t""$LEX" 1>&6
else
echo "$ac_t""no" 1>&6
fi
- if test "${LIBTOOL}" == ""; then
- echo "configure: warning: libtool not found: building static lib only" 1>&2
- shared="";
- fi
- ;;
-*) # Default, default-disable ("no") or user entered bogus:
- shared="";
- ;;
-esac
+test -n "$LEX" && break
+done
+test -n "$LEX" || LEX=""$missing_dir/missing flex""
+
# Extract the first word of "flex", so it can be a program name with args.
set dummy flex; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1238: checking for $ac_word" >&5
+echo "configure:1548: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$LEX"; then
ac_cv_prog_LEX="$LEX" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_LEX="flex"
*) ac_lib=l ;;
esac
echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6
-echo "configure:1272: checking for yywrap in -l$ac_lib" >&5
+echo "configure:1581: checking for yywrap in -l$ac_lib" >&5
ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-l$ac_lib $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1280 "configure"
+#line 1589 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char yywrap();
yywrap()
; return 0; }
EOF
-if { (eval echo configure:1294: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1600: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
+echo $ac_n "checking lex output file root""... $ac_c" 1>&6
+echo "configure:1623: checking lex output file root" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # The minimal lex program is just a single line: %%. But some broken lexes
+# (Solaris, I think it was) want two %% lines, so accommodate them.
+echo '%%
+%%' | $LEX
+if test -f lex.yy.c; then
+ ac_cv_prog_lex_root=lex.yy
+elif test -f lexyy.c; then
+ ac_cv_prog_lex_root=lexyy
+else
+ { echo "configure: error: cannot find output from $LEX; giving up" 1>&2; exit 1; }
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_lex_root" 1>&6
+LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
+
+echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6
+echo "configure:1644: checking whether yytext is a pointer" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # POSIX says lex can declare yytext either as a pointer or an array; the
+# default is implementation-dependent. Figure out which it is, since
+# not all implementations provide the %pointer and %array declarations.
+ac_cv_prog_lex_yytext_pointer=no
+echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
+ac_save_LIBS="$LIBS"
+LIBS="$LIBS $LEXLIB"
+cat > conftest.$ac_ext <<EOF
+#line 1656 "configure"
+#include "confdefs.h"
+`cat $LEX_OUTPUT_ROOT.c`
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ ac_cv_prog_lex_yytext_pointer=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+rm -f "${LEX_OUTPUT_ROOT}.c"
+
+fi
+
+echo "$ac_t""$ac_cv_prog_lex_yytext_pointer" 1>&6
+if test $ac_cv_prog_lex_yytext_pointer = yes; then
+ cat >> confdefs.h <<\EOF
+#define YYTEXT_POINTER 1
+EOF
+
+fi
+
for ac_prog in 'bison -y' byacc
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1321: checking for $ac_word" >&5
+echo "configure:1689: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$YACC"; then
ac_cv_prog_YACC="$YACC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_YACC="$ac_prog"
else
echo "$ac_t""no" 1>&6
fi
-
-test -n "$YACC" && break
+
+test -n "$YACC" && break
+done
+test -n "$YACC" || YACC="yacc"
+
+
+ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+
+echo $ac_n "checking for cout in -lstdc++""... $ac_c" 1>&6
+echo "configure:1728: checking for cout in -lstdc++" >&5
+ac_lib_var=`echo stdc++'_'cout | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lstdc++ $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1736 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char cout();
+
+int main() {
+cout()
+; return 0; }
+EOF
+if { (eval echo configure:1750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo stdc++ | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lstdc++ $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+for ac_hdr in iostream vector map string list typeinfo iterator strstream stdexcept algorithm
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1782: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1787 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1792: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+{ echo "configure: error: need to have ANSI compliant headers" 1>&2; exit 1; }
+fi
done
-test -n "$YACC" || YACC="yacc"
-echo $ac_n "checking lex output file root""... $ac_c" 1>&6
-echo "configure:1352: checking lex output file root" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # The minimal lex program is just a single line: %%. But some broken lexes
-# (Solaris, I think it was) want two %% lines, so accommodate them.
-echo '%%
-%%' | $LEX
-if test -f lex.yy.c; then
- ac_cv_prog_lex_root=lex.yy
-elif test -f lexyy.c; then
- ac_cv_prog_lex_root=lexyy
-else
- { echo "configure: error: cannot find output from $LEX; giving up" 1>&2; exit 1; }
-fi
-fi
-echo "$ac_t""$ac_cv_prog_lex_root" 1>&6
-LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
-echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6
-echo "configure:1373: checking whether yytext is a pointer" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then
+ for ac_hdr in CLN/cln.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1825: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- # POSIX says lex can declare yytext either as a pointer or an array; the
-# default is implementation-dependent. Figure out which it is, since
-# not all implementations provide the %pointer and %array declarations.
-ac_cv_prog_lex_yytext_pointer=no
-echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
-ac_save_LIBS="$LIBS"
-LIBS="$LIBS $LEXLIB"
-cat > conftest.$ac_ext <<EOF
-#line 1385 "configure"
+ cat > conftest.$ac_ext <<EOF
+#line 1830 "configure"
#include "confdefs.h"
-`cat $LEX_OUTPUT_ROOT.c`
-int main() {
-
-; return 0; }
+#include <$ac_hdr>
EOF
-if { (eval echo configure:1392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1835: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
rm -rf conftest*
- ac_cv_prog_lex_yytext_pointer=yes
+ eval "ac_cv_header_$ac_safe=yes"
else
+ echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
-LIBS="$ac_save_LIBS"
-rm -f "${LEX_OUTPUT_ROOT}.c"
-
fi
-
-echo "$ac_t""$ac_cv_prog_lex_yytext_pointer" 1>&6
-if test $ac_cv_prog_lex_yytext_pointer = yes; then
- cat >> confdefs.h <<\EOF
-#define YYTEXT_POINTER 1
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
EOF
-
-fi
-
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1414: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+
+else
+ echo "$ac_t""no" 1>&6
+for ac_hdr in cln.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1862: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1419 "configure"
+#line 1867 "configure"
#include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
+#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1427: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+{ (eval echo configure:1872: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
- ac_cv_header_stdc=yes
+ eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- ac_cv_header_stdc=no
+ eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+{ echo "configure: error: cannot find header for Bruno Haible's CLN" 1>&2; exit 1; };
+
+fi
+done
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1444 "configure"
+
+fi
+done
+
+
+
+ echo $ac_n "checking how to link with libcln""... $ac_c" 1>&6
+echo "configure:1907: checking how to link with libcln" >&5
+ saved_LIBS="${LIBS}"
+ if eval "test \"`echo '$''{'ginac_cv_lib_cln_link'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ LIBS="-lcln"
+ case "${ac_cv_header_CLN_cln_h}" in
+ "yes")
+ cat > conftest.$ac_ext <<EOF
+#line 1916 "configure"
#include "confdefs.h"
-#include <string.h>
+#include <CLN/cln.h>
+int main() {
+factorial(1);
+; return 0; }
EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "memchr" >/dev/null 2>&1; then
- :
+if { (eval echo configure:1923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ ginac_cv_lib_cln_link="-lcln"
else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
rm -rf conftest*
- ac_cv_header_stdc=no
+ ginac_cv_lib_cln_link="fail"
fi
rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1462 "configure"
+ ;;
+ *)
+ cat > conftest.$ac_ext <<EOF
+#line 1936 "configure"
#include "confdefs.h"
-#include <stdlib.h>
+#include <cln.h>
+int main() {
+factorial(1);
+; return 0; }
EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "free" >/dev/null 2>&1; then
- :
+if { (eval echo configure:1943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ ginac_cv_lib_cln_link="-lcln"
else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
rm -rf conftest*
- ac_cv_header_stdc=no
+ ginac_cv_lib_cln_link="fail"
fi
rm -f conftest*
-
+ ;;
+ esac
+
fi
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-if test "$cross_compiling" = yes; then
- :
+ case "${ginac_cv_lib_cln_link}" in
+ "-lcln")
+ LIBS="-lcln ${saved_LIBS}"
+ echo "$ac_t""-lcln" 1>&6
+
+ echo $ac_n "checking whether libcln behaves sane""... $ac_c" 1>&6
+echo "configure:1964: checking whether libcln behaves sane" >&5
+ if eval "test \"`echo '$''{'ginac_cv_lib_cln_integrity'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+ case "${ac_cv_header_CLN_cln_h}" in
+ "yes")
+ if test "$cross_compiling" = yes; then
+ ginac_cv_lib_cln_integrity="guessing sane"
else
cat > conftest.$ac_ext <<EOF
-#line 1483 "configure"
+#line 1975 "configure"
#include "confdefs.h"
#ifdef __cplusplus
extern "C" void exit(int);
#endif
-#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int main () { int i; for (i = 0; i < 256; i++)
-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
-exit (0); }
-
+#include <CLN/cln.h>
+int main() {
+cl_RA q(3); q = q/2; cl_RA p(3); p = p/2;
+if (q+p != 3) return 1; else return 0;
+}
EOF
-if { (eval echo configure:1497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
- :
+ ginac_cv_lib_cln_integrity="sane"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
- ac_cv_header_stdc=no
+ ginac_cv_lib_cln_integrity="insane"
fi
rm -fr conftest*
fi
+ ;;
+ *)
+ if test "$cross_compiling" = yes; then
+ ginac_cv_lib_cln_integrity="guessing sane"
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2004 "configure"
+#include "confdefs.h"
+#ifdef __cplusplus
+extern "C" void exit(int);
+#endif
+#include <cln.h>
+int main() {
+cl_RA q(3); q = q/2; cl_RA p(3); p = p/2;
+if (q+p != 3) return 1; else return 0;
+}
+EOF
+if { (eval echo configure:2015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ ginac_cv_lib_cln_integrity="sane"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ginac_cv_lib_cln_integrity="insane"
fi
+rm -fr conftest*
fi
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
-if test $ac_cv_header_stdc = yes; then
- cat >> confdefs.h <<\EOF
-#define STDC_HEADERS 1
-EOF
-
+ ;;
+ esac
+
fi
+ case "${ginac_cv_lib_cln_integrity}" in
+ "sane")
+ echo "$ac_t""yes" 1>&6
+ ;;
+ "insane")
+ echo "$ac_t""no" 1>&6
+ echo "configure: warning: maybe version of libcln is older than 1.0.2?" 1>&2
+ ;;
+ "guessing sane")
+ echo "$ac_t""hopefully" 1>&6
+ ;;
+ *)
+ echo "configure: warning: you found a bug in the configure script!" 1>&2
+ ;;
+ esac
+
+ ;;
+ "fail")
+ LIBS="${saved_LIBS}"
+ echo "$ac_t""" 1>&6
+ echo "configure: warning: linking with libcln failed" 1>&2
+ ;;
+ *)
+ LIBS="${saved_LIBS}"
+ ;;
+ esac
+
+
for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1524: checking for $ac_hdr" >&5
+echo "configure:2064: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1529 "configure"
+#line 2069 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1534: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+{ (eval echo configure:2074: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
for ac_func in strdup
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1563: checking for $ac_func" >&5
+echo "configure:2103: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1568 "configure"
+#line 2108 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:1594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
else
echo "$ac_t""no" 1>&6
+LIBOBJS="$LIBOBJS ${ac_func}.o"
fi
done
+
for ac_hdr in readline/readline.h readline/history.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1622: checking for $ac_hdr" >&5
+echo "configure:2164: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1627 "configure"
+#line 2169 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1632: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+{ (eval echo configure:2174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_t""no" 1>&6
-{ echo "configure: error: need to have GNU readline headers" 1>&2; exit 1; }
fi
done
echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6
-echo "configure:1660: checking for readline in -lreadline" >&5
+echo "configure:2201: checking for readline in -lreadline" >&5
ac_lib_var=`echo readline'_'readline | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lreadline $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1668 "configure"
+#line 2209 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
readline()
; return 0; }
EOF
-if { (eval echo configure:1682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
else
echo "$ac_t""no" 1>&6
-{ echo "configure: error: need to have GNU readline library" 1>&2; exit 1; }
fi
+
# Extract the first word of "doxygen", so it can be a program name with args.
set dummy doxygen; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1713: checking for $ac_word" >&5
+echo "configure:2254: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_DOXYGEN'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
/*)
ac_cv_path_DOXYGEN="$DOXYGEN" # Let the user override the test with a path.
;;
- ?:/*)
- ac_cv_path_DOXYGEN="$DOXYGEN" # Let the user override the test with a dos path.
- ;;
*)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_path_DOXYGEN="$ac_dir/$ac_word"
# Extract the first word of "latex", so it can be a program name with args.
set dummy latex; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1749: checking for $ac_word" >&5
+echo "configure:2286: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_LATEX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
/*)
ac_cv_path_LATEX="$LATEX" # Let the user override the test with a path.
;;
- ?:/*)
- ac_cv_path_LATEX="$LATEX" # Let the user override the test with a dos path.
- ;;
*)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_path_LATEX="$ac_dir/$ac_word"
# Extract the first word of "makeindex", so it can be a program name with args.
set dummy makeindex; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1785: checking for $ac_word" >&5
+echo "configure:2318: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_MAKEINDEX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
/*)
ac_cv_path_MAKEINDEX="$MAKEINDEX" # Let the user override the test with a path.
;;
- ?:/*)
- ac_cv_path_MAKEINDEX="$MAKEINDEX" # Let the user override the test with a dos path.
- ;;
*)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_path_MAKEINDEX="$ac_dir/$ac_word"
# Extract the first word of "dvips", so it can be a program name with args.
set dummy dvips; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1821: checking for $ac_word" >&5
+echo "configure:2350: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_DVIPS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
/*)
ac_cv_path_DVIPS="$DVIPS" # Let the user override the test with a path.
;;
- ?:/*)
- ac_cv_path_DVIPS="$DVIPS" # Let the user override the test with a dos path.
- ;;
*)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_path_DVIPS="$ac_dir/$ac_word"
# Extract the first word of "fig2dev", so it can be a program name with args.
set dummy fig2dev; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1857: checking for $ac_word" >&5
+echo "configure:2382: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_FIG2DEV'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
/*)
ac_cv_path_FIG2DEV="$FIG2DEV" # Let the user override the test with a path.
;;
- ?:/*)
- ac_cv_path_FIG2DEV="$FIG2DEV" # Let the user override the test with a dos path.
- ;;
*)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_path_FIG2DEV="$ac_dir/$ac_word"
# Extract the first word of "jade", so it can be a program name with args.
set dummy jade; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1893: checking for $ac_word" >&5
+echo "configure:2414: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_JADE'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
/*)
ac_cv_path_JADE="$JADE" # Let the user override the test with a path.
;;
- ?:/*)
- ac_cv_path_JADE="$JADE" # Let the user override the test with a dos path.
- ;;
*)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_path_JADE="$ac_dir/$ac_word"
# Extract the first word of "jadetex", so it can be a program name with args.
set dummy jadetex; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1929: checking for $ac_word" >&5
+echo "configure:2446: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_JADETEX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
/*)
ac_cv_path_JADETEX="$JADETEX" # Let the user override the test with a path.
;;
- ?:/*)
- ac_cv_path_JADETEX="$JADETEX" # Let the user override the test with a dos path.
- ;;
*)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_path_JADETEX="$ac_dir/$ac_word"
fi
-
-
-
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ case `(ac_space=' '; set) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote substitution
# turns \\\\ into \\, and sed turns \\ into \).
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ echo "$CONFIG_STATUS generated by autoconf version 2.12"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
-trap 'rm -fr `echo "Makefile src/Makefile check/Makefile ginsh/Makefile doc/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "Makefile ginac/Makefile check/Makefile ginsh/Makefile doc/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
$ac_vpsub
$extrasub
-s%@SHELL@%$SHELL%g
s%@CFLAGS@%$CFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
s%@DEFS@%$DEFS%g
s%@LDFLAGS@%$LDFLAGS%g
s%@LIBS@%$LIBS%g
s%@oldincludedir@%$oldincludedir%g
s%@infodir@%$infodir%g
s%@mandir@%$mandir%g
-s%@CXX@%$CXX%g
-s%@CXXCPP@%$CXXCPP%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@MAKEDEPEND@%$MAKEDEPEND%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@PACKAGE@%$PACKAGE%g
+s%@VERSION@%$VERSION%g
+s%@ACLOCAL@%$ACLOCAL%g
+s%@AUTOCONF@%$AUTOCONF%g
+s%@AUTOMAKE@%$AUTOMAKE%g
+s%@AUTOHEADER@%$AUTOHEADER%g
+s%@MAKEINFO@%$MAKEINFO%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@MAINT@%$MAINT%g
+s%@CXX@%$CXX%g
+s%@CXXCPP@%$CXXCPP%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@RANLIB@%$RANLIB%g
+s%@CC@%$CC%g
+s%@LD@%$LD%g
+s%@NM@%$NM%g
+s%@LN_S@%$LN_S%g
s%@LIBTOOL@%$LIBTOOL%g
s%@LEX@%$LEX%g
s%@LEXLIB@%$LEXLIB%g
-s%@YACC@%$YACC%g
+s%@CPP@%$CPP%g
s%@LEX_OUTPUT_ROOT@%$LEX_OUTPUT_ROOT%g
+s%@YACC@%$YACC%g
+s%@LIBOBJS@%$LIBOBJS%g
s%@DOXYGEN@%$DOXYGEN%g
s%@LATEX@%$LATEX%g
s%@MAKEINDEX@%$MAKEINDEX%g
s%@FIG2DEV@%$FIG2DEV%g
s%@JADE@%$JADE%g
s%@JADETEX@%$JADETEX%g
-s%@shared@%$shared%g
-s%@LibGiNaC_Ver@%$LibGiNaC_Ver%g
CEOF
EOF
cat >> $CONFIG_STATUS <<EOF
-CONFIG_FILES=\${CONFIG_FILES-"Makefile src/Makefile check/Makefile ginsh/Makefile doc/Makefile"}
+CONFIG_FILES=\${CONFIG_FILES-"Makefile ginac/Makefile check/Makefile ginsh/Makefile doc/Makefile"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
EOF
cat >> $CONFIG_STATUS <<EOF
+
EOF
cat >> $CONFIG_STATUS <<\EOF
+test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
exit 0
EOF
rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-echo "now type make"
+echo "Configuration done. Now type \"make\"."
-dnl ===========================================================================
-dnl Process this file with GNU Autoconf to produce a configure script. Then
-dnl call ./configure to create Makefiles. After that say make and make install.
-dnl See aclocal.m4 for additional self-made macros.
-dnl ===========================================================================
+dnl Process this file with autoconf to produce a configure script.
-dnl This file is used as a signal that everything is in place:
-AC_INIT(include/GiNaC/ginac.h)
-dnl A convenient header file for some additional system-dependend output:
-AC_CONFIG_HEADER(config.h)
+AC_INIT(ginac/basic.cpp)
+AM_CONFIG_HEADER(config.h)
+AC_PREREQ(2.12)
-dnl Set the Version Number at this place only:
-GiNaC_Major_Version=0
-GiNaC_Minor_Version=0
-GiNaC_Micro_Version=40
-dnl This composite variable can be inserted where it appears necessary:
-GiNaC_Version="${GiNaC_Major_Version}.${GiNaC_Minor_Version}.${GiNaC_Micro_Version}"
-dnl This composition is needed for libtool, if a shared lib shall be built:
-LibGiNaC_Ver="${GiNaC_Major_Version}:${GiNaC_Micro_Version}:${GiNaC_Minor_Version}"
-
-dnl ===========================================================================
-dnl Several features need to be added to standard-configure:
-dnl ===========================================================================
-AC_ARG_ENABLE(shared,
- [ --enable-shared build shared libraries [default=no]
- (a static library will still be built as well)],
- shared=${enableval}, shared="no")
+dnl This defines PACKAGE and VERSION
+AM_INIT_AUTOMAKE([GiNaC], [0.4])
+AM_MAINTAINER_MODE
dnl ===========================================================================
dnl Check for the compiler and all the utilities needed for the build:
dnl ===========================================================================
-dnl Which is the C++ Compiler? (whether to use c++, g++, gcc, CC, cxx, cc++...)
AC_PROG_CXX
-dnl How to run the C++ preprocessor?
AC_PROG_CXXCPP
+AM_PROG_INSTALL
+AM_PROG_LIBTOOL
+AM_PROG_LEX
+AC_PROG_YACC
+
dnl Switch to C++ language mode for the following libraries and headers:
AC_LANG_CPLUSPLUS
+
dnl Make sure the following libraries work by testing for symbols therein.
dnl They are automatically added the the variable $LIBS and thus passed into
dnl the Makefile:
AC_CHECK_LIB(stdc++, cout)
+
dnl Make sure all the necessary new-style headers are installed on the system.
dnl If one of them cannot be found the system is probably not ANSI-conform
dnl enough so trying the .h-style headers is a waste of time.
AC_CHECK_HEADERS(iostream vector map string list typeinfo iterator strstream stdexcept algorithm, ,
AC_MSG_ERROR(need to have ANSI compliant headers))
+
dnl We need to have Bruno Haible's CLN installed (macros are in aclocal.m4):
GINAC_CHECK_CLN_H
GINAC_CHECK_LIBCLN
-dnl We need to distribure install-sh anyways since otherwise configure will
-dnl refuse to do several things, like divert into subdirs and so:
-AC_PROG_INSTALL
-dnl Todd Brunhoff's makedepend utility is needed by make:
-AC_PATH_PROG(MAKEDEPEND, makedepend, "")
-dnl We need GNU libtool if the user chose to create a shared lib. (By using a
-dnl little trick we can safely recycle the variable shlib which is later passed
-dnl into the Makefile.)
-case "${shared}" in
-"yes"|"Yes"|"YES") # Default-enable ("yes") or user was nitpicking:
- shared="shlib";
- AC_PATH_PROG(LIBTOOL, libtool, "")
- if test "${LIBTOOL}" == ""; then
- AC_MSG_WARN([libtool not found: building static lib only])
- shared="";
- fi
- ;;
-*) # Default, default-disable ("no") or user entered bogus:
- shared="";
- ;;
-esac
-dnl Check for helpers needed for building the GiNaC interactive shell (ginsh):
-AC_PROG_LEX
-AC_PROG_YACC
-AC_DECL_YYTEXT
-AC_HEADER_STDC
+
+dnl Check for stuff needed for building the GiNaC interactive shell (ginsh):
AC_CHECK_HEADERS(unistd.h)
-AC_CHECK_FUNCS(strdup)
-AC_CHECK_HEADERS(readline/readline.h readline/history.h, , AC_MSG_ERROR(need to have GNU readline headers))
-AC_CHECK_LIB(readline, readline, , AC_MSG_ERROR(need to have GNU readline library))
+AC_REPLACE_FUNCS(strdup)
+AC_CHECK_HEADERS(readline/readline.h readline/history.h)
+AC_CHECK_LIB(readline, readline)
+
dnl Check for utilities needed by the different kinds of documentation.
dnl Documantation needs only be built when extending it, so never mind if it
dnl cannot find those helpers:
AC_PATH_PROG(JADE, jade, "")
AC_PATH_PROG(JADETEX, jadetex, "")
-dnl ===========================================================================
-dnl Substitute these variables in the Makefile:
-dnl ===========================================================================
-AC_SUBST(shared)
-AC_SUBST(LibGiNaC_Ver)
-
dnl ===========================================================================
dnl Produce a Makefile from Makefile.in:
dnl ===========================================================================
-AC_OUTPUT([Makefile src/Makefile check/Makefile ginsh/Makefile doc/Makefile])
-echo "now type make"
+AC_OUTPUT([Makefile ginac/Makefile check/Makefile ginsh/Makefile doc/Makefile])
+echo "Configuration done. Now type \"make\"."
+++ /dev/null
-# Generated automatically from Makefile.in by configure.
-# This is the prototype Makefile for all of GiNaC's documentation. It tries to
-# be tolerant---if some tools were not found it skips the built of that part
-# of documentation and tries to continue.
-
-# Substitution variables from configure skript:
-# Here come the usual install directories in GNU-configure fashion:
-prefix = /usr/local
-docdir = ${prefix}/share/doc/GiNaC
-srcdir = .
-# Dimitri van Heesch's Doxygen is needed for developer's resource:
-DOXYGEN = /usr/local/bin_i386/doxygen
-# LaTeX and friends are needed for processing developer's resource for print:
-LATEX = /usr/local/bin/latex
-MAKEINDEX = /usr/local/bin/makeindex
-DVIPS = /usr/local/bin/dvips
-FIG2DEV = /usr/bin/X11/fig2dev
-# Jade and friends needed for generating the tutorial:
-JADE = /usr/bin/jade
-JADETEX = /usr/local/bin/jadetex
-# Arguments for Jade and friends (does anybody know how to find them out?)
-# JADEARGS_TEX = -t tex -o tutorial.tex -d /usr/lib/dsssl/stylesheets/docbook/print/docbook.dsl
-JADEARGS_TEX = -t tex -o tutorial.tex -d /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/print/docbook.dsl
-# JADEARGS_HTML = -t sgml -d /usr/lib/dsssl/stylesheets/docbook/html/docbook.dsl
-JADEARGS_HTML = -t sgml -d /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/html/docbook.dsl
-# Autoconf macro AC_PROC_INSTALL sets these:
-INSTALL = /usr/bin/install -c
-INSTALL_DATA = ${INSTALL} -m 644
-# All LaTeX builds will take place in a separate subdirectory:
-VPATH = .:./latex:./tutorial
-
-# default target:
-all: reference tutorial
-
-# REFERENCE:
-# This section produces HTML'ed and TeX'ed developer's reference from the
-# sources with a JavaDoc-like tool (in this case doxygen):
-reference_html:
- @ if [ ! -d ${srcdir}/reference ]; then mkdir ${srcdir}/reference; fi
- @ if [ "${DOXYGEN}" ]; then \
- echo "Running ${DOXYGEN} ./DoxyfileHTML..."; \
- cd ..; ${DOXYGEN} ./doc/DoxyfileHTML; \
- else \
- echo "warning: target reference_html disabled by configuration"; \
- fi
-
-reference.tex:
- @ if [ ! -d ${srcdir}/latex ]; then mkdir ${srcdir}/latex; fi
- @ if [ "${DOXYGEN}" ]; then \
- echo "Running ${DOXYGEN} ./DoxyfileTEX..."; \
- cd ..; ${DOXYGEN} ./doc/DoxyfileTEX; \
- else \
- echo "warning: target reference.tex disabled by configuration"; \
- fi
- - mv ${srcdir}/latex/refman.tex ${srcdir}/latex/reference.tex
-
-reference.dvi: reference.tex
- @ if [ "${LATEX}" -a "${MAKEINDEX}" ]; then \
- cd latex; \
- ${LATEX} reference.tex && \
- ${MAKEINDEX} reference.idx && \
- ${LATEX} reference.tex; \
- else \
- echo "warning: target reference.dvi disabled by configuration"; \
- fi
-
-reference.ps: reference.dvi
- @ if [ "${DVIPS}" ]; then \
- echo "Running ${DVIPS} -o reference.ps reference.dvi..."; \
- cd latex; ${DVIPS} -o reference.ps reference.dvi; \
- else \
- echo "warning: target reference.ps disabled by configuration"; \
- fi
-
-reference: reference_html reference.ps
-
-# TUTORIAL:
-# This section produces HTML'ed and TeX'ed versions of the tutorial using a
-# SGML to TeX converter (in this case jade). As a dirty hack, we are doing
-# some regexpese to tutorial.sgml prior to parsing it, in order to allow for
-# different graphics output. This seems to be an ugly limitation of docbook...
-
-EPS = classhierarchy.eps rep_naive.eps rep_pair.eps
-PNG = classhierarchy.png rep_naive.png rep_pair.png
-
-tutorial/index.html: tutorial.sgml.in ${PNG}
- @ if [ ! -d ${srcdir}/latex ]; then mkdir ${srcdir}/latex; fi
- @ if [ "${JADE}" ]; then \
- sed -e 's/graext/png/g' -e 's/GRAEXT/GIF/g' tutorial.sgml.in > tutorial.sgml; \
- echo "Running ${JADE} ${JADEARGS_HTML} tutorial.sgml..."; \
- cd tutorial/; ${JADE} ${JADEARGS_HTML} ../tutorial.sgml; \
- if [ -f book1.html ]; then cp book1.html index.html; fi; \
- else \
- echo "warning: target tutorial_html disabled by configuration"; \
- fi
-
-tutorial.tex: tutorial.sgml.in ${EPS}
- @ if [ ! -d ${srcdir}/latex ]; then mkdir ${srcdir}/latex; fi
- @ if [ "${JADE}" -a "${LATEX}" ]; then \
- sed -e 's/graext/eps/g' -e 's/GRAEXT/EPS/g' tutorial.sgml.in > tutorial.sgml; \
- echo "Running ${JADE} ${JADEARGS_TEX} tutorial.sgml..."; \
- cd latex; ${JADE} ${JADEARGS_TEX} ../tutorial.sgml ; \
- else \
- echo "warning: target tutorial.tex disabled by configuration"; \
- fi
-
-tutorial.dvi: tutorial.tex
- @ if [ "${JADETEX}" ]; then \
- echo "Running ${JADETEX} tutorial.tex..."; \
- cd latex; ${JADETEX} tutorial.tex && ${JADETEX} tutorial.tex && ${JADETEX} tutorial.tex; \
- else \
- echo "warning: target tutorial.dvi disabled by configuration"; \
- fi
-
-tutorial.ps: tutorial.dvi
- @ if [ "${DVIPS}" ]; then \
- echo "Running ${DVIPS} tutorial.dvi -o tutorial.ps..."; \
- cd latex; ${DVIPS} tutorial.dvi -o tutorial.ps; \
- else \
- echo "warning: target tutorial.ps disabled by configuration"; \
- fi
-
-tutorial: tutorial/index.html tutorial.ps
-
-# Target for installing all generated documentation files on the system.
-# (Foolproof: installs what we got, even if one or more targets failed.)
-install:
- - ${INSTALL} -d ${docdir}/reference/
- - ${INSTALL_DATA} ${srcdir}/reference/* ${docdir}/reference/
- - ${INSTALL_DATA} ${srcdir}/latex/reference.ps ${docdir}/
- - ${INSTALL} -d ${docdir}/tutorial/
- - ${INSTALL_DATA} ${srcdir}/tutorial/* ${docdir}/tutorial/
- - ${INSTALL_DATA} ${srcdir}/latex/tutorial.ps ${docdir}/
-
-# Removes all installed documentation files from the system:
-uninstall:
- rm -rf ${docdir}
-
-# The next targets should only be called in case of emergency by developers,
-# since the complete documentation is not normally rebuilt. In any case, they
-# should only be called from people who know what they are doing and never
-# from top-level Makefile's targets clean and distclean.
-clean:
- rm -rf ${srcdir}/tutorial ${srcdir}/reference ${srcdir}/latex
- rm -f tutorial.sgml
-
-distclean: clean
- rm -f Makefile
-
-# Special dummy targets:
-.SUFFIXES: .fig .eps .png
-.PHONY: all clean distclean reference tutorial
-.SILENT: all reference tutorial_html tutorial_tex
-
-# Suffix rules:
-.fig.eps :
- @ if [ ! -d ${srcdir}/latex ]; then mkdir ${srcdir}/latex; fi
- if [ "${FIG2DEV}" ]; then \
- ${FIG2DEV} -L ps -m 0.8 $< ${srcdir}/latex/$@; \
- else \
- echo "warning: fig2dev was not found by configure"; \
- fi
-.fig.png :
- @ if [ ! -d ${srcdir}/tutorial ]; then mkdir ${srcdir}/tutorial; fi
- if [ "${FIG2DEV}" ]; then \
- ${FIG2DEV} -L png $< ${srcdir}/tutorial/$@; \
- else \
- echo "warning: fig2dev was not found by configure"; \
- fi
--- /dev/null
+## Process this file with automake to produce Makefile.in
-# This is the prototype Makefile for all of GiNaC's documentation. It tries to
-# be tolerant---if some tools were not found it skips the built of that part
-# of documentation and tries to continue.
+# Makefile.in generated automatically by automake 1.3 from Makefile.am
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = /bin/sh
-# Substitution variables from configure skript:
-# Here come the usual install directories in GNU-configure fashion:
-prefix = @prefix@
-docdir = @datadir@/doc/GiNaC
srcdir = @srcdir@
-# Dimitri van Heesch's Doxygen is needed for developer's resource:
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DISTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+CC = @CC@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
DOXYGEN = @DOXYGEN@
-# LaTeX and friends are needed for processing developer's resource for print:
-LATEX = @LATEX@
-MAKEINDEX = @MAKEINDEX@
DVIPS = @DVIPS@
FIG2DEV = @FIG2DEV@
-# Jade and friends needed for generating the tutorial:
JADE = @JADE@
JADETEX = @JADETEX@
-# Arguments for Jade and friends (does anybody know how to find them out?)
-# JADEARGS_TEX = -t tex -o tutorial.tex -d /usr/lib/dsssl/stylesheets/docbook/print/docbook.dsl
-JADEARGS_TEX = -t tex -o tutorial.tex -d /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/print/docbook.dsl
-# JADEARGS_HTML = -t sgml -d /usr/lib/dsssl/stylesheets/docbook/html/docbook.dsl
-JADEARGS_HTML = -t sgml -d /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh/html/docbook.dsl
-# Autoconf macro AC_PROC_INSTALL sets these:
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-# All LaTeX builds will take place in a separate subdirectory:
-VPATH = @srcdir@:@srcdir@/latex:@srcdir@/tutorial
-
-# default target:
-all: reference tutorial
-
-# REFERENCE:
-# This section produces HTML'ed and TeX'ed developer's reference from the
-# sources with a JavaDoc-like tool (in this case doxygen):
-reference_html:
- @ if [ ! -d ${srcdir}/reference ]; then mkdir ${srcdir}/reference; fi
- @ if [ "${DOXYGEN}" ]; then \
- echo "Running ${DOXYGEN} ./DoxyfileHTML..."; \
- cd ..; ${DOXYGEN} ./doc/DoxyfileHTML; \
- else \
- echo "warning: target reference_html disabled by configuration"; \
- fi
-
-reference.tex:
- @ if [ ! -d ${srcdir}/latex ]; then mkdir ${srcdir}/latex; fi
- @ if [ "${DOXYGEN}" ]; then \
- echo "Running ${DOXYGEN} ./DoxyfileTEX..."; \
- cd ..; ${DOXYGEN} ./doc/DoxyfileTEX; \
- else \
- echo "warning: target reference.tex disabled by configuration"; \
- fi
- - mv ${srcdir}/latex/refman.tex ${srcdir}/latex/reference.tex
-
-reference.dvi: reference.tex
- @ if [ "${LATEX}" -a "${MAKEINDEX}" ]; then \
- cd latex; \
- ${LATEX} reference.tex && \
- ${MAKEINDEX} reference.idx && \
- ${LATEX} reference.tex; \
- else \
- echo "warning: target reference.dvi disabled by configuration"; \
- fi
-
-reference.ps: reference.dvi
- @ if [ "${DVIPS}" ]; then \
- echo "Running ${DVIPS} -o reference.ps reference.dvi..."; \
- cd latex; ${DVIPS} -o reference.ps reference.dvi; \
- else \
- echo "warning: target reference.ps disabled by configuration"; \
- fi
-
-reference: reference_html reference.ps
-
-# TUTORIAL:
-# This section produces HTML'ed and TeX'ed versions of the tutorial using a
-# SGML to TeX converter (in this case jade). As a dirty hack, we are doing
-# some regexpese to tutorial.sgml prior to parsing it, in order to allow for
-# different graphics output. This seems to be an ugly limitation of docbook...
-
-EPS = classhierarchy.eps rep_naive.eps rep_pair.eps
-PNG = classhierarchy.png rep_naive.png rep_pair.png
-
-tutorial/index.html: tutorial.sgml.in ${PNG}
- @ if [ ! -d ${srcdir}/latex ]; then mkdir ${srcdir}/latex; fi
- @ if [ "${JADE}" ]; then \
- sed -e 's/graext/png/g' -e 's/GRAEXT/GIF/g' tutorial.sgml.in > tutorial.sgml; \
- echo "Running ${JADE} ${JADEARGS_HTML} tutorial.sgml..."; \
- cd tutorial/; ${JADE} ${JADEARGS_HTML} ../tutorial.sgml; \
- if [ -f book1.html ]; then cp book1.html index.html; fi; \
- else \
- echo "warning: target tutorial_html disabled by configuration"; \
- fi
-
-tutorial.tex: tutorial.sgml.in ${EPS}
- @ if [ ! -d ${srcdir}/latex ]; then mkdir ${srcdir}/latex; fi
- @ if [ "${JADE}" -a "${LATEX}" ]; then \
- sed -e 's/graext/eps/g' -e 's/GRAEXT/EPS/g' tutorial.sgml.in > tutorial.sgml; \
- echo "Running ${JADE} ${JADEARGS_TEX} tutorial.sgml..."; \
- cd latex; ${JADE} ${JADEARGS_TEX} ../tutorial.sgml ; \
- else \
- echo "warning: target tutorial.tex disabled by configuration"; \
- fi
-
-tutorial.dvi: tutorial.tex
- @ if [ "${JADETEX}" ]; then \
- echo "Running ${JADETEX} tutorial.tex..."; \
- cd latex; ${JADETEX} tutorial.tex && ${JADETEX} tutorial.tex && ${JADETEX} tutorial.tex; \
- else \
- echo "warning: target tutorial.dvi disabled by configuration"; \
- fi
-
-tutorial.ps: tutorial.dvi
- @ if [ "${DVIPS}" ]; then \
- echo "Running ${DVIPS} tutorial.dvi -o tutorial.ps..."; \
- cd latex; ${DVIPS} tutorial.dvi -o tutorial.ps; \
- else \
- echo "warning: target tutorial.ps disabled by configuration"; \
- fi
-
-tutorial: tutorial/index.html tutorial.ps
-
-# Target for installing all generated documentation files on the system.
-# (Foolproof: installs what we got, even if one or more targets failed.)
-install:
- - ${INSTALL} -d ${docdir}/reference/
- - ${INSTALL_DATA} ${srcdir}/reference/* ${docdir}/reference/
- - ${INSTALL_DATA} ${srcdir}/latex/reference.ps ${docdir}/
- - ${INSTALL} -d ${docdir}/tutorial/
- - ${INSTALL_DATA} ${srcdir}/tutorial/* ${docdir}/tutorial/
- - ${INSTALL_DATA} ${srcdir}/latex/tutorial.ps ${docdir}/
-
-# Removes all installed documentation files from the system:
-uninstall:
- rm -rf ${docdir}
-
-# The next targets should only be called in case of emergency by developers,
-# since the complete documentation is not normally rebuilt. In any case, they
-# should only be called from people who know what they are doing and never
-# from top-level Makefile's targets clean and distclean.
-clean:
- rm -rf ${srcdir}/tutorial ${srcdir}/reference ${srcdir}/latex
- rm -f tutorial.sgml
-
-distclean: clean
- rm -f Makefile
-
-# Special dummy targets:
-.SUFFIXES: .fig .eps .png
-.PHONY: all clean distclean reference tutorial
-.SILENT: all reference tutorial_html tutorial_tex
-
-# Suffix rules:
-.fig.eps :
- @ if [ ! -d ${srcdir}/latex ]; then mkdir ${srcdir}/latex; fi
- if [ "${FIG2DEV}" ]; then \
- ${FIG2DEV} -L ps -m 0.8 $< ${srcdir}/latex/$@; \
- else \
- echo "warning: fig2dev was not found by configure"; \
- fi
-.fig.png :
- @ if [ ! -d ${srcdir}/tutorial ]; then mkdir ${srcdir}/tutorial; fi
- if [ "${FIG2DEV}" ]; then \
- ${FIG2DEV} -L png $< ${srcdir}/tutorial/$@; \
- else \
- echo "warning: fig2dev was not found by configure"; \
- fi
+LATEX = @LATEX@
+LD = @LD@
+LEX = @LEX@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINDEX = @MAKEINDEX@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+VERSION = @VERSION@
+YACC = @YACC@
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES =
+DIST_COMMON = Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP = --best
+all: Makefile
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+tags: TAGS
+TAGS:
+
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = doc
+
+distdir: $(DISTFILES)
+ here=`cd $(top_builddir) && pwd`; \
+ top_distdir=`cd $(top_distdir) && pwd`; \
+ distdir=`cd $(distdir) && pwd`; \
+ cd $(top_srcdir) \
+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu doc/Makefile
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file; \
+ done
+info:
+dvi:
+check: all
+ $(MAKE)
+installcheck:
+install-exec:
+ @$(NORMAL_INSTALL)
+
+install-data:
+ @$(NORMAL_INSTALL)
+
+install: install-exec install-data all
+ @:
+
+uninstall:
+
+install-strip:
+ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+installdirs:
+
+
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -rm -f Makefile $(DISTCLEANFILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+mostlyclean: mostlyclean-generic
+
+clean: clean-generic mostlyclean
+
+distclean: distclean-generic clean
+ -rm -f config.status
+ -rm -f libtool
+
+maintainer-clean: maintainer-clean-generic distclean
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+.PHONY: tags distdir info dvi installcheck install-exec install-data \
+install uninstall all installdirs mostlyclean-generic distclean-generic \
+clean-generic maintainer-clean-generic clean mostlyclean distclean \
+maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- /dev/null
+## Process this file with automake to produce Makefile.in
+lib_LTLIBRARIES = libginac.la
+libginac_la_SOURCES = add.cpp basic.cpp constant.cpp diff.cpp ex.cpp \
+ expairseq.cpp exprseq.cpp fail.cpp function.cpp inifcns.cpp \
+ inifcns_trans.cpp inifcns_gamma.cpp matrix.cpp mul.cpp normal.cpp \
+ numeric.cpp operators.cpp power.cpp print.cpp printraw.cpp printtree.cpp \
+ printcsrc.cpp relational.cpp symbol.cpp utils.cpp series.cpp ncmul.cpp \
+ clifford.cpp structure.cpp color.cpp indexed.cpp idx.cpp isospin.cpp \
+ exprseq_suppl.cpp lst.cpp lst_suppl.cpp simp_lor.cpp coloridx.cpp \
+ lorentzidx.cpp utils.h
+ginacincludedir = $(includedir)/ginac
+ginacinclude_HEADERS = ginac.h add.h basic.h clifford.h color.h coloridx.h \
+ constant.h debugmsg.h ex.h expair.h expairseq.h exprseq.h fail.h flags.h \
+ function.h idx.h indexed.h inifcns.h isospin.h lorentzidx.h lst.h matrix.h \
+ mul.h ncmul.h normal.h numeric.h operators.h power.h relational.h series.h \
+ simp_lor.h structure.h symbol.h tinfos.h
--- /dev/null
+# Makefile.in generated automatically by automake 1.3 from Makefile.am
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = /bin/sh
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DISTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+CC = @CC@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+DOXYGEN = @DOXYGEN@
+DVIPS = @DVIPS@
+FIG2DEV = @FIG2DEV@
+JADE = @JADE@
+JADETEX = @JADETEX@
+LATEX = @LATEX@
+LD = @LD@
+LEX = @LEX@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINDEX = @MAKEINDEX@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+VERSION = @VERSION@
+YACC = @YACC@
+
+lib_LTLIBRARIES = libginac.la
+libginac_la_SOURCES = add.cpp basic.cpp constant.cpp diff.cpp ex.cpp \
+ expairseq.cpp exprseq.cpp fail.cpp function.cpp inifcns.cpp \
+ inifcns_trans.cpp inifcns_gamma.cpp matrix.cpp mul.cpp normal.cpp \
+ numeric.cpp operators.cpp power.cpp print.cpp printraw.cpp printtree.cpp \
+ printcsrc.cpp relational.cpp symbol.cpp utils.cpp series.cpp ncmul.cpp \
+ clifford.cpp structure.cpp color.cpp indexed.cpp idx.cpp isospin.cpp \
+ exprseq_suppl.cpp lst.cpp lst_suppl.cpp simp_lor.cpp coloridx.cpp \
+ lorentzidx.cpp utils.h
+ginacincludedir = $(includedir)/ginac
+ginacinclude_HEADERS = ginac.h add.h basic.h clifford.h color.h coloridx.h \
+ constant.h debugmsg.h ex.h expair.h expairseq.h exprseq.h fail.h flags.h \
+ function.h idx.h indexed.h inifcns.h isospin.h lorentzidx.h lst.h matrix.h \
+ mul.h ncmul.h normal.h numeric.h operators.h power.h relational.h series.h \
+ simp_lor.h structure.h symbol.h tinfos.h
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(lib_LTLIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I..
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+libginac_la_LDFLAGS =
+libginac_la_LIBADD =
+libginac_la_OBJECTS = add.lo basic.lo constant.lo diff.lo ex.lo \
+expairseq.lo exprseq.lo fail.lo function.lo inifcns.lo inifcns_trans.lo \
+inifcns_gamma.lo matrix.lo mul.lo normal.lo numeric.lo operators.lo \
+power.lo print.lo printraw.lo printtree.lo printcsrc.lo relational.lo \
+symbol.lo utils.lo series.lo ncmul.lo clifford.lo structure.lo color.lo \
+indexed.lo idx.lo isospin.lo exprseq_suppl.lo lst.lo lst_suppl.lo \
+simp_lor.lo coloridx.lo lorentzidx.lo
+CXXFLAGS = @CXXFLAGS@
+CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS)
+CXXLINK = $(LIBTOOL) --mode=link $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@
+HEADERS = $(ginacinclude_HEADERS)
+
+DIST_COMMON = Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP = --best
+DEP_FILES = .deps/add.P .deps/basic.P .deps/clifford.P .deps/color.P \
+.deps/coloridx.P .deps/constant.P .deps/diff.P .deps/ex.P \
+.deps/expairseq.P .deps/exprseq.P .deps/exprseq_suppl.P .deps/fail.P \
+.deps/function.P .deps/idx.P .deps/indexed.P .deps/inifcns.P \
+.deps/inifcns_gamma.P .deps/inifcns_trans.P .deps/isospin.P \
+.deps/lorentzidx.P .deps/lst.P .deps/lst_suppl.P .deps/matrix.P \
+.deps/mul.P .deps/ncmul.P .deps/normal.P .deps/numeric.P \
+.deps/operators.P .deps/power.P .deps/print.P .deps/printcsrc.P \
+.deps/printraw.P .deps/printtree.P .deps/relational.P .deps/series.P \
+.deps/simp_lor.P .deps/structure.P .deps/symbol.P .deps/utils.P
+CXXMKDEP = $(CXX) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS)
+SOURCES = $(libginac_la_SOURCES)
+OBJECTS = $(libginac_la_OBJECTS)
+
+all: Makefile $(LTLIBRARIES) $(HEADERS)
+
+.SUFFIXES:
+.SUFFIXES: .S .c .cpp .lo .o .s
+$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu ginac/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-libLTLIBRARIES:
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+
+distclean-libLTLIBRARIES:
+
+maintainer-clean-libLTLIBRARIES:
+
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(libdir)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo "$(LIBTOOL) --mode=install $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \
+ $(LIBTOOL) --mode=install $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
+ done
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+
+clean-compile:
+
+distclean-compile:
+ -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+.s.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+.S.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+
+maintainer-clean-libtool:
+
+libginac.la: $(libginac_la_OBJECTS) $(libginac_la_DEPENDENCIES)
+ $(CXXLINK) -rpath $(libdir) $(libginac_la_LDFLAGS) $(libginac_la_OBJECTS) $(libginac_la_LIBADD) $(LIBS)
+.cpp.o:
+ $(CXXCOMPILE) -c $<
+.cpp.lo:
+ $(LTCXXCOMPILE) -c $<
+
+install-ginacincludeHEADERS: $(ginacinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(ginacincludedir)
+ @list='$(ginacinclude_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
+ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(ginacincludedir)/$$p"; \
+ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(ginacincludedir)/$$p; \
+ done
+
+uninstall-ginacincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ list='$(ginacinclude_HEADERS)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(ginacincludedir)/$$p; \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = ginac
+
+distdir: $(DISTFILES)
+ here=`cd $(top_builddir) && pwd`; \
+ top_distdir=`cd $(top_distdir) && pwd`; \
+ distdir=`cd $(distdir) && pwd`; \
+ cd $(top_srcdir) \
+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu ginac/Makefile
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file; \
+ done
+
+DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
+
+-include $(DEP_FILES)
+
+mostlyclean-depend:
+
+clean-depend:
+
+distclean-depend:
+
+maintainer-clean-depend:
+ -rm -rf .deps
+
+%.o: %.c
+ @echo '$(COMPILE) -c $<'; \
+ $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $<
+
+%.lo: %.c
+ @echo '$(LTCOMPILE) -c $<'; \
+ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $<
+ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
+ < .deps/$(*F).p > .deps/$(*F).P
+ @-rm -f .deps/$(*F).p
+
+%.o: %.cpp
+ @echo '$(CXXCOMPILE) -c $<'; \
+ $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).P -c $<
+
+%.lo: %.cpp
+ @echo '$(LTCXXCOMPILE) -c $<'; \
+ $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).p -c $<
+ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
+ < .deps/$(*F).p > .deps/$(*F).P
+ @-rm -f .deps/$(*F).p
+info:
+dvi:
+check: all
+ $(MAKE)
+installcheck:
+install-exec: install-libLTLIBRARIES
+ @$(NORMAL_INSTALL)
+
+install-data: install-ginacincludeHEADERS
+ @$(NORMAL_INSTALL)
+
+install: install-exec install-data all
+ @:
+
+uninstall: uninstall-libLTLIBRARIES uninstall-ginacincludeHEADERS
+
+install-strip:
+ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+installdirs:
+ $(mkinstalldirs) $(DATADIR)$(libdir) $(DATADIR)$(ginacincludedir)
+
+
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -rm -f Makefile $(DISTCLEANFILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+mostlyclean: mostlyclean-libLTLIBRARIES mostlyclean-compile \
+ mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
+ mostlyclean-generic
+
+clean: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \
+ clean-depend clean-generic mostlyclean
+
+distclean: distclean-libLTLIBRARIES distclean-compile distclean-libtool \
+ distclean-tags distclean-depend distclean-generic clean
+ -rm -f config.status
+ -rm -f libtool
+
+maintainer-clean: maintainer-clean-libLTLIBRARIES \
+ maintainer-clean-compile maintainer-clean-libtool \
+ maintainer-clean-tags maintainer-clean-depend \
+ maintainer-clean-generic distclean
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
+clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
+uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
+distclean-compile clean-compile maintainer-clean-compile \
+mostlyclean-libtool distclean-libtool clean-libtool \
+maintainer-clean-libtool uninstall-ginacincludeHEADERS \
+install-ginacincludeHEADERS tags mostlyclean-tags distclean-tags \
+clean-tags maintainer-clean-tags distdir mostlyclean-depend \
+distclean-depend clean-depend maintainer-clean-depend info dvi \
+installcheck install-exec install-data install uninstall all \
+installdirs mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- /dev/null
+/** @file add.cpp
+ *
+ * Implementation of GiNaC's sums of expressions. */
+
+#include <iostream>
+#include <stdexcept>
+
+#include "ginac.h"
+
+//////////
+// default constructor, destructor, copy constructor assignment operator and helpers
+//////////
+
+// public
+
+add::add()
+{
+ debugmsg("add default constructor",LOGLEVEL_CONSTRUCT);
+ tinfo_key = TINFO_ADD;
+}
+
+add::~add()
+{
+ debugmsg("add destructor",LOGLEVEL_DESTRUCT);
+ destroy(0);
+}
+
+add::add(add const & other)
+{
+ debugmsg("add copy constructor",LOGLEVEL_CONSTRUCT);
+ copy(other);
+}
+
+add const & add::operator=(add const & other)
+{
+ debugmsg("add operator=",LOGLEVEL_ASSIGNMENT);
+ if (this != &other) {
+ destroy(1);
+ copy(other);
+ }
+ return *this;
+}
+
+// protected
+
+void add::copy(add const & other)
+{
+ expairseq::copy(other);
+}
+
+void add::destroy(bool call_parent)
+{
+ if (call_parent) expairseq::destroy(call_parent);
+}
+
+//////////
+// other constructors
+//////////
+
+// public
+
+add::add(ex const & lh, ex const & rh)
+{
+ debugmsg("add constructor from ex,ex",LOGLEVEL_CONSTRUCT);
+ tinfo_key = TINFO_ADD;
+ overall_coeff=exZERO();
+ construct_from_2_ex(lh,rh);
+ ASSERT(is_canonical());
+}
+
+add::add(exvector const & v)
+{
+ debugmsg("add constructor from exvector",LOGLEVEL_CONSTRUCT);
+ tinfo_key = TINFO_ADD;
+ overall_coeff=exZERO();
+ construct_from_exvector(v);
+ ASSERT(is_canonical());
+}
+
+/*
+add::add(epvector const & v, bool do_not_canonicalize)
+{
+ debugmsg("add constructor from epvector,bool",LOGLEVEL_CONSTRUCT);
+ tinfo_key = TINFO_ADD;
+ if (do_not_canonicalize) {
+ seq=v;
+#ifdef EXPAIRSEQ_USE_HASHTAB
+ combine_same_terms(); // to build hashtab
+#endif // def EXPAIRSEQ_USE_HASHTAB
+ } else {
+ construct_from_epvector(v);
+ }
+ ASSERT(is_canonical());
+}
+*/
+
+add::add(epvector const & v)
+{
+ debugmsg("add constructor from epvector",LOGLEVEL_CONSTRUCT);
+ tinfo_key = TINFO_ADD;
+ overall_coeff=exZERO();
+ construct_from_epvector(v);
+ ASSERT(is_canonical());
+}
+
+add::add(epvector const & v, ex const & oc)
+{
+ debugmsg("add constructor from epvector,ex",LOGLEVEL_CONSTRUCT);
+ tinfo_key = TINFO_ADD;
+ overall_coeff=oc;
+ construct_from_epvector(v);
+ ASSERT(is_canonical());
+}
+
+add::add(epvector * vp, ex const & oc)
+{
+ debugmsg("add constructor from epvector *,ex",LOGLEVEL_CONSTRUCT);
+ tinfo_key = TINFO_ADD;
+ ASSERT(vp!=0);
+ overall_coeff=oc;
+ construct_from_epvector(*vp);
+ delete vp;
+ ASSERT(is_canonical());
+}
+
+//////////
+// functions overriding virtual functions from bases classes
+//////////
+
+// public
+
+basic * add::duplicate() const
+{
+ debugmsg("add duplicate",LOGLEVEL_DUPLICATE);
+ return new add(*this);
+}
+
+bool add::info(unsigned inf) const
+{
+ // TODO: optimize
+ if (inf==info_flags::polynomial || inf==info_flags::integer_polynomial || inf==info_flags::rational_polynomial || inf==info_flags::rational_function) {
+ for (epvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
+ if (!(recombine_pair_to_ex(*it).info(inf)))
+ return false;
+ }
+ return true;
+ } else {
+ return expairseq::info(inf);
+ }
+}
+
+int add::degree(symbol const & s) const
+{
+ int deg=INT_MIN;
+ if (!overall_coeff.is_equal(exZERO())) {
+ deg=0;
+ }
+ int cur_deg;
+ for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
+ cur_deg=(*cit).rest.degree(s);
+ if (cur_deg>deg) deg=cur_deg;
+ }
+ return deg;
+}
+
+int add::ldegree(symbol const & s) const
+{
+ int deg=INT_MAX;
+ if (!overall_coeff.is_equal(exZERO())) {
+ deg=0;
+ }
+ int cur_deg;
+ for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
+ cur_deg=(*cit).rest.ldegree(s);
+ if (cur_deg<deg) deg=cur_deg;
+ }
+ return deg;
+}
+
+ex add::coeff(symbol const & s, int const n) const
+{
+ epvector coeffseq;
+ coeffseq.reserve(seq.size());
+
+ epvector::const_iterator it=seq.begin();
+ while (it!=seq.end()) {
+ coeffseq.push_back(combine_ex_with_coeff_to_pair((*it).rest.coeff(s,n),
+ (*it).coeff));
+ ++it;
+ }
+ if (n==0) {
+ return (new add(coeffseq,overall_coeff))->setflag(status_flags::dynallocated);
+ }
+ return (new add(coeffseq))->setflag(status_flags::dynallocated);
+}
+
+/*
+ex add::eval(int level) const
+{
+ // simplifications: +(...,x,c1,c2) -> +(...,x,c1+c2) (c1, c2 numeric())
+ // +(...,(c1,c2)) -> (...,(c1*c2,1)) (normalize)
+ // +(...,x,0) -> +(...,x)
+ // +(x) -> x
+ // +() -> 0
+
+ debugmsg("add eval",LOGLEVEL_MEMBER_FUNCTION);
+
+ epvector newseq=seq;
+ epvector::iterator it1,it2;
+
+ // +(...,x,c1,c2) -> +(...,x,c1+c2) (c1, c2 numeric())
+ it2=newseq.end()-1;
+ it1=it2-1;
+ while ((newseq.size()>=2)&&is_exactly_of_type(*(*it1).rest.bp,numeric)&&
+ is_exactly_of_type(*(*it2).rest.bp,numeric)) {
+ *it1=expair(ex_to_numeric((*it1).rest).mul(ex_to_numeric((*it1).coeff))
+ .add(ex_to_numeric((*it2).rest).mul(ex_to_numeric((*it2).coeff))),exONE());
+ newseq.pop_back();
+ it2=newseq.end()-1;
+ it1=it2-1;
+ }
+
+ if ((newseq.size()>=1)&&is_exactly_of_type(*(*it2).rest.bp,numeric)) {
+ // +(...,(c1,c2)) -> (...,(c1*c2,1)) (normalize)
+ *it2=expair(ex_to_numeric((*it2).rest).mul(ex_to_numeric((*it2).coeff)),exONE());
+ // +(...,x,0) -> +(...,x)
+ if (ex_to_numeric((*it2).rest).compare(0)==0) {
+ newseq.pop_back();
+ }
+ }
+
+ if (newseq.size()==0) {
+ // +() -> 0
+ return exZERO();
+ } else if (newseq.size()==1) {
+ // +(x) -> x
+ return recombine_pair_to_ex(*(newseq.begin()));
+ }
+
+ return (new add(newseq,1))->setflag(status_flags::dynallocated |
+ status_flags::evaluated );
+}
+*/
+
+/*
+ex add::eval(int level) const
+{
+ // simplifications: +(...,x,c1,c2) -> +(...,x,c1+c2) (c1, c2 numeric())
+ // +(...,(c1,c2)) -> (...,(c1*c2,1)) (normalize)
+ // +(...,x,0) -> +(...,x)
+ // +(x) -> x
+ // +() -> 0
+
+ debugmsg("add eval",LOGLEVEL_MEMBER_FUNCTION);
+
+ if ((level==1)&&(flags & status_flags::evaluated)) {
+#ifdef DOASSERT
+ for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
+ ASSERT(!is_ex_exactly_of_type((*cit).rest,add));
+ ASSERT(!(is_ex_exactly_of_type((*cit).rest,numeric)&&
+ (ex_to_numeric((*cit).coeff).compare(numONE())!=0)));
+ }
+#endif // def DOASSERT
+ return *this;
+ }
+
+ epvector newseq;
+ epvector::iterator it1,it2;
+ bool seq_copied=false;
+
+ epvector * evaled_seqp=evalchildren(level);
+ if (evaled_seqp!=0) {
+ // do more evaluation later
+ return (new add(evaled_seqp))->setflag(status_flags::dynallocated);
+ }
+
+#ifdef DOASSERT
+ for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
+ ASSERT(!is_ex_exactly_of_type((*cit).rest,add));
+ ASSERT(!(is_ex_exactly_of_type((*cit).rest,numeric)&&
+ (ex_to_numeric((*cit).coeff).compare(numONE())!=0)));
+ }
+#endif // def DOASSERT
+
+ if (flags & status_flags::evaluated) {
+ return *this;
+ }
+
+ expair const & last_expair=*(seq.end()-1);
+ expair const & next_to_last_expair=*(seq.end()-2);
+ int seq_size = seq.size();
+
+ // +(...,x,c1,c2) -> +(...,x,c1+c2) (c1, c2 numeric())
+ if ((!seq_copied)&&(seq_size>=2)&&
+ is_ex_exactly_of_type(last_expair.rest,numeric)&&
+ is_ex_exactly_of_type(next_to_last_expair.rest,numeric)) {
+ newseq=seq;
+ seq_copied=true;
+ it2=newseq.end()-1;
+ it1=it2-1;
+ }
+ while (seq_copied&&(newseq.size()>=2)&&
+ is_ex_exactly_of_type((*it1).rest,numeric)&&
+ is_ex_exactly_of_type((*it2).rest,numeric)) {
+ *it1=expair(ex_to_numeric((*it1).rest).mul(ex_to_numeric((*it1).coeff))
+ .add_dyn(ex_to_numeric((*it2).rest).mul(ex_to_numeric((*it2).coeff))),exONE());
+ newseq.pop_back();
+ it2=newseq.end()-1;
+ it1=it2-1;
+ }
+
+ // +(...,(c1,c2)) -> (...,(c1*c2,1)) (normalize)
+ if ((!seq_copied)&&(seq_size>=1)&&
+ (is_ex_exactly_of_type(last_expair.rest,numeric))&&
+ (ex_to_numeric(last_expair.coeff).compare(numONE())!=0)) {
+ newseq=seq;
+ seq_copied=true;
+ it2=newseq.end()-1;
+ }
+ if (seq_copied&&(newseq.size()>=1)&&
+ (is_ex_exactly_of_type((*it2).rest,numeric))&&
+ (ex_to_numeric((*it2).coeff).compare(numONE())!=0)) {
+ *it2=expair(ex_to_numeric((*it2).rest).mul_dyn(ex_to_numeric((*it2).coeff)),exONE());
+ }
+
+ // +(...,x,0) -> +(...,x)
+ if ((!seq_copied)&&(seq_size>=1)&&
+ (is_ex_exactly_of_type(last_expair.rest,numeric))&&
+ (ex_to_numeric(last_expair.rest).is_zero())) {
+ newseq=seq;
+ seq_copied=true;
+ it2=newseq.end()-1;
+ }
+ if (seq_copied&&(newseq.size()>=1)&&
+ (is_ex_exactly_of_type((*it2).rest,numeric))&&
+ (ex_to_numeric((*it2).rest).is_zero())) {
+ newseq.pop_back();
+ }
+
+ // +() -> 0
+ if ((!seq_copied)&&(seq_size==0)) {
+ return exZERO();
+ } else if (seq_copied&&(newseq.size()==0)) {
+ return exZERO();
+ }
+
+ // +(x) -> x
+ if ((!seq_copied)&&(seq_size==1)) {
+ return recombine_pair_to_ex(*(seq.begin()));
+ } else if (seq_copied&&(newseq.size()==1)) {
+ return recombine_pair_to_ex(*(newseq.begin()));
+ }
+
+ if (!seq_copied) return this->hold();
+
+ return (new add(newseq,1))->setflag(status_flags::dynallocated |
+ status_flags::evaluated );
+}
+*/
+
+ex add::eval(int level) const
+{
+ // simplifications: +(;c) -> c
+ // +(x;1) -> x
+
+ debugmsg("add eval",LOGLEVEL_MEMBER_FUNCTION);
+
+ epvector * evaled_seqp=evalchildren(level);
+ if (evaled_seqp!=0) {
+ // do more evaluation later
+ return (new add(evaled_seqp,overall_coeff))->
+ setflag(status_flags::dynallocated);
+ }
+
+#ifdef DOASSERT
+ for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
+ ASSERT(!is_ex_exactly_of_type((*cit).rest,add));
+ if (is_ex_exactly_of_type((*cit).rest,numeric)) {
+ dbgprint();
+ }
+ ASSERT(!is_ex_exactly_of_type((*cit).rest,numeric));
+ }
+#endif // def DOASSERT
+
+ if (flags & status_flags::evaluated) {
+ ASSERT(seq.size()>0);
+ ASSERT((seq.size()>1)||!overall_coeff.is_equal(exZERO()));
+ return *this;
+ }
+
+ int seq_size=seq.size();
+ if (seq_size==0) {
+ // +(;c) -> c
+ return overall_coeff;
+ } else if ((seq_size==1)&&overall_coeff.is_equal(exZERO())) {
+ // +(x;0) -> x
+ return recombine_pair_to_ex(*(seq.begin()));
+ }
+ return this->hold();
+}
+
+exvector add::get_indices(void) const
+{
+ // all terms in the sum should have the same indices (compatible tensors)
+ // however this is not checked, since there is no function yet which
+ // compares indices (idxvector can be unsorted) !!!!!!!!!!!
+ if (seq.size()==0) {
+ return exvector();
+ }
+ return (seq.begin())->rest.get_indices();
+}
+
+ex add::simplify_ncmul(exvector const & v) const
+{
+ if (seq.size()==0) {
+ return expairseq::simplify_ncmul(v);
+ }
+ return (*seq.begin()).rest.simplify_ncmul(v);
+}
+
+// protected
+
+int add::compare_same_type(basic const & other) const
+{
+ return expairseq::compare_same_type(other);
+}
+
+bool add::is_equal_same_type(basic const & other) const
+{
+ return expairseq::is_equal_same_type(other);
+}
+
+unsigned add::return_type(void) const
+{
+ if (seq.size()==0) {
+ return return_types::commutative;
+ }
+ return (*seq.begin()).rest.return_type();
+}
+
+unsigned add::return_type_tinfo(void) const
+{
+ if (seq.size()==0) {
+ return tinfo_key;
+ }
+ return (*seq.begin()).rest.return_type_tinfo();
+}
+
+ex add::thisexpairseq(epvector const & v, ex const & oc) const
+{
+ return (new add(v,oc))->setflag(status_flags::dynallocated);
+}
+
+ex add::thisexpairseq(epvector * vp, ex const & oc) const
+{
+ return (new add(vp,oc))->setflag(status_flags::dynallocated);
+}
+
+/*
+expair add::split_ex_to_pair(ex const & e) const
+{
+ if (is_ex_exactly_of_type(e,mul)) {
+ mul const & mulref=ex_to_mul(e);
+ ASSERT(mulref.seq.size()>1);
+ ex const & lastfactor_rest=(*(mulref.seq.end()-1)).rest;
+ ex const & lastfactor_coeff=(*(mulref.seq.end()-1)).coeff;
+ if (is_ex_exactly_of_type(lastfactor_rest,numeric) &&
+ ex_to_numeric(lastfactor_coeff).is_equal(numONE())) {
+ epvector s=mulref.seq;
+ //s.pop_back();
+ //return expair((new mul(s,1))->setflag(status_flags::dynallocated),
+ // lastfactor);
+ mul * mulp=static_cast<mul *>(mulref.duplicate());
+#ifdef EXPAIRSEQ_USE_HASHTAB
+ mulp->remove_hashtab_entry(mulp->seq.end()-1);
+#endif // def EXPAIRSEQ_USE_HASHTAB
+ mulp->seq.pop_back();
+#ifdef EXPAIRSEQ_USE_HASHTAB
+ mulp->shrink_hashtab();
+#endif // def EXPAIRSEQ_USE_HASHTAB
+ mulp->clearflag(status_flags::evaluated);
+ mulp->clearflag(status_flags::hash_calculated);
+ return expair(mulp->setflag(status_flags::dynallocated),lastfactor_rest);
+ }
+ }
+ return expair(e,exONE());
+}
+*/
+
+expair add::split_ex_to_pair(ex const & e) const
+{
+ if (is_ex_exactly_of_type(e,mul)) {
+ mul const & mulref=ex_to_mul(e);
+ ex numfactor=mulref.overall_coeff;
+ // mul * mulcopyp=static_cast<mul *>(mulref.duplicate());
+ mul * mulcopyp=new mul(mulref);
+ mulcopyp->overall_coeff=exONE();
+ mulcopyp->clearflag(status_flags::evaluated);
+ mulcopyp->clearflag(status_flags::hash_calculated);
+ return expair(mulcopyp->setflag(status_flags::dynallocated),numfactor);
+ }
+ return expair(e,exONE());
+}
+
+/*
+expair add::combine_ex_with_coeff_to_pair(ex const & e,
+ ex const & c) const
+{
+ ASSERT(is_ex_exactly_of_type(c,numeric));
+ if (is_ex_exactly_of_type(e,mul)) {
+ mul const & mulref=ex_to_mul(e);
+ ASSERT(mulref.seq.size()>1);
+ ex const & lastfactor_rest=(*(mulref.seq.end()-1)).rest;
+ ex const & lastfactor_coeff=(*(mulref.seq.end()-1)).coeff;
+ if (is_ex_exactly_of_type(lastfactor_rest,numeric) &&
+ ex_to_numeric(lastfactor_coeff).is_equal(numONE())) {
+ //epvector s=mulref.seq;
+ //s.pop_back();
+ //return expair((new mul(s,1))->setflag(status_flags::dynallocated),
+ // ex_to_numeric(lastfactor).mul_dyn(ex_to_numeric(c)));
+ mul * mulp=static_cast<mul *>(mulref.duplicate());
+#ifdef EXPAIRSEQ_USE_HASHTAB
+ mulp->remove_hashtab_entry(mulp->seq.end()-1);
+#endif // def EXPAIRSEQ_USE_HASHTAB
+ mulp->seq.pop_back();
+#ifdef EXPAIRSEQ_USE_HASHTAB
+ mulp->shrink_hashtab();
+#endif // def EXPAIRSEQ_USE_HASHTAB
+ mulp->clearflag(status_flags::evaluated);
+ mulp->clearflag(status_flags::hash_calculated);
+ if (are_ex_trivially_equal(c,exONE())) {
+ return expair(mulp->setflag(status_flags::dynallocated),lastfactor_rest);
+ } else if (are_ex_trivially_equal(lastfactor_rest,exONE())) {
+ return expair(mulp->setflag(status_flags::dynallocated),c);
+ }
+ return expair(mulp->setflag(status_flags::dynallocated),
+ ex_to_numeric(lastfactor_rest).mul_dyn(ex_to_numeric(c)));
+ }
+ }
+ return expair(e,c);
+}
+*/
+
+expair add::combine_ex_with_coeff_to_pair(ex const & e,
+ ex const & c) const
+{
+ ASSERT(is_ex_exactly_of_type(c,numeric));
+ if (is_ex_exactly_of_type(e,mul)) {
+ mul const & mulref=ex_to_mul(e);
+ ex numfactor=mulref.overall_coeff;
+ //mul * mulcopyp=static_cast<mul *>(mulref.duplicate());
+ mul * mulcopyp=new mul(mulref);
+ mulcopyp->overall_coeff=exONE();
+ mulcopyp->clearflag(status_flags::evaluated);
+ mulcopyp->clearflag(status_flags::hash_calculated);
+ if (are_ex_trivially_equal(c,exONE())) {
+ return expair(mulcopyp->setflag(status_flags::dynallocated),numfactor);
+ } else if (are_ex_trivially_equal(numfactor,exONE())) {
+ return expair(mulcopyp->setflag(status_flags::dynallocated),c);
+ }
+ return expair(mulcopyp->setflag(status_flags::dynallocated),
+ ex_to_numeric(numfactor).mul_dyn(ex_to_numeric(c)));
+ } else if (is_ex_exactly_of_type(e,numeric)) {
+ if (are_ex_trivially_equal(c,exONE())) {
+ return expair(e,exONE());
+ }
+ return expair(ex_to_numeric(e).mul_dyn(ex_to_numeric(c)),exONE());
+ }
+ return expair(e,c);
+}
+
+expair add::combine_pair_with_coeff_to_pair(expair const & p,
+ ex const & c) const
+{
+ ASSERT(is_ex_exactly_of_type(p.coeff,numeric));
+ ASSERT(is_ex_exactly_of_type(c,numeric));
+
+ if (is_ex_exactly_of_type(p.rest,numeric)) {
+ ASSERT(ex_to_numeric(p.coeff).is_equal(numONE())); // should be normalized
+ return expair(ex_to_numeric(p.rest).mul_dyn(ex_to_numeric(c)),exONE());
+ }
+
+ return expair(p.rest,ex_to_numeric(p.coeff).mul_dyn(ex_to_numeric(c)));
+}
+
+ex add::recombine_pair_to_ex(expair const & p) const
+{
+ //if (p.coeff.compare(exONE())==0) {
+ //if (are_ex_trivially_equal(p.coeff,exONE())) {
+ if (ex_to_numeric(p.coeff).is_equal(numONE())) {
+ return p.rest;
+ } else {
+ return p.rest*p.coeff;
+ }
+}
+
+ex add::expand(unsigned options) const
+{
+ epvector * vp=expandchildren(options);
+ if (vp==0) {
+ return *this;
+ }
+ return (new add(vp,overall_coeff))->setflag(status_flags::expanded |
+ status_flags::dynallocated );
+}
+
+//////////
+// new virtual functions which can be overridden by derived classes
+//////////
+
+// none
+
+//////////
+// non-virtual functions in this class
+//////////
+
+// none
+
+//////////
+// static member variables
+//////////
+
+// protected
+
+unsigned add::precedence=40;
+
+//////////
+// global constants
+//////////
+
+const add some_add;
+type_info const & typeid_add=typeid(some_add);
+
+
+
--- /dev/null
+/** @file add.h
+ *
+ * Interface to GiNaC's sums of expressions. */
+
+#ifndef _ADD_H_
+#define _ADD_H_
+
+#include "expairseq.h"
+
+/** Sum of expressions. */
+class add : public expairseq
+{
+ friend class mul;
+ friend class ncmul;
+ friend class power;
+
+// member functions
+
+ // default constructor, destructor, copy constructor assignment operator and helpers
+public:
+ add();
+ ~add();
+ add(add const & other);
+ add const & operator=(add const & other);
+protected:
+ void copy(add const & other);
+ void destroy(bool call_parent);
+
+ // other constructors
+public:
+ add(ex const & lh, ex const & rh);
+ add(exvector const & v);
+ add(epvector const & v);
+ //add(epvector const & v, bool do_not_canonicalize=0);
+ add(epvector const & v, ex const & oc);
+ add(epvector * vp, ex const & oc);
+
+ // functions overriding virtual functions from bases classes
+public:
+ basic * duplicate() const;
+ void printraw(ostream & os) const;
+ void print(ostream & os, unsigned upper_precedence=0) const;
+ void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+ bool info(unsigned inf) const;
+ int degree(symbol const & s) const;
+ int ldegree(symbol const & s) const;
+ ex coeff(symbol const & s, int const n=1) const;
+ ex eval(int level=0) const;
+ ex diff(symbol const & s) const;
+ ex series(symbol const & s, ex const & point, int order) const;
+ ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
+ numeric integer_content(void) const;
+ ex smod(numeric const &xi) const;
+ numeric max_coefficient(void) const;
+ exvector get_indices(void) const;
+ ex simplify_ncmul(exvector const & v) const;
+protected:
+ int compare_same_type(basic const & other) const;
+ bool is_equal_same_type(basic const & other) const;
+ unsigned return_type(void) const;
+ unsigned return_type_tinfo(void) const;
+ ex thisexpairseq(epvector const & v, ex const & oc) const;
+ ex thisexpairseq(epvector * vp, ex const & oc) const;
+ void printpair(ostream & os, expair const & p,
+ unsigned upper_precedence) const;
+ expair split_ex_to_pair(ex const & e) const;
+ expair combine_ex_with_coeff_to_pair(ex const & e,
+ ex const & c) const;
+ expair combine_pair_with_coeff_to_pair(expair const & p,
+ ex const & c) const;
+ ex recombine_pair_to_ex(expair const & p) const;
+ ex expand(unsigned options=0) const;
+
+ // new virtual functions which can be overridden by derived classes
+ // none
+
+ // non-virtual functions in this class
+ // none
+
+// member variables
+
+protected:
+ static unsigned precedence;
+};
+
+// global constants
+
+extern const add some_add;
+extern type_info const & typeid_add;
+
+#define ex_to_add(X) static_cast<add const &>(*(X).bp)
+
+#endif // ndef _ADD_H_
+
--- /dev/null
+/** @file basic.cpp
+ *
+ * Implementation of GiNaC's ABC. */
+
+#include <iostream>
+#include <typeinfo>
+#include <stdexcept>
+
+#include "ginac.h"
+#include "utils.h"
+
+//////////
+// default constructor, destructor, copy constructor assignment operator and helpers
+//////////
+
+// public
+
+#ifndef INLINE_BASIC_CONSTRUCTORS
+basic::basic() : flags(0), refcount(0), tinfo_key(TINFO_BASIC)
+{
+ debugmsg("basic default constructor",LOGLEVEL_CONSTRUCT);
+ // nothing to do
+}
+
+basic::~basic()
+{
+ debugmsg("basic destructor",LOGLEVEL_DESTRUCT);
+ destroy(0);
+ ASSERT((!(flags & status_flags::dynallocated))||(refcount==0));
+}
+
+basic::basic(basic const & other) : flags(0), refcount(0), tinfo_key(TINFO_BASIC)
+{
+ debugmsg("basic copy constructor",LOGLEVEL_CONSTRUCT);
+ copy(other);
+}
+#endif
+
+basic const & basic::operator=(basic const & other)
+{
+ debugmsg("basic operator=",LOGLEVEL_ASSIGNMENT);
+ if (this != &other) {
+ destroy(1);
+ copy(other);
+ }
+ return *this;
+}
+
+// protected
+
+#if 0
+void basic::copy(basic const & other)
+{
+ flags=other.flags & ~ status_flags::dynallocated;
+ hashvalue=other.hashvalue;
+ tinfo_key=other.tinfo_key;
+}
+#endif
+
+//////////
+// other constructors
+//////////
+
+#ifndef INLINE_BASIC_CONSTRUCTORS
+basic::basic(unsigned ti) : flags(0), refcount(0), tinfo_key(ti)
+{
+ debugmsg("basic constructor with tinfo_key",LOGLEVEL_CONSTRUCT);
+ // nothing to do
+}
+#endif
+
+//////////
+// functions overriding virtual functions from bases classes
+//////////
+
+// none
+
+//////////
+// new virtual functions which can be overridden by derived classes
+//////////
+
+// public
+
+basic * basic::duplicate() const
+{
+ debugmsg("basic duplicate",LOGLEVEL_DUPLICATE);
+ return new basic(*this);
+}
+
+bool basic::info(unsigned inf) const
+{
+ return false; // all possible properties are false for basic objects
+}
+
+int basic::nops() const
+{
+ return 0;
+}
+
+ex basic::op(int const i) const
+{
+ return (const_cast<basic *>(this))->let_op(i);
+}
+
+ex & basic::let_op(int const i)
+{
+ throw(std::out_of_range("op() out of range"));
+}
+
+ex basic::operator[](ex const & index) const
+{
+ if (is_exactly_of_type(*index.bp,numeric)) {
+ return op(static_cast<numeric const &>(*index.bp).to_int());
+ }
+ throw(std::invalid_argument("non-numeric indices not supported by this type"));
+}
+
+ex basic::operator[](int const i) const
+{
+ return op(i);
+}
+
+bool basic::has(ex const & other) const
+{
+ ASSERT(other.bp!=0);
+ if (is_equal(*other.bp)) return true;
+ if (nops()>0) {
+ for (int i=0; i<nops(); i++) {
+ if (op(i).has(other)) return true;
+ }
+ }
+ return false;
+}
+
+int basic::degree(symbol const & s) const
+{
+ return 0;
+}
+
+int basic::ldegree(symbol const & s) const
+{
+ return 0;
+}
+
+ex basic::coeff(symbol const & s, int const n) const
+{
+ return n==0 ? *this : exZERO();
+}
+
+ex basic::collect(symbol const & s) const
+{
+ ex x;
+ int ldeg=ldegree(s);
+ int deg=degree(s);
+ for (int n=ldeg; n<=deg; n++) {
+ x += coeff(s,n)*power(s,n);
+ }
+ return x;
+}
+
+ex basic::eval(int level) const
+{
+ return this->hold();
+}
+
+ex basic::evalf(int level) const
+{
+ return *this;
+}
+
+ex basic::subs(lst const & ls, lst const & lr) const
+{
+ return *this;
+}
+
+exvector basic::get_indices(void) const
+{
+ return exvector(); // return an empty exvector
+}
+
+ex basic::simplify_ncmul(exvector const & v) const
+{
+ return simplified_ncmul(v);
+}
+
+// protected
+
+int basic::compare_same_type(basic const & other) const
+{
+ return compare_pointers(this, &other);
+}
+
+bool basic::is_equal_same_type(basic const & other) const
+{
+ return compare_same_type(other)==0;
+}
+
+unsigned basic::return_type(void) const
+{
+ return return_types::commutative;
+}
+
+unsigned basic::return_type_tinfo(void) const
+{
+ return tinfo();
+}
+
+unsigned basic::calchash(void) const
+{
+ unsigned v=golden_ratio_hash(tinfo());
+ for (int i=0; i<nops(); i++) {
+ v=rotate_left_31(v);
+ v ^= (const_cast<basic *>(this))->let_op(i).gethash();
+ }
+
+ v = v & 0x7FFFFFFFU;
+
+ // store calculated hash value only if object is already evaluated
+ if (flags & status_flags::evaluated) {
+ setflag(status_flags::hash_calculated);
+ hashvalue=v;
+ }
+
+ return v;
+}
+
+ex basic::expand(unsigned options) const
+{
+ return this->setflag(status_flags::expanded);
+}
+
+//////////
+// non-virtual functions in this class
+//////////
+
+// public
+
+ex basic::subs(ex const & e) const
+{
+ // accept 2 types of replacement expressions:
+ // - symbol==ex
+ // - lst(symbol1==ex1,symbol2==ex2,...)
+ // convert to subs(lst(symbol1,symbol2,...),lst(ex1,ex2,...))
+ // additionally, idx can be used instead of symbol
+ if (e.info(info_flags::relation_equal)) {
+ return subs(lst(e));
+ }
+ if (!e.info(info_flags::list)) {
+ throw(std::invalid_argument("basic::subs(ex): argument must be a list"));
+ }
+ lst ls;
+ lst lr;
+ for (int i=0; i<e.nops(); i++) {
+ if (!e.op(i).info(info_flags::relation_equal)) {
+ throw(std::invalid_argument("basic::subs(ex): argument must be a list or equations"));
+ }
+ if (!e.op(i).op(0).info(info_flags::symbol)) {
+ if (!e.op(i).op(0).info(info_flags::idx)) {
+ throw(std::invalid_argument("basic::subs(ex): lhs must be a symbol or an idx"));
+ }
+ }
+ ls.append(e.op(i).op(0));
+ lr.append(e.op(i).op(1));
+ }
+ return subs(ls,lr);
+}
+
+// compare functions to sort expressions canonically
+// all compare functions return: -1 for *this less than other, 0 equal, 1 greater
+
+/*
+int basic::compare(basic const & other) const
+{
+ const type_info & typeid_this = typeid(*this);
+ const type_info & typeid_other = typeid(other);
+
+ if (typeid_this==typeid_other) {
+ return compare_same_type(other);
+ }
+
+ // special rule: sort numeric() to end
+ if (typeid_this==typeid_numeric) return 1;
+ if (typeid_other==typeid_numeric) return -1;
+
+ // otherwise: sort according to type_info order (arbitrary, but well defined)
+ return typeid_this.before(typeid_other) ? -1 : 1;
+}
+*/
+
+int basic::compare(basic const & other) const
+{
+ unsigned hash_this = gethash();
+ unsigned hash_other = other.gethash();
+
+ if (hash_this<hash_other) return -1;
+ if (hash_this>hash_other) return 1;
+
+ unsigned typeid_this = tinfo();
+ unsigned typeid_other = other.tinfo();
+
+ if (typeid_this<typeid_other) {
+ /*
+ cout << "hash collision, different types: "
+ << *this << " and " << other << endl;
+ this->printraw(cout);
+ cout << " and ";
+ other.printraw(cout);
+ cout << endl;
+ */
+ return -1;
+ }
+ if (typeid_this>typeid_other) {
+ /*
+ cout << "hash collision, different types: "
+ << *this << " and " << other << endl;
+ this->printraw(cout);
+ cout << " and ";
+ other.printraw(cout);
+ cout << endl;
+ */
+ return 1;
+ }
+
+ ASSERT(typeid(*this)==typeid(other));
+
+ int cmpval=compare_same_type(other);
+ if ((cmpval!=0)&&(hash_this<0x80000000U)) {
+ /*
+ cout << "hash collision, same type: "
+ << *this << " and " << other << endl;
+ this->printraw(cout);
+ cout << " and ";
+ other.printraw(cout);
+ cout << endl;
+ */
+ }
+ return cmpval;
+}
+
+bool basic::is_equal(basic const & other) const
+{
+ unsigned hash_this = gethash();
+ unsigned hash_other = other.gethash();
+
+ if (hash_this!=hash_other) return false;
+
+ unsigned typeid_this = tinfo();
+ unsigned typeid_other = other.tinfo();
+
+ if (typeid_this!=typeid_other) return false;
+
+ ASSERT(typeid(*this)==typeid(other));
+
+ return is_equal_same_type(other);
+}
+
+// protected
+
+basic const & basic::hold(void) const
+{
+ return setflag(status_flags::evaluated);
+}
+
+void basic::ensure_if_modifiable(void) const
+{
+ if (refcount>1) {
+ throw(std::runtime_error("cannot modify multiply referenced object"));
+ }
+}
+
+//////////
+// static member variables
+//////////
+
+// protected
+
+unsigned basic::precedence=70;
+unsigned basic::delta_indent=4;
+
+//////////
+// global constants
+//////////
+
+const basic some_basic;
+type_info const & typeid_basic=typeid(some_basic);
+
+//////////
+// global variables
+//////////
+
+int max_recursion_level=1024;
--- /dev/null
+/** @file basic.h
+ *
+ * Interface to GiNaC's ABC. */
+
+#ifndef _BASIC_H_
+#define _BASIC_H_
+
+#include <iostream>
+#include <typeinfo>
+#include <vector>
+
+#include "flags.h"
+#include "tinfos.h"
+#include "debugmsg.h"
+
+class basic;
+class ex;
+class symbol;
+class lst;
+class numeric;
+
+typedef vector<ex> exvector;
+
+#define INLINE_BASIC_CONSTRUCTORS
+
+/** This class is the ABC (abstract base class) of GiNaC's class hierarchy.
+ * It is responsible for the reference counting. */
+class basic
+{
+ friend class ex;
+
+// member functions
+
+ // default constructor, destructor, copy constructor assignment operator and helpers
+public:
+ basic()
+#ifdef INLINE_BASIC_CONSTRUCTORS
+ : tinfo_key(TINFO_BASIC), flags(0), refcount(0)
+ {
+ debugmsg("basic default constructor",LOGLEVEL_CONSTRUCT);
+ // nothing to do
+ }
+#else
+;
+#endif // def INLINE_BASIC_CONSTRUCTORS
+
+ virtual ~basic()
+#ifdef INLINE_BASIC_CONSTRUCTORS
+ {
+ debugmsg("basic destructor",LOGLEVEL_DESTRUCT);
+ destroy(0);
+ ASSERT((!(flags & status_flags::dynallocated))||(refcount==0));
+ }
+#else
+;
+#endif // def INLINE_BASIC_CONSTRUCTORS
+
+ basic(basic const & other)
+#ifdef INLINE_BASIC_CONSTRUCTORS
+ {
+ debugmsg("basic copy constructor",LOGLEVEL_CONSTRUCT);
+ copy(other);
+ }
+#else
+;
+#endif // def INLINE_BASIC_CONSTRUCTORS
+
+ virtual basic const & operator=(basic const & other);
+
+protected:
+ void copy(basic const & other)
+ {
+ flags = other.flags & ~status_flags::dynallocated;
+ hashvalue = other.hashvalue;
+ tinfo_key = other.tinfo_key;
+ }
+ void destroy(bool call_parent) {}
+
+ // other constructors
+ basic(unsigned ti)
+#ifdef INLINE_BASIC_CONSTRUCTORS
+ : tinfo_key(ti), flags(0), refcount(0)
+ {
+ debugmsg("basic constructor with tinfo_key",LOGLEVEL_CONSTRUCT);
+ // nothing to do
+ }
+#else
+;
+#endif // def INLINE_BASIC_CONSTRUCTORS
+
+ // functions overriding virtual functions from bases classes
+ // none
+
+ // new virtual functions which can be overridden by derived classes
+public: // only const functions please (may break reference counting)
+ virtual basic * duplicate() const;
+ virtual void printraw(ostream & os) const;
+ virtual void printtree(ostream & os, unsigned indent) const;
+ virtual void print(ostream & os,unsigned upper_precedence=0) const;
+ virtual void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+ virtual void dbgprint(void) const;
+ virtual void dbgprinttree(void) const;
+ virtual bool info(unsigned inf) const;
+ virtual int nops() const;
+ virtual ex op(int const i) const;
+ virtual ex & let_op(int const i);
+ virtual ex operator[](ex const & index) const;
+ virtual ex operator[](int const i) const;
+ virtual bool has(ex const & other) const;
+ virtual int degree(symbol const & s) const;
+ virtual int ldegree(symbol const & s) const;
+ virtual ex coeff(symbol const & s, int const n=1) const;
+ virtual ex collect(symbol const & s) const;
+ virtual ex eval(int level=0) const;
+ virtual ex evalf(int level=0) const;
+ virtual ex diff(symbol const & s) const;
+ virtual ex series(symbol const & s, ex const & point, int order) const;
+ virtual ex subs(lst const & ls, lst const & lr) const;
+ virtual ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
+ virtual numeric integer_content(void) const;
+ virtual ex smod(numeric const &xi) const;
+ virtual numeric max_coefficient(void) const;
+ virtual exvector get_indices(void) const;
+ virtual ex simplify_ncmul(exvector const & v) const;
+protected: // non-const functions should be called from class ex only
+ virtual int compare_same_type(basic const & other) const;
+ virtual bool is_equal_same_type(basic const & other) const;
+ virtual unsigned return_type(void) const;
+ virtual unsigned return_type_tinfo(void) const;
+ virtual unsigned calchash(void) const;
+ virtual ex expand(unsigned options=0) const;
+
+ // non-virtual functions in this class
+public:
+ ex subs(ex const & e) const;
+ int compare(basic const & other) const;
+ bool is_equal(basic const & other) const;
+ basic const & hold(void) const;
+ unsigned gethash(void) const {if (flags & status_flags::hash_calculated) return hashvalue; else return calchash();}
+ unsigned tinfo(void) const {return tinfo_key;}
+protected:
+ basic const & setflag(unsigned f) const {flags |= f; return *this;}
+ basic const & clearflag(unsigned f) const {flags &= ~f; return *this;}
+ void ensure_if_modifiable(void) const;
+
+// member variables
+
+protected:
+ unsigned tinfo_key;
+ mutable unsigned flags;
+ mutable unsigned hashvalue;
+ static unsigned precedence;
+ static unsigned delta_indent;
+private:
+ unsigned refcount;
+};
+
+// global constants
+
+extern const basic some_basic;
+extern type_info const & typeid_basic;
+
+// global variables
+
+extern int max_recursion_level;
+
+/*
+#ifndef _DEBUG
+*/
+#define is_of_type(OBJ,TYPE) \
+ (dynamic_cast<TYPE *>(const_cast<basic *>(&OBJ))!=0)
+
+/*
+#define is_exactly_of_type(OBJ,TYPE) \
+ (typeid(OBJ)==typeid(some_##TYPE))
+*/
+#define is_exactly_of_type(OBJ,TYPE) \
+ ((OBJ).tinfo()==(some_##TYPE).tinfo())
+
+
+ /*
+#else
+#define is_of_type(OBJ,TYPE) \
+ (ASSERT(typeid(OBJ)!=typeid(exZERO())), \
+ (dynamic_cast<TYPE *>(const_cast<basic *>(&OBJ))!=0))
+
+#define is_exactly_of_type(OBJ,TYPE) \
+ (ASSERT(typeid(OBJ)!=typeid(exZERO())), \
+ (typeid(OBJ)==typeid(some_##TYPE))
+#endif // ndef _DEBUG
+*/
+
+#define is_ex_of_type(OBJ,TYPE) \
+ (dynamic_cast<TYPE *>(const_cast<basic *>((OBJ).bp))!=0)
+
+/*
+#define is_ex_exactly_of_type(OBJ,TYPE) \
+ (typeid(*(OBJ).bp)==typeid(some_##TYPE))
+*/
+
+#define is_ex_exactly_of_type(OBJ,TYPE) \
+ ((*(OBJ).bp).tinfo()==(some_##TYPE).tinfo())
+
+#define are_ex_trivially_equal(EX1,EX2) \
+ ((EX1).bp==(EX2).bp)
+
+// global functions
+
+inline unsigned rotate_left_31(unsigned n)
+{
+ // clear highest bit and shift 1 bit to the left
+ n=(n & 0x7FFFFFFFU) << 1;
+
+ // overflow? clear highest bit and set lowest bit
+ if (n & 0x80000000U) {
+ n=(n & 0x7FFFFFFFU) | 0x00000001U;
+ }
+
+ ASSERT(n<0x80000000U);
+
+ return n;
+}
+
+inline unsigned golden_ratio_hash(unsigned n)
+{
+#if 0
+ // This requires ´long long´ (or an equivalent 64 bit type)---which is,
+ // unfortunately, not ANSI-compliant:
+ unsigned long long l = n * 0x4f1bbcddLL;
+ return (l & 0x7fffffffU) ^ (l >> 32);
+#else
+ // This requires ´long double´ to have a mantissa of at least 64 bit---
+ // which is not guaranteed by any standard:
+ const static long double golden_ratio=.618033988749894848204586834370;
+ long double m=golden_ratio*n;
+ return unsigned((m-int(m))*0x80000000);
+#endif
+}
+
+#endif // ndef _BASIC_H_
--- /dev/null
+/** @file clifford.cpp
+ *
+ * Implementation of GiNaC's clifford objects.
+ * No real implementation yet, to be done. */
+
+#include <string>
+
+#include "ginac.h"
+#include "utils.h"
+
+//////////
+// default constructor, destructor, copy constructor assignment operator and helpers
+//////////
+
+// public
+
+clifford::clifford()
+{
+ debugmsg("clifford default constructor",LOGLEVEL_CONSTRUCT);
+ serial=next_serial++;
+ name=autoname_prefix()+ToString(serial);
+ tinfo_key=TINFO_CLIFFORD;
+}
+
+clifford::~clifford()
+{
+ debugmsg("clifford destructor",LOGLEVEL_DESTRUCT);
+ destroy(0);
+}
+
+clifford::clifford(clifford const & other)
+{
+ debugmsg("clifford copy constructor",LOGLEVEL_CONSTRUCT);
+ copy (other);
+}
+
+clifford const & clifford::operator=(clifford const & other)
+{
+ debugmsg("clifford operator=",LOGLEVEL_ASSIGNMENT);
+ if (this != &other) {
+ destroy(1);
+ copy(other);
+ }
+ return *this;
+}
+
+// protected
+
+void clifford::copy(clifford const & other)
+{
+ indexed::copy(other);
+ name=other.name;
+ serial=other.serial;
+}
+
+void clifford::destroy(bool call_parent)
+{
+ if (call_parent) {
+ indexed::destroy(call_parent);
+ }
+}
+
+//////////
+// other constructors
+//////////
+
+// public
+
+clifford::clifford(string const & initname)
+{
+ debugmsg("clifford constructor from string",LOGLEVEL_CONSTRUCT);
+ name=initname;
+ serial=next_serial++;
+ tinfo_key=TINFO_CLIFFORD;
+}
+
+//////////
+// functions overriding virtual functions from bases classes
+//////////
+
+// public
+
+basic * clifford::duplicate() const
+{
+ debugmsg("clifford duplicate",LOGLEVEL_DUPLICATE);
+ return new clifford(*this);
+}
+
+void clifford::printraw(ostream & os) const
+{
+ debugmsg("clifford printraw",LOGLEVEL_PRINT);
+ os << "clifford(" << "name=" << name << ",serial=" << serial
+ << ",indices=";
+ printrawindices(os);
+ os << ",hash=" << hashvalue << ",flags=" << flags << ")";
+}
+
+void clifford::printtree(ostream & os, unsigned indent) const
+{
+ debugmsg("clifford printtree",LOGLEVEL_PRINT);
+ os << string(indent,' ') << name << " (clifford): "
+ << "serial=" << serial << ","
+ << seq.size() << "indices=";
+ printtreeindices(os,indent);
+ os << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
+ << ", flags=" << flags << endl;
+}
+
+void clifford::print(ostream & os, unsigned upper_precedence) const
+{
+ debugmsg("clifford print",LOGLEVEL_PRINT);
+ os << name;
+ printindices(os);
+}
+
+void clifford::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+{
+ debugmsg("clifford print csrc",LOGLEVEL_PRINT);
+ print(os,upper_precedence);
+}
+
+bool clifford::info(unsigned inf) const
+{
+ return indexed::info(inf);
+}
+
+// protected
+
+int clifford::compare_same_type(basic const & other) const
+{
+ ASSERT(other.tinfo() == TINFO_CLIFFORD);
+ const clifford *o = static_cast<const clifford *>(&other);
+ if (serial==o->serial) {
+ return indexed::compare_same_type(other);
+ }
+ return serial < o->serial ? -1 : 1;
+}
+
+ex clifford::simplify_ncmul(exvector const & v) const
+{
+ return simplified_ncmul(v);
+}
+
+unsigned clifford::calchash(void) const
+{
+ hashvalue=golden_ratio_hash(golden_ratio_hash(0x55555556U ^
+ golden_ratio_hash(tinfo_key) ^
+ serial));
+ setflag(status_flags::hash_calculated);
+ return hashvalue;
+}
+
+//////////
+// virtual functions which can be overridden by derived classes
+//////////
+
+// none
+
+//////////
+// non-virtual functions in this class
+//////////
+
+void clifford::setname(string const & n)
+{
+ name=n;
+}
+
+// private
+
+string & clifford::autoname_prefix(void)
+{
+ static string * s=new string("clifford");
+ return *s;
+}
+
+//////////
+// static member variables
+//////////
+
+// private
+
+unsigned clifford::next_serial=0;
+
+//////////
+// global constants
+//////////
+
+const clifford some_clifford;
+type_info const & typeid_clifford=typeid(some_clifford);
+
--- /dev/null
+/** @file clifford.h
+ *
+ * Interface to GiNaC's clifford objects. */
+
+#ifndef _CLIFFORD_H_
+#define _CLIFFORD_H_
+
+#include <string>
+
+class clifford;
+
+#include "indexed.h"
+
+/** Base class for clifford object */
+class clifford : public indexed
+{
+// member functions
+
+ // default constructor, destructor, copy constructor assignment operator and helpers
+public:
+ clifford();
+ ~clifford();
+ clifford(clifford const & other);
+ clifford const & operator=(clifford const & other);
+protected:
+ void copy(clifford const & other);
+ void destroy(bool call_parent);
+
+ // other constructors
+public:
+ explicit clifford(string const & initname);
+
+ // functions overriding virtual functions from base classes
+public:
+ basic * duplicate() const;
+ void printraw(ostream & os) const;
+ void printtree(ostream & os, unsigned indent) const;
+ void print(ostream & os, unsigned upper_precedence=0) const;
+ void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+ bool info(unsigned inf) const;
+protected:
+ int compare_same_type(basic const & other) const;
+ ex simplify_ncmul(exvector const & v) const;
+ unsigned calchash(void) const;
+
+ // new virtual functions which can be overridden by derived classes
+ // none
+
+ // non-virtual functions in this class
+public:
+ void setname(string const & n);
+private:
+ string & autoname_prefix(void);
+
+// member variables
+
+protected:
+ string name;
+ unsigned serial; // unique serial number for comparision
+private:
+ static unsigned next_serial;
+};
+
+// global constants
+
+extern const clifford some_clifford;
+extern type_info const & typeid_clifford;
+
+// macros
+
+#define ex_to_clifford(X) static_cast<clifford const &>(*(X).bp)
+
+#endif // ndef _CLIFFORD_H_
+
+
--- /dev/null
+/** @file color.cpp
+ *
+ * Implementation of GiNaC's color objects.
+ * No real implementation yet, to be done. */
+
+#include <string>
+#include <list>
+#include <algorithm>
+#include <iostream>
+#include <stdexcept>
+
+#include "ginac.h"
+
+//////////
+// default constructor, destructor, copy constructor assignment operator and helpers
+//////////
+
+// public
+
+color::color() : type(invalid), representation_label(0)
+{
+ debugmsg("color default constructor",LOGLEVEL_CONSTRUCT);
+ tinfo_key=TINFO_COLOR;
+}
+
+color::~color()
+{
+ debugmsg("color destructor",LOGLEVEL_DESTRUCT);
+ destroy(0);
+}
+
+color::color(color const & other)
+{
+ debugmsg("color copy constructor",LOGLEVEL_CONSTRUCT);
+ copy (other);
+}
+
+color const & color::operator=(color const & other)
+{
+ debugmsg("color operator=",LOGLEVEL_ASSIGNMENT);
+ if (this != &other) {
+ destroy(1);
+ copy(other);
+ }
+ return *this;
+}
+
+// protected
+
+void color::copy(color const & other)
+{
+ indexed::copy(other);
+ type=other.type;
+ representation_label=other.representation_label;
+}
+
+void color::destroy(bool call_parent)
+{
+ if (call_parent) {
+ indexed::destroy(call_parent);
+ }
+}
+
+//////////
+// other constructors
+//////////
+
+// protected
+
+color::color(color_types const t, unsigned const rl) : type(t), representation_label(rl)
+{
+ debugmsg("color constructor from color_types,unsigned",LOGLEVEL_CONSTRUCT);
+ ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
+ tinfo_key=TINFO_COLOR;
+ ASSERT(all_of_type_coloridx());
+}
+
+color::color(color_types const t, ex const & i1, unsigned const rl)
+ : indexed(i1), type(t), representation_label(rl)
+{
+ debugmsg("color constructor from color_types,ex,unsigned",LOGLEVEL_CONSTRUCT);
+ ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
+ tinfo_key=TINFO_COLOR;
+ ASSERT(all_of_type_coloridx());
+}
+
+color::color(color_types const t, ex const & i1, ex const & i2, unsigned const rl)
+ : indexed(i1,i2), type(t), representation_label(rl)
+{
+ debugmsg("color constructor from color_types,ex,ex,unsigned",LOGLEVEL_CONSTRUCT);
+ ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
+ tinfo_key=TINFO_COLOR;
+ ASSERT(all_of_type_coloridx());
+}
+
+color::color(color_types const t, ex const & i1, ex const & i2, ex const & i3,
+ unsigned const rl) : indexed(i1,i2,i3), type(t), representation_label(rl)
+{
+ debugmsg("color constructor from color_types,ex,ex,ex,unsigned",LOGLEVEL_CONSTRUCT);
+ ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
+ tinfo_key=TINFO_COLOR;
+ ASSERT(all_of_type_coloridx());
+}
+
+color::color(color_types const t, exvector const & iv, unsigned const rl)
+ : indexed(iv), type(t), representation_label(rl)
+{
+ debugmsg("color constructor from color_types,exvector,unsigned",LOGLEVEL_CONSTRUCT);
+ ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
+ tinfo_key=TINFO_COLOR;
+ ASSERT(all_of_type_coloridx());
+}
+
+color::color(color_types const t, exvector * ivp, unsigned const rl)
+ : indexed(ivp), type(t), representation_label(rl)
+{
+ debugmsg("color constructor from color_types,exvector *,unsigned",LOGLEVEL_CONSTRUCT);
+ ASSERT(representation_label<MAX_REPRESENTATION_LABELS);
+ tinfo_key=TINFO_COLOR;
+ ASSERT(all_of_type_coloridx());
+}
+
+//////////
+// functions overriding virtual functions from bases classes
+//////////
+
+// public
+
+basic * color::duplicate() const
+{
+ debugmsg("color duplicate",LOGLEVEL_DUPLICATE);
+ return new color(*this);
+}
+
+void color::printraw(ostream & os) const
+{
+ debugmsg("color printraw",LOGLEVEL_PRINT);
+ os << "color(type=" << (unsigned)type
+ << ",representation_label=" << representation_label
+ << ",indices=";
+ printrawindices(os);
+ os << ",hash=" << hashvalue << ",flags=" << flags << ")";
+}
+
+void color::printtree(ostream & os, unsigned indent) const
+{
+ debugmsg("color printtree",LOGLEVEL_PRINT);
+ os << string(indent,' ') << "color object: "
+ << "type=" << (unsigned)type
+ << ",representation_label=" << representation_label << ", ";
+ os << seq.size() << " indices" << endl;
+ printtreeindices(os,indent);
+ os << string(indent,' ') << "hash=" << hashvalue
+ << " (0x" << hex << hashvalue << dec << ")"
+ << ", flags=" << flags << endl;
+}
+
+void color::print(ostream & os, unsigned upper_precedence) const
+{
+ debugmsg("color print",LOGLEVEL_PRINT);
+ switch (type) {
+ case color_T:
+ os << "T";
+ if (representation_label!=0) {
+ os << "^(" << representation_label << ")";
+ }
+ break;
+ case color_f:
+ os << "f";
+ break;
+ case color_d:
+ os << "d";
+ break;
+ case color_delta8:
+ os << "delta8";
+ break;
+ case color_ONE:
+ os << "color_ONE";
+ break;
+ case invalid:
+ default:
+ os << "INVALID_COLOR_OBJECT";
+ break;
+ }
+ printindices(os);
+}
+
+void color::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
+{
+ debugmsg("color print csrc",LOGLEVEL_PRINT);
+ print(os,upper_precedence);
+}
+
+bool color::info(unsigned inf) const
+{
+ return indexed::info(inf);
+}
+
+#define CMPINDICES(A,B,C) ((idx1.get_value()==(A))&&(idx2.get_value()==(B))&&(idx3.get_value()==(C)))
+
+ex color::eval(int level) const
+{
+ // canonicalize indices
+
+ bool antisymmetric=false;
+
+ switch (type) {
+ case color_f:
+ antisymmetric=true; // no break here!
+ case color_d:
+ case color_delta8:
+ {
+ exvector iv=seq;
+ int sig=canonicalize_indices(iv,antisymmetric);
+ if (sig!=INT_MAX) {
+ // something has changed while sorting indices, more evaluations later
+ if (sig==0) return exZERO();
+ return ex(sig)*color(type,iv,representation_label);
+ }
+ }
+ break;
+ default:
+ // nothing to canonicalize
+ break;
+ }
+
+ switch (type) {
+ case color_delta8:
+ {
+ ASSERT(seq.size()==2);
+ coloridx const & idx1=ex_to_coloridx(seq[0]);
+ coloridx const & idx2=ex_to_coloridx(seq[1]);
+
+ // check for delta8_{a,a} where a is a symbolic index, replace by 8
+ if ((idx1.is_symbolic())&&(idx1.is_equal_same_type(idx2))) {
+ return ex(COLOR_EIGHT);
+ }
+
+ // check for delta8_{a,b} where a and b are numeric indices, replace by 0 or 1
+ if ((!idx1.is_symbolic())&&(!idx2.is_symbolic())) {
+ if ((idx1.get_value()!=idx2.get_value())) {
+ return exONE();
+ } else {
+ return exZERO();
+ }
+ }
+ }
+ break;
+ case color_d:
+ // check for d_{a,a,c} (=0) when a is symbolic
+ {
+ ASSERT(seq.size()==3);
+ coloridx const & idx1=ex_to_coloridx(seq[0]);
+ coloridx const & idx2=ex_to_coloridx(seq[1]);
+ coloridx const & idx3=ex_to_coloridx(seq[2]);
+
+ if (idx1.is_equal_same_type(idx2) && idx1.is_symbolic()) {
+ return exZERO();
+ } else if (idx2.is_equal_same_type(idx3) && idx2.is_symbolic()) {
+ return exZERO();
+ }
+
+ // check for three numeric indices
+ if (!(idx1.is_symbolic()||idx2.is_symbolic()||idx3.is_symbolic())) {
+ ASSERT(idx1.get_value()<=idx2.get_value());
+ ASSERT(idx2.get_value()<=idx3.get_value());
+ if (CMPINDICES(1,4,6)||CMPINDICES(1,5,7)||CMPINDICES(2,5,6)||
+ CMPINDICES(3,4,4)||CMPINDICES(3,5,5)) {
+ return exHALF();
+ } else if (CMPINDICES(2,4,7)||CMPINDICES(3,6,6)||CMPINDICES(3,7,7)) {
+ return -exHALF();
+ } else if (CMPINDICES(1,1,8)||CMPINDICES(2,2,8)||CMPINDICES(3,3,8)) {
+ return 1/sqrt(numeric(3));
+ } else if (CMPINDICES(8,8,8)) {
+ return -1/sqrt(numeric(3));
+ } else if (CMPINDICES(4,4,8)||CMPINDICES(5,5,8)||CMPINDICES(6,6,8)||CMPINDICES(7,7,8)) {
+ return -1/(2*sqrt(numeric(3)));
+ }
+ return exZERO();
+ }
+ }
+ break;
+ case color_f:
+ {
+ ASSERT(seq.size()==3);
+ coloridx const & idx1=ex_to_coloridx(seq[0]);
+ coloridx const & idx2=ex_to_coloridx(seq[1]);
+ coloridx const & idx3=ex_to_coloridx(seq[2]);
+
+ // check for three numeric indices
+ if (!(idx1.is_symbolic()||idx2.is_symbolic()||idx3.is_symbolic())) {
+ ASSERT(idx1.get_value()<=idx2.get_value());
+ ASSERT(idx2.get_value()<=idx3.get_value());
+ if (CMPINDICES(1,2,3)) {
+ return exONE();
+ } else if (CMPINDICES(1,4,7)||CMPINDICES(2,4,6)||
+ CMPINDICES(2,5,7)||CMPINDICES(3,4,5)) {
+ return exHALF();
+ } else if (CMPINDICES(1,5,6)||CMPINDICES(3,6,7)) {
+ return -exHALF();
+ } else if (CMPINDICES(4,5,8)||CMPINDICES(6,7,8)) {
+ return sqrt(numeric(3))/2;
+ } else if (CMPINDICES(8,8,8)) {
+ return -1/sqrt(numeric(3));
+ } else if (CMPINDICES(4,4,8)||CMPINDICES(5,5,8)||CMPINDICES(6,6,8)||CMPINDICES(7,7,8)) {
+ return -1/(2*sqrt(numeric(3)));
+ }
+ return exZERO();
+ }
+ break;
+ }
+ default:
+ // nothing to evaluate
+ break;
+ }
+
+ return this->hold();
+}
+
+// protected
+
+int color::compare_same_type(basic const & other) const
+{
+ ASSERT(other.tinfo() == TINFO_COLOR);
+ const color *o = static_cast<const color *>(&other);
+ if (type==o->type) {
+ if (representation_label==o->representation_label) {
+ return indexed::compare_same_type(other);
+ }
+ return representation_label < o->representation_label ? -1 : 1;
+ }
+ return type < o->type ? -1 : 1;
+}
+
+bool color::is_equal_same_type(basic const & other) const
+{
+ ASSERT(other.tinfo() == TINFO_COLOR);
+ const color *o = static_cast<const color *>(&other);
+ if (type!=o->type) return false;
+ if (representation_label!=o->representation_label) return false;
+ return indexed::is_equal_same_type(other);
+}
+
+#include <iostream>
+
+ex color::simplify_ncmul(exvector const & v) const
+{
+ // simplifications: contract delta8_{a,b} where possible
+ // sort delta8,f,d,T(rl=0),T(rl=1),...,ONE(rl=0),ONE(rl=1),...
+ // remove superfluous ONEs
+
+ // contract indices of delta8_{a,b} if they are different and symbolic
+
+ exvector v_contracted=v;
+ unsigned replacements;
+ bool something_changed=false;
+
+ exvector::iterator it=v_contracted.begin();
+ while (it!=v_contracted.end()) {
+ // process only delta8 objects
+ if (is_ex_exactly_of_type(*it,color) && (ex_to_color(*it).type==color_delta8)) {
+ color & d8=ex_to_nonconst_color(*it);
+ ASSERT(d8.seq.size()==2);
+ coloridx const & first_idx=ex_to_coloridx(d8.seq[0]);
+ coloridx const & second_idx=ex_to_coloridx(d8.seq[1]);
+ // delta8_{a,a} should have been contracted in color::eval()
+ ASSERT((!first_idx.is_equal(second_idx))||(!first_idx.is_symbolic()));
+ ex saved_delta8=*it; // save to restore it later
+
+ // try to contract first index
+ replacements=1;
+ if (first_idx.is_symbolic()) {
+ replacements = subs_index_in_exvector(v_contracted,first_idx,second_idx);
+ if (replacements==1) {
+ // not contracted except in itself, restore delta8 object
+ *it=saved_delta8;
+ } else {
+ // a contracted index should occur exactly twice
+ ASSERT(replacements==2);
+ *it=exONE();
+ something_changed=true;
+ }
+ }
+
+ // try second index only if first was not contracted
+ if ((replacements==1)&&(second_idx.is_symbolic())) {
+ // first index not contracted, *it is guaranteed to be the original delta8 object
+ replacements = subs_index_in_exvector(v_contracted,second_idx,first_idx);
+ if (replacements==1) {
+ // not contracted except in itself, restore delta8 object
+ *it=saved_delta8;
+ } else {
+ // a contracted index should occur exactly twice
+ ASSERT(replacements==2);
+ *it=exONE();
+ something_changed=true;
+ }
+ }
+ }
+ ++it;
+ }
+
+ if (something_changed) {
+ // do more simplifications later
+ return nonsimplified_ncmul(v_contracted);
+ }
+
+ // there were no indices to contract
+ // sort delta8,f,d,T(rl=0),T(rl=1),...,ONE(rl=0),ONE(rl=1),...,unknown
+ // (if there is at least one unknown object, all Ts will be unknown to not change the order)
+
+ exvector delta8vec;
+ exvector fvec;
+ exvector dvec;
+ vector<exvector> Tvecs;
+ Tvecs.resize(MAX_REPRESENTATION_LABELS);
+ vector<exvector> ONEvecs;
+ ONEvecs.resize(MAX_REPRESENTATION_LABELS);
+ exvector unknownvec;
+
+ split_color_string_in_parts(v,delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec);
+
+ // d_{a,k,l} f_{b,k,l}=0 (includes case a=b)
+ if ((dvec.size()>=1)&&(fvec.size()>=1)) {
+ for (exvector::iterator it1=dvec.begin(); it1!=dvec.end(); ++it1) {
+ for (exvector::iterator it2=fvec.begin(); it2!=fvec.end(); ++it2) {
+ ASSERT(is_ex_exactly_of_type(*it1,color));
+ ASSERT(is_ex_exactly_of_type(*it2,color));
+ color const & col1=ex_to_color(*it1);
+ color const & col2=ex_to_color(*it2);
+ exvector iv_intersect=idx_intersect(col1.seq,col2.seq);
+ if (iv_intersect.size()>=2) return exZERO();
+ }
+ }
+ }
+
+ // d_{a,k,l} d_{b,k,l}=5/3 delta8_{a,b} (includes case a=b)
+ if (dvec.size()>=2) {
+ for (exvector::iterator it1=dvec.begin(); it1!=dvec.end()-1; ++it1) {
+ for (exvector::iterator it2=it1+1; it2!=dvec.end(); ++it2) {
+ ASSERT(is_ex_exactly_of_type(*it1,color));
+ ASSERT(is_ex_exactly_of_type(*it2,color));
+ color const & col1=ex_to_color(*it1);
+ color const & col2=ex_to_color(*it2);
+ exvector iv_intersect=idx_intersect(col1.seq,col2.seq);
+ if (iv_intersect.size()>=2) {
+ if (iv_intersect.size()==3) {
+ *it1=numeric(40)/numeric(3);
+ *it2=exONE();
+ } else {
+ int sig1, sig2; // unimportant, since symmetric
+ ex idx1=permute_free_index_to_front(col1.seq,iv_intersect,false,&sig1);
+ ex idx2=permute_free_index_to_front(col2.seq,iv_intersect,false,&sig2);
+ *it1=numeric(5)/numeric(3)*color(color_delta8,idx1,idx2);
+ *it2=exONE();
+ }
+ return nonsimplified_ncmul(recombine_color_string(
+ delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec));
+ }
+ }
+ }
+ }
+
+ // f_{a,k,l} f_{b,k,l}=3 delta8_{a,b} (includes case a=b)
+ if (fvec.size()>=2) {
+ for (exvector::iterator it1=fvec.begin(); it1!=fvec.end()-1; ++it1) {
+ for (exvector::iterator it2=it1+1; it2!=fvec.end(); ++it2) {
+ ASSERT(is_ex_exactly_of_type(*it1,color));
+ ASSERT(is_ex_exactly_of_type(*it2,color));
+ color const & col1=ex_to_color(*it1);
+ color const & col2=ex_to_color(*it2);
+ exvector iv_intersect=idx_intersect(col1.seq,col2.seq);
+ if (iv_intersect.size()>=2) {
+ if (iv_intersect.size()==3) {
+ *it1=numeric(24);
+ *it2=exONE();
+ } else {
+ int sig1, sig2;
+ ex idx1=permute_free_index_to_front(col1.seq,iv_intersect,true,&sig1);
+ ex idx2=permute_free_index_to_front(col2.seq,iv_intersect,true,&sig2);
+ *it1=numeric(sig1*sig2*5)/numeric(3)*color(color_delta8,idx1,idx2);
+ *it2=exONE();
+ }
+ return nonsimplified_ncmul(recombine_color_string(
+ delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec));
+ }
+ }
+ }
+ }
+
+ // d_{a,b,c} T_b T_c = 5/6 T_a
+ // f_{a,b,c} T_b T_c = 3/2 I T_a
+ for (unsigned rl=0; rl<MAX_REPRESENTATION_LABELS; ++rl) {
+ if ((Tvecs[rl].size()>=2)&&((dvec.size()>=1)||(fvec.size()>=1))) {
+ for (exvector::iterator it1=Tvecs[rl].begin(); it1!=Tvecs[rl].end()-1; ++it1) {
+ exvector iv;
+ ASSERT(is_ex_exactly_of_type(*it1,color)&&ex_to_color(*it1).type==color_T);
+ ASSERT(is_ex_exactly_of_type(*(it1+1),color)&&ex_to_color(*(it1+1)).type==color_T);
+ iv.push_back(ex_to_color(*it1).seq[0]);
+ iv.push_back(ex_to_color(*(it1+1)).seq[0]);
+
+ // d_{a,b,c} T_b T_c = 5/6 T_a
+ for (exvector::iterator it2=dvec.begin(); it2!=dvec.end(); ++it2) {
+ ASSERT(is_ex_exactly_of_type(*it2,color)&&ex_to_color(*it2).type==color_d);
+ color const & dref=ex_to_color(*it2);
+ exvector iv_intersect=idx_intersect(dref.seq,iv);
+ if (iv_intersect.size()==2) {
+ int sig; // unimportant, since symmetric
+ ex free_idx=permute_free_index_to_front(dref.seq,iv,false,&sig);
+ *it1=color(color_T,free_idx,rl);
+ *(it1+1)=color(color_ONE,rl);
+ *it2=numeric(5)/numeric(6);
+ return nonsimplified_ncmul(recombine_color_string(
+ delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec));
+ }
+ }
+
+ // f_{a,b,c} T_b T_c = 3/2 I T_a
+ for (exvector::iterator it2=fvec.begin(); it2!=fvec.end(); ++it2) {
+ ASSERT(is_ex_exactly_of_type(*it2,color)&&ex_to_color(*it2).type==color_f);
+ color const & fref=ex_to_color(*it2);
+ exvector iv_intersect=idx_intersect(fref.seq,iv);
+ if (iv_intersect.size()==2) {
+ int sig;
+ ex free_idx=permute_free_index_to_front(fref.seq,iv,true,&sig);
+ *it1=color(color_T,free_idx,rl);
+ *(it1+1)=color(color_ONE,rl);
+ *it2=numeric(sig*3)/numeric(2)*I;
+ return nonsimplified_ncmul(recombine_color_string(
+ delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec));
+ }
+ }
+ }
+ }
+ }
+
+ // clear all ONEs when there is at least one corresponding color_T
+ // in this representation, retain one ONE otherwise
+ for (unsigned rl=0; rl<MAX_REPRESENTATION_LABELS; ++rl) {
+ if (Tvecs[rl].size()!=0) {
+ ONEvecs[rl].clear();
+ } else if (ONEvecs[rl].size()!=0) {
+ ONEvecs[rl].clear();
+ ONEvecs[rl].push_back(color(color_ONE,rl));
+ }
+ }
+
+ // return a sorted vector
+ return simplified_ncmul(recombine_color_string(delta8vec,fvec,dvec,Tvecs,
+ ONEvecs,unknownvec));
+}
+
+ex color::thisexprseq(exvector const & v) const
+{
+ return color(type,v,representation_label);
+}
+
+ex color::thisexprseq(exvector * vp) const
+{
+ return color(type,vp,representation_label);
+}
+
+bool color::all_of_type_coloridx(void) const
+{
+ // used only inside of ASSERTs
+ for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
+ if (!is_ex_of_type(*cit,coloridx)) return false;
+ }
+ return true;
+}
+
+//////////
+// virtual functions which can be overridden by derived classes
+//////////
+
+// none
+
+//////////
+// non-virtual functions in this class
+//////////
+
+//////////
+// static member variables
+//////////
+
+// none
+
+//////////
+// global constants
+//////////
+
+const color some_color;
+type_info const & typeid_color=typeid(some_color);
+
+//////////
+// friend functions
+//////////
+
+color color_ONE(unsigned const rl)
+{
+ return color(color::color_ONE,rl);
+}
+
+color color_T(ex const & a, unsigned const rl)
+{
+ return color(color::color_T,a,rl);
+}
+
+color color_f(ex const & a, ex const & b, ex const & c)
+{
+ return color(color::color_f,a,b,c);
+}
+
+color color_d(ex const & a, ex const & b, ex const & c)
+{
+ return color(color::color_d,a,b,c);
+}
+
+ex color_h(ex const & a, ex const & b, ex const & c)
+{
+ return color(color::color_d,a,b,c)+I*color(color::color_f,a,b,c);
+}
+
+color color_delta8(ex const & a, ex const & b)
+{
+ return color(color::color_delta8,a,b);
+}
+
+void split_color_string_in_parts(exvector const & v, exvector & delta8vec,
+ exvector & fvec, exvector & dvec,
+ vector<exvector> & Tvecs,
+ vector<exvector> & ONEvecs,
+ exvector & unknownvec)
+{
+ // if not all elements are of type color, put all Ts in unknownvec to
+ // retain the ordering
+ bool all_color=true;
+ for (exvector::const_iterator cit=v.begin(); cit!=v.end(); ++cit) {
+ if (!is_ex_exactly_of_type(*cit,color)) {
+ all_color=false;
+ break;
+ }
+ }
+
+ for (exvector::const_iterator cit=v.begin(); cit!=v.end(); ++cit) {
+ if (is_ex_exactly_of_type(*cit,color)) {
+ switch (ex_to_color(*cit).type) {
+ case color::color_delta8:
+ delta8vec.push_back(*cit);
+ break;
+ case color::color_f:
+ fvec.push_back(*cit);
+ break;
+ case color::color_d:
+ dvec.push_back(*cit);
+ break;
+ case color::color_T:
+ ASSERT(ex_to_color(*cit).representation_label<MAX_REPRESENTATION_LABELS);
+ if (all_color) {
+ Tvecs[ex_to_color(*cit).representation_label].push_back(*cit);
+ } else {
+ unknownvec.push_back(*cit);
+ }
+ break;
+ case color::color_ONE:
+ ASSERT(ex_to_color(*cit).representation_label<MAX_REPRESENTATION_LABELS);
+ ONEvecs[ex_to_color(*cit).representation_label].push_back(*cit);
+ break;
+ default:
+ throw(std::logic_error("invalid type in split_color_string_in_parts()"));
+ }
+ } else {
+ unknownvec.push_back(*cit);
+ }
+ }
+}
+
+exvector recombine_color_string(exvector & delta8vec, exvector & fvec,
+ exvector & dvec, vector<exvector> & Tvecs,
+ vector<exvector> & ONEvecs, exvector & unknownvec)
+{
+ unsigned sz=delta8vec.size()+fvec.size()+dvec.size()+unknownvec.size();
+ for (unsigned rl=0; rl<MAX_REPRESENTATION_LABELS; ++rl) {
+ sz += Tvecs[rl].size();
+ sz += ONEvecs[rl].size();
+ }
+ exvector v;
+ v.reserve(sz);
+
+ append_exvector_to_exvector(v,delta8vec);
+ append_exvector_to_exvector(v,fvec);
+ append_exvector_to_exvector(v,dvec);
+ for (unsigned rl=0; rl<MAX_REPRESENTATION_LABELS; ++rl) {
+ append_exvector_to_exvector(v,Tvecs[rl]);
+ append_exvector_to_exvector(v,ONEvecs[rl]);
+ }
+ append_exvector_to_exvector(v,unknownvec);
+ return v;
+}
+
+ex color_trace_of_one_representation_label(exvector const & v)
+{
+ if (v.size()==0) {
+ return numeric(COLOR_THREE);
+ } else if (v.size()==1) {
+ ASSERT(is_ex_exactly_of_type(*(v.begin()),color));
+ return exZERO();
+ }
+ exvector v1=v;
+ ex last_element=v1.back();
+ ASSERT(is_ex_exactly_of_type(last_element,color));
+ ASSERT(ex_to_color(last_element).type==color::color_T);
+ v1.pop_back();
+ ex next_to_last_element=v1.back();
+ ASSERT(is_ex_exactly_of_type(next_to_last_element,color));
+ ASSERT(ex_to_color(next_to_last_element).type==color::color_T);
+ v1.pop_back();
+ exvector v2=v1;
+
+ ex const & last_index=ex_to_color(last_element).seq[0];
+ ex const & next_to_last_index=ex_to_color(next_to_last_element).seq[0];
+ ex summation_index=coloridx();
+
+ v2.push_back(color_T(summation_index)); // don't care about the representation_label
+
+ // check this formula for SU(N) with N!=3 !!!!!!!!!
+ return numeric(1)/numeric(2*COLOR_THREE)*color_delta8(next_to_last_index,last_index)
+ % color_trace_of_one_representation_label(v1)
+ +numeric(1)/numeric(2)*color_h(next_to_last_index,last_index,summation_index)
+ % color_trace_of_one_representation_label(v2);
+ /*
+ ex term1=numeric(1)/numeric(2*COLOR_THREE)*color_delta8(next_to_last_index,last_index)
+ % color_trace_of_one_representation_label(v1);
+ cout << "term 1 of trace of " << v.size() << " ts=" << term1 << endl;
+ ex term2=numeric(1)/numeric(2)*color_h(next_to_last_index,last_index,summation_index)
+ % color_trace_of_one_representation_label(v2);
+ cout << "term 2 of trace of " << v.size() << " ts=" << term2 << endl;
+ return term1+term2;
+ */
+}
+
+ex color_trace(exvector const & v, unsigned const rl)
+{
+ ASSERT(rl<MAX_REPRESENTATION_LABELS);
+
+ exvector v_rest;
+ v_rest.reserve(v.size()+1); // max size if trace is empty
+
+ exvector delta8vec;
+ exvector fvec;
+ exvector dvec;
+ vector<exvector> Tvecs;
+ Tvecs.resize(MAX_REPRESENTATION_LABELS);
+ vector<exvector> ONEvecs;
+ ONEvecs.resize(MAX_REPRESENTATION_LABELS);
+ exvector unknownvec;
+
+ split_color_string_in_parts(v,delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec);
+
+ if (unknownvec.size()!=0) {
+ throw(std::invalid_argument("color_trace(): expression must be expanded"));
+ }
+
+ append_exvector_to_exvector(v_rest,delta8vec);
+ append_exvector_to_exvector(v_rest,fvec);
+ append_exvector_to_exvector(v_rest,dvec);
+ for (unsigned i=0; i<MAX_REPRESENTATION_LABELS; ++i) {
+ if (i!=rl) {
+ append_exvector_to_exvector(v_rest,Tvecs[i]);
+ append_exvector_to_exvector(v_rest,ONEvecs[i]);
+ } else {
+ if (Tvecs[i].size()!=0) {
+ v_rest.push_back(color_trace_of_one_representation_label(Tvecs[i]));
+ } else if (ONEvecs[i].size()!=0) {
+ v_rest.push_back(numeric(COLOR_THREE));
+ } else {
+ throw(std::logic_error("color_trace(): representation_label not in color string"));
+ }
+ }
+ }
+
+ return nonsimplified_ncmul(v_rest);
+}
+
+ex simplify_pure_color_string(ex const & e)
+{
+ ASSERT(is_ex_exactly_of_type(e,ncmul));
+
+ exvector delta8vec;
+ exvector fvec;
+ exvector dvec;
+ vector<exvector> Tvecs;
+ Tvecs.resize(MAX_REPRESENTATION_LABELS);
+ vector<exvector> ONEvecs;
+ ONEvecs.resize(MAX_REPRESENTATION_LABELS);
+ exvector unknownvec;
+
+ split_color_string_in_parts(ex_to_ncmul(e).get_factors(),delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec);
+
+ // search for T_k S T_k (=1/2 Tr(S) - 1/6 S)
+ for (unsigned rl=0; rl<MAX_REPRESENTATION_LABELS; ++rl) {
+ if (Tvecs[rl].size()>=2) {
+ for (unsigned i=0; i<Tvecs[rl].size()-1; ++i) {
+ for (unsigned j=i+1; j<Tvecs[rl].size(); ++j) {
+ ex & t1=Tvecs[rl][i];
+ ex & t2=Tvecs[rl][j];
+ ASSERT(is_ex_exactly_of_type(t1,color)&&
+ (ex_to_color(t1).type==color::color_T)&&
+ (ex_to_color(t1).seq.size()==1));
+ ASSERT(is_ex_exactly_of_type(t2,color)&&
+ (ex_to_color(t2).type==color::color_T)&&
+ (ex_to_color(t2).seq.size()==1));
+ coloridx const & idx1=ex_to_coloridx(ex_to_color(t1).seq[0]);
+ coloridx const & idx2=ex_to_coloridx(ex_to_color(t2).seq[0]);
+
+ if (idx1.is_equal(idx2) && idx1.is_symbolic()) {
+ exvector S;
+ for (unsigned k=i+1; k<j; ++k) {
+ S.push_back(Tvecs[rl][k]);
+ }
+ t1=exONE();
+ t2=exONE();
+ ex term1=numeric(-1)/numeric(6)*nonsimplified_ncmul(recombine_color_string(
+ delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec));
+ for (unsigned k=i+1; k<j; ++k) {
+ S.push_back(exONE());
+ }
+ t1=color_trace_of_one_representation_label(S);
+ ex term2=numeric(1)/numeric(2)*nonsimplified_ncmul(recombine_color_string(
+ delta8vec,fvec,dvec,Tvecs,ONEvecs,unknownvec));
+ return simplify_color(term1+term2);
+ }
+ }
+ }
+ }
+ }
+
+ // TODO: higher contractions!!!!!!!!!!!!!
+
+ return e;
+}
+
+ex simplify_color(ex const & e)
+{
+ // all simplification is done on expanded objects
+ ex e_expanded=e.expand();
+
+ // simplification of sum=sum of simplifications
+ if (is_ex_exactly_of_type(e_expanded,add)) {
+ ex sum=exZERO();
+ for (int i=0; i<e_expanded.nops(); ++i) {
+ sum += simplify_color(e_expanded.op(i));
+ }
+ return sum;
+ }
+
+ // simplification of commutative product=commutative product of simplifications
+ if (is_ex_exactly_of_type(e_expanded,mul)) {
+ ex prod=exONE();
+ for (int i=0; i<e_expanded.nops(); ++i) {
+ prod *= simplify_color(e_expanded.op(i));
+ }
+ return prod;
+ }
+
+ // simplification of noncommutative product: test if everything is color
+ if (is_ex_exactly_of_type(e_expanded,ncmul)) {
+ bool all_color=true;
+ for (int i=0; i<e_expanded.nops(); ++i) {
+ if (!is_ex_exactly_of_type(e_expanded.op(i),color)) {
+ all_color=false;
+ break;
+ }
+ }
+ if (all_color) {
+ return simplify_pure_color_string(e_expanded);
+ }
+ }
+
+ // cannot do anything
+ return e_expanded;
+}
+
+ex brute_force_sum_color_indices(ex const & e)
+{
+ exvector iv_all=e.get_indices();
+ exvector iv_double;
+
+ // find double symbolic indices
+ if (iv_all.size()<2) return e;
+ for (exvector::const_iterator cit1=iv_all.begin(); cit1!=iv_all.end()-1; ++cit1) {
+ ASSERT(is_ex_of_type(*cit1,coloridx));
+ for (exvector::const_iterator cit2=cit1+1; cit2!=iv_all.end(); ++cit2) {
+ ASSERT(is_ex_of_type(*cit2,coloridx));
+ if (ex_to_coloridx(*cit1).is_symbolic() &&
+ ex_to_coloridx(*cit1).is_equal(ex_to_coloridx(*cit2))) {
+ iv_double.push_back(*cit1);
+ break;
+ }
+ }
+ }
+
+ vector<int> counter;
+ counter.resize(iv_double.size());
+ int l;
+ for (l=0; unsigned(l)<iv_double.size(); ++l) {
+ counter[l]=1;
+ }
+
+ ex sum=exZERO();
+
+ while (1) {
+ ex term=e;
+ for (l=0; unsigned(l)<iv_double.size(); ++l) {
+ term=term.subs(iv_double[l]==coloridx((unsigned)(counter[l])));
+ //iv_double[l].print(cout);
+ //cout << " " << counter[l] << " ";
+ }
+ //cout << endl;
+ sum += term;
+
+ // increment counter[]
+ l=iv_double.size()-1;
+ while ((l>=0)&&((++counter[l])>COLOR_EIGHT)) {
+ counter[l]=1;
+ l--;
+ }
+ if (l<2) { cout << counter[0] << counter[1] << endl; }
+ if (l<0) break;
+ }
+
+ return sum;
+}
+
+void append_exvector_to_exvector(exvector & dest, exvector const & source)
+{
+ for (exvector::const_iterator cit=source.begin(); cit!=source.end(); ++cit) {
+ dest.push_back(*cit);
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+/** @file color.h
+ *
+ * Interface to GiNaC's color objects. */
+
+#ifndef _COLOR_H_
+#define _COLOR_H_
+
+#include <string>
+#include <vector>
+
+class color;
+
+#include "indexed.h"
+
+#define MAX_REPRESENTATION_LABELS 4
+#define COLOR_EIGHT 8 // N*N-1
+#define COLOR_THREE 3 // N
+
+/** Base class for color object */
+class color : public indexed
+{
+// friends
+
+ friend color color_ONE(unsigned const rl);
+ friend color color_T(ex const & a, unsigned const rl);
+ friend color color_f(ex const & a, ex const & b, ex const & c);
+ friend color color_d(ex const & a, ex const & b, ex const & c);
+ friend ex color_h(ex const & a, ex const & b, ex const & c);
+ friend color color_delta8(ex const & a, ex const & b);
+ friend unsigned subs_index_in_exvector(exvector & v, ex const & is, ex const & ir);
+ friend void split_color_string_in_parts(exvector const & v, exvector & delta8vec,
+ exvector & fvec, exvector & dvec,
+ vector<exvector> & Tvecs,
+ vector<exvector> & ONEvecs,
+ exvector & unknownvec);
+ friend exvector recombine_color_string(exvector & delta8vec, exvector & fvec,
+ exvector & dvec, vector<exvector> & Tvecs,
+ vector<exvector> & ONEvecs, exvector & unknownvec);
+ friend ex color_trace_of_one_representation_label(exvector const & v);
+ friend ex color_trace(exvector const & v, unsigned const rl);
+ friend ex simplify_pure_color_string(ex const & e);
+ friend ex simplify_color(ex const & e);
+
+
+// types
+
+public:
+ typedef enum { invalid, // not properly constructed by one of the friend functions
+ color_T,
+ color_f,
+ color_d,
+ color_delta8,
+ color_ONE
+ } color_types;
+
+// member functions
+
+ // default constructor, destructor, copy constructor assignment operator and helpers
+public:
+ color();
+ ~color();
+ color(color const & other);
+ color const & operator=(color const & other);
+protected:
+ void copy(color const & other);
+ void destroy(bool call_parent);
+
+ // other constructors
+protected:
+ color(color_types const t, unsigned const rl=0);
+ color(color_types const t, ex const & i1, unsigned const rl=0);
+ color(color_types const t, ex const & i1, ex const & i2, unsigned const rl=0);
+ color(color_types const t, ex const & i1, ex const & i2, ex const & i3,
+ unsigned const rl=0);
+ color(color_types const t, exvector const & iv, unsigned const rl=0);
+ color(color_types const t, exvector * ivp, unsigned const rl=0);
+
+ // functions overriding virtual functions from base classes
+public:
+ basic * duplicate() const;
+ void printraw(ostream & os) const;
+ void printtree(ostream & os, unsigned indent) const;
+ void print(ostream & os, unsigned upper_precedence=0) const;
+ void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+ bool info(unsigned inf) const;
+ ex eval(int level=0) const;
+protected:
+ int compare_same_type(basic const & other) const;
+ bool is_equal_same_type(basic const & other) const;
+ ex simplify_ncmul(exvector const & v) const;
+ ex thisexprseq(exvector const & v) const;
+ ex thisexprseq(exvector * vp) const;
+
+ // new virtual functions which can be overridden by derived classes
+ // none
+
+ // non-virtual functions in this class
+protected:
+ bool all_of_type_coloridx(void) const;
+
+// member variables
+
+protected:
+ color_types type;
+ unsigned representation_label; // to distiguish independent color matrices coming from separated fermion lines
+};
+
+// global constants
+
+extern const color some_color;
+extern type_info const & typeid_color;
+
+// macros
+
+#define ex_to_color(X) static_cast<color const &>(*(X).bp)
+#define ex_to_nonconst_color(X) static_cast<color &>(*(X).bp)
+
+color color_ONE(unsigned const rl=0);
+color color_T(ex const & a, unsigned const rl=0);
+color color_f(ex const & a, ex const & b, ex const & c);
+color color_d(ex const & a, ex const & b, ex const & c);
+ex color_h(ex const & a, ex const & b, ex const & c);
+color color_delta8(ex const & a, ex const & b);
+void split_color_string_in_parts(exvector const & v, exvector & delta8vec,
+ exvector & fvec, exvector & dvec,
+ vector<exvector> & Tvecs,
+ vector<exvector> & ONEvecs,
+ exvector & unknownvec);
+exvector recombine_color_string(exvector & delta8vec, exvector & fvec,
+ exvector & dvec, vector<exvector> & Tvecs,
+ vector<exvector> & ONEvecs, exvector & unknownvec);
+ex color_trace_of_one_representation_label(exvector const & v);
+ex color_trace(exvector const & v, unsigned const rl=0);
+ex simplify_pure_color_string(ex const & e);
+ex simplify_color(ex const & e);
+
+ex brute_force_sum_color_indices(ex const & e);
+
+void append_exvector_to_exvector(exvector & dest, exvector const & source);
+
+#endif // ndef _COLOR_H_
+
+
--- /dev/null
+/** @file coloridx.cpp
+ *
+ * Implementation of GiNaC's color indices. */
+
+#include <stdexcept>
+
+#include "ginac.h"
+#include "utils.h"
+
+//////////
+// default constructor, destructor, copy constructor assignment operator and helpers
+//////////
+
+// public
+
+coloridx::coloridx()
+{
+ debugmsg("coloridx default constructor",LOGLEVEL_CONSTRUCT);
+ // serial is incremented in idx::idx()
+ name="color"+ToString(serial);
+ tinfo_key=TINFO_COLORIDX;
+}
+
+coloridx::~coloridx()
+{
+ debugmsg("coloridx destructor",LOGLEVEL_DESTRUCT);
+ destroy(0);
+}
+
+coloridx::coloridx(coloridx const & other)
+{
+ debugmsg("coloridx copy constructor",LOGLEVEL_CONSTRUCT);
+ copy(other);
+}
+
+coloridx const & coloridx::operator=(coloridx const & other)
+{
+ debugmsg("coloridx operator=",LOGLEVEL_ASSIGNMENT);
+ if (this != &other) {
+ destroy(1);
+ copy(other);
+ }
+ return *this;
+}
+
+// protected
+
+void coloridx::copy(coloridx const & other)
+{
+ idx::copy(other);
+}
+
+void coloridx::destroy(bool call_parent)
+{
+ if (call_parent) idx::destroy(call_parent);
+}
+
+//////////
+// other constructors
+//////////
+
+// public
+
+coloridx::coloridx(bool cov) : idx(cov)
+{
+ debugmsg("coloridx constructor from bool",LOGLEVEL_CONSTRUCT);
+ // serial is incremented in idx::idx(bool)
+ name="color"+ToString(serial);
+ tinfo_key=TINFO_COLORIDX;
+}
+
+coloridx::coloridx(string const & n, bool cov) : idx(n,cov)
+{
+ debugmsg("coloridx constructor from string,bool",LOGLEVEL_CONSTRUCT);
+ tinfo_key=TINFO_COLORIDX;
+}
+
+coloridx::coloridx(char const * n, bool cov) : idx(n,cov)
+{
+ debugmsg("coloridx constructor from char*,bool",LOGLEVEL_CONSTRUCT);
+ tinfo_key=TINFO_COLORIDX;
+}
+
+coloridx::coloridx(unsigned const v, bool cov) : idx(v,cov)
+{
+ debugmsg("coloridx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT);
+ tinfo_key=TINFO_COLORIDX;
+}
+
+//////////
+// functions overriding virtual functions from bases classes
+//////////
+
+// public
+
+basic * coloridx::duplicate() const
+{
+ debugmsg("coloridx duplicate",LOGLEVEL_DUPLICATE);
+ return new coloridx(*this);
+}
+
+void coloridx::printraw(ostream & os) const
+{
+ debugmsg("coloridx printraw",LOGLEVEL_PRINT);
+
+ os << "coloridx(";
+
+ if (symbolic) {
+ os << "symbolic,name=" << name;
+ } else {
+ os << "non symbolic,value=" << value;
+ }
+
+ if (covariant) {
+ os << ",covariant";
+ } else {
+ os << ",contravariant";
+ }
+
+ os << ",serial=" << serial;
+ os << ",hash=" << hashvalue << ",flags=" << flags;
+ os << ")";
+}
+
+void coloridx::printtree(ostream & os, unsigned indent) const
+{
+ debugmsg("coloridx printtree",LOGLEVEL_PRINT);
+
+ os << string(indent,' ') << "coloridx: ";
+
+ if (symbolic) {
+ os << "symbolic,name=" << name;
+ } else {
+ os << "non symbolic,value=" << value;
+ }
+
+ if (covariant) {
+ os << ",covariant";
+ } else {
+ os << ",contravariant";
+ }
+
+ os << ", serial=" << serial
+ << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
+ << ", flags=" << flags << endl;
+}
+
+void coloridx::print(ostream & os, unsigned upper_precedence) const
+{
+ debugmsg("coloridx print",LOGLEVEL_PRINT);
+
+ if (covariant) {
+ os << "_";
+ } else {
+ os << "~";
+ }
+ if (symbolic) {
+ os << name;
+ } else {
+ os << value;
+ }
+}
+
+bool coloridx::info(unsigned inf) const
+{
+ if (inf==info_flags::coloridx) return true;
+ return idx::info(inf);
+}
+
+//////////
+// new virtual functions which can be overridden by derived classes
+//////////
+
+// none
+
+//////////
+// non-virtual functions in this class
+//////////
+
+// none
+
+//////////
+// static member variables
+//////////
+
+// none
+
+//////////
+// global constants
+//////////
+
+const coloridx some_coloridx;
+type_info const & typeid_coloridx=typeid(some_coloridx);
+
+
+
--- /dev/null
+/** @file coloridx.h
+ *
+ * Interface to GiNaC's color indices. */
+
+#ifndef _COLORIDX_H_
+#define _COLORIDX_H_
+
+#include <string>
+#include <vector>
+
+#include "idx.h"
+
+class coloridx : public idx
+{
+ friend class color;
+
+// member functions
+
+ // default constructor, destructor, copy constructor assignment operator and helpers
+public:
+ coloridx();
+ ~coloridx();
+ coloridx (coloridx const & other);
+ coloridx const & operator=(coloridx const & other);
+protected:
+ void copy(coloridx const & other);
+ void destroy(bool call_parent);
+
+ // other constructors
+public:
+ explicit coloridx(bool cov);
+ explicit coloridx(string const & n, bool cov=false);
+ explicit coloridx(char const * n, bool cov=false);
+ explicit coloridx(unsigned const v, bool cov=false);
+
+ // functions overriding virtual functions from bases classes
+public:
+ basic * duplicate() const;
+ void printraw(ostream & os) const;
+ void printtree(ostream & os, unsigned indent) const;
+ void print(ostream & os, unsigned upper_precedence=0) const;
+ bool info(unsigned inf) const;
+
+ // new virtual functions which can be overridden by derived classes
+ // none
+
+ // non-virtual functions in this class
+ // none
+
+ // member variables
+ // none
+};
+
+// global constants
+
+extern const coloridx some_coloridx;
+extern type_info const & typeid_coloridx;
+
+// macros
+
+#define ex_to_coloridx(X) (static_cast<coloridx const &>(*(X).bp))
+
+#endif // ndef _COLORIDX_H_
--- /dev/null
+/** @file constant.cpp
+ *
+ * Implementation of GiNaC's constant types and some special constants. */
+
+#include <string>
+#include <stdexcept>
+
+#include "ginac.h"
+
+//////////
+// default constructor, destructor, copy constructor assignment operator and helpers
+//////////
+
+// public
+
+constant::~constant()
+{
+ debugmsg("constant destructor",LOGLEVEL_DESTRUCT);
+ destroy(0);
+}
+
+constant::constant(constant const & other)
+{
+ debugmsg("constant copy constructor",LOGLEVEL_CONSTRUCT);
+ copy(other);
+}
+
+// protected
+
+void constant::copy(constant const & other)
+{
+ basic::copy(other);
+ name=other.name;
+ serial=other.serial;
+ ef=other.ef;
+ if (other.number != 0) {
+ number = new numeric(*other.number);
+ } else {
+ number = 0;
+ }
+ fct_assigned=other.fct_assigned;
+}
+
+void constant::destroy(bool call_parent)
+{
+ delete number;
+ if (call_parent)
+ basic::destroy(call_parent);
+}
+
+//////////
+// other constructors
+//////////
+
+// public
+
+constant::constant(string const & initname, ex (*efun)()) :
+ basic(TINFO_CONSTANT), name(initname), ef(efun),
+ number(0), fct_assigned(true), serial(next_serial++)
+{
+ debugmsg("constant constructor from string, function",LOGLEVEL_CONSTRUCT);
+}
+
+constant::constant(string const & initname, numeric const & initnumber) :
+ basic(TINFO_CONSTANT), name(initname), ef(0),
+ number(new numeric(initnumber)), fct_assigned(false), serial(next_serial++)
+{
+ debugmsg("constant constructor from string, numeric",LOGLEVEL_CONSTRUCT);
+}
+
+//////////
+// functions overriding virtual functions from bases classes
+//////////
+
+// public
+
+basic * constant::duplicate() const
+{
+ debugmsg("constant duplicate",LOGLEVEL_DUPLICATE);
+ return new constant(*this);
+}
+
+ex constant::evalf(int level) const
+{
+ if (fct_assigned) {
+ return ef();
+ } else if (number != 0) {
+ return *number;
+ }
+ return *this;
+}
+
+// protected
+
+int constant::compare_same_type(basic const & other) const
+{
+ ASSERT(is_exactly_of_type(other, constant));
+ // constant const & o=static_cast<constant &>(const_cast<basic &>(other));
+ // return name.compare(o.name);
+ const constant *o = static_cast<const constant *>(&other);
+ if (serial==o->serial) return 0;
+ return serial < o->serial ? -1 : 1;
+}
+
+bool constant::is_equal_same_type(basic const & other) const
+{
+ ASSERT(is_exactly_of_type(other, constant));
+ const constant *o = static_cast<const constant *>(&other);
+ return serial==o->serial;
+}
+
+//////////
+// new virtual functions which can be overridden by derived classes
+//////////
+
+// none
+
+//////////
+// non-virtual functions in this class
+//////////
+
+// none
+
+//////////
+// static member variables
+//////////
+
+unsigned constant::next_serial=0;
+
+//////////
+// global constants
+//////////
+
+const constant some_constant("",0);
+type_info const & typeid_constant=typeid(some_constant);
+
+/** Pi. (3.14159...) Diverts straight into CLN for evalf(). */
+const constant Pi("Pi", PiEvalf);
+/** Catalan's constant. (0.91597...) Diverts straight into CLN for evalf(). */
+const constant EulerGamma("EulerGamma", EulerGammaEvalf);
+/** Euler's constant. (0.57721...) Sometimes called Euler-Mascheroni constant.
+ * Diverts straight into CLN for evalf(). */
+const constant Catalan("Catalan", CatalanEvalf);
--- /dev/null
+/** @file constant.h
+ *
+ * Interface to GiNaC's constant types and some special constants. */
+
+#ifndef _CONSTANT_H_
+#define _CONSTANT_H_
+
+#include <string>
+
+class constant;
+
+#include "ex.h"
+#include "numeric.h"
+
+/** This class holds constants, symbols with specific numerical value. Each
+ * object of this class must either provide their own function to evaluate it
+ * to class numeric or provide the constant as a numeric (if it's an exact
+ * number). */
+class constant : public basic
+{
+
+// member functions
+
+ // default constructor, destructor, copy constructor assignment operator and helpers
+public:
+ ~constant();
+ constant(constant const & other);
+ // constant const & operator=(constant const & other); /* it's pervert! */
+protected:
+ void copy(constant const & other);
+ void destroy(bool call_parent);
+
+ // other constructors
+public:
+ constant(string const & initname, ex (*efun)()=0);
+ constant(string const & initname, numeric const & initnumber);
+
+ // functions overriding virtual functions from bases classes
+public:
+ basic * duplicate() const;
+ void printraw(ostream & os) const;
+ void print(ostream & os, unsigned upper_precedence=0) const;
+ void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
+ ex evalf(int level=0) const;
+ ex diff(symbol const & s) const;
+protected:
+ int compare_same_type(basic const & other) const;
+ bool is_equal_same_type(basic const & other) const;
+
+ // new virtual functions which can be overridden by derived classes
+ // none
+
+ // non-virtual functions in this class
+ // none
+
+// member variables
+
+private:
+ string name;
+ ex (*ef)();
+ numeric * number;
+ bool fct_assigned;
+ unsigned serial; //!< unique serial number for comparision
+ static unsigned next_serial;
+};
+
+// global constants
+
+extern const constant some_constant;
+extern type_info const & typeid_constant;
+
+// extern const numeric I;
+extern const constant Pi;
+extern const constant Catalan;
+extern const constant EulerGamma;
+
+#endif // ndef _CONSTANT_H_
--- /dev/null
+#!/usr/bin/perl -w
+
+if ($#ARGV!=0) {
+ die 'usage: container.pl type (type=lst or exprseq)';
+}
+
+if ($ARGV[0] eq 'lst') {
+ $type='lst';
+} elsif ($ARGV[0] eq 'exprseq') {
+ $type='exprseq';
+} else {
+ die 'only lst and exprseq supported';
+}
+
+#$type='lst';
+#$type='exprseq';
+
+if ($type eq 'exprseq') {
+
+ # settings for exprseq
+ $CONTAINER="exprseq";
+ $STLHEADER="vector";
+ $reserve=1;
+ $prepend=0;
+ $let_op=0;
+ $open_bracket='(';
+ $close_bracket=')';
+
+} elsif ($type eq 'lst') {
+
+ # settings for lst
+ $CONTAINER="lst";
+ $STLHEADER="list";
+ $reserve=0;
+ $prepend=1;
+ $let_op=1;
+ $open_bracket='[';
+ $close_bracket=']';
+
+} else {
+ die "invalid type $type";
+}
+
+$CONTAINER_UC=uc(${CONTAINER});
+$STLT="ex".$STLHEADER;
+
+if ($reserve) {
+ $RESERVE_IMPLEMENTATION="#define RESERVE(s,size) (s).reserve(size)";
+} else {
+ $RESERVE_IMPLEMENTATION="#define RESERVE(s,size) // no reserve needed for ${STLHEADER}";
+}
+
+if ($prepend) {
+ $PREPEND_INTERFACE=<<END_OF_PREPEND_INTERFACE;
+ virtual ${CONTAINER} & prepend(ex const & b);
+END_OF_PREPEND_INTERFACE
+
+ $PREPEND_IMPLEMENTATION=<<END_OF_PREPEND_IMPLEMENTATION;
+${CONTAINER} & ${CONTAINER}::prepend(ex const & b)
+{
+ ensure_if_modifiable();
+ seq.push_front(b);
+ return *this;
+}
+END_OF_PREPEND_IMPLEMENTATION
+} else {
+ $PREPEND_INTERFACE=" // no prepend possible for ${CONTAINER}";
+ $PREPEND_IMPLEMENTATION="";
+}
+
+if ($let_op) {
+ $LET_OP_IMPLEMENTATION=<<END_OF_LET_OP_IMPLEMENTATION
+ex & ${CONTAINER}::let_op(int const i)
+{
+ ASSERT(i>=0);
+ ASSERT(i<nops());
+
+ ${STLT}::iterator it=seq.begin();
+ for (int j=0; j<i; j++) {
+ ++it;
+ }
+ return *it;
+}
+END_OF_LET_OP_IMPLEMENTATION
+} else {
+ $LET_OP_IMPLEMENTATION="// ${CONTAINER}::let_op() will be implemented by user elsewhere";
+}
+
+$interface=<<END_OF_INTERFACE;
+/** \@file ${CONTAINER}.h
+ *
+ * Definition of GiNaC's ${CONTAINER}.
+ * This file was generated automatically by container.pl.
+ * Please do not modify it directly, edit the perl script instead!
+ * container.pl options: \$CONTAINER=${CONTAINER}
+ * \$STLHEADER=${STLHEADER}
+ * \$reserve=${reserve}
+ * \$prepend=${prepend}
+ * \$let_op=${let_op}
+ * \$open_bracket=${open_bracket}
+ * \$close_bracket=${close_bracket} */
+
+#ifndef _${CONTAINER_UC}_H_
+#define _${CONTAINER_UC}_H_
+
+#include <${STLHEADER}>
+
+#include <ginac/ginac.h>
+
+typedef ${STLHEADER}<ex> ${STLT};
+
+class ${CONTAINER} : public basic
+{
+
+public:
+ ${CONTAINER}();
+ ~${CONTAINER}();
+ ${CONTAINER}(${CONTAINER} const & other);
+ ${CONTAINER} const & operator=(${CONTAINER} const & other);
+protected:
+ void copy(${CONTAINER} const & other);
+ void destroy(bool call_parent);
+
+public:
+ ${CONTAINER}(${STLT} const & s, bool discardable=0);
+ ${CONTAINER}(${STLT} * vp); // vp will be deleted
+ explicit ${CONTAINER}(ex const & e1);
+ explicit ${CONTAINER}(ex const & e1, ex const & e2);
+ explicit ${CONTAINER}(ex const & e1, ex const & e2, ex const & e3);
+ explicit ${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
+ ex const & e4);
+ explicit ${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
+ ex const & e4, ex const & e5);
+ explicit ${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
+ ex const & e4, ex const & e5, ex const & e6);
+ explicit ${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
+ ex const & e4, ex const & e5, ex const & e6,
+ ex const & e7);
+ explicit ${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
+ ex const & e4, ex const & e5, ex const & e6,
+ ex const & e7, ex const & e8);
+ explicit ${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
+ ex const & e4, ex const & e5, ex const & e6,
+ ex const & e7, ex const & e8, ex const & e9);
+ explicit ${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
+ ex const & e4, ex const & e5, ex const & e6,
+ ex const & e7, ex const & e8, ex const & e9,
+ ex const &e10);
+
+public:
+ basic * duplicate() const;
+ void printraw(ostream & os) const;
+ void print(ostream & os, unsigned upper_precedence=0) const;
+ void printtree(ostream & os, unsigned indent) const;
+ bool info(unsigned inf) const;
+ int nops() const;
+ ex & let_op(int const i);
+ ex expand(unsigned options=0) const;
+ bool has(ex const & other) const;
+ ex eval(int level=0) const;
+ ex evalf(int level=0) const;
+ ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
+ ex diff(symbol const & s) const;
+ ex subs(lst const & ls, lst const & lr) const;
+protected:
+ int compare_same_type(basic const & other) const;
+ bool is_equal_same_type(basic const & other) const;
+ unsigned return_type(void) const;
+
+ // new virtual functions which can be overridden by derived classes
+public:
+ virtual ${CONTAINER} & append(ex const & b);
+${PREPEND_INTERFACE}
+protected:
+ virtual void printseq(ostream & os, char openbracket, char delim,
+ char closebracket, unsigned this_precedence,
+ unsigned upper_precedence=0) const;
+ virtual ex this${CONTAINER}(${STLT} const & v) const;
+ virtual ex this${CONTAINER}(${STLT} * vp) const;
+
+protected:
+ bool is_canonical() const;
+ ${STLT} evalchildren(int level) const;
+ ${STLT} evalfchildren(int level) const;
+ ${STLT} normalchildren(int level) const;
+ ${STLT} diffchildren(symbol const & s) const;
+ ${STLT} * subschildren(lst const & ls, lst const & lr) const;
+
+protected:
+ ${STLT} seq;
+ static unsigned precedence;
+};
+
+// global constants
+
+extern const ${CONTAINER} some_${CONTAINER};
+extern type_info const & typeid_${CONTAINER};
+
+// macros
+
+#define ex_to_${CONTAINER}(X) (static_cast<${CONTAINER} const &>(*(X).bp))
+
+#endif // ndef _${CONTAINER_UC}_H_
+
+END_OF_INTERFACE
+
+$implementation=<<END_OF_IMPLEMENTATION;
+/** \@file ${CONTAINER}.cpp
+ *
+ * Implementation of GiNaC's ${CONTAINER}.
+ * This file was generated automatically by container.pl.
+ * Please do not modify it directly, edit the perl script instead!
+ * container.pl options: \$CONTAINER=${CONTAINER}
+ * \$STLHEADER=${STLHEADER}
+ * \$reserve=${reserve}
+ * \$prepend=${prepend}
+ * \$let_op=${let_op}
+ * \$open_bracket=${open_bracket}
+ * \$close_bracket=${close_bracket} */
+
+#include <iostream>
+#include <stdexcept>
+
+#include "ginac.h"
+
+${RESERVE_IMPLEMENTATION}
+
+//////////
+// default constructor, destructor, copy constructor assignment operator and helpers
+//////////
+
+// public
+
+${CONTAINER}::${CONTAINER}() : basic(TINFO_${CONTAINER_UC})
+{
+ debugmsg("${CONTAINER} default constructor",LOGLEVEL_CONSTRUCT);
+}
+
+${CONTAINER}::~${CONTAINER}()
+{
+ debugmsg("${CONTAINER} destructor",LOGLEVEL_DESTRUCT);
+ destroy(0);
+}
+
+${CONTAINER}::${CONTAINER}(${CONTAINER} const & other)
+{
+ debugmsg("${CONTAINER} copy constructor",LOGLEVEL_CONSTRUCT);
+ copy(other);
+}
+
+${CONTAINER} const & ${CONTAINER}::operator=(${CONTAINER} const & other)
+{
+ debugmsg("${CONTAINER} operator=",LOGLEVEL_ASSIGNMENT);
+ if (this != &other) {
+ destroy(1);
+ copy(other);
+ }
+ return *this;
+}
+
+// protected
+
+void ${CONTAINER}::copy(${CONTAINER} const & other)
+{
+ basic::copy(other);
+ seq=other.seq;
+}
+
+void ${CONTAINER}::destroy(bool call_parent)
+{
+ seq.clear();
+ if (call_parent) basic::destroy(call_parent);
+}
+
+//////////
+// other constructors
+//////////
+
+// public
+
+${CONTAINER}::${CONTAINER}(${STLT} const & s, bool discardable) : basic(TINFO_${CONTAINER_UC})
+{
+ debugmsg("${CONTAINER} constructor from ${STLT}",
+ LOGLEVEL_CONSTRUCT);
+ if (discardable) {
+ seq.swap(const_cast<${STLT} &>(s));
+ } else {
+ seq=s;
+ }
+}
+
+${CONTAINER}::${CONTAINER}(${STLT} * vp) : basic(TINFO_${CONTAINER_UC})
+{
+ debugmsg("${CONTAINER} constructor from ${STLT} *",LOGLEVEL_CONSTRUCT);
+ ASSERT(vp!=0);
+ seq.swap(*vp);
+ delete vp;
+}
+
+${CONTAINER}::${CONTAINER}(ex const & e1) : basic(TINFO_${CONTAINER_UC})
+{
+ debugmsg("${CONTAINER} constructor from 1 ex",
+ LOGLEVEL_CONSTRUCT);
+ RESERVE(seq,1);
+ seq.push_back(e1);
+}
+
+${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2) : basic(TINFO_${CONTAINER_UC})
+{
+ debugmsg("${CONTAINER} constructor from 2 ex",
+ LOGLEVEL_CONSTRUCT);
+ RESERVE(seq,2);
+ seq.push_back(e1);
+ seq.push_back(e2);
+}
+
+${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3)
+ : basic(TINFO_${CONTAINER_UC})
+{
+ debugmsg("${CONTAINER} constructor from 3 ex",
+ LOGLEVEL_CONSTRUCT);
+ RESERVE(seq,3);
+ seq.push_back(e1);
+ seq.push_back(e2);
+ seq.push_back(e3);
+}
+
+${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
+ ex const & e4) : basic(TINFO_${CONTAINER_UC})
+{
+ debugmsg("${CONTAINER} constructor from 4 ex",
+ LOGLEVEL_CONSTRUCT);
+ RESERVE(seq,4);
+ seq.push_back(e1);
+ seq.push_back(e2);
+ seq.push_back(e3);
+ seq.push_back(e4);
+}
+
+${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
+ ex const & e4, ex const & e5) : basic(TINFO_${CONTAINER_UC})
+{
+ debugmsg("${CONTAINER} constructor from 5 ex",
+ LOGLEVEL_CONSTRUCT);
+ RESERVE(seq,5);
+ seq.push_back(e1);
+ seq.push_back(e2);
+ seq.push_back(e3);
+ seq.push_back(e4);
+ seq.push_back(e5);
+}
+
+${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
+ ex const & e4, ex const & e5, ex const & e6)
+ : basic(TINFO_${CONTAINER_UC})
+{
+ debugmsg("${CONTAINER} constructor from 6 ex",
+ LOGLEVEL_CONSTRUCT);
+ RESERVE(seq,6);
+ seq.push_back(e1);
+ seq.push_back(e2);
+ seq.push_back(e3);
+ seq.push_back(e4);
+ seq.push_back(e5);
+ seq.push_back(e6);
+}
+
+${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
+ ex const & e4, ex const & e5, ex const & e6,
+ ex const & e7) : basic(TINFO_${CONTAINER_UC})
+{
+ debugmsg("${CONTAINER} constructor from 7 ex",
+ LOGLEVEL_CONSTRUCT);
+ RESERVE(seq,7);
+ seq.push_back(e1);
+ seq.push_back(e2);
+ seq.push_back(e3);
+ seq.push_back(e4);
+ seq.push_back(e5);
+ seq.push_back(e6);
+ seq.push_back(e7);
+}
+
+${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
+ ex const & e4, ex const & e5, ex const & e6,
+ ex const & e7, ex const & e8) : basic(TINFO_${CONTAINER_UC})
+{
+ debugmsg("${CONTAINER} constructor from 8 ex",
+ LOGLEVEL_CONSTRUCT);
+ RESERVE(seq,8);
+ seq.push_back(e1);
+ seq.push_back(e2);
+ seq.push_back(e3);
+ seq.push_back(e4);
+ seq.push_back(e5);
+ seq.push_back(e6);
+ seq.push_back(e7);
+ seq.push_back(e8);
+}
+
+${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
+ ex const & e4, ex const & e5, ex const & e6,
+ ex const & e7, ex const & e8, ex const & e9)
+ : basic(TINFO_${CONTAINER_UC})
+{
+ debugmsg("${CONTAINER} constructor from 9 ex",
+ LOGLEVEL_CONSTRUCT);
+ RESERVE(seq,9);
+ seq.push_back(e1);
+ seq.push_back(e2);
+ seq.push_back(e3);
+ seq.push_back(e4);
+ seq.push_back(e5);
+ seq.push_back(e6);
+ seq.push_back(e7);
+ seq.push_back(e8);
+ seq.push_back(e9);
+}
+
+${CONTAINER}::${CONTAINER}(ex const & e1, ex const & e2, ex const & e3,
+ ex const & e4, ex const & e5, ex const & e6,
+ ex const & e7, ex const & e8, ex const & e9,
+ ex const &e10)
+ : basic(TINFO_${CONTAINER_UC})
+{
+ debugmsg("${CONTAINER} constructor from 10 ex",
+ LOGLEVEL_CONSTRUCT);
+ RESERVE(seq,10);
+ seq.push_back(e1);
+ seq.push_back(e2);
+ seq.push_back(e3);
+ seq.push_back(e4);
+ seq.push_back(e5);
+ seq.push_back(e6);
+ seq.push_back(e7);
+ seq.push_back(e8);
+ seq.push_back(e9);
+ seq.push_back(e10);
+}
+
+//////////
+// functions overriding virtual functions from bases classes
+//////////
+
+// public
+
+basic * ${CONTAINER}::duplicate() const
+{
+ debugmsg("${CONTAINER} duplicate",LOGLEVEL_DUPLICATE);
+ return new ${CONTAINER}(*this);
+}
+
+void ${CONTAINER}::printraw(ostream & os) const
+{
+ debugmsg("${CONTAINER} printraw",LOGLEVEL_PRINT);
+
+ os << "${CONTAINER}(";
+ for (${STLT}::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
+ (*cit).bp->printraw(os);
+ os << ",";
+ }
+ os << ")";
+}
+
+void ${CONTAINER}::print(ostream & os, unsigned upper_precedence) const
+{
+ debugmsg("${CONTAINER} print",LOGLEVEL_PRINT);
+ // always print brackets around seq, ignore upper_precedence
+ printseq(os,'${open_bracket}',',','${close_bracket}',precedence,precedence+1);
+}
+
+void ${CONTAINER}::printtree(ostream & os, unsigned indent) const
+{
+ debugmsg("${CONTAINER} printtree",LOGLEVEL_PRINT);
+
+ os << string(indent,' ') << "type=" << typeid(*this).name()
+ << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
+ << ", flags=" << flags
+ << ", nops=" << nops() << endl;
+ for (${STLT}::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
+ (*cit).printtree(os,indent+delta_indent);
+ }
+ os << string(indent+delta_indent,' ') << "=====" << endl;
+}
+
+// ${CONTAINER}::info() will be implemented by user elsewhere";
+
+int ${CONTAINER}::nops() const
+{
+ return seq.size();
+}
+
+${LET_OP_IMPLEMENTATION}
+
+ex ${CONTAINER}::expand(unsigned options) const
+{
+ ${STLT} s;
+ RESERVE(s,seq.size());
+ for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
+ s.push_back((*it).expand(options));
+ }
+
+ return this${CONTAINER}(s);
+}
+
+// a ${CONTAINER} 'has' an expression if it is this expression itself or a child 'has' it
+
+bool ${CONTAINER}::has(ex const & other) const
+{
+ ASSERT(other.bp!=0);
+ if (is_equal(*other.bp)) return true;
+ for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
+ if ((*it).has(other)) return true;
+ }
+ return false;
+}
+
+ex ${CONTAINER}::eval(int level) const
+{
+ if (level==1) {
+ return this->hold();
+ }
+ return this${CONTAINER}(evalchildren(level));
+}
+
+ex ${CONTAINER}::evalf(int level) const
+{
+ return this${CONTAINER}(evalfchildren(level));
+}
+
+/** Implementation of ex::normal() for ${CONTAINER}s. It normalizes the arguments
+ * and replaces the ${CONTAINER} by a temporary symbol.
+ * \@see ex::normal */
+ex ${CONTAINER}::normal(lst &sym_lst, lst &repl_lst, int level) const
+{
+ ex n=this${CONTAINER}(normalchildren(level));
+ return n.bp->basic::normal(sym_lst,repl_lst,level);
+}
+
+ex ${CONTAINER}::diff(symbol const & s) const
+{
+ return this${CONTAINER}(diffchildren(s));
+}
+
+ex ${CONTAINER}::subs(lst const & ls, lst const & lr) const
+{
+ ${STLT} * vp=subschildren(ls,lr);
+ if (vp==0) {
+ return *this;
+ }
+ return this${CONTAINER}(vp);
+}
+
+// protected
+
+int ${CONTAINER}::compare_same_type(basic const & other) const
+{
+ ASSERT(is_of_type(other,${CONTAINER}));
+ ${CONTAINER} const & o=static_cast<${CONTAINER} const &>
+ (const_cast<basic &>(other));
+ int cmpval;
+ ${STLT}::const_iterator it1=seq.begin();
+ ${STLT}::const_iterator it2=o.seq.begin();
+
+ for (; (it1!=seq.end())&&(it2!=o.seq.end()); ++it1, ++it2) {
+ cmpval=(*it1).compare(*it2);
+ if (cmpval!=0) return cmpval;
+ }
+
+ if (it1==seq.end()) {
+ return (it2==o.seq.end() ? 0 : -1);
+ }
+
+ return 1;
+}
+
+bool ${CONTAINER}::is_equal_same_type(basic const & other) const
+{
+ ASSERT(is_of_type(other,${CONTAINER}));
+ ${CONTAINER} const & o=static_cast<${CONTAINER} const &>
+ (const_cast<basic &>(other));
+ if (seq.size()!=o.seq.size()) return false;
+
+ ${STLT}::const_iterator it1=seq.begin();
+ ${STLT}::const_iterator it2=o.seq.begin();
+
+ for (; it1!=seq.end(); ++it1, ++it2) {
+ if (!(*it1).is_equal(*it2)) return false;
+ }
+
+ return true;
+}
+
+unsigned ${CONTAINER}::return_type(void) const
+{
+ return return_types::noncommutative_composite;
+}
+
+//////////
+// new virtual functions which can be overridden by derived classes
+//////////
+
+// public
+
+${CONTAINER} & ${CONTAINER}::append(ex const & b)
+{
+ ensure_if_modifiable();
+ seq.push_back(b);
+ return *this;
+}
+
+${PREPEND_IMPLEMENTATION}
+
+// protected
+
+void ${CONTAINER}::printseq(ostream & os, char openbracket, char delim,
+ char closebracket, unsigned this_precedence,
+ unsigned upper_precedence) const
+{
+ if (this_precedence<=upper_precedence) os << openbracket;
+ if (seq.size()!=0) {
+ ${STLT}::const_iterator it,it_last;
+ it=seq.begin();
+ it_last=seq.end();
+ --it_last;
+ for (; it!=it_last; ++it) {
+ (*it).bp->print(os,this_precedence);
+ os << delim;
+ }
+ (*it).bp->print(os,this_precedence);
+ }
+ if (this_precedence<=upper_precedence) os << closebracket;
+}
+
+ex ${CONTAINER}::this${CONTAINER}(${STLT} const & v) const
+{
+ return ${CONTAINER}(v);
+}
+
+ex ${CONTAINER}::this${CONTAINER}(${STLT} * vp) const
+{
+ return ${CONTAINER}(vp);
+}
+
+//////////
+// non-virtual functions in this class
+//////////
+
+// public
+
+// none
+
+// protected
+
+bool ${CONTAINER}::is_canonical() const
+{
+ if (seq.size()<=1) { return 1; }
+
+ ${STLT}::const_iterator it=seq.begin();
+ ${STLT}::const_iterator it_last=it;
+ for (++it; it!=seq.end(); it_last=it, ++it) {
+ if ((*it_last).compare(*it)>0) {
+ if ((*it_last).compare(*it)>0) {
+ cout << *it_last << ">" << *it << "\\n";
+ return 0;
+ }
+ }
+ }
+ return 1;
+}
+
+
+${STLT} ${CONTAINER}::evalchildren(int level) const
+{
+ ${STLT} s;
+ RESERVE(s,seq.size());
+
+ if (level==1) {
+ return seq;
+ }
+ if (level == -max_recursion_level) {
+ throw(std::runtime_error("max recursion level reached"));
+ }
+ --level;
+ for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
+ s.push_back((*it).eval(level));
+ }
+ return s;
+}
+
+${STLT} ${CONTAINER}::evalfchildren(int level) const
+{
+ ${STLT} s;
+ RESERVE(s,seq.size());
+
+ if (level==1) {
+ return seq;
+ }
+ if (level == -max_recursion_level) {
+ throw(std::runtime_error("max recursion level reached"));
+ }
+ --level;
+ for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
+ s.push_back((*it).evalf(level));
+ }
+ return s;
+}
+
+${STLT} ${CONTAINER}::normalchildren(int level) const
+{
+ ${STLT} s;
+ RESERVE(s,seq.size());
+
+ if (level==1) {
+ return seq;
+ }
+ if (level == -max_recursion_level) {
+ throw(std::runtime_error("max recursion level reached"));
+ }
+ --level;
+ for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
+ s.push_back((*it).normal(level));
+ }
+ return s;
+}
+
+${STLT} ${CONTAINER}::diffchildren(symbol const & y) const
+{
+ ${STLT} s;
+ RESERVE(s,seq.size());
+ for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
+ s.push_back((*it).diff(y));
+ }
+ return s;
+}
+
+/* obsolete subschildren
+${STLT} ${CONTAINER}::subschildren(lst const & ls, lst const & lr) const
+{
+ ${STLT} s;
+ RESERVE(s,seq.size());
+ for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
+ s.push_back((*it).subs(ls,lr));
+ }
+ return s;
+}
+*/
+
+${STLT} * ${CONTAINER}::subschildren(lst const & ls, lst const & lr) const
+{
+ // returns a NULL pointer if nothing had to be substituted
+ // returns a pointer to a newly created epvector otherwise
+ // (which has to be deleted somewhere else)
+
+ ${STLT}::const_iterator last=seq.end();
+ ${STLT}::const_iterator cit=seq.begin();
+ while (cit!=last) {
+ ex const & subsed_ex=(*cit).subs(ls,lr);
+ if (!are_ex_trivially_equal(*cit,subsed_ex)) {
+
+ // something changed, copy seq, subs and return it
+ ${STLT} *s=new ${STLT};
+ RESERVE(*s,seq.size());
+
+ // copy parts of seq which are known not to have changed
+ ${STLT}::const_iterator cit2=seq.begin();
+ while (cit2!=cit) {
+ s->push_back(*cit2);
+ ++cit2;
+ }
+ // copy first changed element
+ s->push_back(subsed_ex);
+ ++cit2;
+ // copy rest
+ while (cit2!=last) {
+ s->push_back((*cit2).subs(ls,lr));
+ ++cit2;
+ }
+ return s;
+ }
+ ++cit;
+ }
+
+ return 0; // nothing has changed
+}
+
+//////////
+// static member variables
+//////////
+
+// protected
+
+unsigned ${CONTAINER}::precedence=10;
+
+//////////
+// global constants
+//////////
+
+const ${CONTAINER} some_${CONTAINER};
+type_info const & typeid_${CONTAINER}=typeid(some_${CONTAINER});
+
+END_OF_IMPLEMENTATION
+
+print "Creating interface file ${CONTAINER}.h...";
+open OUT,">${CONTAINER}.h" or die "cannot open ${CONTAINER}.h";
+print OUT $interface;
+close OUT;
+print "ok.\n";
+
+print "Creating implementation file ${CONTAINER}.cpp...";
+open OUT,">${CONTAINER}.cpp" or die "cannot open ${CONTAINER}.cpp";
+print OUT $implementation;
+close OUT;
+print "ok.\n";
+
+print "done.\n";
--- /dev/null
+/** @file debugmsg.h
+ *
+ * Utilities needed for debugging only. */
+
+#ifndef _DEBUGMSG_H_
+#define _DEBUGMSG_H_
+
+#ifdef _DEBUG
+#define VERBOSE
+#define DOASSERT (VERBOSE||DEBUG)
+#endif
+
+#define LOGLEVEL_CONSTRUCT 0x0001
+#define LOGLEVEL_DESTRUCT 0x0002
+#define LOGLEVEL_ASSIGNMENT 0x0004
+#define LOGLEVEL_DUPLICATE 0x0008
+#define LOGLEVEL_PRINT 0x0010
+#define LOGLEVEL_OPERATOR 0x0020
+#define LOGLEVEL_MEMBER_FUNCTION 0x4000
+#define LOGLEVEL_NONMEMBER_FUNCTION 0x8000
+#define LOGLEVEL_ALL 0xffff
+
+#define LOGMASK (LOGLEVEL_PRINT)
+// #define LOGMASK (LOGLEVEL_PRINT | LOGLEVEL_ASSIGNMENT | LOGLEVEL_OPERATOR | LOGLEVEL_DUPLICATE | LOGLEVEL_OPERATOR | LOGLEVEL_MEMBER_FUNCTION | LOGLEVEL_NONMEMBER_FUNCTION )
+
+#include <assert.h>
+#include <iostream>
+
+#ifdef VERBOSE
+#define debugmsg(msg, loglevel) if ((loglevel) & ~LOGMASK) clog << (msg) << endl;
+#else
+#define debugmsg(msg, loglevel)
+#endif // def VERBOSE
+
+#ifdef DOASSERT
+#define ASSERT(X) assert(X)
+#else
+#define ASSERT(X) ((void)0)
+#endif
+
+#endif // ndef _DEBUGMSG_H_
+
--- /dev/null
+/** @file diff.cpp
+ *
+ * Implementation of symbolic differentiation in all of GiNaC's classes. */
+
+#include <stdexcept>
+
+#include "ginac.h"
+
+/** Default implementation of ex::diff(). It prints and error message and returns a fail object.
+ * @see ex::diff */
+ex basic::diff(symbol const & s) const
+{
+ throw(std::logic_error("differentiation not supported by this type"));
+}
+
+
+/** Implementation of ex::diff() for a numeric. It always returns 0.
+ *
+ * @see ex::diff */
+ex numeric::diff(symbol const & s) const
+{
+ return exZERO();
+}
+
+
+/** Implementation of ex::diff() for single differentiation of a symbol.
+ * It returns 1 or 0.
+ *
+ * @see ex::diff */
+ex symbol::diff(symbol const & s) const
+{
+ if (compare_same_type(s)) {
+ return exZERO();
+ } else {
+ return exONE();
+ }
+}
+
+/** Implementation of ex::diff() for a constant. It always returns 0.
+ *
+ * @see ex::diff */
+ex constant::diff(symbol const & s) const
+{
+ return exZERO();
+}
+
+/** Implementation of ex::diff() for multiple differentiation of a symbol.
+ * It returns the symbol, 1 or 0.
+ *
+ * @param nth order of differentiation
+ * @see ex::diff */
+ex symbol::diff(symbol const & s, unsigned nth) const
+{
+ if (compare_same_type(s)) {
+ switch (nth) {
+ case 0:
+ return s;
+ break;
+ case 1:
+ return exONE();
+ break;
+ default:
+ return exZERO();
+ }
+ } else {
+ return exONE();
+ }
+}
+
+
+/** Implementation of ex::diff() for an indexed object. It always returns 0.
+ * @see ex::diff */
+ex indexed::diff(symbol const & s) const
+{
+ return exZERO();
+}
+
+
+/** Implementation of ex::diff() for an expairseq. It differentiates all elements of the sequence.
+ * @see ex::diff */
+ex expairseq::diff(symbol const & s) const
+{
+ return thisexpairseq(diffchildren(s),overall_coeff);
+}
+
+
+/** Implementation of ex::diff() for a sum. It differentiates each term.
+ * @see ex::diff */
+ex add::diff(symbol const & s) const
+{
+ // D(a+b+c)=D(a)+D(b)+D(c)
+ return (new add(diffchildren(s)))->setflag(status_flags::dynallocated);
+}
+
+
+/** Implementation of ex::diff() for a product. It applies the product rule.
+ * @see ex::diff */
+ex mul::diff(symbol const & s) const
+{
+ exvector new_seq;
+ new_seq.reserve(seq.size());
+
+ // D(a*b*c)=D(a)*b*c+a*D(b)*c+a*b*D(c)
+ for (unsigned i=0; i!=seq.size(); i++) {
+ epvector sub_seq=seq;
+ sub_seq[i] = split_ex_to_pair(sub_seq[i].coeff*
+ power(sub_seq[i].rest,sub_seq[i].coeff-1)*
+ sub_seq[i].rest.diff(s));
+ new_seq.push_back((new mul(sub_seq,overall_coeff))->setflag(status_flags::dynallocated));
+ }
+ return (new add(new_seq))->setflag(status_flags::dynallocated);
+}
+
+
+/** Implementation of ex::diff() for a non-commutative product. It always returns 0.
+ * @see ex::diff */
+ex ncmul::diff(symbol const & s) const
+{
+ return exZERO();
+}
+
+
+/** Implementation of ex::diff() for a power.
+ * @see ex::diff */
+ex power::diff(symbol const & s) const
+{
+ if (exponent.info(info_flags::real)) {
+ // D(b^r) = r * b^(r-1) * D(b) (faster than the formula below)
+ return mul(mul(exponent, power(basis, exponent - exONE())), basis.diff(s));
+ } else {
+ // D(b^e) = b^e * (D(e)*ln(b) + e*D(b)/b)
+ return mul(power(basis, exponent),
+ add(mul(exponent.diff(s), log(basis)),
+ mul(mul(exponent, basis.diff(s)), power(basis, -1))));
+ }
+}
+
+
+/** Implementation of ex::diff() for functions. It applies the chain rule,
+ * except for the Order term function.
+ * @see ex::diff */
+ex function::diff(symbol const & s) const
+{
+ exvector new_seq;
+
+ if (serial == function_index_Order) {
+
+ // Order Term function only differentiates the argument
+ return Order(seq[0].diff(s));
+
+ } else {
+
+ // Chain rule
+ for (unsigned i=0; i!=seq.size(); i++) {
+ new_seq.push_back(mul(pdiff(i), seq[i].diff(s)));
+ }
+ }
+ return add(new_seq);
+}
+
+
+/** Implementation of ex::diff() for a power-series. It treats the series as a polynomial.
+ * @see ex::diff */
+ex series::diff(symbol const & s) const
+{
+ if (s == var) {
+ epvector new_seq;
+ epvector::const_iterator it = seq.begin(), itend = seq.end();
+
+ //!! coeff might depend on var
+ while (it != itend) {
+ if (is_order_function(it->rest)) {
+ new_seq.push_back(expair(it->rest, it->coeff - 1));
+ } else {
+ ex c = it->rest * it->coeff;
+ if (!c.is_zero())
+ new_seq.push_back(expair(c, it->coeff - 1));
+ }
+ it++;
+ }
+ return series(var, point, new_seq);
+ } else {
+ return *this;
+ }
+}
+
+
+/** Compute partial derivative of an expression.
+ *
+ * @param s symbol by which the expression is derived
+ * @param nth order of derivative (default 1)
+ * @return partial derivative as a new expression */
+
+ex ex::diff(symbol const & s, unsigned nth) const
+{
+ ASSERT(bp!=0);
+
+ if ( nth==0 ) {
+ return *this;
+ }
+
+ ex ndiff = bp->diff(s);
+ while ( nth>1 ) {
+ ndiff = ndiff.diff(s);
+ --nth;
+ }
+ return ndiff;
+}
--- /dev/null
+/** @file ex.cpp
+ *
+ * Implementation of GiNaC's light-weight expression handles. */
+
+#include <iostream>
+
+#include "ginac.h"
+
+//////////
+// default constructor, destructor, copy constructor assignment operator and helpers
+//////////
+
+// public
+
+#ifndef INLINE_EX_CONSTRUCTORS
+
+ex::ex() : bp(exZERO().bp)
+{
+ debugmsg("ex default constructor",LOGLEVEL_CONSTRUCT);
+ ASSERT(exZERO().bp!=0);
+ ASSERT(exZERO().bp->flags & status_flags::dynallocated);
+ ASSERT(bp!=0);
+ ++bp->refcount;
+}
+
+ex::~ex()
+{
+ debugmsg("ex destructor",LOGLEVEL_DESTRUCT);
+ ASSERT(bp!=0);
+ ASSERT(bp->flags & status_flags::dynallocated);
+ if (--bp->refcount == 0) {
+ delete bp;
+ }
+}
+
+ex::ex(ex const & other) : bp(other.bp)
+{
+ debugmsg("ex copy constructor",LOGLEVEL_CONSTRUCT);
+ ASSERT(bp!=0);
+ ASSERT((bp->flags) & status_flags::dynallocated);
+ ++bp->refcount;
+}
+
+ex const & ex::operator=(ex const & other)
+{
+ debugmsg("ex operator=",LOGLEVEL_ASSIGNMENT);
+ ASSERT(bp!=0);
+ ASSERT(bp->flags & status_flags::dynallocated);
+ ASSERT(other.bp!=0);
+ ASSERT(other.bp->flags & status_flags::dynallocated);
+ ++other.bp->refcount;
+ basic * tmpbp=other.bp;
+ if (--bp->refcount==0) {
+ delete bp;
+ }
+ bp=tmpbp;
+ return *this;
+}
+
+#endif // ndef INLINE_EX_CONSTRUCTORS
+
+//////////
+// other constructors
+//////////
+
+// public
+
+#ifndef INLINE_EX_CONSTRUCTORS
+ex::ex(basic const & other)
+{
+ debugmsg("ex constructor from basic",LOGLEVEL_CONSTRUCT);
+ construct_from_basic(other);
+}
+#endif
+
+ex::ex(int const i)
+{
+ debugmsg("ex constructor from int",LOGLEVEL_CONSTRUCT);
+ construct_from_basic(numeric(i));
+}
+
+ex::ex(unsigned int const i)
+{
+ debugmsg("ex constructor from unsigned int",LOGLEVEL_CONSTRUCT);
+ construct_from_basic(numeric(i));
+}
+
+ex::ex(long const i)
+{
+ debugmsg("ex constructor from long",LOGLEVEL_CONSTRUCT);
+ construct_from_basic(numeric(i));
+}
+
+ex::ex(unsigned long const i)
+{
+ debugmsg("ex constructor from unsigned long",LOGLEVEL_CONSTRUCT);
+ construct_from_basic(numeric(i));
+}
+
+ex::ex(double const d)
+{
+ debugmsg("ex constructor from double",LOGLEVEL_CONSTRUCT);
+ construct_from_basic(numeric(d));
+}
+
+//////////
+// functions overriding virtual functions from bases classes
+//////////
+
+// none
+
+//////////
+// new virtual functions which can be overridden by derived classes
+//////////
+
+// none
+
+//////////
+// non-virtual functions in this class
+//////////
+
+// public
+
+void ex::swap(ex & other)
+{
+ debugmsg("ex swap",LOGLEVEL_MEMBER_FUNCTION);
+
+ ASSERT(bp!=0);
+ ASSERT(bp->flags & status_flags::dynallocated);
+ ASSERT(other.bp!=0);
+ ASSERT(other.bp->flags & status_flags::dynallocated);
+
+ basic * tmpbp=bp;
+ bp=other.bp;
+ other.bp=tmpbp;
+}
+
+bool ex::info(unsigned inf) const
+{
+ if (inf == info_flags::normal_form) {
+
+ // Polynomials are in normal form
+ if (info(info_flags::polynomial))
+ return true;
+
+ // polynomial^(-int) is in normal form
+ if (is_ex_exactly_of_type(*this, power))
+ return op(1).info(info_flags::negint);
+
+ // polynomial^(int) * polynomial^(int) * ... is in normal form
+ if (!is_ex_exactly_of_type(*this, mul))
+ return false;
+ for (int i=0; i<nops(); i++) {
+ if (is_ex_exactly_of_type(op(i), power)) {
+ if (!op(i).op(1).info(info_flags::integer))
+ return false;
+ if (!op(i).op(0).info(info_flags::polynomial))
+ return false;
+ } else
+ if (!op(i).info(info_flags::polynomial))
+ return false;
+ }
+ return true;
+ } else {
+ return bp->info(inf);
+ }
+}
+
+int ex::nops() const
+{
+ ASSERT(bp!=0);
+ return bp->nops();
+}
+
+ex ex::expand(unsigned options) const
+{
+ ASSERT(bp!=0);
+ return bp->expand(options);
+}
+
+bool ex::has(ex const & other) const
+{
+ ASSERT(bp!=0);
+ return bp->has(other);
+}
+
+int ex::degree(symbol const & s) const
+{
+ ASSERT(bp!=0);
+ return bp->degree(s);
+}
+
+int ex::ldegree(symbol const & s) const
+{
+ ASSERT(bp!=0);
+ return bp->ldegree(s);
+}
+
+ex ex::coeff(symbol const & s, int const n) const
+{
+ ASSERT(bp!=0);
+ return bp->coeff(s,n);
+}
+
+ex ex::numer(bool normalize) const
+{
+ ex n;
+ if (normalize && !info(info_flags::normal_form))
+ n = normal();
+ else
+ n = *this;
+
+ // polynomial
+ if (n.info(info_flags::polynomial))
+ return n;
+
+ // something^(-int)
+ if (is_ex_exactly_of_type(n, power) && n.op(1).info(info_flags::negint))
+ return exONE();
+
+ // something^(int) * something^(int) * ...
+ if (!is_ex_exactly_of_type(n, mul))
+ return n;
+ ex res = exONE();
+ for (int i=0; i<n.nops(); i++) {
+ if (!is_ex_exactly_of_type(n.op(i), power) || !n.op(i).op(1).info(info_flags::negint))
+ res *= n.op(i);
+ }
+ return res;
+}
+
+ex ex::denom(bool normalize) const
+{
+ ex n;
+ if (normalize && !info(info_flags::normal_form))
+ n = normal();
+ else
+ n = *this;
+
+ // polynomial
+ if (n.info(info_flags::polynomial))
+ return exONE();
+
+ // something^(-int)
+ if (is_ex_exactly_of_type(n, power) && n.op(1).info(info_flags::negint))
+ return power(n.op(0), -(n.op(1)));
+
+ // something^(int) * something^(int) * ...
+ if (!is_ex_exactly_of_type(n, mul))
+ return exONE();
+ ex res = exONE();
+ for (int i=0; i<n.nops(); i++) {
+ if (is_ex_exactly_of_type(n.op(i), power) && n.op(i).op(1).info(info_flags::negint))
+ res *= power(n.op(i), -1);
+ }
+ return res;
+}
+
+ex ex::collect(symbol const & s) const
+{
+ ASSERT(bp!=0);
+ return bp->collect(s);
+}
+
+ex ex::eval(int level) const
+{
+ ASSERT(bp!=0);
+ return bp->eval(level);
+}
+
+ex ex::evalf(int level) const
+{
+ ASSERT(bp!=0);
+ return bp->evalf(level);
+}
+
+ex ex::subs(lst const & ls, lst const & lr) const
+{
+ ASSERT(bp!=0);
+ return bp->subs(ls,lr);
+}
+
+ex ex::subs(ex const & e) const
+{
+ ASSERT(bp!=0);
+ return bp->subs(e);
+}
+
+exvector ex::get_indices(void) const
+{
+ ASSERT(bp!=0);
+ return bp->get_indices();
+}
+
+ex ex::simplify_ncmul(exvector const & v) const
+{
+ ASSERT(bp!=0);
+ return bp->simplify_ncmul(v);
+}
+
+ex ex::operator[](ex const & index) const
+{
+ debugmsg("ex operator[ex]",LOGLEVEL_OPERATOR);
+ ASSERT(bp!=0);
+ return (*bp)[index];
+}
+
+ex ex::operator[](int const i) const
+{
+ debugmsg("ex operator[int]",LOGLEVEL_OPERATOR);
+ ASSERT(bp!=0);
+ return (*bp)[i];
+}
+
+ex ex::op(int const i) const
+{
+ debugmsg("ex op()",LOGLEVEL_MEMBER_FUNCTION);
+ ASSERT(bp!=0);
+ return bp->op(i);
+}
+
+ex & ex::let_op(int const i)
+{
+ debugmsg("ex let_op()",LOGLEVEL_MEMBER_FUNCTION);
+ makewriteable();
+ ASSERT(bp!=0);
+ return bp->let_op(i);
+}
+
+#ifndef INLINE_EX_CONSTRUCTORS
+int ex::compare(ex const & other) const
+{
+ ASSERT(bp!=0);
+ ASSERT(other.bp!=0);
+ if (bp==other.bp) {
+ // special case: both expression point to same basic, trivially equal
+ return 0;
+ }
+ return bp->compare(*other.bp);
+}
+#endif // ndef INLINE_EX_CONSTRUCTORS
+
+#ifndef INLINE_EX_CONSTRUCTORS
+bool ex::is_equal(ex const & other) const
+{
+ ASSERT(bp!=0);
+ ASSERT(other.bp!=0);
+ if (bp==other.bp) {
+ // special case: both expression point to same basic, trivially equal
+ return true;
+ }
+ return bp->is_equal(*other.bp);
+}
+#endif // ndef INLINE_EX_CONSTRUCTORS
+
+unsigned ex::return_type(void) const
+{
+ ASSERT(bp!=0);
+ return bp->return_type();
+}
+
+unsigned ex::return_type_tinfo(void) const
+{
+ ASSERT(bp!=0);
+ return bp->return_type_tinfo();
+}
+
+unsigned ex::gethash(void) const
+{
+ ASSERT(bp!=0);
+ return bp->gethash();
+}
+
+ex ex::exadd(ex const & rh) const
+{
+ return (new add(*this,rh))->setflag(status_flags::dynallocated);
+}
+
+ex ex::exmul(ex const & rh) const
+{
+ return (new mul(*this,rh))->setflag(status_flags::dynallocated);
+}
+
+ex ex::exncmul(ex const & rh) const
+{
+ return (new ncmul(*this,rh))->setflag(status_flags::dynallocated);
+}
+
+// private
+
+void ex::makewriteable()
+{
+ debugmsg("ex makewriteable",LOGLEVEL_MEMBER_FUNCTION);
+ ASSERT(bp!=0);
+ ASSERT(bp->flags & status_flags::dynallocated);
+ if (bp->refcount > 1) {
+ basic * bp2=bp->duplicate();
+ ++bp2->refcount;
+ bp2->setflag(status_flags::dynallocated);
+ --bp->refcount;
+ bp=bp2;
+ }
+ ASSERT(bp->refcount == 1);
+}
+
+void ex::construct_from_basic(basic const & other)
+{
+ if ( (other.flags & status_flags::evaluated)==0 ) {
+ // cf. copy constructor
+ ex const & tmpex = other.eval(1); // evaluate only one (top) level
+ bp = tmpex.bp;
+ ASSERT(bp!=0);
+ ASSERT(bp->flags & status_flags::dynallocated);
+ ++bp->refcount;
+ if ((other.flags & status_flags::dynallocated)&&(other.refcount==0)) {
+ delete &const_cast<basic &>(other);
+ }
+ } else {
+ if (other.flags & status_flags::dynallocated) {
+ bp=&const_cast<basic &>(other);
+ } else {
+ bp=other.duplicate();
+ bp->setflag(status_flags::dynallocated);
+ }
+ ASSERT(bp!=0);
+ // bp->clearflag(status_flags::evaluated);
+ ++bp->refcount;
+ }
+ ASSERT(bp!=0);
+ ASSERT(bp->flags & status_flags::dynallocated);
+}
+
+//////////
+// static member variables
+//////////
+
+// none
+
+//////////
+// functions which are not member functions
+//////////
+
+// none
+
+//////////
+// global functions
+//////////
+
+ex const & exZERO(void)
+{
+ static ex * eZERO=new ex(numZERO());
+ return *eZERO;
+}
+
+ex const & exONE(void)
+{
+ static ex * eONE=new ex(numONE());
+ return *eONE;
+}
+
+ex const & exTWO(void)
+{
+ static ex * eTWO=new ex(numTWO());
+ return *eTWO;
+}
+
+ex const & exTHREE(void)
+{
+ static ex * eTHREE=new ex(numTHREE());
+ return *eTHREE;
+}
+
+ex const & exMINUSONE(void)
+{
+ static ex * eMINUSONE=new ex(numMINUSONE());
+ return *eMINUSONE;
+}
+
+ex const & exHALF(void)
+{
+ static ex * eHALF=new ex(ex(1)/ex(2));
+ return *eHALF;
+}
+
+ex const & exMINUSHALF(void)
+{
+ static ex * eMINUSHALF=new ex(numeric(-1,2));
+ return *eMINUSHALF;
+}
+
--- /dev/null
+/** @file ex.h
+ *
+ * Interface to GiNaC's light-weight expression handles. */
+
+#ifndef _EX_H_
+#define _EX_H_
+
+#include <iostream>
+
+class ex;
+class expand_options;
+class status_flags;
+
+#include "basic.h"
+#include "debugmsg.h"
+#include "flags.h"
+
+class symbol;
+class lst;
+
+typedef vector<ex> exvector;
+
+// enum definitions
+
+ex const & exZERO(void);
+ex const & exONE(void);
+ex const & exTWO(void);
+ex const & exTHREE(void);
+ex const & exMINUSONE(void);
+ex const & exHALF(void);
+ex const & exMINUSHALF(void);
+
+#define INLINE_EX_CONSTRUCTORS
+
+/** Lightweight interface to GiNaC's symbolic objects. Basically all it does is
+ * to hold a pointer to the other objects, manage the reference counting and
+ * provide methods for manipulation of these objects. */
+class ex
+{
+ friend class basic;
+
+// member functions
+
+ // default constructor, destructor, copy constructor assignment operator and helpers
+public:
+ ex()
+#ifdef INLINE_EX_CONSTRUCTORS
+ : bp(exZERO().bp)
+ {
+ debugmsg("ex default constructor",LOGLEVEL_CONSTRUCT);
+ ASSERT(exZERO().bp!=0);
+ ASSERT(exZERO().bp->flags & status_flags::dynallocated);
+ ASSERT(bp!=0);
+ ++bp->refcount;
+ }
+#else
+;
+#endif // def INLINE_EX_CONSTRUCTORS
+
+ ~ex()
+#ifdef INLINE_EX_CONSTRUCTORS
+ {
+ debugmsg("ex destructor",LOGLEVEL_DESTRUCT);
+ ASSERT(bp!=0);
+ ASSERT(bp->flags & status_flags::dynallocated);
+ if (--bp->refcount == 0) {
+ delete bp;
+ }
+ }
+#else
+;
+#endif // def INLINE_EX_CONSTRUCTORS
+
+ ex(ex const & other)
+#ifdef INLINE_EX_CONSTRUCTORS
+ : bp(other.bp)
+ {
+ debugmsg("ex copy constructor",LOGLEVEL_CONSTRUCT);
+ ASSERT(bp!=0);
+ ASSERT((bp->flags) & status_flags::dynallocated);
+ ++bp->refcount;
+ }
+#else
+;
+#endif // def INLINE_EX_CONSTRUCTORS
+
+ ex const & operator=(ex const & other)
+#ifdef INLINE_EX_CONSTRUCTORS
+ {
+ debugmsg("ex operator=",LOGLEVEL_ASSIGNMENT);
+ ASSERT(bp!=0);
+ ASSERT(bp->flags & status_flags::dynallocated);
+ ASSERT(other.bp!=0);
+ ASSERT(other.bp->flags & status_flags::dynallocated);
+ ++other.bp->refcount;
+ basic * tmpbp=other.bp;
+ if (--bp->refcount==0) {
+ delete bp;
+ }
+ bp=tmpbp;
+ return *this;
+ }
+#else
+;
+#endif // def INLINE_EX_CONSTRUCTORS
+
+ // other constructors
+public:
+ ex(basic const & other)
+#ifdef INLINE_EX_CONSTRUCTORS
+ {
+ debugmsg("ex constructor from basic",LOGLEVEL_CONSTRUCT);
+ construct_from_basic(other);