]> www.ginac.de Git - ginac.git/blob - configure.in
be24b7ec14ae10e00432c89817f45a857b977bd6
[ginac.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2
3 AC_INIT(ginac/basic.cpp)
4 AC_PREREQ(2.13)
5
6 dnl GiNaC library version information.
7 dnl
8 dnl Making releases:
9 dnl   GINACLIB_MICRO_VERSION += 1;
10 dnl   GINACLIB_INTERFACE_AGE += 1;
11 dnl   GINACLIB_BINARY_AGE += 1;
12 dnl if any functions have been added, set GINACLIB_INTERFACE_AGE to 0.
13 dnl if backwards compatibility has been broken,
14 dnl set GINACLIB_BINARY_AGE and GINACLIB_INTERFACE_AGE to 0.
15 dnl
16 dnl NOTE: these can't be renamed to GINAC_MAJOR_VERSION etc. because
17 dnl autoconf sees "AC_MAJOR_VERSION" and complains about an undefined macro
18 dnl (don't we all *love* M4?)...
19
20 GINACLIB_MAJOR_VERSION=0
21 GINACLIB_MINOR_VERSION=5
22 GINACLIB_MICRO_VERSION=2
23 GINACLIB_INTERFACE_AGE=2
24 GINACLIB_BINARY_AGE=2
25 GINACLIB_VERSION=$GINACLIB_MAJOR_VERSION.$GINACLIB_MINOR_VERSION.$GINACLIB_MICRO_VERSION
26
27 AC_SUBST(GINACLIB_MAJOR_VERSION)
28 AC_SUBST(GINACLIB_MINOR_VERSION)
29 AC_SUBST(GINACLIB_MICRO_VERSION)
30 AC_SUBST(GINACLIB_INTERFACE_AGE)
31 AC_SUBST(GINACLIB_BINARY_AGE)
32 AC_SUBST(GINACLIB_VERSION)
33
34 dnl GiNaC archive file version information.
35 dnl
36 dnl If properties have been added, ARCHIVE_VERSION += 1, ARCHIVE_AGE += 1.
37 dnl If backwards compatibility has been broken, ARCHIVE_AGE to 0.
38 dnl
39 dnl The version number in newly created archives will be ARCHIVE_VERSION.
40 dnl Archives version (ARCHIVE_VERSION-ARCHIVE_AGE) thru ARCHIVE_VERSION can
41 dnl be read by this version of the GiNaC library.
42
43 ARCHIVE_VERSION=0
44 ARCHIVE_AGE=0
45
46 AC_SUBST(ARCHIVE_VERSION)
47 AC_SUBST(ARCHIVE_AGE)
48 AC_DEFINE_UNQUOTED(ARCHIVE_VERSION, $ARCHIVE_VERSION)
49 AC_DEFINE_UNQUOTED(ARCHIVE_AGE, $ARCHIVE_AGE)
50
51 dnl libtool versioning
52 LT_RELEASE=$GINACLIB_MAJOR_VERSION.$GINACLIB_MINOR_VERSION
53 LT_CURRENT=`expr $GINACLIB_MICRO_VERSION - $GINACLIB_INTERFACE_AGE`
54 LT_REVISION=$GINACLIB_INTERFACE_AGE
55 LT_AGE=`expr $GINACLIB_BINARY_AGE - $GINACLIB_INTERFACE_AGE`
56
57 AC_SUBST(LT_RELEASE)
58 AC_SUBST(LT_CURRENT)
59 AC_SUBST(LT_REVISION)
60 AC_SUBST(LT_AGE)
61
62 dnl This defines PACKAGE and VERSION.
63 AM_CONFIG_HEADER(config.h)
64 AM_INIT_AUTOMAKE([GiNaC], $GINACLIB_VERSION)
65 AM_MAINTAINER_MODE
66
67 dnl Check for the compiler and all the utilities needed for the build.
68 AC_PROG_CXX
69 AC_PROG_CXXCPP
70 AC_PROG_INSTALL
71 AM_PROG_LIBTOOL
72 AM_PROG_LEX
73 AC_PROG_YACC
74
75 dnl Configure options.
76 AC_ARG_ENABLE(html-doc, [  --enable-html-doc       build HTML documentation [default=yes]], , enable_html_doc=yes)
77 AC_ARG_ENABLE(ps-doc,   [  --enable-ps-doc         build PostScript documentation [default=yes]], , enable_ps_doc=yes)
78 AC_ARG_WITH(cint, [  --with-cint=CINTSYSDIR  build GiNaC-cint C++ interpreter [default=no]], , with_cint=no)
79
80 dnl Check for data types which are needed by the hash function (golden_ratio_hash).
81 AC_CHECK_SIZEOF(long, 4)
82 AC_CHECK_SIZEOF(long long, 8)
83 AC_CHECK_SIZEOF(long double, 12)
84
85 dnl Switch to C++ language mode for the following libraries and headers.
86 AC_LANG_CPLUSPLUS
87
88 dnl Check for stuff needed for building the GiNaC interactive shell (ginsh).
89 AC_CHECK_HEADERS(unistd.h)
90 AC_CHECK_HEADER(readline/readline.h, ,
91   GINAC_WARNING([I could not find the header file readline/readline.h (needed for ginsh).]))
92 AC_CHECK_HEADER(readline/history.h, ,
93   GINAC_WARNING([I could not find the header file readline/history.h (needed for ginsh).]))
94 save_LIBS=$LIBS
95 AC_CHECK_LIB(readline, readline, ,
96   GINAC_WARNING([I could not find libreadline (needed by ginsh).]))
97 GINSH_LIBS=$LIBS
98 LIBS=$save_LIBS
99 AC_SUBST(GINSH_LIBS)
100
101 dnl Make sure the following libraries work by testing for symbols therein. 
102 dnl They are automatically added the the variable $LIBS and thus passed into
103 dnl the Makefile:
104 AC_CHECK_LIB(stdc++, cout)
105
106 dnl Make sure all the necessary new-style headers are installed on the system.
107 dnl If one of them cannot be found the system is probably not ANSI-conform
108 dnl enough so trying the .h-style headers is a waste of time.
109 AC_CHECK_HEADERS(iostream vector map string list typeinfo iterator stdexcept algorithm, ,
110   AC_MSG_ERROR(need to have ANSI compliant headers))
111 AC_CHECK_HEADERS(sstream strstream)
112
113 dnl We need to have Bruno Haible's CLN installed (macros are in acinclude.m4):
114 GINAC_CHECK_CLN_H
115 GINAC_CHECK_LIBCLN
116
117 dnl Expand the cppflags and libraries needed by apps using GiNaC
118 GINACLIB_CPPFLAGS=$CPPFLAGS
119 GINACLIB_LIBS=$LIBS
120 AC_SUBST(GINACLIB_CPPFLAGS)
121 AC_SUBST(GINACLIB_LIBS)
122
123 dnl Check for utilities needed by the different kinds of documentation.
124 dnl Documantation needs only be built when extending it, so never mind if it
125 dnl cannot find those helpers:
126 AC_PATH_PROG(DOXYGEN, doxygen, "")
127 AC_PATH_PROG(LATEX, latex, "")
128 AC_PATH_PROG(MAKEINDEX, makeindex, "")
129 AC_PATH_PROG(DVIPS, dvips, "")
130 AC_PATH_PROG(FIG2DEV, fig2dev, "")
131
132 dnl Determine which documentation shall be built
133 TUTORIAL_TARGETS=
134 REFERENCE_TARGETS=
135 if [[ "x$enable_html_doc" = "xyes" ]]; then
136   TUTORIAL_TARGETS="$TUTORIAL_TARGETS ginac.html"
137   if [[ "$DOXYGEN" ]]; then
138     REFERENCE_TARGETS="$REFERENCE_TARGETS index.html"
139   fi
140 fi
141 if [[ "x$enable_ps_doc" = "xyes" ]]; then
142   TUTORIAL_TARGETS="$TUTORIAL_TARGETS ginac.ps"
143   if [[ "$DOXYGEN" ]]; then
144     REFERENCE_TARGETS="$REFERENCE_TARGETS reference.ps"
145   fi
146 fi
147 AC_SUBST(TUTORIAL_TARGETS)
148 AC_SUBST(REFERENCE_TARGETS)
149
150 dnl Configure GiNaC-cint
151 LIBGINACCINT=
152 GINACCINTDIR=
153 if [[ "x$with_cint" != "xno" ]]; then
154   if [[ "x$enable_static" != "xyes" ]]; then
155     AC_MSG_ERROR([currently GiNaC-cint needs to build a static libginac])
156   fi
157   if [[ "x$with_cint" = "xyes" ]]; then
158     if [[ "x$CINTSYSDIR" = "x" ]]; then
159       AC_MSG_ERROR([please export \$CINTSYSDIR or specify --with-cint=CINTSYSDIR])
160     fi
161   else
162     CINTSYSDIR=$with_cint
163     export CINTSYSDIR
164   fi
165   AC_PATH_PROG(CINT, cint, "", $CINTSYSDIR:$PATH)
166   AC_PATH_PROG(MAKECINT, makecint, "", $CINTSYSDIR:$PATH)
167   if [[ "$CINT" -a "$MAKECINT" ]]; then
168     AC_MSG_RESULT([creating cint/Makefile])
169     (cd cint && \
170     $MAKECINT -mk Makefile.makecint -o ginaccint.bin -m \
171       -D OBSCURE_CINT_HACK -D NO_NAMESPACE_GINAC \
172       -I .. -I $CINTSYSDIR -m -H ../ginac/ginac.h dummies.h \
173       -C++ dummies.cpp -C++ ginaccint.bin.cpp \
174       -l ./libginac.a -lcln -cint -M0x10; \
175     cd ..)
176     LIBGINACCINT="libginac.a"
177     GINACCINTDIR="cint"
178   else
179     AC_MSG_ERROR([Cannot configure GiNaC-cint])
180   fi
181 fi
182 AC_SUBST(CINTSYSDIR)
183 AC_SUBST(LIBGINACCINT)
184 AC_SUBST(GINACCINTDIR)
185
186 dnl Output makefiles etc.
187 AC_OUTPUT([
188 Makefile
189 GiNaC.spec
190 ginac-config
191 ginac/Makefile
192 check/Makefile
193 ginsh/Makefile
194 tools/Makefile
195 doc/Makefile
196 doc/tutorial/Makefile
197 doc/reference/Makefile
198 cint/Makefile
199 cint/ginaccint
200 ], [chmod +x ginac-config cint/ginaccint])
201 dnl Display a final warning if there has been a GINAC_ERROR or a GINAC_WARNING
202 GINAC_CHECK_ERRORS