1 dnl Process this -*- autoconf -*- file with autoconf to produce a
3 AC_INIT(dia, 0.93+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.231 $)
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)
133 AM_CONDITIONAL(WITH_CAIRO, test "x$with_cairo" != "xno")
137 # Check if XSLT is available at all
139 PKG_CHECK_MODULES(XSLT, libxslt, have_xslt=true, have_xslt=false)
140 AM_CONDITIONAL(HAVE_XSLT, $have_xslt)
141 if test "$have_xslt" = "true"; then
143 XSLT_LIBS="`$PKG_CONFIG --libs libxslt`"
144 XSLT_CFLAGS="`$PKG_CONFIG --cflags libxslt`"
149 AC_SUBST(XSLT_CFLAGS)
151 # Figure out a prefix for where to find libxslt at runtime.
152 AC_ARG_WITH(xslt-prefix,
153 [ --with-xslt-prefix=DIR Specify where to find the optional XSLT libraries
155 libxslt_prefix=$withval,
156 libxslt_prefix=/usr/lib)
157 AC_DEFINE_UNQUOTED(LIBXSLT_PREFIX,"$libxslt_prefix", [Place to look for XSLT libs])
163 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [
164 AC_DEFINE(HAVE_LIBPOPT,,[popt library available])
166 AC_CHECK_HEADERS(popt.h)
168 APP_LIBS="$APP_LIBS $POPT_LIBS"
173 dnl this likely already comes from GTK
175 dnl Something in here pollutes $LIBS with -lpng. Make sure to
181 AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)
182 AC_CHECK_LIB(png, png_read_info, ,png_ok=no, -lz -lm)
183 if test "$png_ok" = yes; then
184 AC_MSG_CHECKING([for png_structp in png.h])
185 dnl Why can't AC_LINK_IFELSE take extra libs?
186 old_LDFLAGS="${LDFLAGS}"
187 LDFLAGS="${LDFLAGS} -lz -lm"
188 AC_LINK_IFELSE([#include <png.h>
192 main() { void*foo = png_create_read_struct; }],
195 LDFLAGS="${old_LDFLAGS}"
196 AC_MSG_RESULT($png_ok)
197 if test "$png_ok" = yes; then
198 PNG_LIBS='-lpng -lz -lm'
199 AC_DEFINE(HAVE_LIBPNG,,[PNG library available])
204 LIBS="${old_LIBS} ${PNG_LIBS}"
210 [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
212 enable_debug=minimum)
214 if test "x$enable_debug" = "xyes"; then
215 DEBUG_FLAGS="-g -DENABLE_DEBUG"
217 if test "x$enable_debug" = "xno"; then
223 AC_SUBST(DEBUG_FLAGS)
230 AC_SUBST(GETTEXT_PACKAGE)
231 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Needed for glib gettext])
232 ALL_LINGUAS="am az be ca cs da de el en_CA en_GB es fi fr ga hr hu is it ja ko mk mn ml ms nl nn no pl pt pt_BR ro ru sk sl sq sr sr@Latn sv tr uk vi zh_CN zh_TW"
235 dnl INTLOBJS doesn't seem to always get subst'ed, but I believe it's
239 localedir='${prefix}/${DATADIRNAME}/locale'
243 dnl Locate the gnome-xml library
245 dnl GTK2: remove support for libxml1. move check for libxml2 in
246 dnl AM_PATH_GTK_2_0's fourth argument (module is libxml-2.0)
249 if test $found_libxml = false; then
250 AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
251 if test "x$XML2_CONFIG" != x ; then
252 AC_MSG_CHECKING(for libxml >= 2.3.9)
253 vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
255 if test "$vers" -ge 2003009; then
258 XML_LIBS="`$XML2_CONFIG --libs`"
259 XML_CFLAGS="`$XML2_CONFIG --cflags`"
261 if test "$enable_gnome_print" = "yes"
263 gnome-config --cflags print | \
264 grep gnome-xml 2>&1 >/dev/null && \
265 AC_MSG_ERROR(libxml2 found but gnome-print uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable gnome-print.)
267 echo $GNOME_CFLAGS | \
268 grep gnome-xml 2>&1 >/dev/null && \
269 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.)
272 AC_MSG_RESULT(not found)
277 if test $found_libxml = false; then
278 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
279 if test "x$XML_CONFIG" != x ; then
280 AC_MSG_CHECKING(for libxml >= 1.8.14)
281 vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
283 dnl 1.18.14 is required for xmlUseNewParser()
284 if test "$vers" -ge 1008014; then
287 XML_LIBS="`$XML_CONFIG --libs`"
288 XML_CFLAGS="`$XML_CONFIG --cflags`"
290 AC_MSG_RESULT(not found)
295 if test $found_libxml = false; then
296 AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably))
302 CFLAGS="$XML_CFLAGS $CFLAGS"
305 AC_CHECK_HEADERS(zlib.h,
306 AC_CHECK_LIB(z, gzread,[
307 AC_DEFINE(HAVE_LIBZ,, we have the libz compression library)
308 if test "x${Z_DIR}" != "x"; then
309 Z_CFLAGS="-I${Z_DIR}/include"
310 Z_LIBS="-L${Z_DIR}/lib -lz"
317 CFLAGS="${CFLAGS} ${Z_CFLAGS}"
318 LIBS="${LIBS} ${Z_LIBS}"
320 dnl Platform-specific fixes.
323 dnl Sun Forte C provides isinf() in the unbundled -lsunmath. Solaris
324 dnl declares finite() in ieeefp.h. It's preferrable not to link
325 dnl to -lsunmath as it's not present on all machines.
327 AC_CHECK_HEADERS(math.h,
328 AC_CHECK_LIB(m,isinf,
331 if test "$have_isinf" = "no"; then
332 AC_CHECK_HEADER(ieeefp.h,
333 [AC_CHECK_FUNC(finite,
334 AC_DEFINE(HAVE_IEEEFP_H,1,
335 [Define if finite() is defined in ieeefp.h]),
336 AC_MSG_ERROR([Can't find a definition of neither
337 finite nor isinf]))],
338 [AC_MSG_ERROR(Can't find neither a definition of
339 isinf nor ieeefp.h)])
341 AC_DEFINE([HAVE_ISINF], 1,
342 [Define if the isinf() function is available])
345 dnl Alpha needs -mieee or we get a segfault
346 dnl This shouldn't be needed but is here until a real solution is found
349 CFLAGS="$CFLAGS -mieee"
353 if test "$GCC" = yes; then
354 dnl Relieve register pressure on i386. Other architectures may become unable
355 dnl to debug, and usually have more registers anyway.
358 dnl DIA_CHECK_CFLAG(-fomit-frame-pointer)
361 dnl (it looks like gdb is very confused by this now even on x86. We might be
362 dnl getting poor stack traces with bug-buddy because of this)
364 DIA_CHECK_CFLAG(-Wall)
365 DIA_CHECK_CFLAG(-Wunused)
366 dnl Premature optimization is the root of all evil. Uncomment this if
367 dnl you want ti figure out functions that should have been inlined but aint.
368 dnl DIA_CHECK_CFLAG(-Winline)
369 DIA_CHECK_CFLAG(-Wmissing-prototypes)
370 DIA_CHECK_CFLAG(-Wmissing-declarations)
371 DIA_CHECK_CFLAG(-finline-functions)
372 DIA_CHECK_CFLAG(-fstrict-aliasing)
375 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = yes)
377 dnl Do we have the db2html script to build the documentation?
378 AC_ARG_ENABLE(db2html,
379 [ --enable-db2html don't rebuild documentation],,enable_db2html=no)
380 AC_PATH_PROG(DB2HTML, db2html, no)
381 AM_CONDITIONAL(HAVE_DB2HTML,
382 test "x$enable_db2html" != xno && test "x$DB2HTML" != xno)
384 dnl Only enable man page generation if we have db2man (in maintainer mode)
386 dnl Have to have the nwalsh docbook.xsl, which does manpages.
387 dnl RedHat installs it in a version-numbered place. Grumpf.
390 /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl \
391 /usr/share/sgml/docbook/xsl-stylesheets-\*/manpages/docbook.xsl; do
392 if test -f $file; then db2man_file=$file; break; fi
394 AM_CONDITIONAL(HAVE_DB2MAN, test "x$db2man_file" != x)
395 AC_SUBST(DB2MAN, "$db2man_file")
397 dnl Handling for Python
399 [ --with-python compile python plug-in],,with_python=no)
401 if test "x$with_python" != xno; then
402 AM_PATH_PYTHON(1.5.2)
403 AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
404 AM_CHECK_PYTHON_HEADERS
407 if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then
408 AC_MSG_ERROR([could not find files required to build python plugin])
411 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno")
419 dnl objects/sybase/Makefile
420 objects/bondgraph/Makefile
421 objects/chronogram/Makefile
422 objects/custom/Makefile
424 objects/flowchart/Makefile
426 objects/GRAFCET/Makefile
427 objects/Istar/Makefile
428 objects/Jackson/Makefile
429 objects/KAOS/Makefile
430 objects/Misc/Makefile
431 objects/network/Makefile
432 objects/SADT/Makefile
433 objects/standard/Makefile
436 shapes/Assorted/Makefile
437 shapes/ChemEng/Makefile
438 shapes/Circuit/Makefile
439 shapes/Cisco/Makefile
440 shapes/Civil/Makefile
441 shapes/Contact/Makefile
442 shapes/Cybernetics/Makefile
443 shapes/Electric/Makefile
444 shapes/flowchart/Makefile
445 shapes/jigsaw/Makefile
446 shapes/Logic/Makefile
448 shapes/Map/Isometric/Makefile
451 shapes/network/Makefile
452 shapes/Pneumatic/Makefile
454 shapes/sybase/Makefile
460 sheets/GRAFCET/Makefile
461 sheets/Istar/Makefile
462 sheets/Jackson/Makefile
466 plug-ins/cgm/Makefile
467 plug-ins/cairo/Makefile
468 plug-ins/dxf/Makefile
469 plug-ins/hpgl/Makefile
470 plug-ins/metapost/Makefile
471 plug-ins/pixbuf/Makefile
472 plug-ins/pstricks/Makefile
473 plug-ins/python/Makefile
474 plug-ins/shape/Makefile
475 plug-ins/svg/Makefile
476 plug-ins/wmf/Makefile
477 plug-ins/wpg/Makefile
478 plug-ins/xfig/Makefile
479 plug-ins/xslt/Makefile
485 dnl GTK2: simplify this, we will have much less options.
489 Source code location: ${srcdir}
492 Gnome support: ${GNOME}
493 Python support: ${with_python}
494 Libart support (PNG export): ${have_libart}
495 Cairo support (experimental): ${have_cairo}
498 echo "Now type make to build dia..."