UML class fix bigtime.
[dia.git] / configure.in
blob41dcf95aee3e012c96cf06dbf8695605533941bd
1 dnl Process this -*- autoconf -*- file with autoconf to produce a 
2 dnl configure script.
3 AC_INIT(dia, 0.94+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.257 $)
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 AM_PATH_GLIB_2_0(2.0.0)
56 PKG_CHECK_MODULES(GMODULE, gmodule-2.0 gobject-2.0)
57 AC_SUBST(GMODULE_CFLAGS)
58 AC_SUBST(GMODULE_LIBS)
59 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
61 AM_PATH_GTK_2_0(2.4.0)
63 GTK_MODULES="gtk+-2.0 libxml-2.0 gdk-pixbuf-2.0 gthread-2.0"
64 PKG_CHECK_MODULES(PANGOVERSION, pango >= 1.1.5, , 
65                   AC_MSG_ERROR([Need Pango version 1.1.5 or higher]))
66 PKG_CHECK_MODULES(PANGOFT2,pangoft2,have_pangoft2=true,have_pangoft2=false)
67 if test "$have_pangoft2" = "true"; then
68   dnl On Solaris with Forte C, at least, need to link app/dia with -lfreetype.
69   dnl It's not enough that -lpangoft2 implicitly pulls it in.
70   have_freetype=false
71   AC_CHECK_LIB(freetype,FT_Init_FreeType,have_freetype=true,have_freetype=false,`freetype-config --libs`)
72   if test "$have_freetype" = "true"; then
73     dnl Need 2.0.9, as a bug was fixed for us there.
74     dnl However, freetype-config doesn't give a meaningful version, so we must
75     dnl do it like this.
76     AC_MSG_CHECKING([if FreeType version is 2.0.9 or higher])
77     old_CPPFLAGS="$CPPFLAGS"
78     CPPFLAGS="$CPPFLAGS `freetype-config --cflags`"
79     AC_TRY_CPP([#include <ft2build.h>
80 #include FT_FREETYPE_H
81 #if (FREETYPE_MAJOR*1000+FREETYPE_MINOR)*1000+FREETYPE_PATCH < 2000009
82 #error Freetype version too low.
83 #endif
85         [AC_MSG_RESULT(yes)
86          FREETYPE_LIBS=`freetype-config --libs`
87          AC_SUBST(FREETYPE_LIBS)
88          FREETYPE_CFLAGS=`freetype-config --cflags`
89          AC_SUBST(FREETYPE_CFLAGS)
90          GTK_MODULES="$GTK_MODULES pangoft2"
91          AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])]
92     ,
93         [AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])])
94     CPPFLAGS="$old_CPPFLAGS"
95   else
96    AC_MSG_ERROR(Can't find FreeType library)
97   fi
98 else
99    AC_MSG_ERROR(Can't find PangoFT2 library)
102 CFLAGS="$FREETYPE_CFLAGS $CFLAGS"
104 dnl Try for libart
105 PKG_CHECK_MODULES(LIBART,libart-2.0,have_libart=yes,have_libart=no)
106 if test "$have_libart" = "yes" ; then
107    GTK_MODULES="$GTK_MODULES libart-2.0"
108    AC_DEFINE(HAVE_LIBART,1,[Define if building with LIBART support])
111 AC_MSG_CHECKING([whether GNOME specific code should be used])
112 AC_ARG_ENABLE(gnome,[  --enable-gnome          enable gnome code],
113               GNOME=$enableval, GNOME=no)
114 if test "$GNOME" = "yes" ; then
115     GTK_MODULES="$GTK_MODULES libgnome-2.0 libgnomeui-2.0"
116     AC_DEFINE(GNOME,1,[Define if building with GNOME support])
117     AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${prefix}/share/pixmaps", [GNOME icon directory])
118     have_gnome=true
119 else
120     have_gnome=false
122 AM_CONDITIONAL(HAVE_GNOME, $have_gnome)
123 AC_MSG_RESULT($GNOME)
125 dnl GTK2:     libgnomecanvas-2.0 ?
127 PKG_CHECK_MODULES(GTK,$GTK_MODULES)
128 AC_SUBST(GTK_CFLAGS)
129 AC_SUBST(GTK_LIBS)
131 AM_CONDITIONAL(HAVE_BONOBO,false)
133 dnl Look for Gnome Print
134 AC_ARG_WITH(gnomeprint,
135 [  --with-gnomeprint        compile *experimental* gnomeprint plug-in],,with_gnomeprint=no)
136 if test "x$with_gnomeprint" == "xyes"; then
137   PKG_CHECK_MODULES(GNOMEPRINT, libgnomeprint-2.2, have_gnomeprint=yes,have_gnomeprint=no)
138   AC_SUBST(GNOMEPRINT_LIBS)
139   AC_SUBST(GNOMEPRINT_CFLAGS)
140   AC_DEFINE(HAVE_GNOMEPRINT,1,[Define if building with Gnome Print support])
142 AM_CONDITIONAL(WITH_GNOMEPRINT, test "x$with_gnomeprint" != "xno")
144 dnl Look for Cairo
145 AC_ARG_WITH(cairo,
146 [  --with-cairo           compile *experimental* cairo plug-in],,with_cairo=no)
147 if test "x$with_cairo" != "xno"; then
148   PKG_CHECK_MODULES(CAIROVERSION, cairo >= 0.6.0, , 
149                     AC_MSG_ERROR([Need Cairo version 0.6.0 or higher]))
150   PKG_CHECK_MODULES(CAIRO, cairo,have_cairo=yes,have_cairo=no)
151   AC_SUBST(CAIRO_LIBS)
152   AC_SUBST(CAIRO_CFLAGS)
153   AC_DEFINE(HAVE_CAIRO,1,[Define if building with Cairo support])
155 AM_CONDITIONAL(WITH_CAIRO, test "x$with_cairo" != "xno")
157 dnl XSLT
159 # Check if XSLT is available at all
160 XSLT_DIR=""
161 PKG_CHECK_MODULES(XSLT, libxslt, have_xslt=true, have_xslt=false)
162 AM_CONDITIONAL(HAVE_XSLT, $have_xslt)
163 if test "$have_xslt" = "true"; then
164   XSLT_DIR="xslt"
165   XSLT_LIBS="`$PKG_CONFIG --libs libxslt`"
166   XSLT_CFLAGS="`$PKG_CONFIG --cflags libxslt`"
169 AC_SUBST(XSLT_DIR)
170 AC_SUBST(XSLT_LIBS)
171 AC_SUBST(XSLT_CFLAGS)
173 # Figure out a prefix for where to find libxslt at runtime.
174 AC_ARG_WITH(xslt-prefix, 
175             [  --with-xslt-prefix=DIR     Specify where to find the optional XSLT libraries
176                              (default=/usr/lib)], 
177             libxslt_prefix=$withval,
178             libxslt_prefix=/usr/lib)
179 AC_DEFINE_UNQUOTED(LIBXSLT_PREFIX,"$libxslt_prefix", [Place to look for XSLT libs])
182 dnl Popt
185 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [
186                 AC_DEFINE(HAVE_LIBPOPT,,[popt library available])
187                    POPT_LIBS="-lpopt"])
188 AC_CHECK_HEADERS(popt.h)
189 AC_SUBST(POPT_LIBS)
190 APP_LIBS="$APP_LIBS $POPT_LIBS"
193 dnl libpng
195 dnl this likely already comes from GTK
197 dnl Something in here pollutes $LIBS with -lpng.  Make sure to
198 dnl avoid that.
200 old_LIBS="${LIBS}"
202 png_ok=no
203 AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)
204 AC_CHECK_LIB(png, png_read_info, ,png_ok=no, -lz -lm)
205 if test "$png_ok" = yes; then
206   AC_MSG_CHECKING([for png_structp in png.h])
207   dnl Why can't AC_LINK_IFELSE take extra libs?
208   old_LDFLAGS="${LDFLAGS}"
209   LDFLAGS="${LDFLAGS} -lz -lm"
210   AC_LINK_IFELSE([#include <png.h>
211                   png_structp pp;
212                   png_infop info; 
213                   png_colorp cmap; 
214                   main() { void*foo = png_create_read_struct; }],
215                  png_ok=yes,
216                  png_ok=no)
217   LDFLAGS="${old_LDFLAGS}"
218   AC_MSG_RESULT($png_ok)
219   if test "$png_ok" = yes; then
220     PNG_LIBS='-lpng -lz -lm'
221     AC_DEFINE(HAVE_LIBPNG,,[PNG library available])
222   fi
224 AC_SUBST(PNG_LIBS)
226 LIBS="${old_LIBS} ${PNG_LIBS}"
229 dnl Debugging
231 AC_ARG_ENABLE(debug, 
232 [  --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
233   ,
234   enable_debug=minimum)
236 if test "x$enable_debug" = "xyes"; then
237   DEBUG_FLAGS="-g -DENABLE_DEBUG"
238 else
239   if test "x$enable_debug" = "xno"; then
240     DEBUG_FLAGS=""
241   else
242     DEBUG_FLAGS=""
243   fi
245 AC_SUBST(DEBUG_FLAGS)
248 dnl i18n
251 GETTEXT_PACKAGE=dia
252 AC_SUBST(GETTEXT_PACKAGE)
253 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Needed for glib gettext])
254 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 mk ml mn ms nb ne nl nn no pl pt pt_BR ro ru rw sk sl sq sr sr@Latn sv tr uk vi zh_CN zh_TW"
255 AM_GLIB_GNU_GETTEXT
257 dnl INTLOBJS doesn't seem to always get subst'ed, but I believe it's
258 dnl idempotent
259 AC_SUBST(INTLOBJS)
261 localedir='${prefix}/${DATADIRNAME}/locale'
262 AC_SUBST(localedir)
265 dnl Locate the gnome-xml library
267 dnl GTK2: remove support for libxml1. move check for libxml2 in 
268 dnl AM_PATH_GTK_2_0's fourth argument (module is libxml-2.0)
270 found_libxml=false
271 if test $found_libxml = false; then
272   AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
273   if test "x$XML2_CONFIG" != x ; then
274     AC_MSG_CHECKING(for libxml >= 2.3.9)
275     vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
277     if test "$vers" -ge 2003009; then
278       AC_MSG_RESULT(found)
279       found_libxml=true
280       XML_LIBS="`$XML2_CONFIG --libs`"
281       XML_CFLAGS="`$XML2_CONFIG --cflags`"
283       if test "$enable_gnome_print" = "yes"; then
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.)
287       fi
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.)
291         
292     else
293       AC_MSG_RESULT(not found)
294     fi
295   fi
298 if test $found_libxml = false; then
299 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
300 if test "x$XML_CONFIG" != x ; then
301   AC_MSG_CHECKING(for libxml >= 1.8.14)
302   vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
304   dnl 1.18.14 is required for xmlUseNewParser()    
305   if test "$vers" -ge 1008014; then
306     AC_MSG_RESULT(found)
307     found_libxml=true
308     XML_LIBS="`$XML_CONFIG --libs`"
309     XML_CFLAGS="`$XML_CONFIG --cflags`"
310   else
311     AC_MSG_RESULT(not found)
312   fi
316 if test $found_libxml = false; then
317     AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably))
320 AC_SUBST(XML_LIBS)
321 AC_SUBST(XML_CFLAGS)
323 CFLAGS="$XML_CFLAGS $CFLAGS"
325 dnl LibZ
326 AC_CHECK_HEADERS(zlib.h,
327     AC_CHECK_LIB(z, gzread,[
328         AC_DEFINE(HAVE_LIBZ,, we have the libz compression library)
329         if test "x${Z_DIR}" != "x"; then
330             Z_CFLAGS="-I${Z_DIR}/include"
331             Z_LIBS="-L${Z_DIR}/lib -lz"
332         else
333             Z_LIBS="-lz"
334         fi]))
336 AC_SUBST(Z_LIBS)
338 CFLAGS="${CFLAGS} ${Z_CFLAGS}"
339 LIBS="${LIBS} ${Z_LIBS}"
341 dnl Platform-specific fixes.
342 dnl 
344 dnl Sun Forte C provides isinf() in the unbundled -lsunmath. Solaris
345 dnl declares finite() in ieeefp.h. It's preferrable not to link 
346 dnl to -lsunmath as it's not present on all machines.
347 have_isinf=no
348 AC_CHECK_HEADERS(math.h,
349         AC_CHECK_LIB(m,isinf,
350                 have_isinf=yes))
352 if test "$have_isinf" = "no"; then
353     AC_CHECK_HEADER(ieeefp.h,
354              [AC_CHECK_FUNC(finite, 
355                        AC_DEFINE(HAVE_IEEEFP_H,1,
356                                  [Define if finite() is defined in ieeefp.h]),
357                        AC_MSG_ERROR([Can't find a definition of neither 
358                                      finite nor isinf]))],
359              [AC_MSG_ERROR(Can't find neither a definition of
360                            isinf nor ieeefp.h)])
361 else
362     AC_DEFINE([HAVE_ISINF], 1, 
363               [Define if the isinf() function is available])
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
368 case "$host" in
369   alpha*-*-linux*)
370     CFLAGS="$CFLAGS -mieee"
371     ;;
372 esac
374 if test "$GCC" = yes; then
375   dnl Relieve register pressure on i386. Other architectures may become unable
376   dnl to debug, and usually have more registers anyway.
377   dnl case "$host" in 
378   dnl  i?86-pc-*)
379   dnl    DIA_CHECK_CFLAG(-fomit-frame-pointer)
380   dnl    ;;
381   dnl esac
382   dnl (it looks like gdb is very confused by this now even on x86. We might be
383   dnl getting poor stack traces with bug-buddy because of this)
385   DIA_CHECK_CFLAG(-Wall)
386   DIA_CHECK_CFLAG(-Wunused)
387   dnl Premature optimization is the root of all evil.  Uncomment this if
388   dnl you want ti figure out functions that should have been inlined but aint.
389   dnl DIA_CHECK_CFLAG(-Winline)
390   DIA_CHECK_CFLAG(-Wmissing-prototypes)
391   DIA_CHECK_CFLAG(-Wmissing-declarations)
392   DIA_CHECK_CFLAG(-finline-functions)
393   DIA_CHECK_CFLAG(-fstrict-aliasing)
396 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = yes)
398 dnl Do we have the db2html script to build the documentation?
399 AC_ARG_ENABLE(db2html,
400 [  --enable-db2html        don't rebuild documentation],,enable_db2html=no)
401 AC_PATH_PROG(DB2HTML, db2html, no)
402 AM_CONDITIONAL(HAVE_DB2HTML, 
403                test "x$enable_db2html" != xno && test "x$DB2HTML" != xno)
405 dnl Only enable man page generation if we have db2man (in maintainer mode)
408 dnl Have to have the nwalsh docbook.xsl, which does manpages.
409 dnl RedHat installs it in a version-numbered place.  Grumpf.
410 AC_PATH_PROG(XSLTPROC, xsltproc, no)
411 AM_CONDITIONAL(HAVE_DB2MAN, test "x$XSLTPROC" != xno)
412 AC_SUBST(DB2MAN, "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl")
414 dnl Handling for Python
415 AC_ARG_WITH(python,
416 [  --with-python           compile python plug-in],,with_python=no)
418 if test "x$with_python" != xno; then
419   AM_PATH_PYTHON(1.5.2)
420   AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
421   AM_CHECK_PYTHON_HEADERS
422   AM_CHECK_PYTHON_LIB
424   if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then
425     AC_MSG_ERROR([could not find files required to build python plugin])
426   fi
428 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno")
430 AC_OUTPUT(
431 Makefile
432 lib/Makefile
433 lib/pixmaps/Makefile
434 po/Makefile.in
435 objects/Makefile
436 dnl objects/sybase/Makefile
437 objects/bondgraph/Makefile
438 objects/chronogram/Makefile
439 objects/custom/Makefile
440 objects/ER/Makefile
441 objects/flowchart/Makefile
442 objects/FS/Makefile
443 objects/GRAFCET/Makefile
444 objects/Istar/Makefile
445 objects/Jackson/Makefile
446 objects/KAOS/Makefile
447 objects/Misc/Makefile
448 objects/network/Makefile
449 objects/SADT/Makefile
450 objects/standard/Makefile
451 objects/UML/Makefile
452 shapes/Makefile
453 shapes/Assorted/Makefile
454 shapes/ChemEng/Makefile
455 shapes/Circuit/Makefile
456 shapes/Cisco/Makefile
457 shapes/Civil/Makefile
458 shapes/Contact/Makefile
459 shapes/Cybernetics/Makefile
460 shapes/Electric/Makefile
461 shapes/flowchart/Makefile
462 shapes/jigsaw/Makefile
463 shapes/Logic/Makefile
464 shapes/Map/Makefile
465 shapes/Map/Isometric/Makefile
466 shapes/Misc/Makefile
467 shapes/MSE/Makefile
468 shapes/network/Makefile
469 shapes/Pneumatic/Makefile
470 shapes/RDP/Makefile
471 shapes/SDL/Makefile
472 shapes/sybase/Makefile
473 app/Makefile
474 app/pixmaps/Makefile
475 samples/Makefile
476 sheets/Makefile
477 sheets/ER/Makefile
478 sheets/GRAFCET/Makefile
479 sheets/Istar/Makefile
480 sheets/Jackson/Makefile
481 sheets/KAOS/Makefile
482 sheets/UML/Makefile
483 plug-ins/Makefile
484 plug-ins/cgm/Makefile
485 plug-ins/cairo/Makefile
486 plug-ins/dxf/Makefile
487 plug-ins/gprint/Makefile
488 plug-ins/hpgl/Makefile
489 plug-ins/metapost/Makefile
490 plug-ins/pixbuf/Makefile
491 plug-ins/pstricks/Makefile
492 plug-ins/python/Makefile
493 plug-ins/shape/Makefile
494 plug-ins/svg/Makefile
495 plug-ins/wmf/Makefile
496 plug-ins/wpg/Makefile
497 plug-ins/xfig/Makefile
498 plug-ins/xslt/Makefile
499 doc/Makefile
500 doc/en/Makefile
501 doc/eu/Makefile
502 doc/pl/Makefile
505 dnl GTK2: simplify this, we will have much less options.
506 echo "
508 Configuration:
509         Source code location:   ${srcdir}
510         Compiler:               ${CC}
512         Gnome support:                          ${GNOME}
513         Python support:                         ${with_python}
514         Libart support (PNG export):            ${have_libart}
515         Cairo support (experimental):           ${with_cairo}
516         Gnome Print support (experimental):     ${with_gnomeprint}
519 echo "Now type make to build dia..."