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.241 $)
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 AM_PATH_GTK_2_0(2.0.0)
58 GTK_MODULES="gtk+-2.0 libxml-2.0 gdk-pixbuf-2.0"
59 PKG_CHECK_MODULES(PANGOVERSION, pango >= 1.1.5, ,
60 AC_MSG_ERROR([Need Pango version 1.1.5 or higher]))
61 PKG_CHECK_MODULES(PANGOFT2,pangoft2,have_pangoft2=true,have_pangoft2=false)
62 if test "$have_pangoft2" = "true"; then
63 dnl On Solaris with Forte C, at least, need to link app/dia with -lfreetype.
64 dnl It's not enough that -lpangoft2 implicitly pulls it in.
66 AC_CHECK_LIB(freetype,FT_Init_FreeType,have_freetype=true,have_freetype=false,`freetype-config --libs`)
67 if test "$have_freetype" = "true"; then
68 dnl Need 2.0.9, as a bug was fixed for us there.
69 dnl However, freetype-config doesn't give a meaningful version, so we must
71 AC_MSG_CHECKING([if FreeType version is 2.0.9 or higher])
72 old_CPPFLAGS="$CPPFLAGS"
73 CPPFLAGS="$CPPFLAGS `freetype-config --cflags`"
74 AC_TRY_CPP([#include <ft2build.h>
75 #include FT_FREETYPE_H
76 #if (FREETYPE_MAJOR*1000+FREETYPE_MINOR)*1000+FREETYPE_PATCH < 2000009
77 #error Freetype version too low.
81 FREETYPE_LIBS=`freetype-config --libs`
82 AC_SUBST(FREETYPE_LIBS)
83 FREETYPE_CFLAGS=`freetype-config --cflags`
84 AC_SUBST(FREETYPE_CFLAGS)
85 GTK_MODULES="$GTK_MODULES pangoft2"
86 AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])]
88 [AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])])
89 CPPFLAGS="$old_CPPFLAGS"
91 AC_MSG_ERROR(Can't find FreeType library)
94 AC_MSG_ERROR(Can't find PangoFT2 library)
97 CFLAGS="$FREETYPE_CFLAGS $CFLAGS"
100 PKG_CHECK_MODULES(LIBART,libart-2.0,have_libart=yes,have_libart=no)
101 if test "$have_libart" = "yes" ; then
102 GTK_MODULES="$GTK_MODULES libart-2.0"
103 AC_DEFINE(HAVE_LIBART,1,[Define if building with LIBART support])
106 AC_MSG_CHECKING([whether GNOME specific code should be used])
107 AC_ARG_ENABLE(gnome,[ --enable-gnome enable gnome code],
108 GNOME=$enableval, GNOME=no)
109 if test "$GNOME" = "yes" ; then
110 GTK_MODULES="$GTK_MODULES libgnome-2.0 libgnomeui-2.0"
111 AC_DEFINE(GNOME,1,[Define if building with GNOME support])
112 AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${prefix}/share/pixmaps", [GNOME icon directory])
117 AM_CONDITIONAL(HAVE_GNOME, $have_gnome)
118 AC_MSG_RESULT($GNOME)
120 dnl GTK2: libgnomecanvas-2.0 ?
122 PKG_CHECK_MODULES(GTK,$GTK_MODULES)
123 AM_CONDITIONAL(HAVE_BONOBO,false)
127 [ --with-cairo compile cairo plug-in],,with_cairo=no)
128 if test "x$with_cairo" != "xno"; then
129 PKG_CHECK_MODULES(CAIRO, cairo,have_cairo=yes,have_cairo=no)
131 AC_SUBST(CAIRO_CFLAGS)
132 AC_DEFINE(HAVE_CAIRO,1,[Define if building with Cairo support])
134 AM_CONDITIONAL(WITH_CAIRO, test "x$with_cairo" != "xno")
138 # Check if XSLT is available at all
140 PKG_CHECK_MODULES(XSLT, libxslt, have_xslt=true, have_xslt=false)
141 AM_CONDITIONAL(HAVE_XSLT, $have_xslt)
142 if test "$have_xslt" = "true"; then
144 XSLT_LIBS="`$PKG_CONFIG --libs libxslt`"
145 XSLT_CFLAGS="`$PKG_CONFIG --cflags libxslt`"
150 AC_SUBST(XSLT_CFLAGS)
152 # Figure out a prefix for where to find libxslt at runtime.
153 AC_ARG_WITH(xslt-prefix,
154 [ --with-xslt-prefix=DIR Specify where to find the optional XSLT libraries
156 libxslt_prefix=$withval,
157 libxslt_prefix=/usr/lib)
158 AC_DEFINE_UNQUOTED(LIBXSLT_PREFIX,"$libxslt_prefix", [Place to look for XSLT libs])
164 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [
165 AC_DEFINE(HAVE_LIBPOPT,,[popt library available])
167 AC_CHECK_HEADERS(popt.h)
169 APP_LIBS="$APP_LIBS $POPT_LIBS"
174 dnl this likely already comes from GTK
176 dnl Something in here pollutes $LIBS with -lpng. Make sure to
182 AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)
183 AC_CHECK_LIB(png, png_read_info, ,png_ok=no, -lz -lm)
184 if test "$png_ok" = yes; then
185 AC_MSG_CHECKING([for png_structp in png.h])
186 dnl Why can't AC_LINK_IFELSE take extra libs?
187 old_LDFLAGS="${LDFLAGS}"
188 LDFLAGS="${LDFLAGS} -lz -lm"
189 AC_LINK_IFELSE([#include <png.h>
193 main() { void*foo = png_create_read_struct; }],
196 LDFLAGS="${old_LDFLAGS}"
197 AC_MSG_RESULT($png_ok)
198 if test "$png_ok" = yes; then
199 PNG_LIBS='-lpng -lz -lm'
200 AC_DEFINE(HAVE_LIBPNG,,[PNG library available])
205 LIBS="${old_LIBS} ${PNG_LIBS}"
211 [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
213 enable_debug=minimum)
215 if test "x$enable_debug" = "xyes"; then
216 DEBUG_FLAGS="-g -DENABLE_DEBUG"
218 if test "x$enable_debug" = "xno"; then
224 AC_SUBST(DEBUG_FLAGS)
231 AC_SUBST(GETTEXT_PACKAGE)
232 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Needed for glib gettext])
233 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"
236 dnl INTLOBJS doesn't seem to always get subst'ed, but I believe it's
240 localedir='${prefix}/${DATADIRNAME}/locale'
244 dnl Locate the gnome-xml library
246 dnl GTK2: remove support for libxml1. move check for libxml2 in
247 dnl AM_PATH_GTK_2_0's fourth argument (module is libxml-2.0)
250 if test $found_libxml = false; then
251 AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
252 if test "x$XML2_CONFIG" != x ; then
253 AC_MSG_CHECKING(for libxml >= 2.3.9)
254 vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
256 if test "$vers" -ge 2003009; then
259 XML_LIBS="`$XML2_CONFIG --libs`"
260 XML_CFLAGS="`$XML2_CONFIG --cflags`"
262 if test "$enable_gnome_print" = "yes"
264 gnome-config --cflags print | \
265 grep gnome-xml 2>&1 >/dev/null && \
266 AC_MSG_ERROR(libxml2 found but gnome-print uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable gnome-print.)
268 echo $GNOME_CFLAGS | \
269 grep gnome-xml 2>&1 >/dev/null && \
270 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.)
273 AC_MSG_RESULT(not found)
278 if test $found_libxml = false; then
279 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
280 if test "x$XML_CONFIG" != x ; then
281 AC_MSG_CHECKING(for libxml >= 1.8.14)
282 vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
284 dnl 1.18.14 is required for xmlUseNewParser()
285 if test "$vers" -ge 1008014; then
288 XML_LIBS="`$XML_CONFIG --libs`"
289 XML_CFLAGS="`$XML_CONFIG --cflags`"
291 AC_MSG_RESULT(not found)
296 if test $found_libxml = false; then
297 AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably))
303 CFLAGS="$XML_CFLAGS $CFLAGS"
306 AC_CHECK_HEADERS(zlib.h,
307 AC_CHECK_LIB(z, gzread,[
308 AC_DEFINE(HAVE_LIBZ,, we have the libz compression library)
309 if test "x${Z_DIR}" != "x"; then
310 Z_CFLAGS="-I${Z_DIR}/include"
311 Z_LIBS="-L${Z_DIR}/lib -lz"
318 CFLAGS="${CFLAGS} ${Z_CFLAGS}"
319 LIBS="${LIBS} ${Z_LIBS}"
321 dnl Platform-specific fixes.
324 dnl Sun Forte C provides isinf() in the unbundled -lsunmath. Solaris
325 dnl declares finite() in ieeefp.h. It's preferrable not to link
326 dnl to -lsunmath as it's not present on all machines.
328 AC_CHECK_HEADERS(math.h,
329 AC_CHECK_LIB(m,isinf,
332 if test "$have_isinf" = "no"; then
333 AC_CHECK_HEADER(ieeefp.h,
334 [AC_CHECK_FUNC(finite,
335 AC_DEFINE(HAVE_IEEEFP_H,1,
336 [Define if finite() is defined in ieeefp.h]),
337 AC_MSG_ERROR([Can't find a definition of neither
338 finite nor isinf]))],
339 [AC_MSG_ERROR(Can't find neither a definition of
340 isinf nor ieeefp.h)])
342 AC_DEFINE([HAVE_ISINF], 1,
343 [Define if the isinf() function is available])
346 dnl Alpha needs -mieee or we get a segfault
347 dnl This shouldn't be needed but is here until a real solution is found
350 CFLAGS="$CFLAGS -mieee"
354 if test "$GCC" = yes; then
355 dnl Relieve register pressure on i386. Other architectures may become unable
356 dnl to debug, and usually have more registers anyway.
359 dnl DIA_CHECK_CFLAG(-fomit-frame-pointer)
362 dnl (it looks like gdb is very confused by this now even on x86. We might be
363 dnl getting poor stack traces with bug-buddy because of this)
365 DIA_CHECK_CFLAG(-Wall)
366 DIA_CHECK_CFLAG(-Wunused)
367 dnl Premature optimization is the root of all evil. Uncomment this if
368 dnl you want ti figure out functions that should have been inlined but aint.
369 dnl DIA_CHECK_CFLAG(-Winline)
370 DIA_CHECK_CFLAG(-Wmissing-prototypes)
371 DIA_CHECK_CFLAG(-Wmissing-declarations)
372 DIA_CHECK_CFLAG(-finline-functions)
373 DIA_CHECK_CFLAG(-fstrict-aliasing)
376 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = yes)
378 dnl Do we have the db2html script to build the documentation?
379 AC_ARG_ENABLE(db2html,
380 [ --enable-db2html don't rebuild documentation],,enable_db2html=no)
381 AC_PATH_PROG(DB2HTML, db2html, no)
382 AM_CONDITIONAL(HAVE_DB2HTML,
383 test "x$enable_db2html" != xno && test "x$DB2HTML" != xno)
385 dnl Only enable man page generation if we have db2man (in maintainer mode)
387 dnl Have to have the nwalsh docbook.xsl, which does manpages.
388 dnl RedHat installs it in a version-numbered place. Grumpf.
391 /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl \
392 /usr/share/sgml/docbook/xsl-stylesheets-\*/manpages/docbook.xsl; do
393 if test -f $file; then db2man_file=$file; break; fi
395 AM_CONDITIONAL(HAVE_DB2MAN, test "x$db2man_file" != x)
396 AC_SUBST(DB2MAN, "$db2man_file")
398 dnl Handling for Python
400 [ --with-python compile python plug-in],,with_python=no)
402 if test "x$with_python" != xno; then
403 AM_PATH_PYTHON(1.5.2)
404 AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
405 AM_CHECK_PYTHON_HEADERS
408 if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then
409 AC_MSG_ERROR([could not find files required to build python plugin])
412 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno")
420 dnl objects/sybase/Makefile
421 objects/bondgraph/Makefile
422 objects/chronogram/Makefile
423 objects/custom/Makefile
425 objects/flowchart/Makefile
427 objects/GRAFCET/Makefile
428 objects/Istar/Makefile
429 objects/Jackson/Makefile
430 objects/KAOS/Makefile
431 objects/Misc/Makefile
432 objects/network/Makefile
433 objects/SADT/Makefile
434 objects/standard/Makefile
437 shapes/Assorted/Makefile
438 shapes/ChemEng/Makefile
439 shapes/Circuit/Makefile
440 shapes/Cisco/Makefile
441 shapes/Civil/Makefile
442 shapes/Contact/Makefile
443 shapes/Cybernetics/Makefile
444 shapes/Electric/Makefile
445 shapes/flowchart/Makefile
446 shapes/jigsaw/Makefile
447 shapes/Logic/Makefile
449 shapes/Map/Isometric/Makefile
452 shapes/network/Makefile
453 shapes/Pneumatic/Makefile
456 shapes/sybase/Makefile
462 sheets/GRAFCET/Makefile
463 sheets/Istar/Makefile
464 sheets/Jackson/Makefile
468 plug-ins/cgm/Makefile
469 plug-ins/cairo/Makefile
470 plug-ins/dxf/Makefile
471 plug-ins/hpgl/Makefile
472 plug-ins/metapost/Makefile
473 plug-ins/pixbuf/Makefile
474 plug-ins/pstricks/Makefile
475 plug-ins/python/Makefile
476 plug-ins/shape/Makefile
477 plug-ins/svg/Makefile
478 plug-ins/wmf/Makefile
479 plug-ins/wpg/Makefile
480 plug-ins/xfig/Makefile
481 plug-ins/xslt/Makefile
487 dnl GTK2: simplify this, we will have much less options.
491 Source code location: ${srcdir}
494 Gnome support: ${GNOME}
495 Python support: ${with_python}
496 Libart support (PNG export): ${have_libart}
497 Cairo support (experimental): ${have_cairo}
500 echo "Now type make to build dia..."