using dia-manual.chm instead of dia.chm
[dia.git] / configure.in
blob769e152af83321510157ca66ca866e320cfcd789
1 dnl Process this -*- autoconf -*- file with autoconf to produce a 
2 dnl configure script.
3 AC_INIT(dia, 0.92-pre1, 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.204 $)
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 
16 dnl Initialize maintainer mode
17 AM_MAINTAINER_MODE
19 dnl Initialize libtool
20 AC_DISABLE_STATIC
21 AC_PROG_LIBTOOL
23 dnl Build time sanity check
24 AM_SANITY_CHECK
26 dnl Checks for programs.
27 dnl AC_PROG_CC # already done 
28 AC_PROG_INSTALL
29 AC_PROG_LN_S
30 AC_PROG_MAKE_SET
31 AC_ISC_POSIX
33 dnl Checks for header files.
34 AC_HEADER_DIRENT
35 AC_HEADER_STDC
36 AC_CHECK_HEADERS(stddef.h fcntl.h unistd.h utime.h)
38 dnl Checks for typedefs, structures, and compiler characteristics.
39 AC_C_CONST
41 dnl Checks for library functions.
42 AC_CHECK_FUNCS(select strcspn strdup strtol snprintf)
44 dnl stuff for intltool
45 AC_PROG_INTLTOOL(0.21) 
47 APP_LIBS=""
48 AC_SUBST(APP_LIBS)
51 dnl Checks for libraries
53 AM_PATH_GLIB_2_0(2.0.0)
54 AM_PATH_GTK_2_0(2.0.0)
56 GTK_MODULES="gtk+-2.0 libxml-2.0 gdk-pixbuf-2.0"
57 PKG_CHECK_MODULES(PANGOVERSION, pango >= 1.1.5, , 
58                   AC_MSG_ERROR([Need Pango version 1.1.5 or higher]))
59 PKG_CHECK_MODULES(PANGOFT2,pangoft2,have_pangoft2=true,have_pangoft2=false)
60 if test "$have_pangoft2" = "true"; then
61   dnl On Solaris with Forte C, at least, need to link app/dia with -lfreetype.
62   dnl It's not enough that -lpangoft2 implicitly pulls it in.
63   have_freetype=false
64   AC_CHECK_LIB(freetype,FT_Init_FreeType,have_freetype=true,have_freetype=false,`freetype-config --libs`)
65   if test "$have_freetype" = "true"; then
66     dnl Need 2.0.9, as a bug was fixed for us there.
67     dnl However, freetype-config doesn't give a meaningful version, so we must
68     dnl do it like this.
69     AC_MSG_CHECKING([if FreeType version is 2.0.9 or higher])
70     old_CPPFLAGS="$CPPFLAGS"
71     CPPFLAGS="$CPPFLAGS `freetype-config --cflags`"
72     AC_TRY_CPP([#include <freetype/freetype.h>
73 #if (FREETYPE_MAJOR*1000+FREETYPE_MINOR)*1000+FREETYPE_PATCH < 2000009
74 #error Freetype version too low.
75 #endif
77         [AC_MSG_RESULT(yes)
78          FREETYPE_LIBS=`freetype-config --libs`
79          AC_SUBST(FREETYPE_LIBS)
80          FREETYPE_CFLAGS=`freetype-config --cflags`
81          AC_SUBST(FREETYPE_CFLAGS)
82          GTK_MODULES="$GTK_MODULES pangoft2"
83          AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])]
84     ,
85         [AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])])
86     CPPFLAGS="$old_CPPFLAGS"
87   else
88    AC_MSG_ERROR(Can't find FreeType library)
89   fi
90 else
91    AC_MSG_ERROR(Can't find PangoFT2 library)
94 CFLAGS="$FREETYPE_CFLAGS $CFLAGS"
96 dnl Try for libart
97 PKG_CHECK_MODULES(LIBART,libart-2.0,have_libart=yes,have_libart=no)
98 if test "$have_libart" = "yes" ; then
99    GTK_MODULES="$GTK_MODULES libart-2.0"
100    AC_DEFINE(HAVE_LIBART,1,[Define if building with LIBART support])
103 AC_MSG_CHECKING([whether GNOME specific code should be used])
104 AC_ARG_ENABLE(gnome,[  --enable-gnome          enable gnome code],
105               GNOME=$enableval, GNOME=no)
106 if test "$GNOME" = "yes" ; then
107     GTK_MODULES="$GTK_MODULES libgnome-2.0 libgnomeui-2.0"
108     AC_DEFINE(GNOME,1,[Define if building with GNOME support])
109     AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${prefix}/share/pixmaps", [GNOME icon directory])
110     have_gnome=true
111 else
112     have_gnome=false
114 AM_CONDITIONAL(HAVE_GNOME, $have_gnome)
115 AC_MSG_RESULT($GNOME)
117 dnl GTK2:     libgnomecanvas-2.0 ?
119 PKG_CHECK_MODULES(GTK,$GTK_MODULES)
120 AM_CONDITIONAL(HAVE_BONOBO,false)
122 dnl XSLT
124 # Check if XSLT is available at all
125 XSLT_DIR=""
126 PKG_CHECK_MODULES(XSLT, libxslt, have_xslt=true, have_xslt=false)
127 AM_CONDITIONAL(HAVE_XSLT, $have_xslt)
128 if test "$have_xslt" = "true"; then
129   XSLT_DIR="xslt"
130   XSLT_LIBS="`$PKG_CONFIG --libs libxslt`"
131   XSLT_CFLAGS="`$PKG_CONFIG --cflags libxslt`"
134 AC_SUBST(XSLT_DIR)
135 AC_SUBST(XSLT_LIBS)
136 AC_SUBST(XSLT_CFLAGS)
138 # Figure out a prefix for where to find libxslt at runtime.
139 AC_ARG_WITH(xslt-prefix, 
140             [  --with-xslt-prefix=DIR     Specify where to find the optional XSLT libraries
141                              (default=/usr/lib)], 
142             libxslt_prefix=$withval,
143             libxslt_prefix=/usr/lib)
144 AC_DEFINE_UNQUOTED(LIBXSLT_PREFIX,"$libxslt_prefix", [Place to look for XSLT libs])
147 dnl Popt
150 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [
151                 AC_DEFINE(HAVE_LIBPOPT,,[popt library available])
152                    POPT_LIBS="-lpopt"])
153 AC_CHECK_HEADERS(popt.h)
154 AC_SUBST(POPT_LIBS)
155 APP_LIBS="$APP_LIBS $POPT_LIBS"
158 dnl libpng
160 dnl this likely already comes from GTK
162 dnl Something in here pollutes $LIBS with -lpng.  Make sure to
163 dnl avoid that.
165 old_LIBS="$LIBS"
167 png_ok=no
168 AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)
169 AC_CHECK_LIB(png, png_read_info, ,png_ok=no, -lz -lm)
170 if test "$png_ok" = yes; then
171   AC_MSG_CHECKING([for png_structp in png.h])
172   AC_LINK_IFELSE([#include <png.h>
173                   png_structp pp;
174                   png_infop info; 
175                   png_colorp cmap; 
176                   main() { void*foo = png_create_read_struct; }],
177                  png_ok=yes,
178                  png_ok=no)
179   AC_MSG_RESULT($png_ok)
180   if test "$png_ok" = yes; then
181     PNG_LIBS='-lpng -lz -lm'
182     AC_DEFINE(HAVE_LIBPNG,,[PNG library available])
183   fi
185 AC_SUBST(PNG_LIBS)
187 LIBS="${old_LIBS} ${PNG_LIBS}"
190 dnl Debugging
192 AC_ARG_ENABLE(debug, 
193 [  --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
194   ,
195   enable_debug=minimum)
197 if test "x$enable_debug" = "xyes"; then
198   DEBUG_FLAGS="-g -DENABLE_DEBUG"
199 else
200   if test "x$enable_debug" = "xno"; then
201     DEBUG_FLAGS=""
202   else
203     DEBUG_FLAGS=""
204   fi
206 AC_SUBST(DEBUG_FLAGS)
209 dnl i18n
212 GETTEXT_PACKAGE=dia
213 AC_SUBST(GETTEXT_PACKAGE)
214 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Needed for glib gettext])
215 ALL_LINGUAS="am az be ca cs da de el en_GB es fi fr ga hu it ja ko mk ml ms nl nn no pl pt pt_BR ro ru sk sl sr sr@Latn sv tr uk vi zh_CN zh_TW"
216 AM_GLIB_GNU_GETTEXT
218 dnl INTLOBJS doesn't seem to always get subst'ed, but I believe it's
219 dnl idempotent
220 AC_SUBST(INTLOBJS)
222 localedir='${prefix}/${DATADIRNAME}/locale'
223 AC_SUBST(localedir)
226 dnl Locate the gnome-xml library
228 dnl GTK2: remove support for libxml1. move check for libxml2 in 
229 dnl AM_PATH_GTK_2_0's fourth argument (module is libxml-2.0)
231 found_libxml=false
232 if test $found_libxml = false; then
233   AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
234   if test "x$XML2_CONFIG" != x ; then
235     AC_MSG_CHECKING(for libxml >= 2.3.9)
236     vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
238     if test "$vers" -ge 2003009; then
239       AC_MSG_RESULT(found)
240       found_libxml=true
241       XML_LIBS="`$XML2_CONFIG --libs`"
242       XML_CFLAGS="`$XML2_CONFIG --cflags`"
244       if test "$enable_gnome_print" = "yes"
245       then
246           gnome-config --cflags print | \
247           grep gnome-xml 2>&1 >/dev/null && \
248           AC_MSG_ERROR(libxml2 found but gnome-print uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable gnome-print.)
249       fi
250       echo $GNOME_CFLAGS | \
251       grep gnome-xml 2>&1 >/dev/null && \
252       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.)
253         
254     else
255       AC_MSG_RESULT(not found)
256     fi
257   fi
260 if test $found_libxml = false; then
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
268     AC_MSG_RESULT(found)
269     found_libxml=true
270     XML_LIBS="`$XML_CONFIG --libs`"
271     XML_CFLAGS="`$XML_CONFIG --cflags`"
272   else
273     AC_MSG_RESULT(not found)
274   fi
278 if test $found_libxml = false; then
279     AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably))
282 AC_SUBST(XML_LIBS)
283 AC_SUBST(XML_CFLAGS)
285 CFLAGS="$XML_CFLAGS $CFLAGS"
287 dnl LibZ
288 AC_CHECK_HEADERS(zlib.h,
289     AC_CHECK_LIB(z, gzread,[
290         AC_DEFINE(HAVE_LIBZ,, we have the libz compression library)
291         if test "x${Z_DIR}" != "x"; then
292             Z_CFLAGS="-I${Z_DIR}/include"
293             Z_LIBS="-L${Z_DIR}/lib -lz"
294         else
295             Z_LIBS="-lz"
296         fi]))
298 AC_SUBST(Z_LIBS)
300 CFLAGS="${CFLAGS} ${Z_CFLAGS}"
301 LIBS="${LIBS} ${Z_LIBS}"
303 dnl Platform-specific fixes.
304 dnl 
306 dnl Sun Forte C provides isinf() in the unbundled -lsunmath. Solaris
307 dnl declares finite() in ieeefp.h. It's preferrable not to link 
308 dnl to -lsunmath as it's not present on all machines.
309 have_isinf=no
310 AC_CHECK_HEADERS(math.h,
311         AC_CHECK_LIB(m,isinf,
312                 have_isinf=yes))
314 if test "$have_isinf" = "no"; then
315     AC_CHECK_HEADER(ieeefp.h,
316              [AC_CHECK_FUNC(finite, 
317                        AC_DEFINE(HAVE_IEEEFP_H,1,
318                                  [Define if finite() is defined in ieeefp.h]),
319                        AC_MSG_ERROR([Can't find a definition of neither 
320                                      finite nor isinf]))],
321              [AC_MSG_ERROR(Can't find neither a definition of
322                            isinf nor ieeefp.h)])
323 else
324     AC_DEFINE([HAVE_ISINF], 1, 
325               [Define if the isinf() function is available])
328 dnl Alpha needs -mieee or we get a segfault
329 dnl This shouldn't be needed but is here until a real solution is found
330 case "$host" in
331   alpha*-*-linux*)
332     CFLAGS="$CFLAGS -mieee"
333     ;;
334 esac
336 if test "$GCC" = yes; then
337   dnl Relieve register pressure on i386. Other architectures may become unable
338   dnl to debug, and usually have more registers anyway.
339   dnl case "$host" in 
340   dnl  i?86-pc-*)
341   dnl    DIA_CHECK_CFLAG(-fomit-frame-pointer)
342   dnl    ;;
343   dnl esac
344   dnl (it looks like gdb is very confused by this now even on x86. We might be
345   dnl getting poor stack traces with bug-buddy because of this)
347   DIA_CHECK_CFLAG(-Wall)
348   DIA_CHECK_CFLAG(-Wunused)
349   dnl Premature optimization is the root of all evil.  Uncomment this if
350   dnl you want ti figure out functions that should have been inlined but aint.
351   dnl DIA_CHECK_CFLAG(-Winline)
352   DIA_CHECK_CFLAG(-Wmissing-prototypes)
353   DIA_CHECK_CFLAG(-Wmissing-declarations)
354   DIA_CHECK_CFLAG(-finline-functions)
355   DIA_CHECK_CFLAG(-fstrict-aliasing)
358 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = yes)
360 dnl Do we have the db2html script to build the documentation?
361 AC_ARG_ENABLE(db2html,
362 [  --enable-db2html        don't rebuild documentation],,enable_db2html=no)
363 AC_PATH_PROG(DB2HTML, db2html, no)
364 AM_CONDITIONAL(HAVE_DB2HTML, 
365                test "x$enable_db2html" != xno && test "x$DB2HTML" != xno)
367 dnl Handling for Python
368 AC_ARG_WITH(python,
369 [  --with-python           compile python plug-in],,with_python=no)
371 if test "x$with_python" != xno; then
372   AM_PATH_PYTHON(1.5.2)
373   AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
374   AM_CHECK_PYTHON_HEADERS
375   AM_CHECK_PYTHON_LIB
377   if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then
378     AC_MSG_ERROR([could not find files required to build python plugin])
379   fi
381 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno")
383 AC_OUTPUT(
384 Makefile
385 lib/Makefile
386 po/Makefile.in
387 objects/Makefile
388 dnl objects/sybase/Makefile
389 objects/bondgraph/Makefile
390 objects/chronogram/Makefile
391 objects/custom/Makefile
392 objects/ER/Makefile
393 objects/flowchart/Makefile
394 objects/FS/Makefile
395 objects/GRAFCET/Makefile
396 objects/Misc/Makefile
397 objects/network/Makefile
398 objects/SADT/Makefile
399 objects/standard/Makefile
400 objects/UML/Makefile
401 shapes/Makefile
402 shapes/Assorted/Makefile
403 shapes/Circuit/Makefile
404 shapes/Cisco/Makefile
405 shapes/Civil/Makefile
406 shapes/Contact/Makefile
407 shapes/Electric/Makefile
408 shapes/flowchart/Makefile
409 shapes/jigsaw/Makefile
410 shapes/Logic/Makefile
411 shapes/Misc/Makefile
412 shapes/MSE/Makefile
413 shapes/network/Makefile
414 shapes/Pneumatic/Makefile
415 shapes/SDL/Makefile
416 shapes/sybase/Makefile
417 app/Makefile
418 samples/Makefile
419 sheets/Makefile
420 sheets/ER/Makefile
421 sheets/GRAFCET/Makefile
422 sheets/UML/Makefile
423 plug-ins/Makefile
424 plug-ins/cgm/Makefile
425 plug-ins/dxf/Makefile
426 plug-ins/hpgl/Makefile
427 plug-ins/metapost/Makefile
428 plug-ins/pixbuf/Makefile
429 plug-ins/pstricks/Makefile
430 plug-ins/python/Makefile
431 plug-ins/shape/Makefile
432 plug-ins/svg/Makefile
433 plug-ins/wmf/Makefile
434 plug-ins/wpg/Makefile
435 plug-ins/xfig/Makefile
436 plug-ins/xslt/Makefile
437 doc/Makefile
438 doc/en/Makefile
439 doc/pl/Makefile
442 dnl GTK2: simplify this, we will have much less options.
443 echo "
445 Configuration:
446         Source code location:   ${srcdir}
447         Compiler:               ${CC}
449         Gnome support:                          ${GNOME}
450         Python support:                         ${with_python}
451         Libart support (PNG export):            ${have_libart}
454 echo "Now type make to build dia..."