1 dnl Process this -*- autoconf -*- file with autoconf to produce a
3 AC_INIT(dia, 0.94+cvs, http://bugzilla.gnome.org/enter_bug.cgi?product=dia)
4 AC_CONFIG_SRCDIR(app/diagram.c)
5 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION)
8 AC_REVISION($Revision: 1.257 $)
10 dnl Specify a header configuration file
11 AM_CONFIG_HEADER(config.h)
13 dnl do this check now, to keep autogen quiet.
18 dnl Initialize maintainer mode
21 dnl Initialize libtool
25 dnl Build time sanity check
28 dnl Checks for programs.
29 dnl AC_PROG_CC # already done
35 dnl Checks for header files.
38 AC_CHECK_HEADERS(stddef.h fcntl.h unistd.h utime.h)
40 dnl Checks for typedefs, structures, and compiler characteristics.
43 dnl Checks for library functions.
44 AC_CHECK_FUNCS(select strcspn strdup strtol snprintf)
46 dnl stuff for intltool
47 AC_PROG_INTLTOOL(0.21)
53 dnl Checks for libraries
55 AM_PATH_GLIB_2_0(2.0.0)
56 PKG_CHECK_MODULES(GMODULE, gmodule-2.0 gobject-2.0)
57 AC_SUBST(GMODULE_CFLAGS)
58 AC_SUBST(GMODULE_LIBS)
59 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
61 AM_PATH_GTK_2_0(2.4.0)
63 GTK_MODULES="gtk+-2.0 libxml-2.0 gdk-pixbuf-2.0 gthread-2.0"
64 PKG_CHECK_MODULES(PANGOVERSION, pango >= 1.1.5, ,
65 AC_MSG_ERROR([Need Pango version 1.1.5 or higher]))
66 PKG_CHECK_MODULES(PANGOFT2,pangoft2,have_pangoft2=true,have_pangoft2=false)
67 if test "$have_pangoft2" = "true"; then
68 dnl On Solaris with Forte C, at least, need to link app/dia with -lfreetype.
69 dnl It's not enough that -lpangoft2 implicitly pulls it in.
71 AC_CHECK_LIB(freetype,FT_Init_FreeType,have_freetype=true,have_freetype=false,`freetype-config --libs`)
72 if test "$have_freetype" = "true"; then
73 dnl Need 2.0.9, as a bug was fixed for us there.
74 dnl However, freetype-config doesn't give a meaningful version, so we must
76 AC_MSG_CHECKING([if FreeType version is 2.0.9 or higher])
77 old_CPPFLAGS="$CPPFLAGS"
78 CPPFLAGS="$CPPFLAGS `freetype-config --cflags`"
79 AC_TRY_CPP([#include <ft2build.h>
80 #include FT_FREETYPE_H
81 #if (FREETYPE_MAJOR*1000+FREETYPE_MINOR)*1000+FREETYPE_PATCH < 2000009
82 #error Freetype version too low.
86 FREETYPE_LIBS=`freetype-config --libs`
87 AC_SUBST(FREETYPE_LIBS)
88 FREETYPE_CFLAGS=`freetype-config --cflags`
89 AC_SUBST(FREETYPE_CFLAGS)
90 GTK_MODULES="$GTK_MODULES pangoft2"
91 AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])]
93 [AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])])
94 CPPFLAGS="$old_CPPFLAGS"
96 AC_MSG_ERROR(Can't find FreeType library)
99 AC_MSG_ERROR(Can't find PangoFT2 library)
102 CFLAGS="$FREETYPE_CFLAGS $CFLAGS"
105 PKG_CHECK_MODULES(LIBART,libart-2.0,have_libart=yes,have_libart=no)
106 if test "$have_libart" = "yes" ; then
107 GTK_MODULES="$GTK_MODULES libart-2.0"
108 AC_DEFINE(HAVE_LIBART,1,[Define if building with LIBART support])
111 AC_MSG_CHECKING([whether GNOME specific code should be used])
112 AC_ARG_ENABLE(gnome,[ --enable-gnome enable gnome code],
113 GNOME=$enableval, GNOME=no)
114 if test "$GNOME" = "yes" ; then
115 GTK_MODULES="$GTK_MODULES libgnome-2.0 libgnomeui-2.0"
116 AC_DEFINE(GNOME,1,[Define if building with GNOME support])
117 AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${prefix}/share/pixmaps", [GNOME icon directory])
122 AM_CONDITIONAL(HAVE_GNOME, $have_gnome)
123 AC_MSG_RESULT($GNOME)
125 dnl GTK2: libgnomecanvas-2.0 ?
127 PKG_CHECK_MODULES(GTK,$GTK_MODULES)
131 AM_CONDITIONAL(HAVE_BONOBO,false)
133 dnl Look for Gnome Print
134 AC_ARG_WITH(gnomeprint,
135 [ --with-gnomeprint compile *experimental* gnomeprint plug-in],,with_gnomeprint=no)
136 if test "x$with_gnomeprint" == "xyes"; then
137 PKG_CHECK_MODULES(GNOMEPRINT, libgnomeprint-2.2, have_gnomeprint=yes,have_gnomeprint=no)
138 AC_SUBST(GNOMEPRINT_LIBS)
139 AC_SUBST(GNOMEPRINT_CFLAGS)
140 AC_DEFINE(HAVE_GNOMEPRINT,1,[Define if building with Gnome Print support])
142 AM_CONDITIONAL(WITH_GNOMEPRINT, test "x$with_gnomeprint" != "xno")
146 [ --with-cairo compile *experimental* cairo plug-in],,with_cairo=no)
147 if test "x$with_cairo" != "xno"; then
148 PKG_CHECK_MODULES(CAIROVERSION, cairo >= 0.6.0, ,
149 AC_MSG_ERROR([Need Cairo version 0.6.0 or higher]))
150 PKG_CHECK_MODULES(CAIRO, cairo,have_cairo=yes,have_cairo=no)
152 AC_SUBST(CAIRO_CFLAGS)
153 AC_DEFINE(HAVE_CAIRO,1,[Define if building with Cairo support])
155 AM_CONDITIONAL(WITH_CAIRO, test "x$with_cairo" != "xno")
159 # Check if XSLT is available at all
161 PKG_CHECK_MODULES(XSLT, libxslt, have_xslt=true, have_xslt=false)
162 AM_CONDITIONAL(HAVE_XSLT, $have_xslt)
163 if test "$have_xslt" = "true"; then
165 XSLT_LIBS="`$PKG_CONFIG --libs libxslt`"
166 XSLT_CFLAGS="`$PKG_CONFIG --cflags libxslt`"
171 AC_SUBST(XSLT_CFLAGS)
173 # Figure out a prefix for where to find libxslt at runtime.
174 AC_ARG_WITH(xslt-prefix,
175 [ --with-xslt-prefix=DIR Specify where to find the optional XSLT libraries
177 libxslt_prefix=$withval,
178 libxslt_prefix=/usr/lib)
179 AC_DEFINE_UNQUOTED(LIBXSLT_PREFIX,"$libxslt_prefix", [Place to look for XSLT libs])
185 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [
186 AC_DEFINE(HAVE_LIBPOPT,,[popt library available])
188 AC_CHECK_HEADERS(popt.h)
190 APP_LIBS="$APP_LIBS $POPT_LIBS"
195 dnl this likely already comes from GTK
197 dnl Something in here pollutes $LIBS with -lpng. Make sure to
203 AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)
204 AC_CHECK_LIB(png, png_read_info, ,png_ok=no, -lz -lm)
205 if test "$png_ok" = yes; then
206 AC_MSG_CHECKING([for png_structp in png.h])
207 dnl Why can't AC_LINK_IFELSE take extra libs?
208 old_LDFLAGS="${LDFLAGS}"
209 LDFLAGS="${LDFLAGS} -lz -lm"
210 AC_LINK_IFELSE([#include <png.h>
214 main() { void*foo = png_create_read_struct; }],
217 LDFLAGS="${old_LDFLAGS}"
218 AC_MSG_RESULT($png_ok)
219 if test "$png_ok" = yes; then
220 PNG_LIBS='-lpng -lz -lm'
221 AC_DEFINE(HAVE_LIBPNG,,[PNG library available])
226 LIBS="${old_LIBS} ${PNG_LIBS}"
232 [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
234 enable_debug=minimum)
236 if test "x$enable_debug" = "xyes"; then
237 DEBUG_FLAGS="-g -DENABLE_DEBUG"
239 if test "x$enable_debug" = "xno"; then
245 AC_SUBST(DEBUG_FLAGS)
252 AC_SUBST(GETTEXT_PACKAGE)
253 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Needed for glib gettext])
254 ALL_LINGUAS="am az be bg bs ca cs da de el en_CA en_GB es eu fi fr ga gu hr hu id is it ja ko mk ml mn ms nb ne nl nn no pl pt pt_BR ro ru rw sk sl sq sr sr@Latn sv tr uk vi zh_CN zh_TW"
257 dnl INTLOBJS doesn't seem to always get subst'ed, but I believe it's
261 localedir='${prefix}/${DATADIRNAME}/locale'
265 dnl Locate the gnome-xml library
267 dnl GTK2: remove support for libxml1. move check for libxml2 in
268 dnl AM_PATH_GTK_2_0's fourth argument (module is libxml-2.0)
271 if test $found_libxml = false; then
272 AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
273 if test "x$XML2_CONFIG" != x ; then
274 AC_MSG_CHECKING(for libxml >= 2.3.9)
275 vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
277 if test "$vers" -ge 2003009; then
280 XML_LIBS="`$XML2_CONFIG --libs`"
281 XML_CFLAGS="`$XML2_CONFIG --cflags`"
283 if test "$enable_gnome_print" = "yes"; then
284 gnome-config --cflags print | \
285 grep gnome-xml 2>&1 >/dev/null && \
286 AC_MSG_ERROR(libxml2 found but gnome-print uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable gnome-print.)
288 echo $GNOME_CFLAGS | \
289 grep gnome-xml 2>&1 >/dev/null && \
290 AC_MSG_ERROR(libxml2 found but one GNOME component uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable the offending GNOME component.)
293 AC_MSG_RESULT(not found)
298 if test $found_libxml = false; then
299 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
300 if test "x$XML_CONFIG" != x ; then
301 AC_MSG_CHECKING(for libxml >= 1.8.14)
302 vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
304 dnl 1.18.14 is required for xmlUseNewParser()
305 if test "$vers" -ge 1008014; then
308 XML_LIBS="`$XML_CONFIG --libs`"
309 XML_CFLAGS="`$XML_CONFIG --cflags`"
311 AC_MSG_RESULT(not found)
316 if test $found_libxml = false; then
317 AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably))
323 CFLAGS="$XML_CFLAGS $CFLAGS"
326 AC_CHECK_HEADERS(zlib.h,
327 AC_CHECK_LIB(z, gzread,[
328 AC_DEFINE(HAVE_LIBZ,, we have the libz compression library)
329 if test "x${Z_DIR}" != "x"; then
330 Z_CFLAGS="-I${Z_DIR}/include"
331 Z_LIBS="-L${Z_DIR}/lib -lz"
338 CFLAGS="${CFLAGS} ${Z_CFLAGS}"
339 LIBS="${LIBS} ${Z_LIBS}"
341 dnl Platform-specific fixes.
344 dnl Sun Forte C provides isinf() in the unbundled -lsunmath. Solaris
345 dnl declares finite() in ieeefp.h. It's preferrable not to link
346 dnl to -lsunmath as it's not present on all machines.
348 AC_CHECK_HEADERS(math.h,
349 AC_CHECK_LIB(m,isinf,
352 if test "$have_isinf" = "no"; then
353 AC_CHECK_HEADER(ieeefp.h,
354 [AC_CHECK_FUNC(finite,
355 AC_DEFINE(HAVE_IEEEFP_H,1,
356 [Define if finite() is defined in ieeefp.h]),
357 AC_MSG_ERROR([Can't find a definition of neither
358 finite nor isinf]))],
359 [AC_MSG_ERROR(Can't find neither a definition of
360 isinf nor ieeefp.h)])
362 AC_DEFINE([HAVE_ISINF], 1,
363 [Define if the isinf() function is available])
366 dnl Alpha needs -mieee or we get a segfault
367 dnl This shouldn't be needed but is here until a real solution is found
370 CFLAGS="$CFLAGS -mieee"
374 if test "$GCC" = yes; then
375 dnl Relieve register pressure on i386. Other architectures may become unable
376 dnl to debug, and usually have more registers anyway.
379 dnl DIA_CHECK_CFLAG(-fomit-frame-pointer)
382 dnl (it looks like gdb is very confused by this now even on x86. We might be
383 dnl getting poor stack traces with bug-buddy because of this)
385 DIA_CHECK_CFLAG(-Wall)
386 DIA_CHECK_CFLAG(-Wunused)
387 dnl Premature optimization is the root of all evil. Uncomment this if
388 dnl you want ti figure out functions that should have been inlined but aint.
389 dnl DIA_CHECK_CFLAG(-Winline)
390 DIA_CHECK_CFLAG(-Wmissing-prototypes)
391 DIA_CHECK_CFLAG(-Wmissing-declarations)
392 DIA_CHECK_CFLAG(-finline-functions)
393 DIA_CHECK_CFLAG(-fstrict-aliasing)
396 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = yes)
398 dnl Do we have the db2html script to build the documentation?
399 AC_ARG_ENABLE(db2html,
400 [ --enable-db2html don't rebuild documentation],,enable_db2html=no)
401 AC_PATH_PROG(DB2HTML, db2html, no)
402 AM_CONDITIONAL(HAVE_DB2HTML,
403 test "x$enable_db2html" != xno && test "x$DB2HTML" != xno)
405 dnl Only enable man page generation if we have db2man (in maintainer mode)
408 dnl Have to have the nwalsh docbook.xsl, which does manpages.
409 dnl RedHat installs it in a version-numbered place. Grumpf.
410 AC_PATH_PROG(XSLTPROC, xsltproc, no)
411 AM_CONDITIONAL(HAVE_DB2MAN, test "x$XSLTPROC" != xno)
412 AC_SUBST(DB2MAN, "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl")
414 dnl Handling for Python
416 [ --with-python compile python plug-in],,with_python=no)
418 if test "x$with_python" != xno; then
419 AM_PATH_PYTHON(1.5.2)
420 AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
421 AM_CHECK_PYTHON_HEADERS
424 if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then
425 AC_MSG_ERROR([could not find files required to build python plugin])
428 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno")
436 dnl objects/sybase/Makefile
437 objects/bondgraph/Makefile
438 objects/chronogram/Makefile
439 objects/custom/Makefile
441 objects/flowchart/Makefile
443 objects/GRAFCET/Makefile
444 objects/Istar/Makefile
445 objects/Jackson/Makefile
446 objects/KAOS/Makefile
447 objects/Misc/Makefile
448 objects/network/Makefile
449 objects/SADT/Makefile
450 objects/standard/Makefile
453 shapes/Assorted/Makefile
454 shapes/ChemEng/Makefile
455 shapes/Circuit/Makefile
456 shapes/Cisco/Makefile
457 shapes/Civil/Makefile
458 shapes/Contact/Makefile
459 shapes/Cybernetics/Makefile
460 shapes/Electric/Makefile
461 shapes/flowchart/Makefile
462 shapes/jigsaw/Makefile
463 shapes/Logic/Makefile
465 shapes/Map/Isometric/Makefile
468 shapes/network/Makefile
469 shapes/Pneumatic/Makefile
472 shapes/sybase/Makefile
478 sheets/GRAFCET/Makefile
479 sheets/Istar/Makefile
480 sheets/Jackson/Makefile
484 plug-ins/cgm/Makefile
485 plug-ins/cairo/Makefile
486 plug-ins/dxf/Makefile
487 plug-ins/gprint/Makefile
488 plug-ins/hpgl/Makefile
489 plug-ins/metapost/Makefile
490 plug-ins/pixbuf/Makefile
491 plug-ins/pstricks/Makefile
492 plug-ins/python/Makefile
493 plug-ins/shape/Makefile
494 plug-ins/svg/Makefile
495 plug-ins/wmf/Makefile
496 plug-ins/wpg/Makefile
497 plug-ins/xfig/Makefile
498 plug-ins/xslt/Makefile
505 dnl GTK2: simplify this, we will have much less options.
509 Source code location: ${srcdir}
512 Gnome support: ${GNOME}
513 Python support: ${with_python}
514 Libart support (PNG export): ${have_libart}
515 Cairo support (experimental): ${with_cairo}
516 Gnome Print support (experimental): ${with_gnomeprint}
519 echo "Now type make to build dia..."