1 dnl Process this -*- autoconf -*- file with autoconf to produce a
3 AC_INIT(dia, 0.95+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.287 $)
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 PKG_CHECK_MODULES(GMODULE, gmodule-2.0 gobject-2.0)
56 AC_SUBST(GMODULE_CFLAGS)
57 AC_SUBST(GMODULE_LIBS)
58 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
60 GTK_MODULES="gtk+-2.0 >= 2.6.0 glib-2.0 >= 2.6.0 libxml-2.0 gdk-pixbuf-2.0 gthread-2.0"
61 PKG_CHECK_MODULES(PANGOVERSION, pango >= 1.1.5, ,
62 AC_MSG_ERROR([Need Pango version 1.1.5 or higher]))
65 [ --without-freetype compile without FreeType support],,with_freetype=yes)
66 if test "x$with_freetype" == "xyes"; then
67 PKG_CHECK_MODULES(PANGOFT2,pangoft2,have_pangoft2=true,have_pangoft2=false)
68 if test "$have_pangoft2" = "true"; then
69 dnl On Solaris with Forte C, at least, need to link app/dia with -lfreetype.
70 dnl It's not enough that -lpangoft2 implicitly pulls it in.
72 AC_CHECK_LIB(freetype,FT_Init_FreeType,have_freetype=true,have_freetype=false,`freetype-config --libs`)
73 if test "$have_freetype" = "true"; then
74 dnl Need 2.0.9, as a bug was fixed for us there.
75 dnl However, freetype-config doesn't give a meaningful version, so we must
77 AC_MSG_CHECKING([if FreeType version is 2.0.9 or higher])
78 old_CPPFLAGS="$CPPFLAGS"
79 CPPFLAGS="$CPPFLAGS `freetype-config --cflags`"
80 AC_TRY_CPP([#include <ft2build.h>
81 #include FT_FREETYPE_H
82 #if (FREETYPE_MAJOR*1000+FREETYPE_MINOR)*1000+FREETYPE_PATCH < 2000009
83 #error Freetype version too low.
87 FREETYPE_LIBS=`freetype-config --libs`
88 AC_SUBST(FREETYPE_LIBS)
89 FREETYPE_CFLAGS=`freetype-config --cflags`
90 AC_SUBST(FREETYPE_CFLAGS)
91 GTK_MODULES="$GTK_MODULES pangoft2"
92 AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])]
94 [AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])])
95 CPPFLAGS="$old_CPPFLAGS"
97 AC_MSG_ERROR(Can't find FreeType library)
100 AC_MSG_ERROR(Can't find PangoFT2 library)
103 AM_CONDITIONAL(WITH_FREETYPE, test "x$with_freetype" != "xno")
105 CFLAGS="$FREETYPE_CFLAGS $CFLAGS"
108 PKG_CHECK_MODULES(LIBART,libart-2.0,have_libart=yes,have_libart=no)
109 if test "$have_libart" = "yes" ; then
110 GTK_MODULES="$GTK_MODULES libart-2.0"
111 AC_DEFINE(HAVE_LIBART,1,[Define if building with LIBART support])
114 AC_MSG_CHECKING([whether GNOME specific code should be used])
115 AC_ARG_ENABLE(gnome,[ --enable-gnome enable gnome code],
116 GNOME=$enableval, GNOME=no)
117 if test "$GNOME" = "yes" ; then
118 GTK_MODULES="$GTK_MODULES libgnome-2.0 libgnomeui-2.0"
119 AC_DEFINE(GNOME,1,[Define if building with GNOME support])
120 AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${prefix}/share/pixmaps", [GNOME icon directory])
125 AM_CONDITIONAL(HAVE_GNOME, $have_gnome)
126 AC_MSG_RESULT($GNOME)
128 dnl GTK2: libgnomecanvas-2.0 ?
130 PKG_CHECK_MODULES(GTK,$GTK_MODULES)
134 AM_CONDITIONAL(HAVE_BONOBO,false)
136 dnl Look for Gnome Print
137 AC_ARG_WITH(gnomeprint,
138 [ --with-gnomeprint compile *experimental* gnomeprint plug-in],,with_gnomeprint=no)
139 if test "x$with_gnomeprint" == "xyes"; then
140 PKG_CHECK_MODULES(GNOMEPRINT, libgnomeprint-2.2, have_gnomeprint=yes,have_gnomeprint=no)
141 AC_SUBST(GNOMEPRINT_LIBS)
142 AC_SUBST(GNOMEPRINT_CFLAGS)
143 AC_DEFINE(HAVE_GNOMEPRINT,1,[Define if building with Gnome Print support])
145 AM_CONDITIONAL(WITH_GNOMEPRINT, test "x$with_gnomeprint" != "xno")
149 [ --with-cairo compile *experimental* cairo plug-in],,with_cairo=no)
150 if test "x$with_cairo" != "xno"; then
151 PKG_CHECK_MODULES(CAIROVERSION, cairo >= 0.6.0, ,
152 AC_MSG_ERROR([Need Cairo version 0.6.0 or higher]))
153 PKG_CHECK_MODULES(CAIRO, cairo,have_cairo=yes,have_cairo=no)
155 AC_SUBST(CAIRO_CFLAGS)
156 AC_DEFINE(HAVE_CAIRO,1,[Define if building with Cairo support])
158 AM_CONDITIONAL(WITH_CAIRO, test "x$with_cairo" != "xno")
162 # Check if XSLT is available at all
164 PKG_CHECK_MODULES(XSLT, libxslt, have_xslt=true, have_xslt=false)
165 AM_CONDITIONAL(HAVE_XSLT, $have_xslt)
166 if test "$have_xslt" = "true"; then
168 XSLT_LIBS="`$PKG_CONFIG --libs libxslt`"
169 XSLT_CFLAGS="`$PKG_CONFIG --cflags libxslt`"
174 AC_SUBST(XSLT_CFLAGS)
176 # Figure out a prefix for where to find libxslt at runtime.
177 AC_ARG_WITH(xslt-prefix,
178 [ --with-xslt-prefix=DIR Specify where to find the optional XSLT libraries
180 libxslt_prefix=$withval,
181 libxslt_prefix=/usr/lib)
182 AC_DEFINE_UNQUOTED(LIBXSLT_PREFIX,"$libxslt_prefix", [Place to look for XSLT libs])
188 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [
189 AC_DEFINE(HAVE_LIBPOPT,,[popt library available])
191 AC_CHECK_HEADERS(popt.h)
193 APP_LIBS="$APP_LIBS $POPT_LIBS"
198 dnl this likely already comes from GTK
200 dnl Something in here pollutes $LIBS with -lpng. Make sure to
206 AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)
207 AC_CHECK_LIB(png, png_read_info, ,png_ok=no, -lz -lm)
208 if test "$png_ok" = yes; then
209 AC_MSG_CHECKING([for png_structp in png.h])
210 dnl Why can't AC_LINK_IFELSE take extra libs?
211 old_LDFLAGS="${LDFLAGS}"
212 LDFLAGS="${LDFLAGS} -lz -lm"
213 AC_LINK_IFELSE([#include <png.h>
217 main() { void*foo = png_create_read_struct; }],
220 LDFLAGS="${old_LDFLAGS}"
221 AC_MSG_RESULT($png_ok)
222 if test "$png_ok" = yes; then
223 PNG_LIBS='-lpng -lz -lm'
224 AC_DEFINE(HAVE_LIBPNG,,[PNG library available])
229 LIBS="${old_LIBS} ${PNG_LIBS}"
235 [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
237 enable_debug=minimum)
239 if test "x$enable_debug" = "xyes"; then
240 DEBUG_FLAGS="-g -DENABLE_DEBUG"
242 if test "x$enable_debug" = "xno"; then
248 AC_SUBST(DEBUG_FLAGS)
255 AC_SUBST(GETTEXT_PACKAGE)
256 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Needed for glib gettext])
257 ALL_LINGUAS="am ar az be bg bs ca cs da de el en_CA en_GB es eu fi fr ga gl gu hr hu id is it ja ko lt mk ml mn ms nb ne nl nn pl pt pt_BR ro ru rw sk sl sq sr sr@Latn sv th tr uk vi zh_CN zh_TW"
259 AC_CHECK_PROG(XGETTEXT, xgettext, xgettext, none)
260 if test "$XGETTEXT" == none ; then
261 AC_MSG_ERROR([xgettext program not found: $XGETTEXT.])
267 dnl INTLOBJS doesn't seem to always get subst'ed, but I believe it's
271 localedir='${prefix}/${DATADIRNAME}/locale'
275 dnl Locate the gnome-xml library
277 dnl GTK2: remove support for libxml1. move check for libxml2 in
278 dnl AM_PATH_GTK_2_0's fourth argument (module is libxml-2.0)
281 if test $found_libxml = false; then
282 AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
283 if test "x$XML2_CONFIG" != x ; then
284 AC_MSG_CHECKING(for libxml >= 2.3.9)
285 vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
287 if test "$vers" -ge 2003009; then
290 XML_LIBS="`$XML2_CONFIG --libs`"
291 XML_CFLAGS="`$XML2_CONFIG --cflags`"
293 if test "$enable_gnome_print" = "yes"; then
294 gnome-config --cflags print | \
295 grep gnome-xml 2>&1 >/dev/null && \
296 AC_MSG_ERROR(libxml2 found but gnome-print uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable gnome-print.)
298 echo $GNOME_CFLAGS | \
299 grep gnome-xml 2>&1 >/dev/null && \
300 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.)
303 AC_MSG_RESULT(not found)
308 if test $found_libxml = false; then
309 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
310 if test "x$XML_CONFIG" != x ; then
311 AC_MSG_CHECKING(for libxml >= 1.8.14)
312 vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
314 dnl 1.18.14 is required for xmlUseNewParser()
315 if test "$vers" -ge 1008014; then
318 XML_LIBS="`$XML_CONFIG --libs`"
319 XML_CFLAGS="`$XML_CONFIG --cflags`"
321 AC_MSG_RESULT(not found)
326 if test $found_libxml = false; then
327 AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably))
333 CFLAGS="$XML_CFLAGS $CFLAGS"
336 AC_CHECK_HEADERS(zlib.h,
337 AC_CHECK_LIB(z, gzread,[
338 AC_DEFINE(HAVE_LIBZ,, we have the libz compression library)
339 if test "x${Z_DIR}" != "x"; then
340 Z_CFLAGS="-I${Z_DIR}/include"
341 Z_LIBS="-L${Z_DIR}/lib -lz"
348 CFLAGS="${CFLAGS} ${Z_CFLAGS}"
349 LIBS="${LIBS} ${Z_LIBS}"
352 dnl Path to UI resources
353 AC_SUBST(uidatadir, '${pkgdatadir}/ui')
356 dnl Platform-specific fixes.
359 dnl Sun Forte C provides isinf() in the unbundled -lsunmath. Solaris
360 dnl declares finite() in ieeefp.h. It's preferrable not to link
361 dnl to -lsunmath as it's not present on all machines.
363 AC_CHECK_HEADERS(math.h,
364 AC_CHECK_LIB(m,isinf,
367 if test "$have_isinf" = "no"; then
368 AC_CHECK_HEADER(ieeefp.h,
369 [AC_CHECK_FUNC(finite,
370 AC_DEFINE(HAVE_IEEEFP_H,1,
371 [Define if finite() is defined in ieeefp.h]),
372 AC_MSG_ERROR([Can't find a definition of neither
373 finite nor isinf]))],
374 [AC_MSG_ERROR(Can't find neither a definition of
375 isinf nor ieeefp.h)])
377 AC_DEFINE([HAVE_ISINF], 1,
378 [Define if the isinf() function is available])
381 dnl Alpha needs -mieee or we get a segfault
382 dnl This shouldn't be needed but is here until a real solution is found
385 CFLAGS="$CFLAGS -mieee"
389 if test "$GCC" = yes; then
390 dnl Relieve register pressure on i386. Other architectures may become unable
391 dnl to debug, and usually have more registers anyway.
394 dnl DIA_CHECK_CFLAG(-fomit-frame-pointer)
397 dnl (it looks like gdb is very confused by this now even on x86. We might be
398 dnl getting poor stack traces with bug-buddy because of this)
400 DIA_CHECK_CFLAG(-Wall)
401 DIA_CHECK_CFLAG(-Wunused)
402 DIA_CHECK_CFLAG(--std=c89)
403 DIA_CHECK_CFLAG(-Wdeclaration-after-statement)
404 dnl I'd rather like to enable this but it fails on isnan() with -std=c89
405 dnl DIA_CHECK_CFLAG(-Werror-implicit-function-declaration)
406 dnl Premature optimization is the root of all evil. Uncomment this if
407 dnl you want ti figure out functions that should have been inlined but aint.
408 dnl DIA_CHECK_CFLAG(-Winline)
409 DIA_CHECK_CFLAG(-Wmissing-prototypes)
410 DIA_CHECK_CFLAG(-Wmissing-declarations)
411 DIA_CHECK_CFLAG(-finline-functions)
412 DIA_CHECK_CFLAG(-fstrict-aliasing)
415 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = yes)
417 dnl Do we have the db2html script to build the documentation?
418 AC_ARG_ENABLE(db2html,
419 [ --enable-db2html don't rebuild documentation],,enable_db2html=no)
420 AC_PATH_PROG(DB2HTML, db2html, no)
421 AM_CONDITIONAL(HAVE_DB2HTML,
422 test "x$enable_db2html" != xno && test "x$DB2HTML" != xno)
424 dnl Only enable man page generation if we have db2man (in maintainer mode)
427 dnl Have to have the nwalsh docbook.xsl, which does manpages.
428 dnl RedHat installs it in a version-numbered place. Grumpf.
429 AC_PATH_PROG(XSLTPROC, xsltproc, no)
430 AM_CONDITIONAL(HAVE_DB2MAN, test "x$XSLTPROC" != xno)
431 AC_SUBST(DB2MAN, "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl")
433 dnl Handling for Python
435 [ --with-python compile python plug-in],,with_python=no)
437 if test "x$with_python" != xno; then
438 AM_PATH_PYTHON(1.5.2)
439 AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
440 AM_CHECK_PYTHON_HEADERS
443 if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then
444 AC_MSG_ERROR([could not find files required to build python plugin])
447 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno")
455 dnl objects/sybase/Makefile
456 objects/AADL/Makefile
457 objects/bondgraph/Makefile
458 objects/chronogram/Makefile
459 objects/custom/Makefile
461 objects/flowchart/Makefile
463 objects/GRAFCET/Makefile
464 objects/Istar/Makefile
465 objects/Jackson/Makefile
466 objects/KAOS/Makefile
467 objects/Misc/Makefile
468 objects/network/Makefile
469 objects/SADT/Makefile
470 objects/standard/Makefile
473 shapes/Assorted/Makefile
475 shapes/ChemEng/Makefile
476 shapes/Circuit/Makefile
477 shapes/Cisco/Makefile
478 shapes/Civil/Makefile
479 shapes/Contact/Makefile
480 shapes/Cybernetics/Makefile
481 shapes/Electric/Makefile
482 shapes/flowchart/Makefile
483 shapes/Gane_and_Sarson/Makefile
484 shapes/jigsaw/Makefile
485 shapes/Logic/Makefile
487 shapes/Map/Isometric/Makefile
490 shapes/network/Makefile
491 shapes/Pneumatic/Makefile
494 shapes/sybase/Makefile
500 sheets/GRAFCET/Makefile
501 sheets/Istar/Makefile
502 sheets/Jackson/Makefile
506 plug-ins/cgm/Makefile
507 plug-ins/cairo/Makefile
508 plug-ins/dxf/Makefile
509 plug-ins/gprint/Makefile
510 plug-ins/hpgl/Makefile
511 plug-ins/metapost/Makefile
512 plug-ins/pixbuf/Makefile
513 plug-ins/pstricks/Makefile
514 plug-ins/pgf/Makefile
515 plug-ins/python/Makefile
516 plug-ins/shape/Makefile
517 plug-ins/svg/Makefile
518 plug-ins/vdx/Makefile
519 plug-ins/wmf/Makefile
520 plug-ins/wpg/Makefile
521 plug-ins/xfig/Makefile
522 plug-ins/xslt/Makefile
524 tests/exports/Makefile
532 dnl GTK2: simplify this, we will have much less options.
536 Source code location: ${srcdir}
539 Gnome support: ${GNOME}
540 Python support: ${with_python}
541 Libart support (PNG export): ${have_libart}
542 Cairo support (experimental): ${with_cairo}
543 Gnome Print support (experimental): ${with_gnomeprint}
546 echo "Now type make to build dia..."