1dnl Process this file with autoconf to produce a configure script. 2 3dnl GiNaC library version information. 4dnl 5dnl When making releases do whatever you want with the major, 6dnl minor and micro project version numbers ; but for the library 7dnl version, you must be more careful (the following lines are 8dnl to be read as an algorithm, don't stop at the first one!) : 9dnl 1. increment lt_revision 10dnl 2. if any interface has been added, removed or modified since the 11dnl last release, then increment lt_current and set lt_revision to 0 12dnl 3. if any interface has been added, then increment lt_age 13dnl 4. if any interface has been removed, then set lt_age to zero 14dnl 15dnl In case you wonder why such instructions: 16dnl http://www.sourceware.org/autobook/autobook/autobook_91.html#SEC91 17dnl The following article is helpful too: 18dnl http://www.freesoftwaremagazine.com/articles/building_shared_libraries_once_using_autotools 19 20dnl if you change this YOU MUST also change the libtool version below 21m4_define([ginac_major_version], [0]) 22m4_define([ginac_minor_version], [7]) 23m4_define([ginac_micro_version], [27]) 24 25m4_define([lt_current], [21]) 26m4_define([lt_revision], [5]) 27m4_define([lt_age], [3]) 28 29 30m4_define([ginac_version], [ginac_major_version.ginac_minor_version.ginac_micro_version]) 31m4_define([ginac_release], [ginac_major_version.ginac_minor_version]) 32 33AC_INIT([pynac], ginac_version, [<pynac-devel@googlegroups.com>]) 34AC_PREREQ(2.59) 35AC_CONFIG_SRCDIR(ginac/basic.cpp) 36AC_CONFIG_HEADERS(config.h) 37dnl This defines PACKAGE and VERSION. 38AM_INIT_AUTOMAKE([gnu 1.7 dist-bzip2]) 39# Allow "configure --disable-maintainer-mode" to disable timestamp checking 40AM_MAINTAINER_MODE([enable]) 41 42AM_PATH_PYTHON([2.7]) 43 44dnl Adapted from CPython 3.8 cpython/Misc/python-config.in 45AC_MSG_CHECKING([for Python preprocessor flags]) 46PYTHON_CPPFLAGS=$($PYTHON - <<EOD 47import sysconfig 48print(' '.join(list(('-I' + sysconfig.get_path('include'), 49 '-I' + sysconfig.get_path('platinclude'),)) 50 + sysconfig.get_config_var('CFLAGS').split())) 51EOD 52) 53AC_MSG_RESULT([$PYTHON_CPPFLAGS]) 54AC_SUBST([PYTHON_CPPFLAGS]) 55 56AC_MSG_CHECKING([for Python library flags]) 57PYTHON_LDFLAGS=$(CC=dummy-cc $PYTHON - <<EOD 58from distutils.ccompiler import new_compiler 59from distutils.sysconfig import customize_compiler 60compiler = new_compiler() 61customize_compiler(compiler) 62import sys 63import sysconfig 64if compiler.linker_so.pop(0) != 'dummy-cc': 65 sys.stderr.write('Warning: linker_so has a changed linker command; avoid setting the LDSHARED environment variable\n') 66print(' '.join(compiler.linker_so)) 67EOD 68) 69AC_MSG_RESULT([$PYTHON_LDFLAGS]) 70AC_SUBST([PYTHON_LDFLAGS]) 71 72AC_CANONICAL_HOST 73AC_MSG_CHECKING([for Cygwin]) 74case $host_os in 75 *cygwin*) 76 AM_CONDITIONAL(CYGWIN, true) 77 dnl On Cygwin, we need to link through with the Python library, 78 dnl otherwise libtool complains. 79 PYTHON_LDFLAGS="$PYTHON_LDFLAGS $($PYTHON - <<EOD 80import sysconfig 81print(' '.join(list(('-L' + sysconfig.get_config_var('LIBDIR'), 82 '-lpython' + sysconfig.get_config_var('LDVERSION'), 83 sysconfig.get_config_var('SHLIBS'), 84 sysconfig.get_config_var('SYSLIBS'))))) 85EOD 86)" 87 ;; 88 *) 89 AM_CONDITIONAL(CYGWIN, false) 90 ;; 91esac 92AC_MSG_RESULT([$CYGWIN]) 93 94dnl use "make V=1" if you want to see the long awful lines 95m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) 96 97dnl keep the correct libtool macros in-tree 98AC_CONFIG_MACRO_DIR([m4]) 99 100dnl Process GiNaC version information 101GINACLIB_MAJOR_VERSION=ginac_major_version 102GINACLIB_MINOR_VERSION=ginac_minor_version 103GINACLIB_MICRO_VERSION=ginac_micro_version 104GINACLIB_VERSION=ginac_version 105AC_SUBST(GINACLIB_MAJOR_VERSION) 106AC_SUBST(GINACLIB_MINOR_VERSION) 107AC_SUBST(GINACLIB_MICRO_VERSION) 108AC_SUBST(GINACLIB_VERSION) 109 110dnl GiNaC archive file version information. 111dnl 112dnl If properties have been added, ARCHIVE_VERSION += 1, ARCHIVE_AGE += 1. 113dnl If backwards compatibility has been broken, set ARCHIVE_AGE to 0. 114dnl 115dnl The version number in newly created archives will be ARCHIVE_VERSION. 116dnl Archives version (ARCHIVE_VERSION-ARCHIVE_AGE) thru ARCHIVE_VERSION can 117dnl be read by this version of the GiNaC library. 118 119ARCHIVE_VERSION=3 120ARCHIVE_AGE=0 121 122AC_SUBST(ARCHIVE_VERSION) 123AC_SUBST(ARCHIVE_AGE) 124AC_DEFINE_UNQUOTED(ARCHIVE_VERSION, $ARCHIVE_VERSION, [Current GiNaC archive file version number]) 125AC_DEFINE_UNQUOTED(ARCHIVE_AGE, $ARCHIVE_AGE, [GiNaC archive file version age]) 126 127dnl libtool versioning 128LT_VERSION_INFO="lt_current:lt_revision:lt_age" 129AC_SUBST(LT_VERSION_INFO) 130 131 132dnl Check for the compiler and all the utilities needed for the build. 133AC_PROG_CXX 134AC_PROG_CXXCPP 135AC_PROG_INSTALL 136LT_INIT 137AC_LIBTOOL_WIN32_DLL 138 139AC_CHECK_HEADERS([gmp.h], , AC_MSG_ERROR([This package needs gmp headers])) 140AC_SEARCH_LIBS([__gmpz_get_str], [gmp], [], [AC_MSG_ERROR([This package needs libgmp])]) 141 142AC_CHECK_HEADERS([flint/fmpq_poly.h], , AC_MSG_ERROR([This package needs flint headers])) 143AC_SEARCH_LIBS([fmpq_get_mpz_frac], [flint], [], [AC_MSG_ERROR([This package needs libflint])]) 144 145AC_ARG_WITH([giac], 146 [AS_HELP_STRING([--with-giac], 147 [use giac for polynomial manipulations @<:@default=check@:>@])], 148 [], 149 [with_giac=check]) 150 151LIBGIAC= 152AS_IF([test "x$with_giac" != xno], 153 [AC_CHECK_LIB([giac], [ConvertUTF16toUTF8], 154 [AC_SUBST([LIBGIAC], ["-lgiac"]) 155 AC_DEFINE([HAVE_LIBGIAC], [1], 156 [Define if you have libgiac]) 157 ], 158 [if test "x$with_giac" != xcheck; then 159 AC_MSG_FAILURE( 160 [--with-giac was given, but test for giac failed]) 161 fi 162 ], -lgmp)]) 163 164dnl Check for data types which are needed by the hash function 165dnl (golden_ratio_hash). 166AC_CHECK_SIZEOF(int) 167AC_CHECK_SIZEOF(long) 168AC_CHECK_SIZEOF(long long) 169AC_CHECK_SIZEOF(long double) 170AC_CHECK_SIZEOF(void *) 171 172dnl Switch to C++ language mode for the following libraries and headers. 173AC_LANG([C++]) 174AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory]) 175 176dnl Make sure all the necessary standard headers are installed on the system. 177AC_CHECK_HEADER(iosfwd, , GINAC_ERROR([The standard <iosfwd> header file could not be found.])) 178AC_CHECK_HEADER(iostream, , GINAC_ERROR([The standard <iostream> header file could not be found.])) 179AC_CHECK_HEADER(vector, , GINAC_ERROR([The standard <vector> header file could not be found.])) 180AC_CHECK_HEADER(list, , GINAC_ERROR([The standard <list> header file could not be found.])) 181AC_CHECK_HEADER(map, , GINAC_ERROR([The standard <map> header file could not be found.])) 182AC_CHECK_HEADER(string, , GINAC_ERROR([The standard <string> header file could not be found.])) 183AC_CHECK_HEADER(sstream, , GINAC_ERROR([The standard <sstream> header file could not be found.])) 184AC_CHECK_HEADER(typeinfo, , GINAC_ERROR([The standard <typeinfo> header file could not be found.])) 185AC_CHECK_HEADER(stdexcept, , GINAC_ERROR([The standard <stdexcept> header file could not be found.])) 186AC_CHECK_HEADER(algorithm, , GINAC_ERROR([The standard <algorithm> header file could not be found.])) 187AC_CHECK_HEADER(limits, , GINAC_ERROR([The standard <limits> header file could not be found.])) 188if test "x$CONFIG_RUSAGE" = "xno"; then 189 AC_CHECK_HEADER(ctime, , GINAC_ERROR([The standard <ctime> header file could not be found.])) 190fi 191 192PKG_PROG_PKG_CONFIG 193 194dnl Find Singular's factory header and library with pkg-config 195PKG_CHECK_MODULES([FACTORY], [factory],[ 196 AC_SUBST(FACTORY_CFLAGS) 197 AC_SUBST(FACTORY_LIBS)], 198 [AC_MSG_ERROR([This package needs libfactory])]) 199 200dnl Check for utilities needed by the different kinds of documentation. 201dnl Documentation needs only be built when extending it, so never mind if it 202dnl cannot find those helpers: 203#AC_PATH_PROG(DOXYGEN, doxygen, "") 204#AM_CONDITIONAL(CONFIG_DOXYGEN, [test ! -z "$DOXYGEN"]) 205#AC_PATH_PROG(LATEX, latex, "") 206#AC_PATH_PROG(PDFLATEX, pdflatex, "") 207#AC_PATH_PROG(MAKEINDEX, makeindex, "") 208#AC_PATH_PROG(DVIPS, dvips, "") 209#AM_CONDITIONAL(CONFIG_TEX, [test ! \( -z "$LATEX" -o -z $"PDFLATEX" -o -z "$MAKEINDEX" -o -z "$DVIPS" \)]) 210#AC_PATH_PROG(FIG2DEV, fig2dev, "") 211#AM_CONDITIONAL(CONFIG_FIG2DEV, [test ! -z "$FIG2DEV"]) 212 213AC_PATH_PROG(RM, rm, $FALSE) 214RM="$RM -f" 215 216 217dnl Output makefiles etc. 218AC_CONFIG_FILES([ 219Makefile 220pynac.spec 221pynac.pc 222ginac/Makefile 223ginac/version.h 224]) 225AX_PREFIX_CONFIG_H 226AC_OUTPUT 227dnl Display a final warning if there has been a GINAC_ERROR or a GINAC_WARNING 228GINAC_CHECK_ERRORS 229