From 46f08989fb0103fe00dd63468dc9dc46dfc9c5f3 Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Fri, 15 Dec 2000 20:45:59 +0000 Subject: [PATCH] - Updated dependencies in INSTALL. - Last fixes to NEWS. - New config.guess and config.sub from FSF. - Rewritten ginac.m4 to make it idiot-proof. --- INSTALL | 6 +- NEWS | 7 +- config.guess | 134 +++++++++++++++++++-------- config.sub | 52 +++++++---- ginac.m4 | 253 +++++++++++++++++++++++++-------------------------- 5 files changed, 257 insertions(+), 195 deletions(-) diff --git a/INSTALL b/INSTALL index 8194eccc..a4999320 100644 --- a/INSTALL +++ b/INSTALL @@ -109,7 +109,5 @@ to compile, install and work properly: Cint version | how it works --------------+---------------------------------------------------------- < 5.14.39 | `VERBOTEN' by license (please bite your favorite lawyer) - < 5.14.41 | compiles but does not feel happy at all (inconsistent!) - 5.14.41 | tested on egcs 1.1.1, gcc 2.95.2: some weirdnesses - 5.14.44 | does not compile: G__cpp_ginaccint.C needs manual fixes - 5.14.45-62 | compiles fine, works well + < 5.14.60 | since GiNaC version 0.7, these do not compile any more + 5.14.62-65 | compiles fine, works well diff --git a/NEWS b/NEWS index c6fa4826..62391834 100644 --- a/NEWS +++ b/NEWS @@ -1,14 +1,15 @@ This file records noteworthy changes. -0.7.0 () +0.7.0 (15 December 2000) * Requires CLN 1.1 now. Class numeric doesn't use an indirect pointer to the actual representation any more. This is a speedup. * mul::expand() was reengineered to not allocate temporary excess memory. * Non-integer powers of a symbol are treated as constants by (l)degree() and - coeff(). Using these functions on an expression containing such powers used - to fail with an internal error message. The side-effect is that collect() + coeff(). Using these functions on an expression containing such powers used + to fail with an internal error message. The side-effect is that collect() can be used on expressions which are not polynomials. * Added a man page for the ginac-config script. +* Ctor of numeric from char* honors Digits. 0.6.4 (10 August 2000) * Complete revamp of methods in class matrix. Some redundant (and poor) diff --git a/config.guess b/config.guess index 42cd3fec..69b1ab94 100755 --- a/config.guess +++ b/config.guess @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 # Free Software Foundation, Inc. -version='2000-11-08' +timestamp='2000-12-07' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ version='2000-11-08' # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you -# don't specify an explicit system type (host/target name). +# don't specify an explicit build system type. # # Only a few systems have been added to this list; please add others # (but try to keep the structure clean). @@ -43,19 +43,34 @@ me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] -Output the configuration name of this system. +Output the configuration name of the system \`$me' is run on. Operation modes: - -h, --help print this help, then exit - -V, --version print version number, then exit" + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do - case "$1" in - --version | --vers* | -V ) + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; @@ -64,9 +79,7 @@ while test $# -gt 0 ; do - ) # Use stdin as input. break ;; -* ) - exec >&2 - echo "$me: invalid option $1" - echo "$help" + echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; @@ -78,19 +91,30 @@ if test $# != 0; then exit 1 fi -# Use $HOST_CC if defined. $CC may point to a cross-compiler -if test x"$CC_FOR_BUILD" = x; then - if test x"$HOST_CC" != x; then - CC_FOR_BUILD="$HOST_CC" - else - if test x"$CC" != x; then - CC_FOR_BUILD="$CC" - else - CC_FOR_BUILD=cc - fi - fi -fi +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break + fi + done + rm -f $dummy.c $dummy.o + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 8/24/94.) @@ -100,12 +124,9 @@ fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -129,16 +150,24 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ibmrt|romp-ibm) machine=romp-ibm ;; *) machine=${UNAME_MACHINE}-unknown ;; esac - # The Operating System including object format. - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac # The OS release release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: @@ -495,10 +524,28 @@ EOF echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE @@ -533,9 +580,10 @@ EOF } EOF (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy + fi ;; esac - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) @@ -628,9 +676,12 @@ EOF CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; - CRAY*T3E:*:*:*) + CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; @@ -1124,6 +1175,11 @@ EOF fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; + i?86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1303,7 +1359,7 @@ exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "version='" +# time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: diff --git a/config.sub b/config.sub index ac1c2b51..d6c68210 100755 --- a/config.sub +++ b/config.sub @@ -1,9 +1,9 @@ #! /bin/sh -# Configuration validation subroutine script, version 1.1. +# Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 # Free Software Foundation, Inc. -version='2000-11-04' +timestamp='2000-12-07' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -60,16 +60,30 @@ Usage: $0 [OPTION] CPU-MFR-OPSYS Canonicalize a configuration name. Operation modes: - -h, --help print this help, then exit - -V, --version print version number, then exit" + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do - case "$1" in - --version | --vers* | -V ) + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; @@ -78,9 +92,7 @@ while test $# -gt 0 ; do - ) # Use stdin as input. break ;; -* ) - exec >&2 - echo "$me: invalid option $1" - echo "$help" + echo "$me: invalid option $1$help" exit 1 ;; *local*) @@ -203,10 +215,11 @@ esac case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | armv[2345] | armv[345][lb] | pyramid | mn10200 | mn10300 | tron | a29k \ + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ + | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ + | pyramid | mn10200 | mn10300 | tron | a29k \ | 580 | i960 | h8300 \ - | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ | hppa64 \ | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ @@ -243,11 +256,12 @@ case $basic_machine in # Recognize the basic CPU types with company name. # FIXME: clean up the formatting here. vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ + | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ | xmp-* | ymp-* \ - | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ | hppa2.0n-* | hppa64-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ @@ -259,7 +273,7 @@ case $basic_machine in | mips64el-* | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ | mipstx39-* | mipstx39el-* | mcore-* \ - | f301-* | armv*-* | s390-* | sv1-* | t3e-* \ + | f301-* | s390-* | sv1-* | t3e-* \ | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \ | bs2000-* | tic54x-* | c54x-* | x86_64-*) @@ -686,7 +700,7 @@ case $basic_machine in basic_machine=i686-pc ;; pentiumii | pentium2) - basic_machine=i786-pc + basic_machine=i686-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` @@ -695,12 +709,12 @@ case $basic_machine in basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; - power) basic_machine=rs6000-ibm + power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; @@ -1326,7 +1340,7 @@ exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "version='" +# time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: diff --git a/ginac.m4 b/ginac.m4 index ebe30299..78eb8960 100644 --- a/ginac.m4 +++ b/ginac.m4 @@ -1,5 +1,6 @@ # Configure paths for GiNaC -# Christian Bauer 12/1/99 +# Richard Kreckel 12/12/2000 +# borrowed from Christian Bauer # stolen from Sam Lantinga # stolen from Manish Singh # stolen back from Frank Belew @@ -18,149 +19,141 @@ AC_ARG_WITH(ginac-prefix,[ --with-ginac-prefix=PFX Prefix where GiNaC is instal AC_ARG_WITH(ginac-exec-prefix,[ --with-ginac-exec-prefix=PFX Exec prefix where GiNaC is installed (optional)], ginac_exec_prefix="$withval", ginac_exec_prefix="") AC_ARG_ENABLE(ginactest, [ --disable-ginactest Do not try to compile and run a test GiNaC program], - , enable_ginactest=yes) + , enable_ginactest=yes) - if test x$ginac_exec_prefix != x ; then - ginac_args="$ginac_args --exec-prefix=$ginac_exec_prefix" - if test x${GINACLIB_CONFIG+set} != xset ; then +if test x$ginac_exec_prefix != x ; then + ginac_args="$ginac_args --exec-prefix=$ginac_exec_prefix" + if test x${GINACLIB_CONFIG+set} != xset ; then GINACLIB_CONFIG=$ginac_exec_prefix/bin/ginac-config - fi - fi - if test x$ginac_prefix != x ; then - ginac_args="$ginac_args --prefix=$ginac_prefix" - if test x${GINACLIB_CONFIG+set} != xset ; then + fi +fi +if test x$ginac_prefix != x ; then + ginac_args="$ginac_args --prefix=$ginac_prefix" + if test x${GINACLIB_CONFIG+set} != xset ; then GINACLIB_CONFIG=$ginac_prefix/bin/ginac-config - fi - fi + fi +fi - AC_PATH_PROG(GINACLIB_CONFIG, ginac-config, no) - min_ginac_version=ifelse([$1], ,0.4.0,$1) - AC_MSG_CHECKING(for GiNaC - version >= $min_ginac_version) - no_ginac="" - if test "$GINACLIB_CONFIG" = "no" ; then - no_ginac=yes - else - GINACLIB_CPPFLAGS=`$GINACLIB_CONFIG $ginacconf_args --cppflags` - GINACLIB_LIBS=`$GINACLIB_CONFIG $ginacconf_args --libs` - - ginac_major_version=`$GINACLIB_CONFIG $ginac_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - ginac_minor_version=`$GINACLIB_CONFIG $ginac_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - ginac_micro_version=`$GINACLIB_CONFIG $ginac_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_ginactest" = "xyes" ; then - ac_save_CPPFLAGS="$CPPFLAGS" - ac_save_LIBS="$LIBS" - CPPFLAGS="$CPPFLAGS $GINACLIB_CPPFLAGS" - LIBS="$LIBS $GINACLIB_LIBS" -dnl -dnl Now check if the installed GiNaC is sufficiently new. (Also sanity -dnl checks the results of ginac-config to some extent -dnl - rm -f conf.ginactest - AC_TRY_RUN([ +AC_PATH_PROG(GINACLIB_CONFIG, ginac-config, no) +ginac_min_version=ifelse([$1], ,0.7.0,$1) +AC_MSG_CHECKING(for GiNaC - version >= $ginac_min_version) +if test "$GINACLIB_CONFIG" = "no" ; then + AC_MSG_RESULT(no) + echo "*** The ginac-config script installed by GiNaC could not be found" + echo "*** If GiNaC was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GINACLIB_CONFIG environment variable to the" + echo "*** full path to ginac-config." + ifelse([$3], , :, [$3]) +else +dnl Parse required version and the result of ginac-config. + ginac_min_major_version=`echo $ginac_min_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + ginac_min_minor_version=`echo $ginac_min_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + ginac_min_micro_version=`echo $ginac_min_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + GINACLIB_CPPFLAGS=`$GINACLIB_CONFIG $ginac_args --cppflags` + GINACLIB_LIBS=`$GINACLIB_CONFIG $ginac_args --libs` + ginac_config_major_version=`$GINACLIB_CONFIG $ginac_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + ginac_config_minor_version=`$GINACLIB_CONFIG $ginac_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + ginac_config_micro_version=`$GINACLIB_CONFIG $ginac_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` +dnl Check if the installed GiNaC is sufficiently new according to ginac-config. + if test \( $ginac_config_major_version -lt $ginac_min_major_version \) -o \ + \( $ginac_config_major_version -eq $ginac_min_major_version -a $ginac_config_minor_version -lt $ginac_min_minor_version \) -o \ + \( $ginac_config_major_version -eq $ginac_min_major_version -a $ginac_config_minor_version -eq $ginac_min_minor_version -a $ginac_config_micro_version -lt $ginac_min_micro_version \); then + echo -e "\n*** 'ginac-config --version' returned $ginac_config_major_version.$ginac_config_minor_version.$ginac_config_micro_version, but the minimum version" + echo "*** of GiNaC required is $ginac_min_major_version.$ginac_min_minor_version.$ginac_min_micro_version. If ginac-config is correct, then it is" + echo "*** best to upgrade to the required version." + echo "*** If ginac-config was wrong, set the environment variable GINACLIB_CONFIG" + echo "*** to point to the correct copy of ginac-config, and remove the file" + echo "*** config.cache before re-running configure." + ifelse([$3], , :, [$3]) + else +dnl The versions match so far. Now do a sanity check: Does the result of ginac-config +dnl match the version of the headers and the version built into the library, too? + no_ginac="" + if test "x$enable_ginactest" = "xyes" ; then + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LIBS="$LIBS" + CPPFLAGS="$CPPFLAGS $GINACLIB_CPPFLAGS" + LIBS="$LIBS $GINACLIB_LIBS" + rm -f conf.ginactest + AC_TRY_RUN([ #include -#include #include -#include +#include -char* -my_strdup (char *str) -{ - char *new_str; - - if (str) - { - new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); - strcpy (new_str, str); - } - else - new_str = NULL; - - return new_str; -} +/* we do not #include because autoconf in C++ mode inserts a + prototype for exit() that conflicts with the one in stdlib.h */ +extern "C" int system(const char *); -int main () +int main(void) { - int major, minor, micro; - char *tmp_version; + int major, minor, micro; + char *tmp_version; - system ("touch conf.ginactest"); + system("touch conf.ginactest"); - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = my_strdup("$min_ginac_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_ginac_version"); - exit(1); - } - - if (($ginac_major_version > major) || - (($ginac_major_version == major) && ($ginac_minor_version > minor)) || - (($ginac_major_version == major) && ($ginac_minor_version == minor) && ($ginac_micro_version >= micro))) - { - return 0; + if ((GINACLIB_MAJOR_VERSION != $ginac_config_major_version) || + (GINACLIB_MINOR_VERSION != $ginac_config_minor_version) || + (GINACLIB_MICRO_VERSION != $ginac_config_micro_version)) { + printf("\n*** 'ginac-config --version' returned %d.%d.%d, but the header file I found\n", $ginac_config_major_version, $ginac_config_minor_version, $ginac_config_micro_version); + printf("*** corresponds to %d.%d.%d. This mismatch suggests your installation of GiNaC\n", GINACLIB_MAJOR_VERSION, GINACLIB_MINOR_VERSION, GINACLIB_MICRO_VERSION); + printf("*** is corrupted or you have specified some wrong -I compiler flags.\n"); + printf("*** Please inquire and consider reinstalling GiNaC.\n"); + return 1; } - else - { - printf("\n*** 'ginac-config --version' returned %d.%d.%d, but the minimum version\n", $ginac_major_version, $ginac_minor_version, $ginac_micro_version); - printf("*** of GiNaC required is %d.%d.%d. If ginac-config is correct, then it is\n", major, minor, micro); - printf("*** best to upgrade to the required version.\n"); - printf("*** If ginac-config was wrong, set the environment variable GINACLIB_CONFIG\n"); - printf("*** to point to the correct copy of ginac-config, and remove the file\n"); - printf("*** config.cache before re-running configure\n"); - return 1; + if ((GiNaC::version_major != $ginac_config_major_version) || + (GiNaC::version_minor != $ginac_config_minor_version) || + (GiNaC::version_micro != $ginac_config_micro_version)) { + printf("\n*** 'ginac-config --version' returned %d.%d.%d, but the library I found\n", $ginac_config_major_version, $ginac_config_minor_version, $ginac_config_micro_version); + printf("*** corresponds to %d.%d.%d. This mismatch suggests your installation of GiNaC\n", GiNaC::version_major, GiNaC::version_minor, GiNaC::version_micro); + printf("*** is corrupted or you have specified some wrong -L compiler flags.\n"); + printf("*** Please inquire and consider reinstalling GiNaC.\n"); + return 1; } + return 0; } - ],, no_ginac=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CPPFLAGS="$ac_save_CPPFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_ginac" = x ; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$GINACLIB_CONFIG" = "no" ; then - echo "*** The ginac-config script installed by GiNaC could not be found" - echo "*** If GiNaC was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the GINACLIB_CONFIG environment variable to the" - echo "*** full path to ginac-config." - else - if test -f conf.ginactest ; then - : - else - echo "*** Could not run GiNaC test program, checking why..." - CPPFLAGS="$CFLAGS $GINACLIB_CPPFLAGS" - LIBS="$LIBS $GINACLIB_LIBS" - AC_TRY_LINK([ + CPPFLAGS="$ac_save_CPPFLAGS" + LIBS="$ac_save_LIBS" + fi + if test "x$no_ginac" = x ; then + AC_MSG_RESULT([yes, `$GINACLIB_CONFIG $ginac_args --version`]) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test ! -f conf.ginactest ; then + echo "*** Could not run GiNaC test program, checking why..." + CPPFLAGS="$CFLAGS $GINACLIB_CPPFLAGS" + LIBS="$LIBS $GINACLIB_LIBS" + AC_TRY_LINK([ #include -#include -], [ return 0; ], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding GiNaC or finding the wrong" - echo "*** version of GiNaC. If it is not finding GiNaC, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GiNaC was incorrectly installed" - echo "*** or that you have moved GiNaC since it was installed. In the latter case, you" - echo "*** may want to edit the ginac-config script: $GINACLIB_CONFIG" ]) - CPPFLAGS="$ac_save_CPPFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - GINACLIB_CPPFLAGS="" - GINACLIB_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(GINACLIB_CPPFLAGS) - AC_SUBST(GINACLIB_LIBS) - rm -f conf.ginactest +#include +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GiNaC or finding the wrong" + echo "*** version of GiNaC. If it is not finding GiNaC, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system."], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GiNaC was incorrectly installed" + echo "*** or that you have moved GiNaC since it was installed. In the latter case, you" + echo "*** may want to edit the ginac-config script: $GINACLIB_CONFIG." ]) + CPPFLAGS="$ac_save_CPPFLAGS" + LIBS="$ac_save_LIBS" + fi + GINACLIB_CPPFLAGS="" + GINACLIB_LIBS="" + ifelse([$3], , :, [$3]) + fi + fi +fi +AC_SUBST(GINACLIB_CPPFLAGS) +AC_SUBST(GINACLIB_LIBS) +rm -f conf.ginactest ]) -- 2.44.0