1 dnl Process this -*- m4 -*- file with autoconf to produce a configure script.
5 dnl AC_REVISION($Revision: 1.141 $)
7 AM_INIT_AUTOMAKE(dia, 0.89)
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
128 AC_ARG_ENABLE(unicode,
129 [ --enable-unicode enable (LIMITED, EXPERIMENTAL) unicode support],,
136 if test "$enable_unicode" = "yes"; then
137 AC_MSG_CHECKING(for libunicode)
138 if unicode-config --libs > /dev/null 2>&1; then
139 vers=`unicode-config --version`
142 UNICODE_CFLAGS=`unicode-config --cflags`
143 UNICODE_LIBS=`unicode-config --libs`
144 AC_DEFINE(HAVE_UNICODE,, Unicode support library available)
145 AC_MSG_RESULT([found, version $vers])
147 AC_MSG_RESULT([not found])
152 AC_SUBST(UNICODE_CFLAGS)
153 AC_SUBST(UNICODE_LIBS)
154 AM_CONDITIONAL(HAVE_UNICODE,$have_unicode)
156 CPPFLAGS=$OLDCPPFLAGS
158 dnl check for libfreetype
159 AC_ARG_ENABLE(freetype,
160 [ --enable-freetype enable (LIMITED, EXPERIMENTAL) freetype support],,
167 if test "$enable_freetype" = "yes"; then
170 FREETYPE_CFLAGS=$FT2_CFLAGS
171 FREETYPE_LIBS=$FT2_LIBS
172 AC_DEFINE(HAVE_FREETYPE,, Freetype support library available)
173 yn_have_freetype=yes])
175 AC_SUBST(FREETYPE_CFLAGS)
176 AC_SUBST(FREETYPE_LIBS)
177 AM_CONDITIONAL(HAVE_FREETYPE,$have_freetype)
179 CPPFLAGS=$OLDCPPFLAGS
185 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [AC_DEFINE(HAVE_LIBPOPT)
186 APP_LIBS="$APP_LIBS -lpopt"])
187 AC_CHECK_HEADERS(popt.h)
192 AM_PATH_LIBART(2.1.0,dnl
194 AC_DEFINE(HAVE_LIBART)],
201 AM_PATH_GDK_PIXBUF(0.7.0,,AC_MSG_ERROR([gdk-pixbuf >= 0.7.0 is required]))
208 AC_CHECK_LIB(png, png_read_info,
209 AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no),png_ok=no, -lz -lm)
210 if test "$png_ok" = yes; then
211 AC_MSG_CHECKING([for png_structp in png.h])
212 AC_TRY_COMPILE([#include <png.h>],
213 [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;],
216 AC_MSG_RESULT($png_ok)
217 if test "$png_ok" = yes; then
218 PNG_LIBS='-lpng -lz -lm'
219 AC_DEFINE(HAVE_LIBPNG)
230 [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
232 enable_debug=minimum)
234 if test "x$enable_debug" = "xyes"; then
235 DEBUG_FLAGS="-g -DENABLE_DEBUG"
237 if test "x$enable_debug" = "xno"; then
243 AC_SUBST(DEBUG_FLAGS)
249 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 zh_CN zh_TW"
253 localedir='${prefix}/${DATADIRNAME}/locale'
257 dnl Locate the gnome-xml library
261 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
262 if test "x$XML_CONFIG" != x ; then
263 AC_MSG_CHECKING(for libxml >= 1.8.14)
264 vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
266 dnl 1.18.14 is required for xmlUseNewParser()
267 if test "$vers" -ge 1008014; then
270 XML_LIBS="`$XML_CONFIG --libs`"
271 XML_CFLAGS="`$XML_CONFIG --cflags`"
273 AC_MSG_RESULT(not found)
277 if ! $found_libxml; then
278 AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
279 if test "x$XML2_CONFIG" != x ; then
280 AC_MSG_CHECKING(for libxml >= 2.3.9)
281 vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
283 if test "$vers" -ge 2003009; then
286 XML_LIBS="`$XML2_CONFIG --libs`"
287 XML_CFLAGS="`$XML2_CONFIG --cflags`"
289 if test "$enable_gnome_print" = "yes"
291 gnome-config --cflags print | \
292 grep gnome-xml 2>&1 >/dev/null && \
293 AC_MSG_ERROR(libxml2 found but gnome-print uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable gnome-print.)
295 echo $GNOME_CFLAGS | \
296 grep gnome-xml 2>&1 >/dev/null && \
297 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.)
300 AC_MSG_RESULT(not found)
305 if ! $found_libxml; then
306 AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably))
312 CFLAGS="$XML_CFLAGS $CFLAGS"
316 AC_CHECK_HEADERS(zlib.h,
317 AC_CHECK_LIB(z, gzread,[
318 AC_DEFINE(HAVE_LIBZ,, we have the libz compression library)
319 if test "x${Z_DIR}" != "x"; then
320 Z_CFLAGS="-I${Z_DIR}/include"
321 Z_LIBS="-L${Z_DIR}/lib -lz"
325 CFLAGS="${CPPFLAGS} ${Z_CFLAGS}"
326 LIBS="${LIBS} ${Z_LIBS}"
328 dnl Checks for header files.
331 AC_CHECK_HEADERS(stddef.h fcntl.h unistd.h)
333 dnl Checks for typedefs, structures, and compiler characteristics.
336 dnl Checks for library functions.
337 AC_CHECK_FUNCS(select strcspn strdup strtol snprintf)
339 dnl Set some variables we'll need for the UTF-8 transition.
340 gtk_advancement=dia_talks_utf8
342 if test "$gtk_advancement" = "initial"; then
343 AC_DEFINE(GTK_DOESNT_SPEAK_UTF8_NEITHER_DO_WE,,
344 We haven't begun the transition yet)
345 elif test "$gtk_advancement" = "dia_talks_utf8"; then
346 AC_DEFINE(UNICODE_WORK_IN_PROGRESS,,Cyrille's work towards UTF-8)
347 AC_DEFINE(GTK_DOESNT_TALK_UTF8_WE_DO,,...)
348 AC_DEFINE(GTK_CHARSET_MISMATCH,,
349 Mismatch between the charset dia uses and the charset GTK uses)
350 elif test "$gtk_advancement" = "dia_under_win32"; then
351 dnl please check this with Hans. I believe this is true -- CC
352 AC_DEFINE(GTK_TALKS_UTF8,,...)
353 AC_DEFINE(GTK_TALKS_UTF8_WE_DONT,,...)
354 AC_DEFINE(GTK_CHARSET_MISMATCH,,
355 Mismatch between the charset dia uses and the charset GTK uses)
356 elif test "$gtk_advancement" = "gtk2"; then
357 AC_DEFINE(GTK_TALKS_UTF8,,...)
358 AC_DEFINE(UNICODE_WORK_IN_PROGRESS,,Cyrille's work towards UTF-8)
359 dnl the latter shouldn't appear anymore by then (manually compiled)
362 dnl Solaris provides isinf() in -lsunmath and defines finite() in math.h
363 AC_CHECK_HEADERS(ieeefp.h sunmath.h)
364 AC_CHECK_LIB(sunmath,isinf)
366 dnl Alpha needs -mieee or we get a segfault
367 dnl This shouldn't be needed but is here until a real solution is found
370 CFLAGS="$CFLAGS -mieee"
374 DIA_CHECK_CFLAG(-Wall)
375 DIA_CHECK_CFLAG(-Wunused)
376 DIA_CHECK_CFLAG(-Winline)
377 DIA_CHECK_CFLAG(-Wmissing-prototypes)
378 DIA_CHECK_CFLAG(-Wmissing-declarations)
380 dnl Relieve register pressure on i386. Other architectures may become unable
381 dnl to debug, and usually have more registers anyway.
384 dnl DIA_CHECK_CFLAG(-fomit-frame-pointer)
387 dnl (it looks like gdb is very confused by this now even on x86. We might be
388 dnl getting poor stack traces with bug-buddy because of this)
390 DIA_CHECK_CFLAG(-finline-functions)
391 DIA_CHECK_CFLAG(-fstrict-aliasing)
393 dnl Do we have the db2html script to build the documentation?
394 AC_ARG_ENABLE(db2html,
395 [ --enable-db2html don't rebuild documentation],,enable_db2html=no)
396 AC_PATH_PROG(DB2HTML, db2html, no)
397 AM_CONDITIONAL(HAVE_DB2HTML, test "x$enable_db2html" != xno && test "x$DB2HTML" != xno)
399 dnl Handling for Python
401 [ --with-python compile python plug-in],,with_python=no)
404 if test "x$with_python" != xno; then
405 AM_PATH_PYTHON(1.5.2)
406 AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
407 AM_CHECK_PYTHON_HEADERS
410 if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then
411 AC_MSG_ERROR([could not find files required to build python plugin])
414 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno")
419 po/Makefile.in intl/Makefile
421 objects/standard/Makefile
422 objects/network/Makefile
426 dnl objects/sybase/Makefile
427 objects/flowchart/Makefile
428 objects/custom/Makefile
429 objects/GRAFCET/Makefile
430 objects/chronogram/Makefile
431 objects/SADT/Makefile
433 shapes/Circuit/Makefile
434 shapes/flowchart/Makefile
435 shapes/Contact/Makefile
436 shapes/network/Makefile
437 shapes/Pneumatic/Makefile
438 shapes/Electric/Makefile
439 shapes/Civil/Makefile
440 shapes/jigsaw/Makefile
443 shapes/Logic/Makefile
444 shapes/sybase/Makefile
451 sheets/GRAFCET/Makefile
453 plug-ins/cgm/Makefile
454 plug-ins/pstricks/Makefile
455 plug-ins/dxf/Makefile
456 plug-ins/hpgl/Makefile
457 plug-ins/wpg/Makefile
458 plug-ins/svg/Makefile
459 plug-ins/shape/Makefile
460 plug-ins/xfig/Makefile
461 plug-ins/python/Makefile
469 Source code location: ${srcdir}
472 Libart (AA rendering, png export): ${have_libart}
474 Gnome support: ${GNOME}
475 Build bonobo component (not supported): ${bonobo_msg}
476 Gnome-print support (not recommended): ${enable_gnome_print}
478 Python support: ${with_python}
479 (LIMITED) Unicode support: ${yn_have_unicode}
480 (LIMITED) Freetype support: ${yn_have_freetype}
482 if test "$yn_have_unicode" != "yes" ; then
483 echo "WARNING: Unicode support disabled or support libraries missing.
484 We contemplate making these mandatory in the future; if this upsets you, please
485 speak up *NOW* (summer 2001), in the dia mailing list
486 <dia-list@lists.gnome.org>. Thank you very much.
490 echo "Now type make to build dia."