1 dnl Process this -*- autoconf -*- file with autoconf to produce a
3 AC_INIT(dia, 0.95-pre4, 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.268 $)
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.6.0, :,
57 *** GLib 2.6.0 ior better is required. The latest version of
58 *** GLib is always available from ftp://ftp.gtk.org/pub/gtk.]),
60 PKG_CHECK_MODULES(GMODULE, gmodule-2.0 gobject-2.0)
61 AC_SUBST(GMODULE_CFLAGS)
62 AC_SUBST(GMODULE_LIBS)
63 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
65 AM_PATH_GTK_2_0(2.6.0, :,
67 *** GTK+ 2.6.0 ior better is required. The latest version of
68 *** GTK+ is always available from ftp://ftp.gtk.org/pub/gtk.]),
71 GTK_MODULES="gtk+-2.0 libxml-2.0 gdk-pixbuf-2.0 gthread-2.0"
72 PKG_CHECK_MODULES(PANGOVERSION, pango >= 1.1.5, ,
73 AC_MSG_ERROR([Need Pango version 1.1.5 or higher]))
74 PKG_CHECK_MODULES(PANGOFT2,pangoft2,have_pangoft2=true,have_pangoft2=false)
75 if test "$have_pangoft2" = "true"; then
76 dnl On Solaris with Forte C, at least, need to link app/dia with -lfreetype.
77 dnl It's not enough that -lpangoft2 implicitly pulls it in.
79 AC_CHECK_LIB(freetype,FT_Init_FreeType,have_freetype=true,have_freetype=false,`freetype-config --libs`)
80 if test "$have_freetype" = "true"; then
81 dnl Need 2.0.9, as a bug was fixed for us there.
82 dnl However, freetype-config doesn't give a meaningful version, so we must
84 AC_MSG_CHECKING([if FreeType version is 2.0.9 or higher])
85 old_CPPFLAGS="$CPPFLAGS"
86 CPPFLAGS="$CPPFLAGS `freetype-config --cflags`"
87 AC_TRY_CPP([#include <ft2build.h>
88 #include FT_FREETYPE_H
89 #if (FREETYPE_MAJOR*1000+FREETYPE_MINOR)*1000+FREETYPE_PATCH < 2000009
90 #error Freetype version too low.
94 FREETYPE_LIBS=`freetype-config --libs`
95 AC_SUBST(FREETYPE_LIBS)
96 FREETYPE_CFLAGS=`freetype-config --cflags`
97 AC_SUBST(FREETYPE_CFLAGS)
98 GTK_MODULES="$GTK_MODULES pangoft2"
99 AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])]
101 [AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])])
102 CPPFLAGS="$old_CPPFLAGS"
104 AC_MSG_ERROR(Can't find FreeType library)
107 AC_MSG_ERROR(Can't find PangoFT2 library)
110 CFLAGS="$FREETYPE_CFLAGS $CFLAGS"
113 PKG_CHECK_MODULES(LIBART,libart-2.0,have_libart=yes,have_libart=no)
114 if test "$have_libart" = "yes" ; then
115 GTK_MODULES="$GTK_MODULES libart-2.0"
116 AC_DEFINE(HAVE_LIBART,1,[Define if building with LIBART support])
119 AC_MSG_CHECKING([whether GNOME specific code should be used])
120 AC_ARG_ENABLE(gnome,[ --enable-gnome enable gnome code],
121 GNOME=$enableval, GNOME=no)
122 if test "$GNOME" = "yes" ; then
123 GTK_MODULES="$GTK_MODULES libgnome-2.0 libgnomeui-2.0"
124 AC_DEFINE(GNOME,1,[Define if building with GNOME support])
125 AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${prefix}/share/pixmaps", [GNOME icon directory])
130 AM_CONDITIONAL(HAVE_GNOME, $have_gnome)
131 AC_MSG_RESULT($GNOME)
133 dnl GTK2: libgnomecanvas-2.0 ?
135 PKG_CHECK_MODULES(GTK,$GTK_MODULES)
139 AM_CONDITIONAL(HAVE_BONOBO,false)
141 dnl Look for Gnome Print
142 AC_ARG_WITH(gnomeprint,
143 [ --with-gnomeprint compile *experimental* gnomeprint plug-in],,with_gnomeprint=no)
144 if test "x$with_gnomeprint" == "xyes"; then
145 PKG_CHECK_MODULES(GNOMEPRINT, libgnomeprint-2.2, have_gnomeprint=yes,have_gnomeprint=no)
146 AC_SUBST(GNOMEPRINT_LIBS)
147 AC_SUBST(GNOMEPRINT_CFLAGS)
148 AC_DEFINE(HAVE_GNOMEPRINT,1,[Define if building with Gnome Print support])
150 AM_CONDITIONAL(WITH_GNOMEPRINT, test "x$with_gnomeprint" != "xno")
154 [ --with-cairo compile *experimental* cairo plug-in],,with_cairo=no)
155 if test "x$with_cairo" != "xno"; then
156 PKG_CHECK_MODULES(CAIROVERSION, cairo >= 0.6.0, ,
157 AC_MSG_ERROR([Need Cairo version 0.6.0 or higher]))
158 PKG_CHECK_MODULES(CAIRO, cairo,have_cairo=yes,have_cairo=no)
160 AC_SUBST(CAIRO_CFLAGS)
161 AC_DEFINE(HAVE_CAIRO,1,[Define if building with Cairo support])
163 AM_CONDITIONAL(WITH_CAIRO, test "x$with_cairo" != "xno")
167 # Check if XSLT is available at all
169 PKG_CHECK_MODULES(XSLT, libxslt, have_xslt=true, have_xslt=false)
170 AM_CONDITIONAL(HAVE_XSLT, $have_xslt)
171 if test "$have_xslt" = "true"; then
173 XSLT_LIBS="`$PKG_CONFIG --libs libxslt`"
174 XSLT_CFLAGS="`$PKG_CONFIG --cflags libxslt`"
179 AC_SUBST(XSLT_CFLAGS)
181 # Figure out a prefix for where to find libxslt at runtime.
182 AC_ARG_WITH(xslt-prefix,
183 [ --with-xslt-prefix=DIR Specify where to find the optional XSLT libraries
185 libxslt_prefix=$withval,
186 libxslt_prefix=/usr/lib)
187 AC_DEFINE_UNQUOTED(LIBXSLT_PREFIX,"$libxslt_prefix", [Place to look for XSLT libs])
193 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [
194 AC_DEFINE(HAVE_LIBPOPT,,[popt library available])
196 AC_CHECK_HEADERS(popt.h)
198 APP_LIBS="$APP_LIBS $POPT_LIBS"
203 dnl this likely already comes from GTK
205 dnl Something in here pollutes $LIBS with -lpng. Make sure to
211 AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)
212 AC_CHECK_LIB(png, png_read_info, ,png_ok=no, -lz -lm)
213 if test "$png_ok" = yes; then
214 AC_MSG_CHECKING([for png_structp in png.h])
215 dnl Why can't AC_LINK_IFELSE take extra libs?
216 old_LDFLAGS="${LDFLAGS}"
217 LDFLAGS="${LDFLAGS} -lz -lm"
218 AC_LINK_IFELSE([#include <png.h>
222 main() { void*foo = png_create_read_struct; }],
225 LDFLAGS="${old_LDFLAGS}"
226 AC_MSG_RESULT($png_ok)
227 if test "$png_ok" = yes; then
228 PNG_LIBS='-lpng -lz -lm'
229 AC_DEFINE(HAVE_LIBPNG,,[PNG library available])
234 LIBS="${old_LIBS} ${PNG_LIBS}"
240 [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
242 enable_debug=minimum)
244 if test "x$enable_debug" = "xyes"; then
245 DEBUG_FLAGS="-g -DENABLE_DEBUG"
247 if test "x$enable_debug" = "xno"; then
253 AC_SUBST(DEBUG_FLAGS)
260 AC_SUBST(GETTEXT_PACKAGE)
261 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Needed for glib gettext])
262 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"
265 dnl INTLOBJS doesn't seem to always get subst'ed, but I believe it's
269 localedir='${prefix}/${DATADIRNAME}/locale'
273 dnl Locate the gnome-xml library
275 dnl GTK2: remove support for libxml1. move check for libxml2 in
276 dnl AM_PATH_GTK_2_0's fourth argument (module is libxml-2.0)
279 if test $found_libxml = false; then
280 AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
281 if test "x$XML2_CONFIG" != x ; then
282 AC_MSG_CHECKING(for libxml >= 2.3.9)
283 vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
285 if test "$vers" -ge 2003009; then
288 XML_LIBS="`$XML2_CONFIG --libs`"
289 XML_CFLAGS="`$XML2_CONFIG --cflags`"
291 if test "$enable_gnome_print" = "yes"; then
292 gnome-config --cflags print | \
293 grep gnome-xml 2>&1 >/dev/null && \
294 AC_MSG_ERROR(libxml2 found but gnome-print uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable gnome-print.)
296 echo $GNOME_CFLAGS | \
297 grep gnome-xml 2>&1 >/dev/null && \
298 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.)
301 AC_MSG_RESULT(not found)
306 if test $found_libxml = false; then
307 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
308 if test "x$XML_CONFIG" != x ; then
309 AC_MSG_CHECKING(for libxml >= 1.8.14)
310 vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
312 dnl 1.18.14 is required for xmlUseNewParser()
313 if test "$vers" -ge 1008014; then
316 XML_LIBS="`$XML_CONFIG --libs`"
317 XML_CFLAGS="`$XML_CONFIG --cflags`"
319 AC_MSG_RESULT(not found)
324 if test $found_libxml = false; then
325 AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably))
331 CFLAGS="$XML_CFLAGS $CFLAGS"
334 AC_CHECK_HEADERS(zlib.h,
335 AC_CHECK_LIB(z, gzread,[
336 AC_DEFINE(HAVE_LIBZ,, we have the libz compression library)
337 if test "x${Z_DIR}" != "x"; then
338 Z_CFLAGS="-I${Z_DIR}/include"
339 Z_LIBS="-L${Z_DIR}/lib -lz"
346 CFLAGS="${CFLAGS} ${Z_CFLAGS}"
347 LIBS="${LIBS} ${Z_LIBS}"
349 dnl Platform-specific fixes.
352 dnl Sun Forte C provides isinf() in the unbundled -lsunmath. Solaris
353 dnl declares finite() in ieeefp.h. It's preferrable not to link
354 dnl to -lsunmath as it's not present on all machines.
356 AC_CHECK_HEADERS(math.h,
357 AC_CHECK_LIB(m,isinf,
360 if test "$have_isinf" = "no"; then
361 AC_CHECK_HEADER(ieeefp.h,
362 [AC_CHECK_FUNC(finite,
363 AC_DEFINE(HAVE_IEEEFP_H,1,
364 [Define if finite() is defined in ieeefp.h]),
365 AC_MSG_ERROR([Can't find a definition of neither
366 finite nor isinf]))],
367 [AC_MSG_ERROR(Can't find neither a definition of
368 isinf nor ieeefp.h)])
370 AC_DEFINE([HAVE_ISINF], 1,
371 [Define if the isinf() function is available])
374 dnl Alpha needs -mieee or we get a segfault
375 dnl This shouldn't be needed but is here until a real solution is found
378 CFLAGS="$CFLAGS -mieee"
382 if test "$GCC" = yes; then
383 dnl Relieve register pressure on i386. Other architectures may become unable
384 dnl to debug, and usually have more registers anyway.
387 dnl DIA_CHECK_CFLAG(-fomit-frame-pointer)
390 dnl (it looks like gdb is very confused by this now even on x86. We might be
391 dnl getting poor stack traces with bug-buddy because of this)
393 DIA_CHECK_CFLAG(-Wall)
394 DIA_CHECK_CFLAG(-Wunused)
395 DIA_CHECK_CFLAG(--std=c89)
396 DIA_CHECK_CFLAG(-Wdeclaration-after-statement)
397 dnl I'd rather like to enable this but it fails on isnan() with -std=c89
398 dnl DIA_CHECK_CFLAG(-Werror-implicit-function-declaration)
399 dnl Premature optimization is the root of all evil. Uncomment this if
400 dnl you want ti figure out functions that should have been inlined but aint.
401 dnl DIA_CHECK_CFLAG(-Winline)
402 DIA_CHECK_CFLAG(-Wmissing-prototypes)
403 DIA_CHECK_CFLAG(-Wmissing-declarations)
404 DIA_CHECK_CFLAG(-finline-functions)
405 DIA_CHECK_CFLAG(-fstrict-aliasing)
408 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = yes)
410 dnl Do we have the db2html script to build the documentation?
411 AC_ARG_ENABLE(db2html,
412 [ --enable-db2html don't rebuild documentation],,enable_db2html=no)
413 AC_PATH_PROG(DB2HTML, db2html, no)
414 AM_CONDITIONAL(HAVE_DB2HTML,
415 test "x$enable_db2html" != xno && test "x$DB2HTML" != xno)
417 dnl Only enable man page generation if we have db2man (in maintainer mode)
420 dnl Have to have the nwalsh docbook.xsl, which does manpages.
421 dnl RedHat installs it in a version-numbered place. Grumpf.
422 AC_PATH_PROG(XSLTPROC, xsltproc, no)
423 AM_CONDITIONAL(HAVE_DB2MAN, test "x$XSLTPROC" != xno)
424 AC_SUBST(DB2MAN, "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl")
426 dnl Handling for Python
428 [ --with-python compile python plug-in],,with_python=no)
430 if test "x$with_python" != xno; then
431 AM_PATH_PYTHON(1.5.2)
432 AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
433 AM_CHECK_PYTHON_HEADERS
436 if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then
437 AC_MSG_ERROR([could not find files required to build python plugin])
440 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno")
448 dnl objects/sybase/Makefile
449 objects/AADL/Makefile
450 objects/bondgraph/Makefile
451 objects/chronogram/Makefile
452 objects/custom/Makefile
454 objects/flowchart/Makefile
456 objects/GRAFCET/Makefile
457 objects/Istar/Makefile
458 objects/Jackson/Makefile
459 objects/KAOS/Makefile
460 objects/Misc/Makefile
461 objects/network/Makefile
462 objects/SADT/Makefile
463 objects/standard/Makefile
466 shapes/Assorted/Makefile
467 shapes/ChemEng/Makefile
468 shapes/Circuit/Makefile
469 shapes/Cisco/Makefile
470 shapes/Civil/Makefile
471 shapes/Contact/Makefile
472 shapes/Cybernetics/Makefile
473 shapes/Electric/Makefile
474 shapes/flowchart/Makefile
475 shapes/Gane_and_Sarson/Makefile
476 shapes/jigsaw/Makefile
477 shapes/Logic/Makefile
479 shapes/Map/Isometric/Makefile
482 shapes/network/Makefile
483 shapes/Pneumatic/Makefile
486 shapes/sybase/Makefile
492 sheets/GRAFCET/Makefile
493 sheets/Istar/Makefile
494 sheets/Jackson/Makefile
498 plug-ins/cgm/Makefile
499 plug-ins/cairo/Makefile
500 plug-ins/dxf/Makefile
501 plug-ins/gprint/Makefile
502 plug-ins/hpgl/Makefile
503 plug-ins/metapost/Makefile
504 plug-ins/pixbuf/Makefile
505 plug-ins/pstricks/Makefile
506 plug-ins/pgf/Makefile
507 plug-ins/python/Makefile
508 plug-ins/shape/Makefile
509 plug-ins/svg/Makefile
510 plug-ins/wmf/Makefile
511 plug-ins/wpg/Makefile
512 plug-ins/xfig/Makefile
513 plug-ins/xslt/Makefile
520 dnl GTK2: simplify this, we will have much less options.
524 Source code location: ${srcdir}
527 Gnome support: ${GNOME}
528 Python support: ${with_python}
529 Libart support (PNG export): ${have_libart}
530 Cairo support (experimental): ${with_cairo}
531 Gnome Print support (experimental): ${with_gnomeprint}
534 echo "Now type make to build dia..."