1 dnl Process this -*- m4 -*- file with autoconf to produce a configure script.
5 dnl AC_REVISION($Revision: 1.147 $)
7 AM_INIT_AUTOMAKE(dia, 0.90.RC1)
9 dnl Specify a header configuration file
10 AM_CONFIG_HEADER(config.h)
12 dnl do this check now, to keep autogen quiet.
15 dnl Initialize maintainer mode
18 dnl Initialize libtool
22 dnl Build time sanity check
25 dnl Checks for programs.
26 dnl AC_PROG_CC # already done
32 dnl stuff for xml-i18n-tools
33 AC_PROG_INTLTOOL(0.12)
35 dnl Checks for libraries.
36 dnl AM_PATH_GLIB(1.2.9) dnl (for g_critical)
39 dnl XIM support (on by default)
41 [ --disable-xim enable gnome code],,enable_xim=yes)
42 AC_MSG_CHECKING([whether to enable XIM support])
43 if test "x$enable_xim" != xno; then
46 AC_MSG_RESULT($enable_xim)
55 AC_MSG_CHECKING([whether GNOME specific code should be used])
57 [ --enable-gnome enable gnome code],
60 AC_ARG_ENABLE(gnome-print,
61 [ --enable-gnome-print enable gnome-print support],,enable_gnome_print=no)
63 [ --enable-bonobo enable bonobo support],,enable_bonobo=no)
71 if test "$GNOME" = "yes"; then
76 if test "$enable_gnome_print" = "yes"; then
77 AC_DEFINE(GNOME_PRINT)
78 components="$components print"
80 if test "$enable_bonobo" = "yes"; then
82 AC_MSG_CHECKING(for Bonobo >= 0.31)
84 if gnome-config --libs bonobox_print > /dev/null 2>&1; then
85 vers=`gnome-config --modversion bonobo | sed -e "s/bonobo-//" | \
86 awk 'BEGIN { FS = "."; } { printf "%d", $1 * 1000 + $2;}'`
87 if test "$vers" -ge 31; then
97 AC_MSG_RESULT([found ("$vers")])
101 AC_MSG_RESULT([not found])
104 hcomponents="$hcomponents bonobox_print"
105 BONOBO_LIBS=`gnome-config bonobox_print $components --libs`
107 GNOME_CFLAGS=`gnome-config $hcomponents $components --cflags`
108 GNOME_LIBS=`gnome-config $components --libs`
110 AM_CONDITIONAL(HAVE_GNOME, $have_gnome)
111 AM_CONDITIONAL(HAVE_GNOME_PRINT,
112 $have_gnome && test "$enable_gnome_print" = "yes")
113 AM_CONDITIONAL(HAVE_BONOBO, $have_bonobo)
115 AC_SUBST(GNOME_CFLAGS)
117 AC_SUBST(BONOBO_LIBS)
119 dnl Check if this Gnome has Bonobo
120 OLDCPPFLAGS=$CPPFLAGS
121 CPPFLAGS="$CPPFLAGS `glib-config --cflags`"
123 dnl This is required to play character set games
127 dnl check for libunicode
133 AC_MSG_CHECKING(for libunicode)
134 if unicode-config --libs > /dev/null 2>&1; then
135 vers=`unicode-config --version`
138 UNICODE_CFLAGS=`unicode-config --cflags`
139 UNICODE_LIBS=`unicode-config --libs`
140 AC_DEFINE(HAVE_UNICODE,, Unicode support library available)
141 AC_MSG_RESULT([found, version $vers])
143 AC_MSG_RESULT([not found])
145 AC_SUBST(UNICODE_CFLAGS)
146 AC_SUBST(UNICODE_LIBS)
147 AM_CONDITIONAL(HAVE_UNICODE,$have_unicode)
149 CPPFLAGS=$OLDCPPFLAGS
151 dnl check for libfreetype
152 AC_ARG_ENABLE(freetype,
153 [ --enable-freetype enable (LIMITED, EXPERIMENTAL) freetype support],,
160 if test "$enable_freetype" = "yes"; then
163 FREETYPE_CFLAGS=$FT2_CFLAGS
164 FREETYPE_LIBS=$FT2_LIBS
165 AC_DEFINE(HAVE_FREETYPE,, Freetype support library available)
166 yn_have_freetype=yes])
168 AC_SUBST(FREETYPE_CFLAGS)
169 AC_SUBST(FREETYPE_LIBS)
170 AM_CONDITIONAL(HAVE_FREETYPE,$have_freetype)
172 CPPFLAGS=$OLDCPPFLAGS
178 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [AC_DEFINE(HAVE_LIBPOPT)
179 APP_LIBS="$APP_LIBS -lpopt"])
180 AC_CHECK_HEADERS(popt.h)
185 AM_PATH_LIBART(2.1.0,dnl
187 AC_DEFINE(HAVE_LIBART)],
194 AM_PATH_GDK_PIXBUF(0.7.0,,AC_MSG_ERROR([gdk-pixbuf >= 0.7.0 is required]))
201 AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)
202 AC_CHECK_LIB(png, png_read_info, ,png_ok=no, -lz -lm)
203 if test "$png_ok" = yes; then
204 AC_MSG_CHECKING([for png_structp in png.h])
205 AC_TRY_COMPILE([#include <png.h>],
206 [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;],
209 AC_MSG_RESULT($png_ok)
210 if test "$png_ok" = yes; then
211 PNG_LIBS='-lpng -lz -lm'
212 AC_DEFINE(HAVE_LIBPNG)
223 [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
225 enable_debug=minimum)
227 if test "x$enable_debug" = "xyes"; then
228 DEBUG_FLAGS="-g -DENABLE_DEBUG"
230 if test "x$enable_debug" = "xno"; then
236 AC_SUBST(DEBUG_FLAGS)
242 ALL_LINGUAS="az ca da de el en_GB es fi fr ga hu it ja ko nl nn no pl pt pt_BR ru sk sl sv tr uk vi zh_CN zh_TW"
246 localedir='${prefix}/${DATADIRNAME}/locale'
250 dnl Locate the gnome-xml library
254 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
255 if test "x$XML_CONFIG" != x ; then
256 AC_MSG_CHECKING(for libxml >= 1.8.14)
257 vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
259 dnl 1.18.14 is required for xmlUseNewParser()
260 if test "$vers" -ge 1008014; then
263 XML_LIBS="`$XML_CONFIG --libs`"
264 XML_CFLAGS="`$XML_CONFIG --cflags`"
266 AC_MSG_RESULT(not found)
270 if ! $found_libxml; then
271 AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
272 if test "x$XML2_CONFIG" != x ; then
273 AC_MSG_CHECKING(for libxml >= 2.3.9)
274 vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
276 if test "$vers" -ge 2003009; then
279 XML_LIBS="`$XML2_CONFIG --libs`"
280 XML_CFLAGS="`$XML2_CONFIG --cflags`"
282 if test "$enable_gnome_print" = "yes"
284 gnome-config --cflags print | \
285 grep gnome-xml 2>&1 >/dev/null && \
286 AC_MSG_ERROR(libxml2 found but gnome-print uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable gnome-print.)
288 echo $GNOME_CFLAGS | \
289 grep gnome-xml 2>&1 >/dev/null && \
290 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.)
293 AC_MSG_RESULT(not found)
298 if ! $found_libxml; then
299 AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably))
305 CFLAGS="$XML_CFLAGS $CFLAGS"
309 AC_CHECK_HEADERS(zlib.h,
310 AC_CHECK_LIB(z, gzread,[
311 AC_DEFINE(HAVE_LIBZ,, we have the libz compression library)
312 if test "x${Z_DIR}" != "x"; then
313 Z_CFLAGS="-I${Z_DIR}/include"
314 Z_LIBS="-L${Z_DIR}/lib -lz"
318 CFLAGS="${CPPFLAGS} ${Z_CFLAGS}"
319 LIBS="${LIBS} ${Z_LIBS}"
321 dnl Checks for header files.
324 AC_CHECK_HEADERS(stddef.h fcntl.h unistd.h utime.h)
326 dnl Checks for typedefs, structures, and compiler characteristics.
329 dnl Checks for library functions.
330 AC_CHECK_FUNCS(select strcspn strdup strtol snprintf)
332 dnl Set some variables we'll need for the UTF-8 transition.
333 gtk_advancement=dia_talks_utf8
335 if test "$gtk_advancement" = "initial"; then
336 AC_DEFINE(GTK_DOESNT_SPEAK_UTF8_NEITHER_DO_WE,,
337 We haven't begun the transition yet)
338 elif test "$gtk_advancement" = "dia_talks_utf8"; then
339 AC_DEFINE(UNICODE_WORK_IN_PROGRESS,,Cyrille's work towards UTF-8)
340 AC_DEFINE(GTK_DOESNT_TALK_UTF8_WE_DO,,...)
341 AC_DEFINE(GTK_CHARSET_MISMATCH,,
342 Mismatch between the charset dia uses and the charset GTK uses)
343 elif test "$gtk_advancement" = "dia_under_win32"; then
344 dnl please check this with Hans. I believe this is true -- CC
345 AC_DEFINE(GTK_TALKS_UTF8,,...)
346 AC_DEFINE(GTK_TALKS_UTF8_WE_DONT,,...)
347 AC_DEFINE(GTK_CHARSET_MISMATCH,,
348 Mismatch between the charset dia uses and the charset GTK uses)
349 elif test "$gtk_advancement" = "gtk2"; then
350 AC_DEFINE(GTK_TALKS_UTF8,,...)
351 AC_DEFINE(UNICODE_WORK_IN_PROGRESS,,Cyrille's work towards UTF-8)
352 dnl the latter shouldn't appear anymore by then (manually compiled)
355 dnl Solaris provides isinf() in -lsunmath and defines finite() in math.h
356 AC_CHECK_HEADERS(ieeefp.h sunmath.h)
357 AC_CHECK_LIB(sunmath,isinf)
359 dnl Alpha needs -mieee or we get a segfault
360 dnl This shouldn't be needed but is here until a real solution is found
363 CFLAGS="$CFLAGS -mieee"
367 DIA_CHECK_CFLAG(-Wall)
368 DIA_CHECK_CFLAG(-Wunused)
369 DIA_CHECK_CFLAG(-Winline)
370 DIA_CHECK_CFLAG(-Wmissing-prototypes)
371 DIA_CHECK_CFLAG(-Wmissing-declarations)
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(-finline-functions)
384 DIA_CHECK_CFLAG(-fstrict-aliasing)
386 dnl Do we have the db2html script to build the documentation?
387 AC_ARG_ENABLE(db2html,
388 [ --enable-db2html don't rebuild documentation],,enable_db2html=no)
389 AC_PATH_PROG(DB2HTML, db2html, no)
390 AM_CONDITIONAL(HAVE_DB2HTML, test "x$enable_db2html" != xno && test "x$DB2HTML" != xno)
392 dnl Handling for Python
394 [ --with-python compile python plug-in],,with_python=no)
397 if test "x$with_python" != xno; then
398 AM_PATH_PYTHON(1.5.2)
399 AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
400 AM_CHECK_PYTHON_HEADERS
403 if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then
404 AC_MSG_ERROR([could not find files required to build python plugin])
407 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno")
412 po/Makefile.in intl/Makefile
414 objects/standard/Makefile
415 objects/network/Makefile
419 dnl objects/sybase/Makefile
420 objects/flowchart/Makefile
421 objects/custom/Makefile
422 objects/GRAFCET/Makefile
423 objects/chronogram/Makefile
424 objects/SADT/Makefile
426 shapes/Circuit/Makefile
427 shapes/flowchart/Makefile
428 shapes/Contact/Makefile
429 shapes/network/Makefile
430 shapes/Pneumatic/Makefile
431 shapes/Electric/Makefile
432 shapes/Civil/Makefile
433 shapes/jigsaw/Makefile
436 shapes/Logic/Makefile
437 shapes/sybase/Makefile
444 sheets/GRAFCET/Makefile
446 plug-ins/cgm/Makefile
447 plug-ins/pstricks/Makefile
448 plug-ins/dxf/Makefile
449 plug-ins/hpgl/Makefile
450 plug-ins/wpg/Makefile
451 plug-ins/wmf/Makefile
452 plug-ins/metapost/Makefile
453 plug-ins/svg/Makefile
454 plug-ins/shape/Makefile
455 plug-ins/xfig/Makefile
456 plug-ins/python/Makefile
464 Source code location: ${srcdir}
467 Libart (AA rendering, png export): ${have_libart}
469 Gnome support: ${GNOME}
470 Build bonobo component (not supported): ${bonobo_msg}
471 Gnome-print support (not recommended): ${enable_gnome_print}
473 Python support: ${with_python}
474 (LIMITED) Freetype support: ${yn_have_freetype}
476 if test "$yn_have_unicode" != "yes" ; then
477 echo "Unicode not present. This will NOT build."
480 echo "Now type make to build dia."