added missing horizontal jumper icon
[dia.git] / configure.in
blob071da29cd19a903b12feb95b386884587e6f6804
1 dnl Process this -*- autoconf -*- file with autoconf to produce a 
2 dnl configure script.
3 AC_INIT(dia, 0.91-pre4, 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.186 $)
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)
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=`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=-lfreetype
79          AC_SUBST(FREETYPE_LIBS)
80          GTK_MODULES="$GTK_MODULES pangoft2"
81          AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])
82          CPPFLAGS="$old_CPPFLAGS"]
83     ,
84         [AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])])
85   else
86    AC_MSG_ERROR(Can't find FreeType library)
87   fi
88 else
89    AC_MSG_ERROR(Can't find PangoFT2 library)
92 dnl Try for libart
93 PKG_CHECK_MODULES(LIBART,libart-2.0,have_libart=yes,have_libart=no)
94 if test "$have_libart" = "yes" ; then
95    GTK_MODULES="$GTK_MODULES libart-2.0"
96    AC_DEFINE(HAVE_LIBART,1,[Define if building with LIBART support])
99 AC_MSG_CHECKING([whether GNOME specific code should be used])
100 AC_ARG_ENABLE(gnome,[  --enable-gnome          enable gnome code],
101               GNOME=$enableval, GNOME=no)
102 if test "$GNOME" = "yes" ; then
103     GTK_MODULES="$GTK_MODULES libgnome-2.0 libgnomeui-2.0"
104     AC_DEFINE(GNOME,1,[Define if building with GNOME support])
105     AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${prefix}/share/pixmaps", [GNOME icon directory])
106     have_gnome=true
107 else
108     have_gnome=false
110 AM_CONDITIONAL(HAVE_GNOME, $have_gnome)
111 AC_MSG_RESULT($GNOME)
113 dnl GTK2:     libgnomecanvas-2.0 ?
115 PKG_CHECK_MODULES(GTK,$GTK_MODULES)
116 AM_CONDITIONAL(HAVE_BONOBO,false)
118 dnl XSLT
120 XSLT_DIR=""
121 PKG_CHECK_MODULES(XSLT, libxslt, have_xslt=true, have_xslt=false)
122 AM_CONDITIONAL(HAVE_XSLT, $have_xslt)
123 if test "$have_xslt" = "true"; then
124   XSLT_DIR="xslt"
126 AC_SUBST(XSLT_DIR)
129 dnl Popt
132 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [
133                 AC_DEFINE(HAVE_LIBPOPT,,[popt library available])
134                    POPT_LIBS="-lpopt"])
135 AC_CHECK_HEADERS(popt.h)
136 AC_SUBST(POPT_LIBS)
137 APP_LIBS="$APP_LIBS $POPT_LIBS"
140 dnl libpng
142 dnl this likely already comes from GTK
143 png_ok=no
144 AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)
145 AC_CHECK_LIB(png, png_read_info, ,png_ok=no, -lz -lm)
146 if test "$png_ok" = yes; then
147   AC_MSG_CHECKING([for png_structp in png.h])
148   AC_TRY_COMPILE([#include <png.h>],
149                  [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;],
150                  png_ok=yes,
151                  png_ok=no)
152   AC_MSG_RESULT($png_ok)
153   if test "$png_ok" = yes; then
154     PNG_LIBS='-lpng -lz -lm'
155     AC_DEFINE(HAVE_LIBPNG,,[PNG library available])
156   fi
158 AC_SUBST(PNG_LIBS)
159 LIBS="${LIBS} ${PNG_LIBS}"
162 dnl Debugging
164 AC_ARG_ENABLE(debug, 
165 [  --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
166   ,
167   enable_debug=minimum)
169 if test "x$enable_debug" = "xyes"; then
170   DEBUG_FLAGS="-g -DENABLE_DEBUG"
171 else
172   if test "x$enable_debug" = "xno"; then
173     DEBUG_FLAGS=""
174   else
175     DEBUG_FLAGS=""
176   fi
178 AC_SUBST(DEBUG_FLAGS)
181 dnl i18n
184 GETTEXT_PACKAGE=dia
185 AC_SUBST(GETTEXT_PACKAGE)
186 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Needed for glib gettext])
187 ALL_LINGUAS="am az ca cs da de el en_GB es fi fr ga hu it ja ko nl nn no pl pt pt_BR ro ru sk sl sv tr uk vi zh_CN zh_TW"
188 AM_GLIB_GNU_GETTEXT
190 dnl INTLOBJS doesn't seem to always get subst'ed, but I believe it's
191 dnl idempotent
192 AC_SUBST(INTLOBJS)
194 localedir='${prefix}/${DATADIRNAME}/locale'
195 AC_SUBST(localedir)
198 dnl Locate the gnome-xml library
200 dnl GTK2: remove support for libxml1. move check for libxml2 in 
201 dnl AM_PATH_GTK_2_0's fourth argument (module is libxml-2.0)
203 found_libxml=false
204 if test $found_libxml = false; then
205   AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
206   if test "x$XML2_CONFIG" != x ; then
207     AC_MSG_CHECKING(for libxml >= 2.3.9)
208     vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
210     if test "$vers" -ge 2003009; then
211       AC_MSG_RESULT(found)
212       found_libxml=true
213       XML_LIBS="`$XML2_CONFIG --libs`"
214       XML_CFLAGS="`$XML2_CONFIG --cflags`"
216       if test "$enable_gnome_print" = "yes"
217       then
218           gnome-config --cflags print | \
219           grep gnome-xml 2>&1 >/dev/null && \
220           AC_MSG_ERROR(libxml2 found but gnome-print uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable gnome-print.)
221       fi
222       echo $GNOME_CFLAGS | \
223       grep gnome-xml 2>&1 >/dev/null && \
224       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.)
225         
226     else
227       AC_MSG_RESULT(not found)
228     fi
229   fi
232 if test $found_libxml = false; then
233 AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config)
234 if test "x$XML_CONFIG" != x ; then
235   AC_MSG_CHECKING(for libxml >= 1.8.14)
236   vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
238   dnl 1.18.14 is required for xmlUseNewParser()    
239   if test "$vers" -ge 1008014; then
240     AC_MSG_RESULT(found)
241     found_libxml=true
242     XML_LIBS="`$XML_CONFIG --libs`"
243     XML_CFLAGS="`$XML_CONFIG --cflags`"
244   else
245     AC_MSG_RESULT(not found)
246   fi
250 if test $found_libxml = false; then
251     AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably))
254 AC_SUBST(XML_LIBS)
255 AC_SUBST(XML_CFLAGS)
257 CFLAGS="$XML_CFLAGS $CFLAGS"
259 dnl LibZ
260 AC_CHECK_HEADERS(zlib.h,
261     AC_CHECK_LIB(z, gzread,[
262         AC_DEFINE(HAVE_LIBZ,, we have the libz compression library)
263         if test "x${Z_DIR}" != "x"; then
264             Z_CFLAGS="-I${Z_DIR}/include"
265             Z_LIBS="-L${Z_DIR}/lib -lz"
266         else
267             Z_LIBS="-lz"
268         fi]))
270 AC_SUBST(Z_LIBS)
272 CFLAGS="${CFLAGS} ${Z_CFLAGS}"
273 LIBS="${LIBS} ${Z_LIBS}"
275 dnl Platform-specific fixes.
276 dnl 
278 dnl Sun Forte C provides isinf() in the unbundled -lsunmath. Solaris
279 dnl declares finite() in ieeefp.h. It's preferrable not to link 
280 dnl to -lsunmath as it's not present on all machines.
281 have_isinf=no
282 AC_CHECK_HEADERS(math.h,
283         AC_CHECK_LIB(m,isinf,
284                 have_isinf=yes))
286 if test "$have_isinf" = "no"; then
287          AC_CHECK_HEADERS(ieeefp.h,
288                 [AC_CHECK_FUNC(finite, 
289                         [AC_DEFINE([HAVE_IEEEFP_H], 1,
290                                   [Define if finite() is defined in ieeefp.h])
291                          AC_MSG_ERROR(Can't find a definition of neither 
292                                      finite nor isinf)])],
293                 [AC_MSG_ERROR(Can't find a definition of neither finite 
294                              nor isinf)])
295 else
296         AC_DEFINE([HAVE_ISINF], 1, 
297                   [Define if the isinf() function is available])
300 dnl Alpha needs -mieee or we get a segfault
301 dnl This shouldn't be needed but is here until a real solution is found
302 case "$host" in
303   alpha*-*-linux*)
304     CFLAGS="$CFLAGS -mieee"
305     ;;
306 esac
308 if test "$GCC" = yes; then
309   dnl Relieve register pressure on i386. Other architectures may become unable
310   dnl to debug, and usually have more registers anyway.
311   dnl case "$host" in 
312   dnl  i?86-pc-*)
313   dnl    DIA_CHECK_CFLAG(-fomit-frame-pointer)
314   dnl    ;;
315   dnl esac
316   dnl (it looks like gdb is very confused by this now even on x86. We might be
317   dnl getting poor stack traces with bug-buddy because of this)
319   DIA_CHECK_CFLAG(-Wall)
320   DIA_CHECK_CFLAG(-Wunused)
321   DIA_CHECK_CFLAG(-Winline)
322   DIA_CHECK_CFLAG(-Wmissing-prototypes)
323   DIA_CHECK_CFLAG(-Wmissing-declarations)
324   DIA_CHECK_CFLAG(-finline-functions)
325   DIA_CHECK_CFLAG(-fstrict-aliasing)
328 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = yes)
330 dnl Do we have the db2html script to build the documentation?
331 AC_ARG_ENABLE(db2html,
332 [  --enable-db2html        don't rebuild documentation],,enable_db2html=no)
333 AC_PATH_PROG(DB2HTML, db2html, no)
334 AM_CONDITIONAL(HAVE_DB2HTML, 
335                test "x$enable_db2html" != xno && test "x$DB2HTML" != xno)
337 dnl Handling for Python
338 AC_ARG_WITH(python,
339 [  --with-python           compile python plug-in],,with_python=no)
341 if test "x$with_python" != xno; then
342   AM_PATH_PYTHON(1.5.2)
343   AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
344   AM_CHECK_PYTHON_HEADERS
345   AM_CHECK_PYTHON_LIB
347   if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then
348     AC_MSG_ERROR([could not find files required to build python plugin])
349   fi
351 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno")
353 AC_OUTPUT(
354 Makefile
355 lib/Makefile
356 po/Makefile.in
357 objects/Makefile
358 dnl objects/sybase/Makefile
359 objects/bondgraph/Makefile
360 objects/chronogram/Makefile
361 objects/custom/Makefile
362 objects/ER/Makefile
363 objects/flowchart/Makefile
364 objects/FS/Makefile
365 objects/GRAFCET/Makefile
366 objects/Misc/Makefile
367 objects/network/Makefile
368 objects/SADT/Makefile
369 objects/standard/Makefile
370 objects/UML/Makefile
371 shapes/Makefile
372 shapes/Assorted/Makefile
373 shapes/Circuit/Makefile
374 shapes/Cisco/Makefile
375 shapes/Civil/Makefile
376 shapes/Contact/Makefile
377 shapes/Electric/Makefile
378 shapes/flowchart/Makefile
379 shapes/jigsaw/Makefile
380 shapes/Logic/Makefile
381 shapes/Misc/Makefile
382 shapes/MSE/Makefile
383 shapes/network/Makefile
384 shapes/Pneumatic/Makefile
385 shapes/SDL/Makefile
386 shapes/sybase/Makefile
387 app/Makefile
388 samples/Makefile
389 sheets/Makefile
390 sheets/ER/Makefile
391 sheets/GRAFCET/Makefile
392 sheets/UML/Makefile
393 plug-ins/Makefile
394 plug-ins/cgm/Makefile
395 plug-ins/dxf/Makefile
396 plug-ins/hpgl/Makefile
397 plug-ins/metapost/Makefile
398 plug-ins/pixbuf/Makefile
399 plug-ins/pstricks/Makefile
400 plug-ins/python/Makefile
401 plug-ins/shape/Makefile
402 plug-ins/svg/Makefile
403 plug-ins/wmf/Makefile
404 plug-ins/wpg/Makefile
405 plug-ins/xfig/Makefile
406 plug-ins/xslt/Makefile
407 doc/Makefile
408 doc/en/Makefile
409 doc/pl/Makefile
412 dnl GTK2: simplify this, we will have much less options.
413 echo "
415 Configuration:
416         Source code location:   ${srcdir}
417         Compiler:               ${CC}
419         Gnome support:                          ${GNOME}
420         Python support:                         ${with_python}
421         Libart support (PNG export):            ${have_libart}
424 echo "Now type make to build dia..."