added filesystem shapes and misc sheet
[dia.git] / configure.in
blob742454ae288bfaa4937c3dc50462f4562378c533
1 dnl Process this -*- m4 -*- file with autoconf to produce a configure script.
2 AC_INIT(app/diagram.c)
4 dnl AC_PREREQ(2.50)
5 dnl AC_REVISION($Revision: 1.141 $)
7 AM_INIT_AUTOMAKE(dia, 0.89)
9 dnl Specify a header configuration file
10 AM_CONFIG_HEADER(config.h)
12 dnl do this check now, to keep autogen quiet.
13 AC_PROG_CC 
15 dnl Initialize maintainer mode
16 AM_MAINTAINER_MODE
18 dnl Initialize libtool
19 AC_DISABLE_STATIC
20 AC_PROG_LIBTOOL
22 dnl Build time sanity check
23 AM_SANITY_CHECK
25 dnl Checks for programs.
26 dnl AC_PROG_CC # already done 
27 AC_PROG_INSTALL
28 AC_PROG_LN_S
29 AC_PROG_MAKE_SET
30 AC_ISC_POSIX
32 dnl stuff for xml-i18n-tools
33 AC_PROG_INTLTOOL(0.12) 
35 dnl Checks for libraries.
36 dnl AM_PATH_GLIB(1.2.9) dnl (for g_critical)
37 AM_PATH_GTK(1.2.0)
39 dnl XIM support (on by default)
40 AC_ARG_ENABLE(xim,
41 [  --disable-xim           enable gnome code],,enable_xim=yes)
42 AC_MSG_CHECKING([whether to enable XIM support])
43 if test "x$enable_xim" != xno; then
44   AC_DEFINE(USE_XIM)
46 AC_MSG_RESULT($enable_xim)
48 APP_LIBS=""
49 AC_SUBST(APP_LIBS)
51 dnl
52 dnl GNOME
53 dnl
55 AC_MSG_CHECKING([whether GNOME specific code should be used])
56 AC_ARG_ENABLE(gnome,
57 [  --enable-gnome          enable gnome code],
58     GNOME=$enableval,
59     GNOME=no)
60 AC_ARG_ENABLE(gnome-print,
61 [  --enable-gnome-print    enable gnome-print support],,enable_gnome_print=no)
62 AC_ARG_ENABLE(bonobo,
63 [  --enable-bonobo         enable bonobo support],,enable_bonobo=no)
64 AC_MSG_RESULT($GNOME)
65 GNOME_CFLAGS=""
66 GNOME_LIBS=""
67 BONOBO_LIBS=""
68 bonobo_msg=no
69 have_gnome=false
70 have_bonobo=false
71 if test "$GNOME" = "yes"; then
72   AC_DEFINE(GNOME)
73   have_gnome=true
74   components="gnomeui"
75   hcomponents=""
76   if test "$enable_gnome_print" = "yes"; then
77     AC_DEFINE(GNOME_PRINT)
78     components="$components print"
79   fi
80   if test "$enable_bonobo" = "yes"; then
82     AC_MSG_CHECKING(for Bonobo >= 0.31)
84     if gnome-config --libs bonobox_print > /dev/null 2>&1; then
85       vers=`gnome-config --modversion bonobo | sed -e "s/bonobo-//" | \
86         awk 'BEGIN { FS = "."; } { printf "%d", $1 * 1000 + $2;}'`
87       if test "$vers" -ge 31; then
88         bonobo_ok=true
89       else
90         bonobo_ok=false
91       fi
92     else
93       bonobo_ok=false
94     fi
95         
96     if $bonobo_ok; then
97       AC_MSG_RESULT([found ("$vers")])
98       have_bonobo=true
99       bonobo_msg=yes
100     else
101       AC_MSG_RESULT([not found])
102     fi
104     hcomponents="$hcomponents bonobox_print"
105     BONOBO_LIBS=`gnome-config bonobox_print $components --libs`
106   fi
107   GNOME_CFLAGS=`gnome-config $hcomponents $components --cflags`
108   GNOME_LIBS=`gnome-config $components --libs`
110 AM_CONDITIONAL(HAVE_GNOME, $have_gnome)
111 AM_CONDITIONAL(HAVE_GNOME_PRINT,
112         $have_gnome && test "$enable_gnome_print" = "yes")
113 AM_CONDITIONAL(HAVE_BONOBO, $have_bonobo)
115 AC_SUBST(GNOME_CFLAGS)
116 AC_SUBST(GNOME_LIBS)
117 AC_SUBST(BONOBO_LIBS)
119 dnl Check if this Gnome has Bonobo
120 OLDCPPFLAGS=$CPPFLAGS
121 CPPFLAGS="$CPPFLAGS `glib-config --cflags`"
123 dnl This is required to play character set games
124 AM_LANGINFO_CODESET
125 AM_ICONV
127 dnl check for libunicode 
128 AC_ARG_ENABLE(unicode, 
129 [  --enable-unicode        enable (LIMITED, EXPERIMENTAL) unicode support],,
130         enable_unicode=yes)
131 UNICODE_CFLAGS=
132 UNICODE_LIBS=
133 have_unicode=false
134 yn_have_unicode=no
136 if test "$enable_unicode" = "yes"; then
137   AC_MSG_CHECKING(for libunicode)
138   if unicode-config --libs > /dev/null 2>&1; then
139     vers=`unicode-config --version`
140     have_unicode=true     
141     yn_have_unicode=yes        
142     UNICODE_CFLAGS=`unicode-config --cflags`
143     UNICODE_LIBS=`unicode-config --libs`
144     AC_DEFINE(HAVE_UNICODE,, Unicode support library available)
145     AC_MSG_RESULT([found, version $vers])
146   else
147     AC_MSG_RESULT([not found])
148   fi
149 else
150   have_unicode=false
152 AC_SUBST(UNICODE_CFLAGS)
153 AC_SUBST(UNICODE_LIBS)
154 AM_CONDITIONAL(HAVE_UNICODE,$have_unicode)
156 CPPFLAGS=$OLDCPPFLAGS
158 dnl check for libfreetype
159 AC_ARG_ENABLE(freetype, 
160 [  --enable-freetype       enable (LIMITED, EXPERIMENTAL) freetype support],,
161         freetype=yes)
162 FREETYPE_CFLAGS=
163 FREETYPE_LIBS=
164 have_freetype=false
165 yn_have_freetype=no
167 if test "$enable_freetype" = "yes"; then
168   AC_CHECK_FT2(2.0.5,
169     [have_freetype=true
170      FREETYPE_CFLAGS=$FT2_CFLAGS
171      FREETYPE_LIBS=$FT2_LIBS
172      AC_DEFINE(HAVE_FREETYPE,, Freetype support library available)
173      yn_have_freetype=yes])
175 AC_SUBST(FREETYPE_CFLAGS)
176 AC_SUBST(FREETYPE_LIBS)
177 AM_CONDITIONAL(HAVE_FREETYPE,$have_freetype)
179 CPPFLAGS=$OLDCPPFLAGS
182 dnl Popt
185 AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [AC_DEFINE(HAVE_LIBPOPT)
186                    APP_LIBS="$APP_LIBS -lpopt"])
187 AC_CHECK_HEADERS(popt.h)
189 dnl libart_lgpl
192 AM_PATH_LIBART(2.1.0,dnl
193  [have_libart=yes
194   AC_DEFINE(HAVE_LIBART)],
195  [have_libart=no])
198 dnl gdk_pixbuf
201 AM_PATH_GDK_PIXBUF(0.7.0,,AC_MSG_ERROR([gdk-pixbuf >= 0.7.0 is required]))
204 dnl libpng
207 png_ok=no
208 AC_CHECK_LIB(png, png_read_info,
209   AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no),png_ok=no, -lz -lm)
210 if test "$png_ok" = yes; then
211   AC_MSG_CHECKING([for png_structp in png.h])
212   AC_TRY_COMPILE([#include <png.h>],
213                  [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;],
214                  png_ok=yes,
215                  png_ok=no)
216   AC_MSG_RESULT($png_ok)
217   if test "$png_ok" = yes; then
218     PNG_LIBS='-lpng -lz -lm'
219     AC_DEFINE(HAVE_LIBPNG)
220   fi
222 AC_SUBST(PNG_LIBS)
226 dnl Debugging
229 AC_ARG_ENABLE(debug, 
230 [  --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],
231   ,
232   enable_debug=minimum)
234 if test "x$enable_debug" = "xyes"; then
235   DEBUG_FLAGS="-g -DENABLE_DEBUG"
236 else
237   if test "x$enable_debug" = "xno"; then
238     DEBUG_FLAGS=""
239   else
240     DEBUG_FLAGS=""
241   fi
243 AC_SUBST(DEBUG_FLAGS)
246 dnl i18n
249 ALL_LINGUAS="az ca da de el en_GB es fi fr ga hu it ja ko nl nn no pl pt pt_BR ru sk sl sv tr uk zh_CN zh_TW"
251 AM_GNU_GETTEXT
253 localedir='${prefix}/${DATADIRNAME}/locale'
254 AC_SUBST(localedir)
256 dnl     
257 dnl Locate the gnome-xml library
260 found_libxml=false
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
277 if ! $found_libxml; then
278   AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config)
279   if test "x$XML2_CONFIG" != x ; then
280     AC_MSG_CHECKING(for libxml >= 2.3.9)
281     vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
283     if test "$vers" -ge 2003009; then
284       AC_MSG_RESULT(found)
285       found_libxml=true
286       XML_LIBS="`$XML2_CONFIG --libs`"
287       XML_CFLAGS="`$XML2_CONFIG --cflags`"
289       if test "$enable_gnome_print" = "yes"
290       then
291           gnome-config --cflags print | \
292           grep gnome-xml 2>&1 >/dev/null && \
293           AC_MSG_ERROR(libxml2 found but gnome-print uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable gnome-print.)
294       fi
295       echo $GNOME_CFLAGS | \
296       grep gnome-xml 2>&1 >/dev/null && \
297       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.)
298         
299     else
300       AC_MSG_RESULT(not found)
301     fi
302   fi
305 if ! $found_libxml; then
306     AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably))
309 AC_SUBST(XML_LIBS)
310 AC_SUBST(XML_CFLAGS)
312 CFLAGS="$XML_CFLAGS $CFLAGS"
314 dnl LibZ
316 AC_CHECK_HEADERS(zlib.h,
317     AC_CHECK_LIB(z, gzread,[
318         AC_DEFINE(HAVE_LIBZ,, we have the libz compression library)
319         if test "x${Z_DIR}" != "x"; then
320             Z_CFLAGS="-I${Z_DIR}/include"
321             Z_LIBS="-L${Z_DIR}/lib -lz"
322         else
323             Z_LIBS="-lz"
324         fi]))
325 CFLAGS="${CPPFLAGS} ${Z_CFLAGS}"
326 LIBS="${LIBS} ${Z_LIBS}"
328 dnl Checks for header files.
329 AC_HEADER_DIRENT
330 AC_HEADER_STDC
331 AC_CHECK_HEADERS(stddef.h fcntl.h unistd.h)
333 dnl Checks for typedefs, structures, and compiler characteristics.
334 AC_C_CONST
336 dnl Checks for library functions.
337 AC_CHECK_FUNCS(select strcspn strdup strtol snprintf)
339 dnl Set some variables we'll need for the UTF-8 transition.
340 gtk_advancement=dia_talks_utf8
342 if test "$gtk_advancement" = "initial"; then
343    AC_DEFINE(GTK_DOESNT_SPEAK_UTF8_NEITHER_DO_WE,,
344           We haven't begun the transition yet)
345 elif test "$gtk_advancement" = "dia_talks_utf8"; then
346    AC_DEFINE(UNICODE_WORK_IN_PROGRESS,,Cyrille's work towards UTF-8)
347    AC_DEFINE(GTK_DOESNT_TALK_UTF8_WE_DO,,...)
348    AC_DEFINE(GTK_CHARSET_MISMATCH,,     
349              Mismatch between the charset dia uses and the charset GTK uses)
350 elif test "$gtk_advancement" = "dia_under_win32"; then
351    dnl please check this with Hans. I believe this is true -- CC
352    AC_DEFINE(GTK_TALKS_UTF8,,...)
353    AC_DEFINE(GTK_TALKS_UTF8_WE_DONT,,...)
354    AC_DEFINE(GTK_CHARSET_MISMATCH,,     
355              Mismatch between the charset dia uses and the charset GTK uses)
356 elif test "$gtk_advancement" = "gtk2"; then
357    AC_DEFINE(GTK_TALKS_UTF8,,...)
358    AC_DEFINE(UNICODE_WORK_IN_PROGRESS,,Cyrille's work towards UTF-8)
359    dnl the latter shouldn't appear anymore by then (manually compiled)
362 dnl Solaris provides isinf() in -lsunmath and defines finite() in math.h
363   AC_CHECK_HEADERS(ieeefp.h sunmath.h)
364   AC_CHECK_LIB(sunmath,isinf)
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 DIA_CHECK_CFLAG(-Wall)
375 DIA_CHECK_CFLAG(-Wunused)
376 DIA_CHECK_CFLAG(-Winline)
377 DIA_CHECK_CFLAG(-Wmissing-prototypes)
378 DIA_CHECK_CFLAG(-Wmissing-declarations)
380 dnl Relieve register pressure on i386. Other architectures may become unable
381 dnl to debug, and usually have more registers anyway.
382 dnl case "$host" in 
383 dnl  i?86-pc-*)
384 dnl    DIA_CHECK_CFLAG(-fomit-frame-pointer)
385 dnl    ;;
386 dnl esac
387 dnl (it looks like gdb is very confused by this now even on x86. We might be
388 dnl getting poor stack traces with bug-buddy because of this)
390 DIA_CHECK_CFLAG(-finline-functions)
391 DIA_CHECK_CFLAG(-fstrict-aliasing)
393 dnl Do we have the db2html script to build the documentation?
394 AC_ARG_ENABLE(db2html,
395 [  --enable-db2html        don't rebuild documentation],,enable_db2html=no)
396 AC_PATH_PROG(DB2HTML, db2html, no)
397 AM_CONDITIONAL(HAVE_DB2HTML, test "x$enable_db2html" != xno && test "x$DB2HTML" != xno)
399 dnl Handling for Python
400 AC_ARG_WITH(python,
401 [  --with-python           compile python plug-in],,with_python=no)
403 #hello
404 if test "x$with_python" != xno; then
405   AM_PATH_PYTHON(1.5.2)
406   AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
407   AM_CHECK_PYTHON_HEADERS
408   AM_CHECK_PYTHON_LIB
410   if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then
411     AC_MSG_ERROR([could not find files required to build python plugin])
412   fi
414 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno")
416 AC_OUTPUT(
417 Makefile
418 lib/Makefile
419  po/Makefile.in intl/Makefile
420 objects/Makefile
421 objects/standard/Makefile
422 objects/network/Makefile
423 objects/UML/Makefile
424 objects/ER/Makefile
425 objects/FS/Makefile
426 dnl objects/sybase/Makefile
427 objects/flowchart/Makefile
428 objects/custom/Makefile
429 objects/GRAFCET/Makefile
430 objects/chronogram/Makefile
431 objects/SADT/Makefile
432 shapes/Makefile
433 shapes/Circuit/Makefile
434 shapes/flowchart/Makefile
435 shapes/Contact/Makefile
436 shapes/network/Makefile
437 shapes/Pneumatic/Makefile
438 shapes/Electric/Makefile
439 shapes/Civil/Makefile
440 shapes/jigsaw/Makefile
441 shapes/MSE/Makefile
442 shapes/SDL/Makefile
443 shapes/Logic/Makefile
444 shapes/sybase/Makefile
445 shapes/Misc/Makefile
446 app/Makefile
447 samples/Makefile
448 sheets/Makefile
449 sheets/UML/Makefile
450 sheets/ER/Makefile
451 sheets/GRAFCET/Makefile
452 plug-ins/Makefile
453 plug-ins/cgm/Makefile
454 plug-ins/pstricks/Makefile
455 plug-ins/dxf/Makefile
456 plug-ins/hpgl/Makefile
457 plug-ins/wpg/Makefile
458 plug-ins/svg/Makefile
459 plug-ins/shape/Makefile
460 plug-ins/xfig/Makefile
461 plug-ins/python/Makefile
462 doc/Makefile
463 doc/en/Makefile
466 echo "
468 Configuration:
469         Source code location:   ${srcdir}
470         Compiler:               ${CC}
472         Libart (AA rendering, png export):      ${have_libart}
474         Gnome support:                          ${GNOME}
475         Build bonobo component (not supported): ${bonobo_msg}
476         Gnome-print support (not recommended):  ${enable_gnome_print}
478         Python support:                         ${with_python}
479         (LIMITED) Unicode support:              ${yn_have_unicode}
480         (LIMITED) Freetype support:             ${yn_have_freetype}
482 if test "$yn_have_unicode" != "yes" ; then
483   echo "WARNING: Unicode support disabled or support libraries missing.
484 We contemplate making these mandatory in the future; if this upsets you, please
485 speak up *NOW* (summer 2001), in the dia mailing list 
486 <dia-list@lists.gnome.org>. Thank you very much.
490 echo "Now type make to build dia."