2 AC_INIT(src/storage.cc)
8 AC_PREFIX_DEFAULT(/usr/local)
9 AC_SUBST(install_flags)
10 AC_CONFIG_HEADER(src/config.h)
13 # Figure out how to turn on compiler warnings.
15 AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
16 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
17 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all])dnl
18 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
19 VAR,[VAR="no, unknown"
22 ac_save_[]FLAGS="$[]FLAGS"
24 in "-pedantic % -Wall" dnl GCC
25 "-xstrconst % -v" dnl Solaris C
26 "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
27 "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
28 "-ansi -ansiE % -fullwarn" dnl IRIX
29 "+ESlit % +w1" dnl HP-UX C
30 "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
31 "-h conform % -h msglevel 2" dnl Cray C (Unicos)
33 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
34 AC_TRY_COMPILE([],[return 0;],
35 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
37 FLAGS="$ac_save_[]FLAGS"
41 .ok|.ok,*) m4_ifvaln($3,$3) ;;
42 .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
43 AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
44 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
46 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
47 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
48 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
49 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
52 AS_VAR_POPDEF([VAR])dnl
53 AS_VAR_POPDEF([FLAGS])dnl
56 dnl the only difference - the LANG selection... and the default FLAGS
58 AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl
59 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
60 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all])dnl
61 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
62 VAR,[VAR="no, unknown"
65 ac_save_[]FLAGS="$[]FLAGS"
67 in "-pedantic % -Wall" dnl GCC
68 "-xstrconst % -v" dnl Solaris C
69 "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
70 "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
71 "-ansi -ansiE % -fullwarn" dnl IRIX
72 "+ESlit % +w1" dnl HP-UX C
73 "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
74 "-h conform % -h msglevel 2" dnl Cray C (Unicos)
76 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
77 AC_TRY_COMPILE([],[return 0;],
78 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
80 FLAGS="$ac_save_[]FLAGS"
84 .ok|.ok,*) m4_ifvaln($3,$3) ;;
85 .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
86 AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
87 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
89 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
90 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
91 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
92 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
95 AS_VAR_POPDEF([VAR])dnl
96 AS_VAR_POPDEF([FLAGS])dnl
102 dnl AC_CHECK_HEADER(expect.h, AC_DEFINE(EXPECTPATH, <expect.h>))
103 dnl if test "$ac_cv_header_expect_h" != "yes"
104 dnl then AC_CHECK_HEADER(tcl8.4/expect.h, AC_DEFINE(EXPECTPATH, <tcl8.4/expect.h>))
105 dnl if test "$ac_cv_header_tcl8_4_expect_h" != "yes"
106 dnl then AC_MSG_ERROR([Need the expect library; get it from http://expect.nist.gov/ .])
110 AC_ARG_ENABLE([runtime-dependency-check], [AS_HELP_STRING([--enable-runtime-dependency-check],
111 [Enable check for runtime dependencies (default is yes)])], , check_runtime_dependencies=yes)
113 if test "$check_runtime_dependencies" == "yes"
114 then AC_CHECK_PROG(LIE, lie, yes, no)
115 if test "${LIE}" == "no"
116 then AC_MSG_ERROR([Need the LiE program; get it from http://young.sp2mi.univ-poitiers.fr/~marc/LiE/ .])
120 AC_CHECK_HEADERS(pcre.h)
121 if test "${ac_cv_header_pcre_h}" == "no"
122 then AC_MSG_ERROR([Need the pcre library; get it from http://www.pcre.org/ . Make sure to set CPPFLAGS if necessary.])
125 AC_CHECK_HEADERS(gmpxx.h)
126 if test "${ac_cv_header_gmpxx_h}" == "no"
127 then AC_MSG_ERROR([Need the gmp and gmpxx library; get them from http://www.swox.com/gmp/ and configure them with --enable-cxx. Also make sure to set CPPFLAGS if necessary.])
130 dnl AC_CHECK_HEADERS(pcre++.h)
131 AC_CHECK_HEADERS(pcrecpp.h)
132 dnl if test "${ac_cv_header_pcrecpp_h}" == "no" -a "${ac_cv_header_pcrepp_h}" == "no"
133 if test "${ac_cv_header_pcrecpp_h}" == "no"
134 then AC_MSG_ERROR([Need the pcrecpp library; get it from http://www.pcre.org . Make sure to set CPPFLAGS if necessary.])
136 dnl if test "${ac_cv_header_pcre++_h}" == "no"
141 PKG_CHECK_MODULES([sigc], [sigc++-2.0])
142 PKG_CHECK_MODULES([modglue], [modglue])
143 if test "$check_runtime_dependencies" == "yes"
144 then AC_CHECK_PROG(PTYWRAP, ptywrap, yes, no)
145 if test "${PTYWRAP}" == "no"
146 then AC_MSG_ERROR([You have the modglue library, but the "ptywrap" tool which comes with it is not installed or executable.])
151 if test "`uname`" == "Darwin"
153 echo "checking system type... Darwin"
154 else echo "checking system type... Unix"
157 echo -n "Checking whether to use -fnested-functions..."
158 echo "main() {};" > conftmp.c
159 NESTED=-fnested-functions
160 if gcc -fnested-functions -c -o conftmp.o conftmp.c 1>/dev/null 2>&1
165 rm -f conftmp.c conftmp.o
167 dnl Optional configuration of the experimental GUI
168 AC_MSG_CHECKING([whether to build the GUI])
169 AC_ARG_ENABLE([gui], [AS_HELP_STRING([--enable-gui],
170 [Enable building of the graphical front-end (default is yes)])], , enable_gui=yes)
171 if test "$enable_gui" == "no"
174 PKG_CHECK_MODULES([sigc], [sigc++-2.0])
175 PKG_CHECK_MODULES([gtk], [gtk+-2.0])
176 PKG_CHECK_MODULES([pango], [pango])
177 PKG_CHECK_MODULES(GTKMM, gtkmm-2.4 >= 2.12.0,
178 [AC_DEFINE([GTKMM_VER],212)],
179 [PKG_CHECK_MODULES(GTKMM, gtkmm-2.4 >= 2.8.0,
180 [AC_DEFINE([GTKMM_VER],28)],
181 [PKG_CHECK_MODULES(GTKMM, gtkmm-2.4 >= 2.6.0,
182 AC_DEFINE([GTKMM_VER],26))])])
184 PKG_CHECK_MODULES(GLIBMM, glibmm-2.4 >= 2.16.0,
185 [AC_DEFINE([GLIBMM_VER],216)],
186 [AC_DEFINE([GLIBMM_VER],old)
187 echo "Using old glibmm"])
188 dnl PKG_CHECK_MODULES([gtkmm], [gtkmm-2.4])
189 dnl if test "x`pkg-config --modversion gtkmm-2.4 | grep 2.8`" == "x" ; then
190 dnl AC_DEFINE([GTKMM_GEQ_28], 0, [Defined if Gtkmm's version is 2.8 or greater])
191 dnl echo "checking for gtkmm version... < 2.8"
193 dnl AC_DEFINE([GTKMM_GEQ_28], 1, [Defined if Gtkmm's version is 2.8 or greater])
194 dnl echo "checking for gtkmm version... >= 2.8"
196 PKG_CHECK_MODULES([pangomm], [pangomm-1.4])
197 if test "$check_runtime_dependencies" == "yes"
198 then AC_CHECK_PROG(DVIPNG, dvipng, yes, no)
199 if test "${DVIPNG}" == "no"
200 then AC_MSG_ERROR([Need the dvipng program; get it from http://sourceforge.net/projects/dvipng/ .])
202 AC_CHECK_PROG(LATEX, latex, yes, no)
203 if test "${LATEX}" == "no"
204 then AC_MSG_ERROR([Need a working LaTeX installation.])
206 printf '\\nonstopmode\\documentclass{article}\\usepackage{breqn}\\begin{document}\\begin{dmath*}x^2\\end{dmath*}\\end{document}\n' > conftmp.tex
207 printf "checking for breqn package..."
208 if latex conftmp.tex > /dev/null 2>&1
211 AC_MSG_ERROR([Need the breqn LaTeX package; get it from ftp://ftp.ams.org/pub/tex/ .])
213 rm -f conftmp.tex conftmp.log conftmp.dvi conftmp.aux
218 AC_SUBST([enable_gui])
222 AC_SUBST([GTKMM_VER])
223 AC_SUBST([GLIBMM_VER])