.cvsignores added.
[dia.git] / configure.in
blob2c3b0e01eb08141d24c494be7dfaa0e6a7f036a3
1 dnl Process this -*- autoconf -*- file with autoconf to produce a 
2 dnl configure script.
3 AC_INIT(dia, 0.95+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)
7 AC_PREREQ(2.50)
8 AC_REVISION($Revision: 1.282 $)
10 dnl Specify a header configuration file
11 AM_CONFIG_HEADER(config.h)
13 dnl do this check now, to keep autogen quiet.
14 AC_PROG_CC 
15 dnl also c++
16 AC_PROG_CXX
18 dnl Initialize maintainer mode
19 AM_MAINTAINER_MODE
21 dnl Initialize libtool
22 AC_DISABLE_STATIC
23 AC_PROG_LIBTOOL
25 dnl Build time sanity check
26 AM_SANITY_CHECK
28 dnl Checks for programs.
29 dnl AC_PROG_CC # already done 
30 AC_PROG_INSTALL
31 AC_PROG_LN_S
32 AC_PROG_MAKE_SET
33 AC_ISC_POSIX
35 dnl Checks for header files.
36 AC_HEADER_DIRENT
37 AC_HEADER_STDC
38 AC_CHECK_HEADERS(stddef.h fcntl.h unistd.h utime.h)
40 dnl Checks for typedefs, structures, and compiler characteristics.
41 AC_C_CONST
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) 
49 APP_LIBS=""
50 AC_SUBST(APP_LIBS)
53 dnl Checks for libraries
55 PKG_CHECK_MODULES(GMODULE, gmodule-2.0 gobject-2.0)
56 AC_SUBST(GMODULE_CFLAGS)
57 AC_SUBST(GMODULE_LIBS)
58 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
60 GTK_MODULES="gtk+-2.0 >= 2.6.0 glib-2.0 >= 2.6.0 libxml-2.0 gdk-pixbuf-2.0 gthread-2.0"
61 PKG_CHECK_MODULES(PANGOVERSION, pango >= 1.1.5, , 
62                   AC_MSG_ERROR([Need Pango version 1.1.5 or higher]))
63 PKG_CHECK_MODULES(PANGOFT2,pangoft2,have_pangoft2=true,have_pangoft2=false)
64 if test "$have_pangoft2" = "true"; then
65   dnl On Solaris with Forte C, at least, need to link app/dia with -lfreetype.
66   dnl It's not enough that -lpangoft2 implicitly pulls it in.
67   have_freetype=false
68   AC_CHECK_LIB(freetype,FT_Init_FreeType,have_freetype=true,have_freetype=false,`freetype-config --libs`)
69   if test "$have_freetype" = "true"; then
70     dnl Need 2.0.9, as a bug was fixed for us there.
71     dnl However, freetype-config doesn't give a meaningful version, so we must
72     dnl do it like this.
73     AC_MSG_CHECKING([if FreeType version is 2.0.9 or higher])
74     old_CPPFLAGS="$CPPFLAGS"
75     CPPFLAGS="$CPPFLAGS `freetype-config --cflags`"
76     AC_TRY_CPP([#include <ft2build.h>
77 #include FT_FREETYPE_H
78 #if (FREETYPE_MAJOR*1000+FREETYPE_MINOR)*1000+FREETYPE_PATCH < 2000009
79 #error Freetype version too low.
80 #endif
82         [AC_MSG_RESULT(yes)
83          FREETYPE_LIBS=`freetype-config --libs`
84          AC_SUBST(FREETYPE_LIBS)
85          FREETYPE_CFLAGS=`freetype-config --cflags`
86          AC_SUBST(FREETYPE_CFLAGS)
87          GTK_MODULES="$GTK_MODULES pangoft2"
88          AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])]
89     ,
90         [AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])])
91     CPPFLAGS="$old_CPPFLAGS"
92   else
93    AC_MSG_ERROR(Can't find FreeType library)
94   fi
95 else
96    AC_MSG_ERROR(Can't find PangoFT2 library)
99 CFLAGS="$FREETYPE_CFLAGS $CFLAGS"
101 dnl Try for libart
102 PKG_CHECK_MODULES(LIBART,libart-2.0,have_libart=yes,have_libart=no)
103 if test "$have_libart" = "yes" ; then
104    GTK_MODULES="$GTK_MODULES libart-2.0"
105    AC_DEFINE(HAVE_LIBART,1,[Define if building with LIBART support])
108 AC_MSG_CHECKING([whether GNOME specific code should be used])
109 AC_ARG_ENABLE(gnome,[  --enable-gnome          enable gnome code],
110               GNOME=$enableval, GNOME=no)
111 if test "$GNOME" = "yes" ; then
112     GTK_MODULES="$GTK_MODULES libgnome-2.0 libgnomeui-2.0"
113     AC_DEFINE(GNOME,1,[Define if building with GNOME support])
114     AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${prefix}/share/pixmaps", [GNOME icon directory])
115     have_gnome=true
116 else
117     have_gnome=false
119 AM_CONDITIONAL(HAVE_GNOME, $have_gnome)
120 AC_MSG_RESULT($GNOME)
122 dnl GTK2:     libgnomecanvas-2.0 ?
124 PKG_CHECK_MODULES(GTK,$GTK_MODULES)
125 AC_SUBST(GTK_CFLAGS)
126 AC_SUBST(GTK_LIBS)
128 AM_CONDITIONAL(HAVE_BONOBO,false)
130 dnl Look for Gnome Print
131 AC_ARG_WITH(gnomeprint,
132 [  --with-gnomeprint        compile *experimental* gnomeprint plug-in],,with_gnomeprint=no)
133 if test "x$with_gnomeprint" == "xyes"; then
134   PKG_CHECK_MODULES(GNOMEPRINT, libgnomeprint-2.2, have_gnomeprint=yes,have_gnomeprint=no)
135   AC_SUBST(GNOMEPRINT_LIBS)
136   AC_SUBST(GNOMEPRINT_CFLAGS)
137   AC_DEFINE(HAVE_GNOMEPRINT,1,[Define if building with Gnome Print support])
139 AM_CONDITIONAL(WITH_GNOMEPRINT, test "x$with_gnomeprint" != "xno")
141 dnl Look for Cairo
142 AC_ARG_WITH(cairo,
143 [  --with-cairo           compile *experimental* cairo plug-in],,with_cairo=no)
144 if test "x$with_cairo" != "xno"; then
145   PKG_CHECK_MODULES(CAIROVERSION, cairo >= 0.6.0, , 
146                     AC_MSG_ERROR([Need Cairo version 0.6.0 or higher]))
147   PKG_CHECK_MODULES(CAIRO, cairo,have_cairo=yes,have_cairo=no)
148   AC_SUBST(CAIRO_LIBS)
149   AC_SUBST(CAIRO_CFLAGS)
150   AC_DEFINE(HAVE_CAIRO,1,[Define if building with Cairo support])
152 AM_CONDITIONAL(WITH_CAIRO, test "x$with_cairo" != "xno")
154 dnl XSLT
156 # Check if XSLT is available at all
157 XSLT_DIR=""
158 PKG_CHECK_MODULES(XSLT, libxslt, have_xslt=true, have_xslt=false)
159 AM_CONDITIONAL(HAVE_XSLT, $have_xslt)
160 if test "$have_xslt" = "true"; then
161   XSLT_DIR="xslt"
162   XSLT_LIBS="`$PKG_CONFIG --libs libxslt`"
163   XSLT_CFLAGS="`$PKG_CONFIG --cflags libxslt`"
166 AC_SUBST(XSLT_DIR)
167 AC_SUBST(XSLT_LIBS)
168 AC_SUBST(XSLT_CFLAGS)
170 # Figure out a prefix for where to find libxslt at runtime.
171 AC_ARG_WITH(xslt-prefix, 
172             [  --with-xslt-prefix=DIR     Specify where to find the optional XSLT libraries
173                              (default=/usr/lib)], 
174             libxslt_prefix=$withval,
175             libxslt_prefix=/usr/lib)
176 AC_DEFINE_UNQUOTED(LIBXSLT_PREFIX,"$libxslt_prefix", [Place to look for XSLT libs])
179 dnl Popt
182 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [
183                 AC_DEFINE(HAVE_LIBPOPT,,[popt library available])
184                    POPT_LIBS="-lpopt"])
185 AC_CHECK_HEADERS(popt.h)
186 AC_SUBST(POPT_LIBS)
187 APP_LIBS="$APP_LIBS $POPT_LIBS"
190 dnl libpng
192 dnl this likely already comes from GTK
194 dnl Something in here pollutes $LIBS with -lpng.  Make sure to
195 dnl avoid that.
197 old_LIBS="${LIBS}"
199 png_ok=no
200 AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)
201 AC_CHECK_LIB(png, png_read_info, ,png_ok=no, -lz -lm)
202 if test "$png_ok" = yes; then
203   AC_MSG_CHECKING([for png_structp in png.h])
204   dnl Why can't AC_LINK_IFELSE take extra libs?
205   old_LDFLAGS="${LDFLAGS}"
206   LDFLAGS="${LDFLAGS} -lz -lm"
207   AC_LINK_IFELSE([#include <png.h>
208                   png_structp pp;
209                   png_infop info; 
210                   png_colorp cmap; 
211                   main() { void*foo = png_create_read_struct; }],
212                  png_ok=yes,
213                  png_ok=no)
214   LDFLAGS="${old_LDFLAGS}"
215   AC_MSG_RESULT($png_ok)
216   if test "$png_ok" = yes; then
217     PNG_LIBS='-lpng -lz -lm'
218     AC_DEFINE(HAVE_LIBPNG,,[PNG library available])
219   fi
221 AC_SUBST(PNG_LIBS)
223 LIBS="${old_LIBS} ${PNG_LIBS}"
226 dnl Debugging
228 AC_ARG_ENABLE(debug, 
229 [  --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
230   ,
231   enable_debug=minimum)
233 if test "x$enable_debug" = "xyes"; then
234   DEBUG_FLAGS="-g -DENABLE_DEBUG"
235 else
236   if test "x$enable_debug" = "xno"; then
237     DEBUG_FLAGS=""
238   else
239     DEBUG_FLAGS=""
240   fi
242 AC_SUBST(DEBUG_FLAGS)
245 dnl i18n
248 GETTEXT_PACKAGE=dia
249 AC_SUBST(GETTEXT_PACKAGE)
250 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Needed for glib gettext])
251 ALL_LINGUAS="am az be bg bs ca cs da de el en_CA en_GB es eu fi fr ga gu hr hu id is it ja ko lt mk ml mn ms nb ne nl nn pl pt pt_BR ro ru rw sk sl sq sr sr@Latn sv tr uk vi zh_CN zh_TW"
253 AC_CHECK_PROG(XGETTEXT, xgettext, xgettext, none)
254 if test "$XGETTEXT" == none ; then
255    AC_MSG_ERROR([xgettext program not found: $XGETTEXT.])
258 AM_GLIB_GNU_GETTEXT
261 dnl INTLOBJS doesn't seem to always get subst'ed, but I believe it's
262 dnl idempotent
263 AC_SUBST(INTLOBJS)
265 localedir='${prefix}/${DATADIRNAME}/locale'
266 AC_SUBST(localedir)
269 dnl Locate the gnome-xml library
271 dnl GTK2: remove support for libxml1. move check for libxml2 in 
272 dnl AM_PATH_GTK_2_0's fourth argument (module is libxml-2.0)
274 found_libxml=false
275 if test $found_libxml = false; then
276   AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
277   if test "x$XML2_CONFIG" != x ; then
278     AC_MSG_CHECKING(for libxml >= 2.3.9)
279     vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
281     if test "$vers" -ge 2003009; then
282       AC_MSG_RESULT(found)
283       found_libxml=true
284       XML_LIBS="`$XML2_CONFIG --libs`"
285       XML_CFLAGS="`$XML2_CONFIG --cflags`"
287       if test "$enable_gnome_print" = "yes"; then
288           gnome-config --cflags print | \
289           grep gnome-xml 2>&1 >/dev/null && \
290           AC_MSG_ERROR(libxml2 found but gnome-print uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable gnome-print.)
291       fi
292       echo $GNOME_CFLAGS | \
293       grep gnome-xml 2>&1 >/dev/null && \
294       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.)
295         
296     else
297       AC_MSG_RESULT(not found)
298     fi
299   fi
302 if test $found_libxml = false; then
303 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
304 if test "x$XML_CONFIG" != x ; then
305   AC_MSG_CHECKING(for libxml >= 1.8.14)
306   vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
308   dnl 1.18.14 is required for xmlUseNewParser()    
309   if test "$vers" -ge 1008014; then
310     AC_MSG_RESULT(found)
311     found_libxml=true
312     XML_LIBS="`$XML_CONFIG --libs`"
313     XML_CFLAGS="`$XML_CONFIG --cflags`"
314   else
315     AC_MSG_RESULT(not found)
316   fi
320 if test $found_libxml = false; then
321     AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably))
324 AC_SUBST(XML_LIBS)
325 AC_SUBST(XML_CFLAGS)
327 CFLAGS="$XML_CFLAGS $CFLAGS"
329 dnl LibZ
330 AC_CHECK_HEADERS(zlib.h,
331     AC_CHECK_LIB(z, gzread,[
332         AC_DEFINE(HAVE_LIBZ,, we have the libz compression library)
333         if test "x${Z_DIR}" != "x"; then
334             Z_CFLAGS="-I${Z_DIR}/include"
335             Z_LIBS="-L${Z_DIR}/lib -lz"
336         else
337             Z_LIBS="-lz"
338         fi]))
340 AC_SUBST(Z_LIBS)
342 CFLAGS="${CFLAGS} ${Z_CFLAGS}"
343 LIBS="${LIBS} ${Z_LIBS}"
346 dnl Path to UI resources
347 AC_SUBST(uidatadir, '${pkgdatadir}/ui')
350 dnl Platform-specific fixes.
351 dnl 
353 dnl Sun Forte C provides isinf() in the unbundled -lsunmath. Solaris
354 dnl declares finite() in ieeefp.h. It's preferrable not to link 
355 dnl to -lsunmath as it's not present on all machines.
356 have_isinf=no
357 AC_CHECK_HEADERS(math.h,
358         AC_CHECK_LIB(m,isinf,
359                 have_isinf=yes))
361 if test "$have_isinf" = "no"; then
362     AC_CHECK_HEADER(ieeefp.h,
363              [AC_CHECK_FUNC(finite, 
364                        AC_DEFINE(HAVE_IEEEFP_H,1,
365                                  [Define if finite() is defined in ieeefp.h]),
366                        AC_MSG_ERROR([Can't find a definition of neither 
367                                      finite nor isinf]))],
368              [AC_MSG_ERROR(Can't find neither a definition of
369                            isinf nor ieeefp.h)])
370 else
371     AC_DEFINE([HAVE_ISINF], 1, 
372               [Define if the isinf() function is available])
375 dnl Alpha needs -mieee or we get a segfault
376 dnl This shouldn't be needed but is here until a real solution is found
377 case "$host" in
378   alpha*-*-linux*)
379     CFLAGS="$CFLAGS -mieee"
380     ;;
381 esac
383 if test "$GCC" = yes; then
384   dnl Relieve register pressure on i386. Other architectures may become unable
385   dnl to debug, and usually have more registers anyway.
386   dnl case "$host" in 
387   dnl  i?86-pc-*)
388   dnl    DIA_CHECK_CFLAG(-fomit-frame-pointer)
389   dnl    ;;
390   dnl esac
391   dnl (it looks like gdb is very confused by this now even on x86. We might be
392   dnl getting poor stack traces with bug-buddy because of this)
394   DIA_CHECK_CFLAG(-Wall)
395   DIA_CHECK_CFLAG(-Wunused)
396   DIA_CHECK_CFLAG(--std=c89)
397   DIA_CHECK_CFLAG(-Wdeclaration-after-statement)
398   dnl I'd rather like to enable this but it fails on isnan() with -std=c89
399   dnl DIA_CHECK_CFLAG(-Werror-implicit-function-declaration)
400   dnl Premature optimization is the root of all evil.  Uncomment this if
401   dnl you want ti figure out functions that should have been inlined but aint.
402   dnl DIA_CHECK_CFLAG(-Winline)
403   DIA_CHECK_CFLAG(-Wmissing-prototypes)
404   DIA_CHECK_CFLAG(-Wmissing-declarations)
405   DIA_CHECK_CFLAG(-finline-functions)
406   DIA_CHECK_CFLAG(-fstrict-aliasing)
409 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = yes)
411 dnl Do we have the db2html script to build the documentation?
412 AC_ARG_ENABLE(db2html,
413 [  --enable-db2html        don't rebuild documentation],,enable_db2html=no)
414 AC_PATH_PROG(DB2HTML, db2html, no)
415 AM_CONDITIONAL(HAVE_DB2HTML, 
416                test "x$enable_db2html" != xno && test "x$DB2HTML" != xno)
418 dnl Only enable man page generation if we have db2man (in maintainer mode)
421 dnl Have to have the nwalsh docbook.xsl, which does manpages.
422 dnl RedHat installs it in a version-numbered place.  Grumpf.
423 AC_PATH_PROG(XSLTPROC, xsltproc, no)
424 AM_CONDITIONAL(HAVE_DB2MAN, test "x$XSLTPROC" != xno)
425 AC_SUBST(DB2MAN, "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl")
427 dnl Handling for Python
428 AC_ARG_WITH(python,
429 [  --with-python           compile python plug-in],,with_python=no)
431 if test "x$with_python" != xno; then
432   AM_PATH_PYTHON(1.5.2)
433   AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
434   AM_CHECK_PYTHON_HEADERS
435   AM_CHECK_PYTHON_LIB
437   if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then
438     AC_MSG_ERROR([could not find files required to build python plugin])
439   fi
441 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno")
443 AC_OUTPUT(
444 Makefile
445 lib/Makefile
446 lib/pixmaps/Makefile
447 po/Makefile.in
448 objects/Makefile
449 dnl objects/sybase/Makefile
450 objects/AADL/Makefile
451 objects/bondgraph/Makefile
452 objects/chronogram/Makefile
453 objects/custom/Makefile
454 objects/ER/Makefile
455 objects/flowchart/Makefile
456 objects/FS/Makefile
457 objects/GRAFCET/Makefile
458 objects/Istar/Makefile
459 objects/Jackson/Makefile
460 objects/KAOS/Makefile
461 objects/Misc/Makefile
462 objects/network/Makefile
463 objects/SADT/Makefile
464 objects/standard/Makefile
465 objects/UML/Makefile
466 shapes/Makefile
467 shapes/Assorted/Makefile
468 shapes/ChemEng/Makefile
469 shapes/Circuit/Makefile
470 shapes/Cisco/Makefile
471 shapes/Civil/Makefile
472 shapes/Contact/Makefile
473 shapes/Cybernetics/Makefile
474 shapes/Electric/Makefile
475 shapes/flowchart/Makefile
476 shapes/Gane_and_Sarson/Makefile
477 shapes/jigsaw/Makefile
478 shapes/Logic/Makefile
479 shapes/Map/Makefile
480 shapes/Map/Isometric/Makefile
481 shapes/Misc/Makefile
482 shapes/MSE/Makefile
483 shapes/network/Makefile
484 shapes/Pneumatic/Makefile
485 shapes/RDP/Makefile
486 shapes/SDL/Makefile
487 shapes/sybase/Makefile
488 app/Makefile
489 app/pixmaps/Makefile
490 samples/Makefile
491 sheets/Makefile
492 sheets/ER/Makefile
493 sheets/GRAFCET/Makefile
494 sheets/Istar/Makefile
495 sheets/Jackson/Makefile
496 sheets/KAOS/Makefile
497 sheets/UML/Makefile
498 plug-ins/Makefile
499 plug-ins/cgm/Makefile
500 plug-ins/cairo/Makefile
501 plug-ins/dxf/Makefile
502 plug-ins/gprint/Makefile
503 plug-ins/hpgl/Makefile
504 plug-ins/metapost/Makefile
505 plug-ins/pixbuf/Makefile
506 plug-ins/pstricks/Makefile
507 plug-ins/pgf/Makefile
508 plug-ins/python/Makefile
509 plug-ins/shape/Makefile
510 plug-ins/svg/Makefile
511 plug-ins/vdx/Makefile
512 plug-ins/wmf/Makefile
513 plug-ins/wpg/Makefile
514 plug-ins/xfig/Makefile
515 plug-ins/xslt/Makefile
516 tests/Makefile
517 tests/exports/Makefile
518 data/Makefile
519 doc/Makefile
520 doc/en/Makefile
521 doc/eu/Makefile
522 doc/pl/Makefile
525 dnl GTK2: simplify this, we will have much less options.
526 echo "
528 Configuration:
529         Source code location:   ${srcdir}
530         Compiler:               ${CC}
532         Gnome support:                          ${GNOME}
533         Python support:                         ${with_python}
534         Libart support (PNG export):            ${have_libart}
535         Cairo support (experimental):           ${with_cairo}
536         Gnome Print support (experimental):     ${with_gnomeprint}
539 echo "Now type make to build dia..."