1 dnl Process this -*- autoconf -*- file with autoconf to produce a
3 AC_INIT(dia, 0.90+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.176 $)
10 dnl Specify a header configuration file
11 AM_CONFIG_HEADER(config.h)
13 dnl do this check now, to keep autogen quiet.
16 dnl Initialize maintainer mode
19 dnl Initialize libtool
23 dnl Build time sanity check
26 dnl Checks for programs.
27 dnl AC_PROG_CC # already done
33 dnl Checks for header files.
36 AC_CHECK_HEADERS(stddef.h fcntl.h unistd.h utime.h)
38 dnl Checks for typedefs, structures, and compiler characteristics.
41 dnl Checks for library functions.
42 AC_CHECK_FUNCS(select strcspn strdup strtol snprintf)
44 dnl stuff for intltool
45 AC_PROG_INTLTOOL(0.21)
51 dnl Checks for libraries
53 AM_PATH_GLIB_2_0(2.0.0)
54 AM_PATH_GTK_2_0(2.0.0)
56 GTK_MODULES="gtk+-2.0 libxml-2.0 gdk-pixbuf-2.0"
57 PKG_CHECK_MODULES(PANGOFT2,pangoft2,have_pangoft2=true,have_pangoft2=false)
58 if test "$have_pangoft2" = "true"; then
59 dnl On Solaris with Forte C, at least, need to link app/dia with -lfreetype.
60 dnl It's not enough that -lpangoft2 implicitly pulls it in.
62 AC_CHECK_LIB(freetype,FT_Init_FreeType,have_freetype=true)
63 if test "$have_freetype" = "true"; then
64 dnl Need 2.0.9, as a bug was fixed for us there.
65 dnl However, freetype-config doesn't give a meaningful version, so we must
67 AC_MSG_CHECKING([for version of FreeType])
68 FREETYPE_INCLUDE=`freetype-config --cflags | cut -c3-`
69 FREETYPE_MAJOR=`grep '^#define FREETYPE_MAJOR' $FREETYPE_INCLUDE/freetype/freetype.h | cut -d' ' -f3`
70 FREETYPE_MINOR=`grep '^#define FREETYPE_MINOR' $FREETYPE_INCLUDE/freetype/freetype.h | cut -d' ' -f3`
71 FREETYPE_PATCH=`grep '^#define FREETYPE_PATCH' $FREETYPE_INCLUDE/freetype/freetype.h | cut -d' ' -f3`
72 FREETYPE_VERSION=`echo | awk "BEGIN { printf \"%d\", ($FREETYPE_MAJOR * 1000 + $FREETYPE_MINOR) * 1000 + $FREETYPE_PATCH;}"`
73 AC_MSG_RESULT([$FREETYPE_MAJOR.$FREETYPE_MINOR.$FREETYPE_PATCH])
74 if test "$FREETYPE_VERSION" -ge 2000009; then
75 FREETYPE_LIBS=-lfreetype
76 AC_SUBST(FREETYPE_LIBS)
77 GTK_MODULES="$GTK_MODULES pangoft2"
78 AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])
80 AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher, found $FREETYPE_MAJOR.$FREETYPE_MINOR.$FREETYPE_PATCH])
83 AC_MSG_ERROR(Can't find FreeType library)
86 AC_MSG_ERROR(Can't find PangoFT2 library)
90 PKG_CHECK_MODULES(LIBART,libart-2.0,have_libart=yes,have_libart=no)
91 if test "$have_libart" = "yes" ; then
92 GTK_MODULES="$GTK_MODULES libart-2.0"
93 AC_DEFINE(HAVE_LIBART,1,[Define if building with LIBART support])
96 AC_MSG_CHECKING([whether GNOME specific code should be used])
97 AC_ARG_ENABLE(gnome,[ --enable-gnome enable gnome code],
98 GNOME=$enableval, GNOME=no)
99 if test "$GNOME" = "yes" ; then
100 GTK_MODULES="$GTK_MODULES libgnome-2.0 libgnomeui-2.0"
101 AC_DEFINE(GNOME,1,[Define if building with GNOME support])
102 AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${prefix}/share/pixmaps", [GNOME icon directory])
107 AM_CONDITIONAL(HAVE_GNOME, $have_gnome)
108 AC_MSG_RESULT($GNOME)
110 dnl GTK2: libgnomecanvas-2.0 ?
112 PKG_CHECK_MODULES(GTK,$GTK_MODULES)
113 AM_CONDITIONAL(HAVE_BONOBO,false)
118 PKG_CHECK_MODULES(XSLT, libxslt, have_xslt=true, have_xslt=false)
119 AM_CONDITIONAL(HAVE_XSLT, $have_xslt)
120 if test "$have_xslt" = "true"; then
129 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [
130 AC_DEFINE(HAVE_LIBPOPT,,[popt library available])
132 AC_CHECK_HEADERS(popt.h)
134 APP_LIBS="$APP_LIBS $POPT_LIBS"
139 dnl this likely already comes from GTK
141 AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)
142 AC_CHECK_LIB(png, png_read_info, ,png_ok=no, -lz -lm)
143 if test "$png_ok" = yes; then
144 AC_MSG_CHECKING([for png_structp in png.h])
145 AC_TRY_COMPILE([#include <png.h>],
146 [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;],
149 AC_MSG_RESULT($png_ok)
150 if test "$png_ok" = yes; then
151 PNG_LIBS='-lpng -lz -lm'
152 AC_DEFINE(HAVE_LIBPNG,,[PNG library available])
156 LIBS="${LIBS} ${PNG_LIBS}"
162 [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
164 enable_debug=minimum)
166 if test "x$enable_debug" = "xyes"; then
167 DEBUG_FLAGS="-g -DENABLE_DEBUG"
169 if test "x$enable_debug" = "xno"; then
175 AC_SUBST(DEBUG_FLAGS)
182 AC_SUBST(GETTEXT_PACKAGE)
183 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Needed for glib gettext])
184 ALL_LINGUAS="az ca cs da de el en_GB es fi fr ga hu it ja ko nl nn no pl pt pt_BR ro ru sk sl sv tr uk vi zh_CN zh_TW"
187 localedir='${prefix}/${DATADIRNAME}/locale'
191 dnl Locate the gnome-xml library
193 dnl GTK2: remove support for libxml1. move check for libxml2 in
194 dnl AM_PATH_GTK_2_0's fourth argument (module is libxml-2.0)
197 if test $found_libxml = false; then
198 AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
199 if test "x$XML2_CONFIG" != x ; then
200 AC_MSG_CHECKING(for libxml >= 2.3.9)
201 vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
203 if test "$vers" -ge 2003009; then
206 XML_LIBS="`$XML2_CONFIG --libs`"
207 XML_CFLAGS="`$XML2_CONFIG --cflags`"
209 if test "$enable_gnome_print" = "yes"
211 gnome-config --cflags print | \
212 grep gnome-xml 2>&1 >/dev/null && \
213 AC_MSG_ERROR(libxml2 found but gnome-print uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable gnome-print.)
215 echo $GNOME_CFLAGS | \
216 grep gnome-xml 2>&1 >/dev/null && \
217 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.)
220 AC_MSG_RESULT(not found)
225 if test $found_libxml = false; then
226 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
227 if test "x$XML_CONFIG" != x ; then
228 AC_MSG_CHECKING(for libxml >= 1.8.14)
229 vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
231 dnl 1.18.14 is required for xmlUseNewParser()
232 if test "$vers" -ge 1008014; then
235 XML_LIBS="`$XML_CONFIG --libs`"
236 XML_CFLAGS="`$XML_CONFIG --cflags`"
238 AC_MSG_RESULT(not found)
243 if test $found_libxml = false; then
244 AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably))
250 CFLAGS="$XML_CFLAGS $CFLAGS"
253 AC_CHECK_HEADERS(zlib.h,
254 AC_CHECK_LIB(z, gzread,[
255 AC_DEFINE(HAVE_LIBZ,, we have the libz compression library)
256 if test "x${Z_DIR}" != "x"; then
257 Z_CFLAGS="-I${Z_DIR}/include"
258 Z_LIBS="-L${Z_DIR}/lib -lz"
265 CFLAGS="${CFLAGS} ${Z_CFLAGS}"
266 LIBS="${LIBS} ${Z_LIBS}"
268 dnl Platform-specific fixes.
271 dnl Sun Forte C provides isinf() in the unbundled -lsunmath. Solaris
272 dnl declares finite() in ieeefp.h. It's preferrable not to link
273 dnl to -lsunmath as it's not present on all machines.
275 AC_CHECK_HEADERS(math.h,
276 AC_CHECK_LIB(m,isinf,
279 if test "$have_isinf" = "no"; then
280 AC_CHECK_HEADERS(ieeefp.h,
281 AC_CHECK_FUNC(finite, ,
282 AC_MSG_ERROR(Can't find a definition of neither
284 AC_MSG_ERROR(Can't find a definition of neither finite
287 AC_DEFINE([HAVE_ISINF], 1,
288 [Define if the isinf() function is available])
291 dnl Alpha needs -mieee or we get a segfault
292 dnl This shouldn't be needed but is here until a real solution is found
295 CFLAGS="$CFLAGS -mieee"
299 if test "$GCC" = yes; then
300 dnl Relieve register pressure on i386. Other architectures may become unable
301 dnl to debug, and usually have more registers anyway.
304 dnl DIA_CHECK_CFLAG(-fomit-frame-pointer)
307 dnl (it looks like gdb is very confused by this now even on x86. We might be
308 dnl getting poor stack traces with bug-buddy because of this)
310 DIA_CHECK_CFLAG(-Wall)
311 DIA_CHECK_CFLAG(-Wunused)
312 DIA_CHECK_CFLAG(-Winline)
313 DIA_CHECK_CFLAG(-Wmissing-prototypes)
314 DIA_CHECK_CFLAG(-Wmissing-declarations)
315 DIA_CHECK_CFLAG(-finline-functions)
316 DIA_CHECK_CFLAG(-fstrict-aliasing)
319 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = yes)
321 dnl Do we have the db2html script to build the documentation?
322 AC_ARG_ENABLE(db2html,
323 [ --enable-db2html don't rebuild documentation],,enable_db2html=no)
324 AC_PATH_PROG(DB2HTML, db2html, no)
325 AM_CONDITIONAL(HAVE_DB2HTML,
326 test "x$enable_db2html" != xno && test "x$DB2HTML" != xno)
328 dnl Handling for Python
330 [ --with-python compile python plug-in],,with_python=no)
332 if test "x$with_python" != xno; then
333 AM_PATH_PYTHON(1.5.2)
334 AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
335 AM_CHECK_PYTHON_HEADERS
338 if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then
339 AC_MSG_ERROR([could not find files required to build python plugin])
342 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno")
349 dnl objects/sybase/Makefile
350 objects/bondgraph/Makefile
351 objects/chronogram/Makefile
352 objects/custom/Makefile
354 objects/flowchart/Makefile
356 objects/GRAFCET/Makefile
357 objects/Misc/Makefile
358 objects/network/Makefile
359 objects/SADT/Makefile
360 objects/standard/Makefile
363 shapes/Assorted/Makefile
364 shapes/Circuit/Makefile
365 shapes/Cisco/Makefile
366 shapes/Civil/Makefile
367 shapes/Contact/Makefile
368 shapes/Electric/Makefile
369 shapes/flowchart/Makefile
370 shapes/jigsaw/Makefile
371 shapes/Logic/Makefile
374 shapes/network/Makefile
375 shapes/Pneumatic/Makefile
377 shapes/sybase/Makefile
382 sheets/GRAFCET/Makefile
385 plug-ins/cgm/Makefile
386 plug-ins/dxf/Makefile
387 plug-ins/hpgl/Makefile
388 plug-ins/metapost/Makefile
389 plug-ins/pstricks/Makefile
390 plug-ins/python/Makefile
391 plug-ins/shape/Makefile
392 plug-ins/svg/Makefile
393 plug-ins/wmf/Makefile
394 plug-ins/wpg/Makefile
395 plug-ins/xfig/Makefile
396 plug-ins/xslt/Makefile
402 dnl GTK2: simplify this, we will have much less options.
406 Source code location: ${srcdir}
409 Gnome support: ${GNOME}
410 Python support: ${with_python}
411 Libart support (PNG export): ${have_libart}
414 echo "Now type make to build dia..."