linewidth is now working for PS_SOLID
[dia.git] / configure.in
bloba39cd0f6222f02895f3a3317b1bfaeb9dafd5fca
1 dnl Process this -*- autoconf -*- file with autoconf to produce a 
2 dnl configure script.
3 AC_INIT(dia, 0.93+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.231 $)
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 AM_PATH_GTK_2_0(2.0.0)
58 GTK_MODULES="gtk+-2.0 libxml-2.0 gdk-pixbuf-2.0"
59 PKG_CHECK_MODULES(PANGOVERSION, pango >= 1.1.5, , 
60                   AC_MSG_ERROR([Need Pango version 1.1.5 or higher]))
61 PKG_CHECK_MODULES(PANGOFT2,pangoft2,have_pangoft2=true,have_pangoft2=false)
62 if test "$have_pangoft2" = "true"; then
63   dnl On Solaris with Forte C, at least, need to link app/dia with -lfreetype.
64   dnl It's not enough that -lpangoft2 implicitly pulls it in.
65   have_freetype=false
66   AC_CHECK_LIB(freetype,FT_Init_FreeType,have_freetype=true,have_freetype=false,`freetype-config --libs`)
67   if test "$have_freetype" = "true"; then
68     dnl Need 2.0.9, as a bug was fixed for us there.
69     dnl However, freetype-config doesn't give a meaningful version, so we must
70     dnl do it like this.
71     AC_MSG_CHECKING([if FreeType version is 2.0.9 or higher])
72     old_CPPFLAGS="$CPPFLAGS"
73     CPPFLAGS="$CPPFLAGS `freetype-config --cflags`"
74     AC_TRY_CPP([#include <ft2build.h>
75 #include FT_FREETYPE_H
76 #if (FREETYPE_MAJOR*1000+FREETYPE_MINOR)*1000+FREETYPE_PATCH < 2000009
77 #error Freetype version too low.
78 #endif
80         [AC_MSG_RESULT(yes)
81          FREETYPE_LIBS=`freetype-config --libs`
82          AC_SUBST(FREETYPE_LIBS)
83          FREETYPE_CFLAGS=`freetype-config --cflags`
84          AC_SUBST(FREETYPE_CFLAGS)
85          GTK_MODULES="$GTK_MODULES pangoft2"
86          AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])]
87     ,
88         [AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])])
89     CPPFLAGS="$old_CPPFLAGS"
90   else
91    AC_MSG_ERROR(Can't find FreeType library)
92   fi
93 else
94    AC_MSG_ERROR(Can't find PangoFT2 library)
97 CFLAGS="$FREETYPE_CFLAGS $CFLAGS"
99 dnl Try for libart
100 PKG_CHECK_MODULES(LIBART,libart-2.0,have_libart=yes,have_libart=no)
101 if test "$have_libart" = "yes" ; then
102    GTK_MODULES="$GTK_MODULES libart-2.0"
103    AC_DEFINE(HAVE_LIBART,1,[Define if building with LIBART support])
106 AC_MSG_CHECKING([whether GNOME specific code should be used])
107 AC_ARG_ENABLE(gnome,[  --enable-gnome          enable gnome code],
108               GNOME=$enableval, GNOME=no)
109 if test "$GNOME" = "yes" ; then
110     GTK_MODULES="$GTK_MODULES libgnome-2.0 libgnomeui-2.0"
111     AC_DEFINE(GNOME,1,[Define if building with GNOME support])
112     AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${prefix}/share/pixmaps", [GNOME icon directory])
113     have_gnome=true
114 else
115     have_gnome=false
117 AM_CONDITIONAL(HAVE_GNOME, $have_gnome)
118 AC_MSG_RESULT($GNOME)
120 dnl GTK2:     libgnomecanvas-2.0 ?
122 PKG_CHECK_MODULES(GTK,$GTK_MODULES)
123 AM_CONDITIONAL(HAVE_BONOBO,false)
125 dnl Look for Cairo
126 AC_ARG_WITH(cairo,
127 [  --with-cairo           compile cairo plug-in],,with_cairo=no)
128 if test "x$with_cairo" != "xno"; then
129   PKG_CHECK_MODULES(CAIRO, cairo,have_cairo=yes,have_cairo=no)
130   AC_SUBST(CAIRO_LIBS)
131   AC_SUBST(CAIRO_CFLAGS)
133 AM_CONDITIONAL(WITH_CAIRO, test "x$with_cairo" != "xno")
135 dnl XSLT
137 # Check if XSLT is available at all
138 XSLT_DIR=""
139 PKG_CHECK_MODULES(XSLT, libxslt, have_xslt=true, have_xslt=false)
140 AM_CONDITIONAL(HAVE_XSLT, $have_xslt)
141 if test "$have_xslt" = "true"; then
142   XSLT_DIR="xslt"
143   XSLT_LIBS="`$PKG_CONFIG --libs libxslt`"
144   XSLT_CFLAGS="`$PKG_CONFIG --cflags libxslt`"
147 AC_SUBST(XSLT_DIR)
148 AC_SUBST(XSLT_LIBS)
149 AC_SUBST(XSLT_CFLAGS)
151 # Figure out a prefix for where to find libxslt at runtime.
152 AC_ARG_WITH(xslt-prefix, 
153             [  --with-xslt-prefix=DIR     Specify where to find the optional XSLT libraries
154                              (default=/usr/lib)], 
155             libxslt_prefix=$withval,
156             libxslt_prefix=/usr/lib)
157 AC_DEFINE_UNQUOTED(LIBXSLT_PREFIX,"$libxslt_prefix", [Place to look for XSLT libs])
160 dnl Popt
163 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [
164                 AC_DEFINE(HAVE_LIBPOPT,,[popt library available])
165                    POPT_LIBS="-lpopt"])
166 AC_CHECK_HEADERS(popt.h)
167 AC_SUBST(POPT_LIBS)
168 APP_LIBS="$APP_LIBS $POPT_LIBS"
171 dnl libpng
173 dnl this likely already comes from GTK
175 dnl Something in here pollutes $LIBS with -lpng.  Make sure to
176 dnl avoid that.
178 old_LIBS="${LIBS}"
180 png_ok=no
181 AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)
182 AC_CHECK_LIB(png, png_read_info, ,png_ok=no, -lz -lm)
183 if test "$png_ok" = yes; then
184   AC_MSG_CHECKING([for png_structp in png.h])
185   dnl Why can't AC_LINK_IFELSE take extra libs?
186   old_LDFLAGS="${LDFLAGS}"
187   LDFLAGS="${LDFLAGS} -lz -lm"
188   AC_LINK_IFELSE([#include <png.h>
189                   png_structp pp;
190                   png_infop info; 
191                   png_colorp cmap; 
192                   main() { void*foo = png_create_read_struct; }],
193                  png_ok=yes,
194                  png_ok=no)
195   LDFLAGS="${old_LDFLAGS}"
196   AC_MSG_RESULT($png_ok)
197   if test "$png_ok" = yes; then
198     PNG_LIBS='-lpng -lz -lm'
199     AC_DEFINE(HAVE_LIBPNG,,[PNG library available])
200   fi
202 AC_SUBST(PNG_LIBS)
204 LIBS="${old_LIBS} ${PNG_LIBS}"
207 dnl Debugging
209 AC_ARG_ENABLE(debug, 
210 [  --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
211   ,
212   enable_debug=minimum)
214 if test "x$enable_debug" = "xyes"; then
215   DEBUG_FLAGS="-g -DENABLE_DEBUG"
216 else
217   if test "x$enable_debug" = "xno"; then
218     DEBUG_FLAGS=""
219   else
220     DEBUG_FLAGS=""
221   fi
223 AC_SUBST(DEBUG_FLAGS)
226 dnl i18n
229 GETTEXT_PACKAGE=dia
230 AC_SUBST(GETTEXT_PACKAGE)
231 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Needed for glib gettext])
232 ALL_LINGUAS="am az be ca cs da de el en_CA en_GB es fi fr ga hr hu is it ja ko mk mn ml ms nl nn no pl pt pt_BR ro ru sk sl sq sr sr@Latn sv tr uk vi zh_CN zh_TW"
233 AM_GLIB_GNU_GETTEXT
235 dnl INTLOBJS doesn't seem to always get subst'ed, but I believe it's
236 dnl idempotent
237 AC_SUBST(INTLOBJS)
239 localedir='${prefix}/${DATADIRNAME}/locale'
240 AC_SUBST(localedir)
243 dnl Locate the gnome-xml library
245 dnl GTK2: remove support for libxml1. move check for libxml2 in 
246 dnl AM_PATH_GTK_2_0's fourth argument (module is libxml-2.0)
248 found_libxml=false
249 if test $found_libxml = false; then
250   AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
251   if test "x$XML2_CONFIG" != x ; then
252     AC_MSG_CHECKING(for libxml >= 2.3.9)
253     vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
255     if test "$vers" -ge 2003009; then
256       AC_MSG_RESULT(found)
257       found_libxml=true
258       XML_LIBS="`$XML2_CONFIG --libs`"
259       XML_CFLAGS="`$XML2_CONFIG --cflags`"
261       if test "$enable_gnome_print" = "yes"
262       then
263           gnome-config --cflags print | \
264           grep gnome-xml 2>&1 >/dev/null && \
265           AC_MSG_ERROR(libxml2 found but gnome-print uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable gnome-print.)
266       fi
267       echo $GNOME_CFLAGS | \
268       grep gnome-xml 2>&1 >/dev/null && \
269       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.)
270         
271     else
272       AC_MSG_RESULT(not found)
273     fi
274   fi
277 if test $found_libxml = false; then
278 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
279 if test "x$XML_CONFIG" != x ; then
280   AC_MSG_CHECKING(for libxml >= 1.8.14)
281   vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
283   dnl 1.18.14 is required for xmlUseNewParser()    
284   if test "$vers" -ge 1008014; then
285     AC_MSG_RESULT(found)
286     found_libxml=true
287     XML_LIBS="`$XML_CONFIG --libs`"
288     XML_CFLAGS="`$XML_CONFIG --cflags`"
289   else
290     AC_MSG_RESULT(not found)
291   fi
295 if test $found_libxml = false; then
296     AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably))
299 AC_SUBST(XML_LIBS)
300 AC_SUBST(XML_CFLAGS)
302 CFLAGS="$XML_CFLAGS $CFLAGS"
304 dnl LibZ
305 AC_CHECK_HEADERS(zlib.h,
306     AC_CHECK_LIB(z, gzread,[
307         AC_DEFINE(HAVE_LIBZ,, we have the libz compression library)
308         if test "x${Z_DIR}" != "x"; then
309             Z_CFLAGS="-I${Z_DIR}/include"
310             Z_LIBS="-L${Z_DIR}/lib -lz"
311         else
312             Z_LIBS="-lz"
313         fi]))
315 AC_SUBST(Z_LIBS)
317 CFLAGS="${CFLAGS} ${Z_CFLAGS}"
318 LIBS="${LIBS} ${Z_LIBS}"
320 dnl Platform-specific fixes.
321 dnl 
323 dnl Sun Forte C provides isinf() in the unbundled -lsunmath. Solaris
324 dnl declares finite() in ieeefp.h. It's preferrable not to link 
325 dnl to -lsunmath as it's not present on all machines.
326 have_isinf=no
327 AC_CHECK_HEADERS(math.h,
328         AC_CHECK_LIB(m,isinf,
329                 have_isinf=yes))
331 if test "$have_isinf" = "no"; then
332     AC_CHECK_HEADER(ieeefp.h,
333              [AC_CHECK_FUNC(finite, 
334                        AC_DEFINE(HAVE_IEEEFP_H,1,
335                                  [Define if finite() is defined in ieeefp.h]),
336                        AC_MSG_ERROR([Can't find a definition of neither 
337                                      finite nor isinf]))],
338              [AC_MSG_ERROR(Can't find neither a definition of
339                            isinf nor ieeefp.h)])
340 else
341     AC_DEFINE([HAVE_ISINF], 1, 
342               [Define if the isinf() function is available])
345 dnl Alpha needs -mieee or we get a segfault
346 dnl This shouldn't be needed but is here until a real solution is found
347 case "$host" in
348   alpha*-*-linux*)
349     CFLAGS="$CFLAGS -mieee"
350     ;;
351 esac
353 if test "$GCC" = yes; then
354   dnl Relieve register pressure on i386. Other architectures may become unable
355   dnl to debug, and usually have more registers anyway.
356   dnl case "$host" in 
357   dnl  i?86-pc-*)
358   dnl    DIA_CHECK_CFLAG(-fomit-frame-pointer)
359   dnl    ;;
360   dnl esac
361   dnl (it looks like gdb is very confused by this now even on x86. We might be
362   dnl getting poor stack traces with bug-buddy because of this)
364   DIA_CHECK_CFLAG(-Wall)
365   DIA_CHECK_CFLAG(-Wunused)
366   dnl Premature optimization is the root of all evil.  Uncomment this if
367   dnl you want ti figure out functions that should have been inlined but aint.
368   dnl DIA_CHECK_CFLAG(-Winline)
369   DIA_CHECK_CFLAG(-Wmissing-prototypes)
370   DIA_CHECK_CFLAG(-Wmissing-declarations)
371   DIA_CHECK_CFLAG(-finline-functions)
372   DIA_CHECK_CFLAG(-fstrict-aliasing)
375 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = yes)
377 dnl Do we have the db2html script to build the documentation?
378 AC_ARG_ENABLE(db2html,
379 [  --enable-db2html        don't rebuild documentation],,enable_db2html=no)
380 AC_PATH_PROG(DB2HTML, db2html, no)
381 AM_CONDITIONAL(HAVE_DB2HTML, 
382                test "x$enable_db2html" != xno && test "x$DB2HTML" != xno)
384 dnl Only enable man page generation if we have db2man (in maintainer mode)
386 dnl Have to have the nwalsh docbook.xsl, which does manpages.
387 dnl RedHat installs it in a version-numbered place.  Grumpf.
388 db2man_file=
389 for file in \
390   /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl \
391   /usr/share/sgml/docbook/xsl-stylesheets-\*/manpages/docbook.xsl; do
392   if test -f $file; then db2man_file=$file; break; fi
393 done
394 AM_CONDITIONAL(HAVE_DB2MAN, test "x$db2man_file" != x)
395 AC_SUBST(DB2MAN, "$db2man_file")
397 dnl Handling for Python
398 AC_ARG_WITH(python,
399 [  --with-python           compile python plug-in],,with_python=no)
401 if test "x$with_python" != xno; then
402   AM_PATH_PYTHON(1.5.2)
403   AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
404   AM_CHECK_PYTHON_HEADERS
405   AM_CHECK_PYTHON_LIB
407   if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then
408     AC_MSG_ERROR([could not find files required to build python plugin])
409   fi
411 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno")
413 AC_OUTPUT(
414 Makefile
415 lib/Makefile
416 lib/pixmaps/Makefile
417 po/Makefile.in
418 objects/Makefile
419 dnl objects/sybase/Makefile
420 objects/bondgraph/Makefile
421 objects/chronogram/Makefile
422 objects/custom/Makefile
423 objects/ER/Makefile
424 objects/flowchart/Makefile
425 objects/FS/Makefile
426 objects/GRAFCET/Makefile
427 objects/Istar/Makefile
428 objects/Jackson/Makefile
429 objects/KAOS/Makefile
430 objects/Misc/Makefile
431 objects/network/Makefile
432 objects/SADT/Makefile
433 objects/standard/Makefile
434 objects/UML/Makefile
435 shapes/Makefile
436 shapes/Assorted/Makefile
437 shapes/ChemEng/Makefile
438 shapes/Circuit/Makefile
439 shapes/Cisco/Makefile
440 shapes/Civil/Makefile
441 shapes/Contact/Makefile
442 shapes/Cybernetics/Makefile
443 shapes/Electric/Makefile
444 shapes/flowchart/Makefile
445 shapes/jigsaw/Makefile
446 shapes/Logic/Makefile
447 shapes/Map/Makefile
448 shapes/Map/Isometric/Makefile
449 shapes/Misc/Makefile
450 shapes/MSE/Makefile
451 shapes/network/Makefile
452 shapes/Pneumatic/Makefile
453 shapes/SDL/Makefile
454 shapes/sybase/Makefile
455 app/Makefile
456 app/pixmaps/Makefile
457 samples/Makefile
458 sheets/Makefile
459 sheets/ER/Makefile
460 sheets/GRAFCET/Makefile
461 sheets/Istar/Makefile
462 sheets/Jackson/Makefile
463 sheets/KAOS/Makefile
464 sheets/UML/Makefile
465 plug-ins/Makefile
466 plug-ins/cgm/Makefile
467 plug-ins/cairo/Makefile
468 plug-ins/dxf/Makefile
469 plug-ins/hpgl/Makefile
470 plug-ins/metapost/Makefile
471 plug-ins/pixbuf/Makefile
472 plug-ins/pstricks/Makefile
473 plug-ins/python/Makefile
474 plug-ins/shape/Makefile
475 plug-ins/svg/Makefile
476 plug-ins/wmf/Makefile
477 plug-ins/wpg/Makefile
478 plug-ins/xfig/Makefile
479 plug-ins/xslt/Makefile
480 doc/Makefile
481 doc/en/Makefile
482 doc/pl/Makefile
485 dnl GTK2: simplify this, we will have much less options.
486 echo "
488 Configuration:
489         Source code location:   ${srcdir}
490         Compiler:               ${CC}
492         Gnome support:                          ${GNOME}
493         Python support:                         ${with_python}
494         Libart support (PNG export):            ${have_libart}
495         Cairo support (experimental):           ${have_cairo}
498 echo "Now type make to build dia..."