1 dnl Process this -*- autoconf -*- file with autoconf to produce a
3 AC_INIT(dia, 0.94, 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.245 $)
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)
60 AM_PATH_GTK_2_0(2.4.0)
62 GTK_MODULES="gtk+-2.0 libxml-2.0 gdk-pixbuf-2.0 gthread-2.0"
63 PKG_CHECK_MODULES(PANGOVERSION, pango >= 1.1.5, ,
64 AC_MSG_ERROR([Need Pango version 1.1.5 or higher]))
65 PKG_CHECK_MODULES(PANGOFT2,pangoft2,have_pangoft2=true,have_pangoft2=false)
66 if test "$have_pangoft2" = "true"; then
67 dnl On Solaris with Forte C, at least, need to link app/dia with -lfreetype.
68 dnl It's not enough that -lpangoft2 implicitly pulls it in.
70 AC_CHECK_LIB(freetype,FT_Init_FreeType,have_freetype=true,have_freetype=false,`freetype-config --libs`)
71 if test "$have_freetype" = "true"; then
72 dnl Need 2.0.9, as a bug was fixed for us there.
73 dnl However, freetype-config doesn't give a meaningful version, so we must
75 AC_MSG_CHECKING([if FreeType version is 2.0.9 or higher])
76 old_CPPFLAGS="$CPPFLAGS"
77 CPPFLAGS="$CPPFLAGS `freetype-config --cflags`"
78 AC_TRY_CPP([#include <ft2build.h>
79 #include FT_FREETYPE_H
80 #if (FREETYPE_MAJOR*1000+FREETYPE_MINOR)*1000+FREETYPE_PATCH < 2000009
81 #error Freetype version too low.
85 FREETYPE_LIBS=`freetype-config --libs`
86 AC_SUBST(FREETYPE_LIBS)
87 FREETYPE_CFLAGS=`freetype-config --cflags`
88 AC_SUBST(FREETYPE_CFLAGS)
89 GTK_MODULES="$GTK_MODULES pangoft2"
90 AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])]
92 [AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])])
93 CPPFLAGS="$old_CPPFLAGS"
95 AC_MSG_ERROR(Can't find FreeType library)
98 AC_MSG_ERROR(Can't find PangoFT2 library)
101 CFLAGS="$FREETYPE_CFLAGS $CFLAGS"
104 PKG_CHECK_MODULES(LIBART,libart-2.0,have_libart=yes,have_libart=no)
105 if test "$have_libart" = "yes" ; then
106 GTK_MODULES="$GTK_MODULES libart-2.0"
107 AC_DEFINE(HAVE_LIBART,1,[Define if building with LIBART support])
110 AC_MSG_CHECKING([whether GNOME specific code should be used])
111 AC_ARG_ENABLE(gnome,[ --enable-gnome enable gnome code],
112 GNOME=$enableval, GNOME=no)
113 if test "$GNOME" = "yes" ; then
114 GTK_MODULES="$GTK_MODULES libgnome-2.0 libgnomeui-2.0"
115 AC_DEFINE(GNOME,1,[Define if building with GNOME support])
116 AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${prefix}/share/pixmaps", [GNOME icon directory])
121 AM_CONDITIONAL(HAVE_GNOME, $have_gnome)
122 AC_MSG_RESULT($GNOME)
124 dnl GTK2: libgnomecanvas-2.0 ?
126 PKG_CHECK_MODULES(GTK,$GTK_MODULES)
130 AM_CONDITIONAL(HAVE_BONOBO,false)
132 dnl Look for Gnome Print
133 AC_ARG_WITH(gnomeprint,
134 [ --with-gnomeprint compile *experimental* gnomeprint plug-in],,with_gnomeprint=no)
135 if test "x$with_gprint" != "xno"; then
136 PKG_CHECK_MODULES(GNOMEPRINT, libgnomeprint-2.2, have_gnomeprint=yes,have_gnomeprint=no)
137 AC_SUBST(GNOMEPRINT_LIBS)
138 AC_SUBST(GNOMEPRINT_CFLAGS)
139 AC_DEFINE(HAVE_GNOMEPRINT,1,[Define if building with Gnome Print support])
141 AM_CONDITIONAL(WITH_GNOMEPRINT, test "x$with_gnomeprint" != "xno")
145 [ --with-cairo compile *experimental* cairo plug-in],,with_cairo=no)
146 if test "x$with_cairo" != "xno"; then
147 PKG_CHECK_MODULES(CAIRO, cairo,have_cairo=yes,have_cairo=no)
149 AC_SUBST(CAIRO_CFLAGS)
150 AC_DEFINE(HAVE_CAIRO,1,[Define if building with Cairo support])
152 AM_CONDITIONAL(WITH_CAIRO, test "x$with_cairo" != "xno")
156 # Check if XSLT is available at all
158 PKG_CHECK_MODULES(XSLT, libxslt, have_xslt=true, have_xslt=false)
159 AM_CONDITIONAL(HAVE_XSLT, $have_xslt)
160 if test "$have_xslt" = "true"; then
162 XSLT_LIBS="`$PKG_CONFIG --libs libxslt`"
163 XSLT_CFLAGS="`$PKG_CONFIG --cflags libxslt`"
168 AC_SUBST(XSLT_CFLAGS)
170 # Figure out a prefix for where to find libxslt at runtime.
171 AC_ARG_WITH(xslt-prefix,
172 [ --with-xslt-prefix=DIR Specify where to find the optional XSLT libraries
174 libxslt_prefix=$withval,
175 libxslt_prefix=/usr/lib)
176 AC_DEFINE_UNQUOTED(LIBXSLT_PREFIX,"$libxslt_prefix", [Place to look for XSLT libs])
182 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [
183 AC_DEFINE(HAVE_LIBPOPT,,[popt library available])
185 AC_CHECK_HEADERS(popt.h)
187 APP_LIBS="$APP_LIBS $POPT_LIBS"
192 dnl this likely already comes from GTK
194 dnl Something in here pollutes $LIBS with -lpng. Make sure to
200 AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)
201 AC_CHECK_LIB(png, png_read_info, ,png_ok=no, -lz -lm)
202 if test "$png_ok" = yes; then
203 AC_MSG_CHECKING([for png_structp in png.h])
204 dnl Why can't AC_LINK_IFELSE take extra libs?
205 old_LDFLAGS="${LDFLAGS}"
206 LDFLAGS="${LDFLAGS} -lz -lm"
207 AC_LINK_IFELSE([#include <png.h>
211 main() { void*foo = png_create_read_struct; }],
214 LDFLAGS="${old_LDFLAGS}"
215 AC_MSG_RESULT($png_ok)
216 if test "$png_ok" = yes; then
217 PNG_LIBS='-lpng -lz -lm'
218 AC_DEFINE(HAVE_LIBPNG,,[PNG library available])
223 LIBS="${old_LIBS} ${PNG_LIBS}"
229 [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
231 enable_debug=minimum)
233 if test "x$enable_debug" = "xyes"; then
234 DEBUG_FLAGS="-g -DENABLE_DEBUG"
236 if test "x$enable_debug" = "xno"; then
242 AC_SUBST(DEBUG_FLAGS)
249 AC_SUBST(GETTEXT_PACKAGE)
250 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Needed for glib gettext])
251 ALL_LINGUAS="am az be bs ca cs da de el en_CA en_GB es fi fr ga gu hr hu is it ja ko mk mn ml ms nb nl nn no pl pt pt_BR ro ru sk sl sq sr sr@Latn sv tr uk vi zh_CN zh_TW"
254 dnl INTLOBJS doesn't seem to always get subst'ed, but I believe it's
258 localedir='${prefix}/${DATADIRNAME}/locale'
262 dnl Locate the gnome-xml library
264 dnl GTK2: remove support for libxml1. move check for libxml2 in
265 dnl AM_PATH_GTK_2_0's fourth argument (module is libxml-2.0)
268 if test $found_libxml = false; then
269 AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
270 if test "x$XML2_CONFIG" != x ; then
271 AC_MSG_CHECKING(for libxml >= 2.3.9)
272 vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
274 if test "$vers" -ge 2003009; then
277 XML_LIBS="`$XML2_CONFIG --libs`"
278 XML_CFLAGS="`$XML2_CONFIG --cflags`"
280 if test "$enable_gnome_print" = "yes"
282 gnome-config --cflags print | \
283 grep gnome-xml 2>&1 >/dev/null && \
284 AC_MSG_ERROR(libxml2 found but gnome-print uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable gnome-print.)
286 echo $GNOME_CFLAGS | \
287 grep gnome-xml 2>&1 >/dev/null && \
288 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.)
291 AC_MSG_RESULT(not found)
296 if test $found_libxml = false; then
297 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
298 if test "x$XML_CONFIG" != x ; then
299 AC_MSG_CHECKING(for libxml >= 1.8.14)
300 vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
302 dnl 1.18.14 is required for xmlUseNewParser()
303 if test "$vers" -ge 1008014; then
306 XML_LIBS="`$XML_CONFIG --libs`"
307 XML_CFLAGS="`$XML_CONFIG --cflags`"
309 AC_MSG_RESULT(not found)
314 if test $found_libxml = false; then
315 AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably))
321 CFLAGS="$XML_CFLAGS $CFLAGS"
324 AC_CHECK_HEADERS(zlib.h,
325 AC_CHECK_LIB(z, gzread,[
326 AC_DEFINE(HAVE_LIBZ,, we have the libz compression library)
327 if test "x${Z_DIR}" != "x"; then
328 Z_CFLAGS="-I${Z_DIR}/include"
329 Z_LIBS="-L${Z_DIR}/lib -lz"
336 CFLAGS="${CFLAGS} ${Z_CFLAGS}"
337 LIBS="${LIBS} ${Z_LIBS}"
339 dnl Platform-specific fixes.
342 dnl Sun Forte C provides isinf() in the unbundled -lsunmath. Solaris
343 dnl declares finite() in ieeefp.h. It's preferrable not to link
344 dnl to -lsunmath as it's not present on all machines.
346 AC_CHECK_HEADERS(math.h,
347 AC_CHECK_LIB(m,isinf,
350 if test "$have_isinf" = "no"; then
351 AC_CHECK_HEADER(ieeefp.h,
352 [AC_CHECK_FUNC(finite,
353 AC_DEFINE(HAVE_IEEEFP_H,1,
354 [Define if finite() is defined in ieeefp.h]),
355 AC_MSG_ERROR([Can't find a definition of neither
356 finite nor isinf]))],
357 [AC_MSG_ERROR(Can't find neither a definition of
358 isinf nor ieeefp.h)])
360 AC_DEFINE([HAVE_ISINF], 1,
361 [Define if the isinf() function is available])
364 dnl Alpha needs -mieee or we get a segfault
365 dnl This shouldn't be needed but is here until a real solution is found
368 CFLAGS="$CFLAGS -mieee"
372 if test "$GCC" = yes; then
373 dnl Relieve register pressure on i386. Other architectures may become unable
374 dnl to debug, and usually have more registers anyway.
377 dnl DIA_CHECK_CFLAG(-fomit-frame-pointer)
380 dnl (it looks like gdb is very confused by this now even on x86. We might be
381 dnl getting poor stack traces with bug-buddy because of this)
383 DIA_CHECK_CFLAG(-Wall)
384 DIA_CHECK_CFLAG(-Wunused)
385 dnl Premature optimization is the root of all evil. Uncomment this if
386 dnl you want ti figure out functions that should have been inlined but aint.
387 dnl DIA_CHECK_CFLAG(-Winline)
388 DIA_CHECK_CFLAG(-Wmissing-prototypes)
389 DIA_CHECK_CFLAG(-Wmissing-declarations)
390 DIA_CHECK_CFLAG(-finline-functions)
391 DIA_CHECK_CFLAG(-fstrict-aliasing)
394 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = yes)
396 dnl Do we have the db2html script to build the documentation?
397 AC_ARG_ENABLE(db2html,
398 [ --enable-db2html don't rebuild documentation],,enable_db2html=no)
399 AC_PATH_PROG(DB2HTML, db2html, no)
400 AM_CONDITIONAL(HAVE_DB2HTML,
401 test "x$enable_db2html" != xno && test "x$DB2HTML" != xno)
403 dnl Only enable man page generation if we have db2man (in maintainer mode)
405 dnl Have to have the nwalsh docbook.xsl, which does manpages.
406 dnl RedHat installs it in a version-numbered place. Grumpf.
409 /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl \
410 /usr/share/sgml/docbook/xsl-stylesheets-\*/manpages/docbook.xsl; do
411 if test -f $file; then db2man_file=$file; break; fi
413 AM_CONDITIONAL(HAVE_DB2MAN, test "x$db2man_file" != x)
414 AC_SUBST(DB2MAN, "$db2man_file")
416 dnl Handling for Python
418 [ --with-python compile python plug-in],,with_python=no)
420 if test "x$with_python" != xno; then
421 AM_PATH_PYTHON(1.5.2)
422 AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
423 AM_CHECK_PYTHON_HEADERS
426 if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then
427 AC_MSG_ERROR([could not find files required to build python plugin])
430 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno")
438 dnl objects/sybase/Makefile
439 objects/bondgraph/Makefile
440 objects/chronogram/Makefile
441 objects/custom/Makefile
443 objects/flowchart/Makefile
445 objects/GRAFCET/Makefile
446 objects/Istar/Makefile
447 objects/Jackson/Makefile
448 objects/KAOS/Makefile
449 objects/Misc/Makefile
450 objects/network/Makefile
451 objects/SADT/Makefile
452 objects/standard/Makefile
455 shapes/Assorted/Makefile
456 shapes/ChemEng/Makefile
457 shapes/Circuit/Makefile
458 shapes/Cisco/Makefile
459 shapes/Civil/Makefile
460 shapes/Contact/Makefile
461 shapes/Cybernetics/Makefile
462 shapes/Electric/Makefile
463 shapes/flowchart/Makefile
464 shapes/jigsaw/Makefile
465 shapes/Logic/Makefile
467 shapes/Map/Isometric/Makefile
470 shapes/network/Makefile
471 shapes/Pneumatic/Makefile
474 shapes/sybase/Makefile
480 sheets/GRAFCET/Makefile
481 sheets/Istar/Makefile
482 sheets/Jackson/Makefile
486 plug-ins/cgm/Makefile
487 plug-ins/cairo/Makefile
488 plug-ins/dxf/Makefile
489 plug-ins/gprint/Makefile
490 plug-ins/hpgl/Makefile
491 plug-ins/metapost/Makefile
492 plug-ins/pixbuf/Makefile
493 plug-ins/pstricks/Makefile
494 plug-ins/python/Makefile
495 plug-ins/shape/Makefile
496 plug-ins/svg/Makefile
497 plug-ins/wmf/Makefile
498 plug-ins/wpg/Makefile
499 plug-ins/xfig/Makefile
500 plug-ins/xslt/Makefile
506 dnl GTK2: simplify this, we will have much less options.
510 Source code location: ${srcdir}
513 Gnome support: ${GNOME}
514 Python support: ${with_python}
515 Libart support (PNG export): ${have_libart}
516 Cairo support (experimental): ${have_cairo}
517 Gnome Print support (experimental): ${have_gnomeprint}
520 echo "Now type make to build dia..."