Ooops typo fixed bug is #127968
[dia.git] / configure.in
blob4da7ca1da1022cbdc4752d38ca64e2091a105387
1 dnl Process this -*- autoconf -*- file with autoconf to produce a 
2 dnl configure script.
3 AC_INIT(dia, 0.92.2+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.215 $)
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 <ft2build.h>
73 #include FT_FREETYPE_H
74 #if (FREETYPE_MAJOR*1000+FREETYPE_MINOR)*1000+FREETYPE_PATCH < 2000009
75 #error Freetype version too low.
76 #endif
78         [AC_MSG_RESULT(yes)
79          FREETYPE_LIBS=`freetype-config --libs`
80          AC_SUBST(FREETYPE_LIBS)
81          FREETYPE_CFLAGS=`freetype-config --cflags`
82          AC_SUBST(FREETYPE_CFLAGS)
83          GTK_MODULES="$GTK_MODULES pangoft2"
84          AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])]
85     ,
86         [AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])])
87     CPPFLAGS="$old_CPPFLAGS"
88   else
89    AC_MSG_ERROR(Can't find FreeType library)
90   fi
91 else
92    AC_MSG_ERROR(Can't find PangoFT2 library)
95 CFLAGS="$FREETYPE_CFLAGS $CFLAGS"
97 dnl Try for libart
98 PKG_CHECK_MODULES(LIBART,libart-2.0,have_libart=yes,have_libart=no)
99 if test "$have_libart" = "yes" ; then
100    GTK_MODULES="$GTK_MODULES libart-2.0"
101    AC_DEFINE(HAVE_LIBART,1,[Define if building with LIBART support])
104 AC_MSG_CHECKING([whether GNOME specific code should be used])
105 AC_ARG_ENABLE(gnome,[  --enable-gnome          enable gnome code],
106               GNOME=$enableval, GNOME=no)
107 if test "$GNOME" = "yes" ; then
108     GTK_MODULES="$GTK_MODULES libgnome-2.0 libgnomeui-2.0"
109     AC_DEFINE(GNOME,1,[Define if building with GNOME support])
110     AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${prefix}/share/pixmaps", [GNOME icon directory])
111     have_gnome=true
112 else
113     have_gnome=false
115 AM_CONDITIONAL(HAVE_GNOME, $have_gnome)
116 AC_MSG_RESULT($GNOME)
118 dnl GTK2:     libgnomecanvas-2.0 ?
120 PKG_CHECK_MODULES(GTK,$GTK_MODULES)
121 AM_CONDITIONAL(HAVE_BONOBO,false)
123 dnl XSLT
125 # Check if XSLT is available at all
126 XSLT_DIR=""
127 PKG_CHECK_MODULES(XSLT, libxslt, have_xslt=true, have_xslt=false)
128 AM_CONDITIONAL(HAVE_XSLT, $have_xslt)
129 if test "$have_xslt" = "true"; then
130   XSLT_DIR="xslt"
131   XSLT_LIBS="`$PKG_CONFIG --libs libxslt`"
132   XSLT_CFLAGS="`$PKG_CONFIG --cflags libxslt`"
135 AC_SUBST(XSLT_DIR)
136 AC_SUBST(XSLT_LIBS)
137 AC_SUBST(XSLT_CFLAGS)
139 # Figure out a prefix for where to find libxslt at runtime.
140 AC_ARG_WITH(xslt-prefix, 
141             [  --with-xslt-prefix=DIR     Specify where to find the optional XSLT libraries
142                              (default=/usr/lib)], 
143             libxslt_prefix=$withval,
144             libxslt_prefix=/usr/lib)
145 AC_DEFINE_UNQUOTED(LIBXSLT_PREFIX,"$libxslt_prefix", [Place to look for XSLT libs])
148 dnl Popt
151 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [
152                 AC_DEFINE(HAVE_LIBPOPT,,[popt library available])
153                    POPT_LIBS="-lpopt"])
154 AC_CHECK_HEADERS(popt.h)
155 AC_SUBST(POPT_LIBS)
156 APP_LIBS="$APP_LIBS $POPT_LIBS"
159 dnl libpng
161 dnl this likely already comes from GTK
163 dnl Something in here pollutes $LIBS with -lpng.  Make sure to
164 dnl avoid that.
166 old_LIBS="${LIBS}"
168 png_ok=no
169 AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)
170 AC_CHECK_LIB(png, png_read_info, ,png_ok=no, -lz -lm)
171 if test "$png_ok" = yes; then
172   AC_MSG_CHECKING([for png_structp in png.h])
173   dnl Why can't AC_LINK_IFELSE take extra libs?
174   old_LDFLAGS="${LDFLAGS}"
175   LDFLAGS="${LDFLAGS} -lz -lm"
176   AC_LINK_IFELSE([#include <png.h>
177                   png_structp pp;
178                   png_infop info; 
179                   png_colorp cmap; 
180                   main() { void*foo = png_create_read_struct; }],
181                  png_ok=yes,
182                  png_ok=no)
183   LDFLAGS="${old_LDFLAGS}"
184   AC_MSG_RESULT($png_ok)
185   if test "$png_ok" = yes; then
186     PNG_LIBS='-lpng -lz -lm'
187     AC_DEFINE(HAVE_LIBPNG,,[PNG library available])
188   fi
190 AC_SUBST(PNG_LIBS)
192 LIBS="${old_LIBS} ${PNG_LIBS}"
195 dnl Debugging
197 AC_ARG_ENABLE(debug, 
198 [  --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
199   ,
200   enable_debug=minimum)
202 if test "x$enable_debug" = "xyes"; then
203   DEBUG_FLAGS="-g -DENABLE_DEBUG"
204 else
205   if test "x$enable_debug" = "xno"; then
206     DEBUG_FLAGS=""
207   else
208     DEBUG_FLAGS=""
209   fi
211 AC_SUBST(DEBUG_FLAGS)
214 dnl i18n
217 GETTEXT_PACKAGE=dia
218 AC_SUBST(GETTEXT_PACKAGE)
219 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Needed for glib gettext])
220 ALL_LINGUAS="am az be ca cs da de el en_GB es fi fr ga hu it ja ko mk mn ml ms nl nn no pl pt pt_BR ro ru sk sl sr sr@Latn sv tr uk vi zh_CN zh_TW"
221 AM_GLIB_GNU_GETTEXT
223 dnl INTLOBJS doesn't seem to always get subst'ed, but I believe it's
224 dnl idempotent
225 AC_SUBST(INTLOBJS)
227 localedir='${prefix}/${DATADIRNAME}/locale'
228 AC_SUBST(localedir)
231 dnl Locate the gnome-xml library
233 dnl GTK2: remove support for libxml1. move check for libxml2 in 
234 dnl AM_PATH_GTK_2_0's fourth argument (module is libxml-2.0)
236 found_libxml=false
237 if test $found_libxml = false; then
238   AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
239   if test "x$XML2_CONFIG" != x ; then
240     AC_MSG_CHECKING(for libxml >= 2.3.9)
241     vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
243     if test "$vers" -ge 2003009; then
244       AC_MSG_RESULT(found)
245       found_libxml=true
246       XML_LIBS="`$XML2_CONFIG --libs`"
247       XML_CFLAGS="`$XML2_CONFIG --cflags`"
249       if test "$enable_gnome_print" = "yes"
250       then
251           gnome-config --cflags print | \
252           grep gnome-xml 2>&1 >/dev/null && \
253           AC_MSG_ERROR(libxml2 found but gnome-print uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable gnome-print.)
254       fi
255       echo $GNOME_CFLAGS | \
256       grep gnome-xml 2>&1 >/dev/null && \
257       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.)
258         
259     else
260       AC_MSG_RESULT(not found)
261     fi
262   fi
265 if test $found_libxml = false; then
266 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
267 if test "x$XML_CONFIG" != x ; then
268   AC_MSG_CHECKING(for libxml >= 1.8.14)
269   vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
271   dnl 1.18.14 is required for xmlUseNewParser()    
272   if test "$vers" -ge 1008014; then
273     AC_MSG_RESULT(found)
274     found_libxml=true
275     XML_LIBS="`$XML_CONFIG --libs`"
276     XML_CFLAGS="`$XML_CONFIG --cflags`"
277   else
278     AC_MSG_RESULT(not found)
279   fi
283 if test $found_libxml = false; then
284     AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably))
287 AC_SUBST(XML_LIBS)
288 AC_SUBST(XML_CFLAGS)
290 CFLAGS="$XML_CFLAGS $CFLAGS"
292 dnl LibZ
293 AC_CHECK_HEADERS(zlib.h,
294     AC_CHECK_LIB(z, gzread,[
295         AC_DEFINE(HAVE_LIBZ,, we have the libz compression library)
296         if test "x${Z_DIR}" != "x"; then
297             Z_CFLAGS="-I${Z_DIR}/include"
298             Z_LIBS="-L${Z_DIR}/lib -lz"
299         else
300             Z_LIBS="-lz"
301         fi]))
303 AC_SUBST(Z_LIBS)
305 CFLAGS="${CFLAGS} ${Z_CFLAGS}"
306 LIBS="${LIBS} ${Z_LIBS}"
308 dnl Platform-specific fixes.
309 dnl 
311 dnl Sun Forte C provides isinf() in the unbundled -lsunmath. Solaris
312 dnl declares finite() in ieeefp.h. It's preferrable not to link 
313 dnl to -lsunmath as it's not present on all machines.
314 have_isinf=no
315 AC_CHECK_HEADERS(math.h,
316         AC_CHECK_LIB(m,isinf,
317                 have_isinf=yes))
319 if test "$have_isinf" = "no"; then
320     AC_CHECK_HEADER(ieeefp.h,
321              [AC_CHECK_FUNC(finite, 
322                        AC_DEFINE(HAVE_IEEEFP_H,1,
323                                  [Define if finite() is defined in ieeefp.h]),
324                        AC_MSG_ERROR([Can't find a definition of neither 
325                                      finite nor isinf]))],
326              [AC_MSG_ERROR(Can't find neither a definition of
327                            isinf nor ieeefp.h)])
328 else
329     AC_DEFINE([HAVE_ISINF], 1, 
330               [Define if the isinf() function is available])
333 dnl Alpha needs -mieee or we get a segfault
334 dnl This shouldn't be needed but is here until a real solution is found
335 case "$host" in
336   alpha*-*-linux*)
337     CFLAGS="$CFLAGS -mieee"
338     ;;
339 esac
341 if test "$GCC" = yes; then
342   dnl Relieve register pressure on i386. Other architectures may become unable
343   dnl to debug, and usually have more registers anyway.
344   dnl case "$host" in 
345   dnl  i?86-pc-*)
346   dnl    DIA_CHECK_CFLAG(-fomit-frame-pointer)
347   dnl    ;;
348   dnl esac
349   dnl (it looks like gdb is very confused by this now even on x86. We might be
350   dnl getting poor stack traces with bug-buddy because of this)
352   DIA_CHECK_CFLAG(-Wall)
353   DIA_CHECK_CFLAG(-Wunused)
354   dnl Premature optimization is the root of all evil.  Uncomment this if
355   dnl you want ti figure out functions that should have been inlined but aint.
356   dnl DIA_CHECK_CFLAG(-Winline)
357   DIA_CHECK_CFLAG(-Wmissing-prototypes)
358   DIA_CHECK_CFLAG(-Wmissing-declarations)
359   DIA_CHECK_CFLAG(-finline-functions)
360   DIA_CHECK_CFLAG(-fstrict-aliasing)
363 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = yes)
365 dnl Do we have the db2html script to build the documentation?
366 AC_ARG_ENABLE(db2html,
367 [  --enable-db2html        don't rebuild documentation],,enable_db2html=no)
368 AC_PATH_PROG(DB2HTML, db2html, no)
369 AM_CONDITIONAL(HAVE_DB2HTML, 
370                test "x$enable_db2html" != xno && test "x$DB2HTML" != xno)
372 dnl Handling for Python
373 AC_ARG_WITH(python,
374 [  --with-python           compile python plug-in],,with_python=no)
376 if test "x$with_python" != xno; then
377   AM_PATH_PYTHON(1.5.2)
378   AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
379   AM_CHECK_PYTHON_HEADERS
380   AM_CHECK_PYTHON_LIB
382   if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then
383     AC_MSG_ERROR([could not find files required to build python plugin])
384   fi
386 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno")
388 AC_OUTPUT(
389 Makefile
390 lib/Makefile
391 po/Makefile.in
392 objects/Makefile
393 dnl objects/sybase/Makefile
394 objects/bondgraph/Makefile
395 objects/chronogram/Makefile
396 objects/custom/Makefile
397 objects/ER/Makefile
398 objects/flowchart/Makefile
399 objects/FS/Makefile
400 objects/GRAFCET/Makefile
401 objects/Misc/Makefile
402 objects/network/Makefile
403 objects/SADT/Makefile
404 objects/standard/Makefile
405 objects/UML/Makefile
406 shapes/Makefile
407 shapes/Assorted/Makefile
408 shapes/Circuit/Makefile
409 shapes/Cisco/Makefile
410 shapes/Civil/Makefile
411 shapes/Contact/Makefile
412 shapes/Electric/Makefile
413 shapes/flowchart/Makefile
414 shapes/jigsaw/Makefile
415 shapes/Logic/Makefile
416 shapes/Misc/Makefile
417 shapes/MSE/Makefile
418 shapes/network/Makefile
419 shapes/Pneumatic/Makefile
420 shapes/SDL/Makefile
421 shapes/sybase/Makefile
422 app/Makefile
423 samples/Makefile
424 sheets/Makefile
425 sheets/ER/Makefile
426 sheets/GRAFCET/Makefile
427 sheets/UML/Makefile
428 plug-ins/Makefile
429 plug-ins/cgm/Makefile
430 plug-ins/dxf/Makefile
431 plug-ins/hpgl/Makefile
432 plug-ins/metapost/Makefile
433 plug-ins/pixbuf/Makefile
434 plug-ins/pstricks/Makefile
435 plug-ins/python/Makefile
436 plug-ins/shape/Makefile
437 plug-ins/svg/Makefile
438 plug-ins/wmf/Makefile
439 plug-ins/wpg/Makefile
440 plug-ins/xfig/Makefile
441 plug-ins/xslt/Makefile
442 doc/Makefile
443 doc/en/Makefile
444 doc/pl/Makefile
447 dnl GTK2: simplify this, we will have much less options.
448 echo "
450 Configuration:
451         Source code location:   ${srcdir}
452         Compiler:               ${CC}
454         Gnome support:                          ${GNOME}
455         Python support:                         ${with_python}
456         Libart support (PNG export):            ${have_libart}
459 echo "Now type make to build dia..."