Code

Test for Dbus and enable if found
[inkscape.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.53)
5 # Always use 0.xx+devel instead of 0.xxdevel for the version, e.g. 0.46+devel.
6 # Rationale: (i) placate simple version comparison software such as
7 # `dpkg --compare-versions'.  (ii) We don't always know what the next
8 # version is going to be called until about the time we release it
9 # (whereas we always know what the previous version was called).
10 AC_INIT(inkscape, 0.46+devel)
12 AC_CANONICAL_HOST
13 AC_CONFIG_SRCDIR([src/main.cpp])
14 AM_INIT_AUTOMAKE([dist-zip dist-bzip2 tar-pax])
16 AC_ARG_ENABLE([lsb], AS_HELP_STRING([--enable-lsb], [LSB-compatible build configuration]), [
17   prefix=/opt/inkscape
18   PATH="/opt/lsb/bin:$PATH"
19   CC=lsbcc
20   CXX=lsbc++
21   export CC CXX
22 ])
24 AM_CONFIG_HEADER(config.h)
26 AC_LANG(C++)
27 AC_ISC_POSIX
28 AC_PROG_CXX
29 AM_PROG_CC_STDC
30 AM_PROG_AS
31 AC_PROG_RANLIB
32 AC_PROG_INTLTOOL(0.22)
33 AC_HEADER_STDC
34 INK_SVN_SNAPSHOT_BUILD
36 dnl These next few lines are needed only while libcroco is in our source tree.
37 AC_PROG_CC
38 AM_PROG_CC_C_O
39 if test "$GCC" = "yes"; then
40   # Enable some warnings from gcc.
41   AC_LANG_PUSH(C)
43   ####
44   # Generic cpp flags...
46   # What is just plain "-W" ?
47   # Fortify source requires -O2 or higher, which is handled with newer autoconf
48   CPPFLAGS="-W -D_FORTIFY_SOURCE=2 $CPPFLAGS"
49   # Enable format and format security warnings
50   CPPFLAGS="-Wformat -Wformat-security $CPPFLAGS"
51   # Enable all default warnings
52   CPPFLAGS="-Wall $CPPFLAGS"
54   # Test for -Werror=... (introduced some time post-4.0)
55   # If we hit a format error -- it should be fatal.
56   AC_MSG_CHECKING([compiler support for -Werror=format-security])
57   ink_svd_CPPFLAGS="$CPPFLAGS"
58   CPPFLAGS="-Werror=format-security $CPPFLAGS"
59   AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), [ink_opt_ok=yes], [ink_opt_ok=no])
60   AC_MSG_RESULT([$ink_opt_ok])
61   if test "x$ink_opt_ok" != "xyes"; then
62     CPPFLAGS="$ink_svd_CPPFLAGS"
63   fi
65   ####
66   # C-specific flags...
68   # -Wno-pointer-sign is probably new in gcc 4.0; certainly it isn't accepted
69   # by gcc 2.95.
70   AC_MSG_CHECKING([compiler support for -Wno-pointer-sign])
71   ink_svd_CFLAGS="$CFLAGS"
72   CFLAGS="-Wno-pointer-sign $CFLAGS"
73   AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), [ink_opt_ok=yes], [ink_opt_ok=no])
74   AC_MSG_RESULT([$ink_opt_ok])
75   if test "x$ink_opt_ok" != "xyes"; then
76     CFLAGS="$ink_svd_CFLAGS"
77   fi
79   ####
80   # Linker flags...
82   # Have linker produce read-only relocations, if it knows how
83   AC_MSG_CHECKING([linker tolerates -z relro])
84   ink_svd_LDFLAGS="$LDFLAGS"
85   LDFLAGS="-Wl,-z,relro $LDFLAGS"
86   AC_LINK_IFELSE(AC_LANG_PROGRAM([]), [ink_opt_ok=yes], [ink_opt_ok=no])
87   AC_MSG_RESULT([$ink_opt_ok])
88   if test "x$ink_opt_ok" != "xyes"; then
89     LDFLAGS="$ink_svd_LDFLAGS"
90   fi
92   AC_LANG_POP
94   # C++-specific flags are defined further below.  Look for CXXFLAGS...
95 fi
97 dnl Honor aclocal flags
98 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
100 dnl Verify our GCC version
101 if test "x$GXX" = "xyes"; then
102         AC_MSG_CHECKING([GNU compiler version])
104         # Don't pass CXXFLAGS to the following CXX command as some 
105         # of them can't be specified along with '-v'.
106         cc_version=["`$CXX -v 2>&1 </dev/null |grep 'gcc version' |\
107                 sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`"]
109         AC_MSG_RESULT([$cc_version])
111         # Some version numbers
112         cc_vers_major=`echo $cc_version | cut -f1 -d.`
113         cc_vers_minor=`echo $cc_version | cut -f2 -d.`
114         cc_vers_patch=`echo $cc_version | cut -f3 -d.`
115         test -n "$cc_vers_major" || cc_vers_major=0
116         test -n "$cc_vers_minor" || cc_vers_minor=0
117         test -n "$cc_vers_patch" || cc_vers_patch=0
118         cc_vers_all=`expr $cc_vers_major '*' 1000000 + $cc_vers_minor '*' 1000 + $cc_vers_patch`
120         if test $cc_vers_major -lt 3; then
121                 AC_MSG_ERROR([gcc >= 3.0 is needed to compile inkscape])
122         fi
123 fi
125 dnl ******************************
126 dnl Gettext stuff
127 dnl ******************************
128 GETTEXT_PACKAGE="AC_PACKAGE_NAME"
129 AC_SUBST(GETTEXT_PACKAGE)
130 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Translation domain used])
131 dnl Add the languages which your application supports here.
132 ALL_LINGUAS="am ar az be bg bn br ca ca@valencia cs da de dz el en_AU en_CA en_GB en_US@piglatin eo es_MX es et eu fi fr ga gl he hr hu hy id it ja km ko lt mk mn nb ne nl nn pa pl pt_BR pt ro ru rw sk sl sq sr@latin sr sv th tr uk vi zh_CN zh_TW"
133 AM_GLIB_GNU_GETTEXT
135 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
136 if test "x$PKG_CONFIG" = "xno"; then
137         AC_MSG_ERROR(You have to install pkg-config to compile inkscape.)
138 fi
140 dnl Find msgfmt.  Without this, po/Makefile fails to set MSGFMT on some platforms.
141 AC_PATH_PROG(MSGFMT, msgfmt, msgfmt)
142 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
144 dnl ******************************
145 dnl Check for OpenMP 
146 dnl Replace this with AC_OPENMP once Autoconf 2.62 is widespread
147 dnl ******************************
148 AX_OPENMP([openmp_ok=yes],[openmp_ok=no])
149 if test "x$openmp_ok" = "xyes"; then
150         dnl We have it, now set up the flags
151         CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
152         AC_CHECK_HEADER(omp.h)
153 fi
155 dnl ******************************
156 dnl Check for libpng 
157 dnl ******************************
158 AC_CHECK_LIB(png, png_read_info, [AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)], png_ok=no, -lz -lm)
159 if test "x$png_ok" != "xyes"; then
160         AC_MSG_ERROR([libpng >= 1.2 is needed to compile inkscape])
161 fi
163 dnl Handle possible dlopen requirement for libgc
164 dnl Isn't this internal to something in autoconf?  Couldn't find it...
165 AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], [AC_CHECK_FUNC([dlopen],
166           [lt_cv_dlopen="dlopen"],
167       [AC_CHECK_LIB([dl], [dlopen],
168             [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
169         [AC_CHECK_LIB([svld], [dlopen],
170               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
171           [AC_CHECK_LIB([dld], [dld_link],
172                 [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
173           ])
174         ])
175       ])
176     ])
178 AC_CHECK_HEADERS([gc.h gc/gc.h],
179                  [
180                     # To test for the different required libs, I have to
181                     # overcome autoconf's caching system, so I change the
182                     # desired function name.  They're all in libgc.
183                     # The "break" will exit from the top level
184                     # AC_CHECK_HEADERS.
185                     gc_libs=""
186                     AC_CHECK_LIB(gc, GC_init,
187                                  [gc_ok=yes;
188                                   LIBS="-lgc $gc_libs $LIBS";
189                                   break], [gc_ok=no], [$gc_libs])
190                     gc_libs="-lpthread"
191                     AC_CHECK_LIB(gc, GC_malloc,
192                                  [gc_ok=yes;
193                                   LIBS="-lgc $gc_libs $LIBS";
194                                   break], [gc_ok=no], [$gc_libs])
195                     gc_libs="$lt_cv_dlopen_libs"
196                     AC_CHECK_LIB(gc, GC_realloc,
197                                  [gc_ok=yes;
198                                   LIBS="-lgc $gc_libs $LIBS";
199                                   break], [gc_ok=no], [$gc_libs])
200                     gc_libs="-lpthread $lt_cv_dlopen_libs"
201                     AC_CHECK_LIB(gc, GC_free,
202                                  [gc_ok=yes;
203                                   LIBS="-lgc $gc_libs $LIBS";
204                                   break], [gc_ok=no], [$gc_libs])
205                     break],
206                  [gc_ok=no])
207 if test "x$gc_ok" = "xyes" && test "x$cross_compiling" = "xno" ; then 
208         AC_MSG_CHECKING([libgc version 6.4+])
209         AC_RUN_IFELSE(
210                 [AC_LANG_SOURCE([[
211                         #ifdef HAVE_GC_GC_H
212                         # include <gc/gc.h>
213                         #else
214                         # include <gc.h>
215                         #endif
216                         #include <stdio.h>
217                         extern unsigned GC_version;
218                         int main(void){
219                                 unsigned min = ((6 << 16) | (4 << 8) | 0);
220                                 printf("%d.%d.%d ",GC_version >> 16, (GC_version >> 8) & 0xFF, GC_version & 0xFF);
221                                 if (GC_version>=min) return 0;
222                                 return 1;
223                         }]])],
224                 [gc_ok=yes],
225                 [gc_ok=no]
226         )
227         AC_MSG_RESULT([$gc_ok])
228 fi
229 if test "x$gc_ok" != "xyes"; then
230         AC_MSG_ERROR([libgc (the Boehm Conservative Collector) 6.4+, is needed to compile inkscape -- http://www.hpl.hp.com/personal/Hans_Boehm/gc])
231 fi
233 dnl This check is to get a FIONREAD definition on Solaris 8
234 AC_CHECK_HEADERS([sys/filio.h])
237 AC_CHECK_HEADERS([malloc.h])
238 AC_CHECK_FUNCS([mallinfo], [
239         AC_CHECK_MEMBERS([struct mallinfo.usmblks,
240                           struct mallinfo.fsmblks,
241                           struct mallinfo.uordblks,
242                           struct mallinfo.fordblks,
243                           struct mallinfo.hblkhd],,,
244                          [#include <malloc.h>])
245 ])
247 AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
248 if test "x$FREETYPE_CONFIG" = "xno"; then
249         AC_MSG_ERROR([Cannot find freetype-config])
250 fi
251 FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
252 FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
253 AC_SUBST(FREETYPE_CFLAGS)
254 AC_SUBST(FREETYPE_LIBS)
256 dnl ******************************
257 dnl Win32
258 dnl ******************************
259 AC_MSG_CHECKING([for Win32 platform])
260 case "$host" in
261   *-*-mingw*)
262     platform_win32=yes
263     WIN32_CFLAGS="-mms-bitfields -DLIBXML_STATIC"
264     ;;
265   *)
266     platform_win32=no
267     ;;
268 esac
269 AC_MSG_RESULT([$platform_win32])
270 AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
271 AC_SUBST(WIN32_CFLAGS)
273 AC_MSG_CHECKING([for Solaris platform])
274 case "$host" in
275   *-solaris2.*)
276     platform_solaris=yes
277     solaris_version=`echo $host|sed -e 's/^.*-solaris2\.//' -e s'/\..*$//'`
278     CFLAGS="$CFLAGS -DSOLARIS=$solaris_version"
279     CXXFLAGS="$CXXFLAGS -DSOLARIS=$solaris_version"
280     ;;
281   *)
282     platform_solaris=no
283     ;;
284 esac
285 AC_MSG_RESULT([$platform_solaris])
286 AM_CONDITIONAL(PLATFORM_SOLARIS, test "$platform_solaris" = "yes")
288 dnl ******************************
289 dnl Xft checking
290 dnl ******************************
292 AC_ARG_WITH(xft,
293             AC_HELP_STRING([--with-xft], [use xft scalable font database (default is auto)]),
294             [with_xft=$withval], [with_xft=auto])
296 if test "x$with_xft" != "xno" ; then
297         dnl Test fontconfig package
298         PKG_CHECK_MODULES(XFT, fontconfig, xft_ok=yes, xft_ok=no)
299         if test "x$xft_ok" != "xyes"; then
300                 dnl test xft package
301                 PKG_CHECK_MODULES(XFT, xft, xft_ok=yes, xft_ok=no)
302                 if test "x$xft_ok" != "xyes"; then
303                         dnl Have to test xft presence
304                         AC_CHECK_HEADER(X11/Xft/Xft.h, xft_ok=yes, xft_ok=no)
305                         if test "x$xft_ok" != "xyes"; then
306                                 dnl No xft found
307                                 if test "x$with_xft" = "xyes"; then
308                                         dnl Xft was explicitly asked, so stop
309                                         AC_MSG_ERROR([--with-xft was specified, but appropriate development packages could not be found])
310                                 fi
311                         else
312                                 dnl Working Xft1
313                                 XFT_LIBS="-L/usr/X11R6/lib -lXft "
314                         fi
315                 fi
316         fi
317 else
318         dnl Asked to ignore xft
319         xft_ok=no
320 fi
322 AC_SUBST(XFT_CFLAGS)
323 AC_SUBST(XFT_LIBS)
325 AM_CONDITIONAL(USE_XFT, test "x$xft_ok" = "xyes")
326 if test "x$xft_ok" = "xyes"; then
327         AC_DEFINE(WITH_XFT, 1, [Use Xft font database])
328 fi
330 dnl ******************************
331 dnl pangoft2 for xft
332 dnl ******************************
334 if test "x$xft_ok" = "xyes"; then
335         PKG_CHECK_MODULES(PANGOFT2, pangoft2, pango_ok=yes, pango_ok=no)
336         if test "x$pango_ok" = "xyes"; then
337                 XFT_LIBS="$XFT_LIBS $PANGOFT2_LIBS"
338         fi
339 fi
342 dnl ******************************
343 dnl gnome vfs checking
344 dnl ******************************
346 AC_ARG_WITH(gnome-vfs,
347         AC_HELP_STRING([--with-gnome-vfs], [use gnome vfs for loading files]),
348         [with_gnome_vfs=$withval], [with_gnome_vfs=auto])
350 if test "x$with_gnome_vfs" = "xno"; then
351         dnl Asked to ignore gnome-vfs
352         gnome_vfs=no
353 else
354         dnl Have to test gnome-vfs presence
355         PKG_CHECK_MODULES(GNOME_VFS, gnome-vfs-2.0 >= 2.0, gnome_vfs=yes, gnome_vfs=no)
356         if test "x$gnome_vfs" != "xyes"; then
357                 dnl No gnome-vfs found
358                 if test "x$with_gnome_vfs" = "xyes"; then
359                         dnl Gnome-VFS was explicitly asked for, so stop
360                         AC_MSG_ERROR([--with-gnome-vfs was specified, but appropriate libgnomevfs development packages could not be found])
361                 else
362                         # gnome-vfs is no, tell us for the log file
363                         AC_MSG_RESULT($gnome_vfs)
364                 fi
365         fi
366 fi
368 AM_CONDITIONAL(USE_GNOME_VFS, test "x$gnome_vfs" = "xyes")
369 if test "x$gnome_vfs" = "xyes"; then
370         AC_DEFINE(WITH_GNOME_VFS, 1, [Use gnome vfs file load functionality])
371 fi
373 AC_SUBST(GNOME_VFS_CFLAGS)
374 AC_SUBST(GNOME_VFS_LIBS)
376 dnl ******************************
377 dnl libinkjar checking
378 dnl ******************************
380 AC_ARG_WITH(inkjar,
381         AC_HELP_STRING([--without-inkjar], [disable openoffice files (SVG jars)]),[with_ij=$withval], [with_ij=yes])
383 if test "x$with_ij" = "xyes"; then
384         AC_DEFINE(WITH_INKJAR, 1, [enable openoffice files (SVG jars)])
385         AC_C_BIGENDIAN
386         AC_CHECK_HEADERS(zlib.h)
387         ij=yes
388 else
389         ij=no
390 fi
391 AM_CONDITIONAL(INKJAR, test "$with_ij" = "yes")
393 ink_spell_pkg=
394 if pkg-config --exists gtkspell-2.0; then
395         ink_spell_pkg=gtkspell-2.0
396         AC_DEFINE(WITH_GTKSPELL, 1, [enable gtk spelling widget])
397 fi
399 dnl ******************************
400 dnl PERL checking
401 dnl ******************************
403 AC_MSG_CHECKING(for Perl development environment)
404 AC_ARG_WITH(perl,
405             AC_HELP_STRING([--with-perl], [use Perl for embedded scripting (EXPERIMENTAL)]),
406             [with_perl=$withval], [with_perl=skipped])
408 if test "x$with_perl" = "xyes"; then
409     checkPERL_CFLAGS=`perl -MExtUtils::Embed -e perl_inc 2>/dev/null`
410     if test "$?" -gt "0"; then
411         with_perl="no"
412     else
413         checkPERL_LIBS=`perl -MExtUtils::Embed -e ldopts 2>/dev/null`
414         if test "$?" -gt "0"; then
415             with_perl="no"
416         else
417             with_perl="yes"
418         fi
419     fi
420 fi
421 AC_MSG_RESULT([$with_perl])
422 if test "x$with_perl" = "xyes"; then
423     # Test that we actually have the perl libraries installed
424     oldCFLAGS="$CFLAGS"
425     oldLIBS="$LIBS"
426     CFLAGS="$CFLAGS $checkPERL_CFLAGS"
427     LIBS="$LIBS $checkPERL_LIBS"
428     AC_CHECK_FUNC([perl_parse],[
429         PERL_CFLAGS="$checkPERL_CFLAGS"
430         PERL_LIBS="$checkPERL_LIBS"
431         AC_DEFINE(WITH_PERL, 1, [use Perl for embedded scripting])
432         ],[
433         with_perl="no"
434         ])
435     CFLAGS="$oldCFLAGS"
436     LIBS="$oldLIBS"
437 fi
438 AM_CONDITIONAL(WITH_PERL, test "x$with_perl" = "xyes")
439 AC_SUBST(PERL_CFLAGS)
440 AC_SUBST(PERL_LIBS)
442 dnl ******************************
443 dnl Python checking
444 dnl ******************************
446 AC_MSG_CHECKING(for Python development environment)
447 AC_ARG_WITH(python,
448             AC_HELP_STRING([--with-python], [use Python for embedded scripting (EXPERIMENTAL)]),
449             [with_python=$withval], [with_python=skipped])
451 if test "x$with_python" = "xyes"; then
452     checkPYTHON_CFLAGS=`python -c "import distutils.sysconfig ; print '-I%s' % distutils.sysconfig.get_config_var('INCLUDEPY')" 2>/dev/null`
453     if test "$?" -gt "0"; then
454         with_python="no"
455     else
456         checkPYTHON_LIBS=`python -c "import distutils.sysconfig ; print '%s/%s %s' % (distutils.sysconfig.get_config_var('LIBPL'),distutils.sysconfig.get_config_var('LDLIBRARY'),distutils.sysconfig.get_config_var('LIBS'))" 2>/dev/null`
457         if test "$?" -gt "0"; then
458             with_python="no"
459         else
460             with_python="yes"
461         fi
462     fi
463 fi
464 AC_MSG_RESULT([$with_python])
465 if test "x$with_python" = "xyes"; then
466     # Test that we actually have the python libraries installed
467     oldCFLAGS="$CFLAGS"
468     oldLIBS="$LIBS"
469     CFLAGS="$CFLAGS $checkPYTHON_CFLAGS"
470     LIBS="$LIBS $checkPYTHON_LIBS"
471     AC_CHECK_FUNC([Py_Initialize],[
472         PYTHON_CFLAGS="$checkPYTHON_CFLAGS"
473         PYTHON_LIBS="$checkPYTHON_LIBS"
474         AC_DEFINE(WITH_PYTHON, 1, [use Python for embedded scripting])
475         ],[
476         with_python="no"
477         ])
478     CFLAGS="$oldCFLAGS"
479     LIBS="$oldLIBS"
480 fi
481 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" = "xyes")
482 AC_SUBST(PYTHON_CFLAGS)
483 AC_SUBST(PYTHON_LIBS)
485 dnl ******************************
486 dnl LittleCms checking
487 dnl ******************************
489 AC_ARG_ENABLE(lcms,
490         AC_HELP_STRING([--enable-lcms], [enable LittleCms for color management]),
491         [enable_lcms=$enableval], [enable_lcms=yes])
493 if test "x$enable_lcms" = "xno"; then
494         dnl Asked to ignore LittleCms
495         lcms=no
496 else
497         dnl Have to test LittleCms presence
498         PKG_CHECK_MODULES(LCMS, lcms >= 1.13, lcms=yes, lcms=no)
499         if test "x$lcms" != "xyes"; then
500                 dnl No lcms found
501                 if test "x$enable_lcms" = "xyes"; then
502                         dnl LittleCms was explicitly asked for, so stop
503                         AC_MSG_ERROR([--enable-lcms was specified, but appropriate LittleCms development packages could not be found])
504                 else
505                         # lcms is no, tell us for the log file
506                         AC_MSG_RESULT($lcms)
507                 fi
508         else
509                 dnl Working lcms
510                 LIBS="$LIBS $LCMS_LIBS"
511                 AC_DEFINE(ENABLE_LCMS, 1, [Use LittleCms color management])
512         fi
513 fi
515 AC_SUBST(LCMS_CFLAGS)
516 AC_SUBST(LCMS_LIBS)
518 dnl ******************************
519 dnl Libpoppler checking
520 dnl ******************************
522 AC_ARG_ENABLE(poppler-cairo,
523         AC_HELP_STRING([--enable-poppler-cairo], [Enable libpoppler-cairo for rendering PDF preview]),
524         [enable_poppler_cairo=$enableval], [enable_poppler_cairo=yes])
526 POPPLER_CFLAGS=""
527 PKG_CHECK_MODULES(POPPLER, poppler >= 0.5.9, poppler=yes, poppler=no)
529 if test "x$poppler" = "xyes"; then
530         dnl Working libpoppler
531         POPPLER_LIBS="-lpoppler "
532         dnl Have to test libpoppler-glib presence
533         PKG_CHECK_MODULES(POPPLER_GLIB, poppler-glib >= 0.5.9, poppler_glib=yes, poppler_glib=no)
534         if test "x$poppler_glib" = "xyes"; then
535                 dnl Working libpoppler-glib found
536                 dnl Check whether the Cairo SVG backend is available
537                 PKG_CHECK_MODULES(CAIRO_SVG, cairo-svg, cairo_svg=yes, cairo_svg=no)
538                 if test "x$cairo_svg" = "xyes"; then
539                         POPPLER_LIBS="$POPPLER_LIBS -lpoppler-glib "
540                 fi
541         fi
542         if test "x$enable_poppler_cairo" = "xyes"; then
543                 dnl Have to test libpoppler-cairo presence for PDF preview
544                 dnl AC_CHECK_HEADER(Magick++.h, magick_ok=yes, magick_ok=no)
545                 PKG_CHECK_MODULES(POPPLER_CAIRO, poppler-cairo >= 0.5.9, poppler_cairo=yes, poppler_cairo=no)
546                 if test "x$poppler_glib" = "xyes" -a "x$poppler_cairo" = "xyes" -a \
547                         "x$cairo_svg" = "xno"
548                 then
549                         POPPLER_LIBS="$POPPLER_LIBS -lpoppler-glib "
550                 fi
551         fi
552 fi
554 if test "x$poppler" = "xyes"; then
555         LIBS="$LIBS $POPPLER_LIBS"
556         AC_DEFINE(HAVE_POPPLER, 1, [Use libpoppler for direct PDF import])
557 fi
558 if test "x$poppler_cairo" = "xyes" -a "x$poppler_glib" = "xyes"; then
559         AC_DEFINE(HAVE_POPPLER_CAIRO, 1, [Use libpoppler-cairo for rendering PDF preview])
560 fi
561 if test "x$poppler_glib" = "xyes" -a "x$cairo_svg" = "xyes"; then
562         AC_DEFINE(HAVE_POPPLER_GLIB, 1, [Use libpoppler-glib and Cairo-SVG for PDF import])
563 fi
564 AC_SUBST(POPPLER_CFLAGS)
565 AC_SUBST(POPPLER_LIBS)
567 PKG_CHECK_MODULES(POPPLERNEW, poppler >= 0.8.3, popplernew=yes, popplernew=no)
568 if test "x$popplernew" = "xyes"; then
569         AC_DEFINE(POPPLER_NEW_GFXFONT, 1, [Poppler version of GfxFont to use (0.8.3 or higher versions of Poppler)])
570 fi
572 dnl ******************************
573 dnl Inkboard dependency checking
574 dnl ******************************
576 with_inkboard="no"
577 with_inkboard_ssl="no"
579 INKBOARD_CFLAGS=""
581 AC_ARG_ENABLE(inkboard,
582                 AS_HELP_STRING([--enable-inkboard], [enable Inkboard online whiteboard facility (disabled by default)]),
583        with_inkboard=$enableval,with_inkboard=no)
585 if test "x$with_inkboard" = "xyes"; then
586                 with_inkboard="yes"
587                 AC_DEFINE(WITH_INKBOARD,1,[Build in Inkboard support])
588                 
589                 dnl Test for OpenSSL
590                 PKG_CHECK_MODULES(INKBOARD, openssl, with_inkboard_ssl=yes, with_inkboard_ssl=no)
591                 if test "x$with_inkboard_ssl" = "xyes"; then
592                         dnl OpenSSL found; enable SSL support in Pedro
593                         INKBOARD_CFLAGS="$INKBOARD_CFLAGS -DHAVE_SSL"
594                         RELAYTOOL([ssl], INKBOARD_LIBS, INKBOARD_CFLAGS, [inkboard_weak=yes])
595                         RELAYTOOL([crypto], INKBOARD_LIBS, INKBOARD_CFLAGS, [inkboard_weak=yes])
596                         AC_DEFINE(WITH_INKBOARD_SSL,1,[Build in SSL support for Inkboard])
597                 fi
598 else
599         with_inkboard="no"
600 fi
602 AM_CONDITIONAL(WITH_INKBOARD, test "x$with_inkboard" = "xyes")
603 AC_SUBST(INKBOARD_LIBS)
604 AC_SUBST(INKBOARD_CFLAGS)
606 dnl ******************************
607 dnl Check for libwpg for extension
608 dnl ******************************
610 PKG_CHECK_MODULES(LIBWPG, libwpg-0.1 libwpg-stream-0.1, with_libwpg=yes, with_libwpg=no)
611 if test "x$with_libwpg" = "xyes"; then
612         AC_DEFINE(WITH_LIBWPG,1,[Build in libwpg])
613 fi
614 AM_CONDITIONAL(WITH_LIBWPG, test "x$with_libwpg" = "xyes")
616 AC_SUBST(LIBWPG_LIBS)
617 AC_SUBST(LIBWPG_CFLAGS)
619 dnl ******************************
620 dnl Check for dbus functionality
621 dnl ******************************
623 PKG_CHECK_MODULES(DBUS, dbus-glib-1, with_dbus=yes, with_dbus=no)
624 if test "x$with_dbus" = "xyes"; then
625         AC_DEFINE(WITH_DBUS,1,[Build in dbus])
626 fi
627 AM_CONDITIONAL(WITH_DBUS, test "x$with_dbus" = "xyes")
629 AC_SUBST(DBUS_LIBS)
630 AC_SUBST(DBUS_CFLAGS)
632 dnl ******************************
633 dnl Check for ImageMagick Magick++ 
634 dnl ******************************
636 PKG_CHECK_MODULES(IMAGEMAGICK, ImageMagick++, magick_ok=yes, magick_ok=no)
637 if test "x$magick_ok" = "xyes"; then
638       AC_DEFINE(WITH_IMAGE_MAGICK,1,[Image Magick++ support for bitmap effects])
639 fi
640 AM_CONDITIONAL(USE_IMAGE_MAGICK, test "x$magick_ok" = "xyes")
642 AC_SUBST(IMAGEMAGICK_LIBS)
643 AC_SUBST(IMAGEMAGICK_CFLAGS)
645 dnl ***********************************************************************************************************
646 dnl Check for a Cairo version that implements user-fonts feature (with a stable API, that is cairo > 1.7.6),
647 dnl so that we conditionally add SVGFonts support
648 dnl ***********************************************************************************************************
650 PKG_CHECK_MODULES(CAIRO_USER_FONTS, cairo > 1.7.6, cairouserfonts=yes, cairouserfonts=no)
651 if test "x$cairouserfonts" = "xyes"; then
652        AC_DEFINE(ENABLE_SVG_FONTS, 1, [SVG Fonts should be used])
653 fi
655 dnl ******************************
656 dnl   Unconditional dependencies
657 dnl ******************************
659 dnl sigc++-2.0 >= 2.0.12: using "visit_each" not available in 2.0.10
660 if test $cc_vers_major -gt 3; then
661   min_sigc_version=2.0.12
662 else
663   min_sigc_version=2.0.11
664 fi
665 PKG_CHECK_MODULES(INKSCAPE, gdkmm-2.4  glibmm-2.4 giomm-2.4 gtkmm-2.4 >= 2.10.0  gtk+-2.0  libxml-2.0 >= 2.6.11  libxslt >= 1.0.15  cairo  sigc++-2.0 >= $min_sigc_version  $ink_spell_pkg  gthread-2.0 >= 2.0 libpng >= 1.2 gsl)
667 # Check for Apple Mac OS X Carbon framework
668 carbon_ok=no
669 AC_MSG_CHECKING([for Mac OS X Carbon support])
670 AC_TRY_CPP([
671 #include <Carbon/Carbon.h>
672 #include <CoreServices/CoreServices.h>
673 ], carbon_ok=yes)
674 AC_MSG_RESULT($carbon_ok)
675 if test "x$carbon_ok" = "xyes"; then
676   AC_DEFINE(HAVE_CARBON, 1, [define to 1 if Carbon is available])
677   CARBON_LDFLAGS="-framework Carbon"
678   AC_SUBST(CARBON_LDFLAGS)
679 fi
680 AM_CONDITIONAL(HAVE_CARBON, test "x$carbon_ok" = "xyes")
682 # Check for some boost header files
683 AC_CHECK_HEADERS([boost/concept_check.hpp], [], AC_MSG_ERROR([You need the boost package (e.g. libboost-dev)]))
685 PKG_CHECK_MODULES(CAIRO_PDF, cairo-pdf, cairo_pdf=yes, cairo_pdf=no)
686 if test "x$cairo_pdf" = "xyes"; then
687   AC_DEFINE(HAVE_CAIRO_PDF, 1, [Whether the Cairo PDF backend is available])
688 fi
690 dnl Shouldn't we test for libpng and libz?
691 if test "x$openmp_ok" = "xyes"; then
692         INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz -lgomp"
693 else
694         INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz"
695 fi
697 AC_CHECK_HEADER(popt.h,
698                 [INKSCAPE_LIBS="$INKSCAPE_LIBS -lpopt"],
699                 AC_MSG_ERROR([libpopt is required]))
701 dnl **************************
702 dnl Check for aspell 
703 dnl ******************************
704 AC_CHECK_LIB(aspell, new_aspell_config, [AC_CHECK_HEADER(aspell.h, aspell_ok=yes, aspell_ok=no)], aspell_ok=no, -lz -lm)
705 if test "x$aspell_ok" = "xyes"; then
706         AC_DEFINE(HAVE_ASPELL, 1, [Use aspell for built-in spellchecker])
707   INKSCAPE_LIBS="$INKSCAPE_LIBS -laspell"
708 else
709         AC_MSG_CHECKING([Aspell not found, spell checker will be disabled])
710 fi
712 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
713 sp_save_LIBS=$LIBS
714 LIBS="$LIBS $INKSCAPE_LIBS"
715 AC_CHECK_FUNCS(bind_textdomain_codeset)
716 dnl Check for gtk_window_fullscreen in gtk (>= 2.2)
717 AC_CHECK_FUNCS(gtk_window_set_default_icon_from_file)
718 AC_CHECK_FUNCS(gtk_window_fullscreen)
719 LIBS=$sp_save_LIBS
722 dnl Check for binary relocation support
723 dnl Hongli Lai <h.lai@chello.nl>
725 AC_ARG_ENABLE(binreloc,
726        [  --enable-binreloc       compile with binary relocation support],
727        enable_binreloc=$enableval,enable_binreloc=no)
729 AC_MSG_CHECKING(whether binary relocation support should be enabled)
730 if test "$enable_binreloc" = "yes"; then
731        AC_MSG_RESULT(yes)
732        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
733        if test -e /proc/self/maps; then
734                AC_MSG_RESULT(yes)
735        else
736                AC_MSG_RESULT(no)
737                AC_MSG_ERROR(/proc/self/maps is not available. Binary relocation cannot be enabled.)
738                enable_binreloc="no"
739        fi
741 elif test "$enable_binreloc" = "auto"; then
742        AC_MSG_RESULT(yes when available)
743        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
744        if test -e /proc/self/maps; then
745                AC_MSG_RESULT(yes)
746                enable_binreloc=yes
748                AC_MSG_CHECKING(whether everything is installed to the same prefix)
749                if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
750                        "$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
751                        "$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
752                then
753                        AC_MSG_RESULT(yes)
754                else
755                        AC_MSG_RESULT(no)
756                        AC_MSG_NOTICE(Binary relocation support will be disabled.)
757                        enable_binreloc=no
758                fi
760        else
761                AC_MSG_RESULT(no)
762                enable_binreloc=no
763        fi
765 elif test "$enable_binreloc" = "no"; then
766        AC_MSG_RESULT(no)
767 else
768        AC_MSG_RESULT(no (unknown value "$enable_binreloc"))
769        enable_binreloc=no
770 fi
771 AC_DEFINE(BR_PTHREADS,[0],[Use binreloc thread support?])
772 if test "$enable_binreloc" = "yes"; then
773    AC_DEFINE(ENABLE_BINRELOC,,[Use AutoPackage?])
774 fi
776 AC_ARG_ENABLE(osxapp,
777        [  --enable-osxapp         compile with OSX .app data dir paths],
778        enable_osxapp=$enableval,enable_osxapp=no)
779 if test "$enable_osxapp" = "yes"; then
780    AC_DEFINE(ENABLE_OSX_APP_LOCATIONS,,[Build with OSX .app data dir paths?])
781 fi
783 dnl ******************************
784 dnl   Reported by autoscan
785 dnl ******************************
786 AC_CHECK_FUNCS(pow)
787 # if we did not find pow(), see if it's in libm.
788 if test x"$ac_cv_func_pow" = x"no" ; then
789         AC_CHECK_LIB(m,pow)
790 fi
791 AC_CHECK_FUNCS(sqrt)
792 AC_CHECK_FUNCS(floor)
793 AC_CHECK_FUNCS(gettimeofday)
794 AC_CHECK_FUNCS(memmove)
795 AC_CHECK_FUNCS(memset)
796 AC_CHECK_FUNCS(mkdir)
797 AC_CHECK_FUNCS(strncasecmp)
798 AC_CHECK_FUNCS(strpbrk)
799 AC_CHECK_FUNCS(strrchr)
800 AC_CHECK_FUNCS(strspn)
801 AC_CHECK_FUNCS(strstr)
802 AC_CHECK_FUNCS(strtoul)
803 AC_CHECK_FUNCS(fpsetmask)
804 AC_CHECK_FUNCS(ecvt)
805 AC_CHECK_HEADERS(ieeefp.h)
806 AC_CHECK_HEADERS(fcntl.h)
807 AC_CHECK_HEADERS(libintl.h)
808 AC_CHECK_HEADERS(stddef.h)
809 AC_CHECK_HEADERS(sys/time.h)
810 AC_FUNC_STAT
811 AC_FUNC_STRFTIME
812 AC_FUNC_STRTOD
813 AC_HEADER_STAT
814 AC_HEADER_TIME
815 AC_STRUCT_TM
816 AC_TYPE_MODE_T
817 AC_TYPE_SIGNAL
819 dnl Work around broken gcc 3.3 (seen on OSX) where "ENABLE_NLS" isn't
820 dnl set correctly because the gettext function isn't noticed.
821 if test "$ac_cv_header_libintl_h" = "yes" &&
822    test "$ac_cv_func_bind_textdomain_codeset" = "yes"  &&
823    test "$gt_cv_func_have_gettext" != "yes"; then
824     AC_DEFINE(ENABLE_NLS)
825 fi
827 dnl ******************************
828 dnl   Compilation warnings
829 dnl ******************************
830 if test "$GXX" = "yes"; then
831   # Enable some warnings from g++.
833   # Rationale: a number of bugs in inkscape have been fixed by enabling g++
834   # warnings and addressing the produced warnings.  Usually the committing
835   # developer is the best person to address the warnings.
837   ink_svd_CXXFLAGS="$CXXFLAGS"
838   CXXFLAGS="-Wno-unused-parameter $CXXFLAGS"
839   # -Wno-unused-parameter isn't accepted by gcc 2.95.
840   AC_COMPILE_IFELSE([int dummy;
841 ], , CXXFLAGS="-Wno-unused $ink_svd_CXXFLAGS",)
842   # Note: At least one bug has been caught from unused parameter warnings,
843   # so it might be worth trying not to disable it.
844   # One way of selectively disabling the warnings (i.e. only where the
845   # programmer deliberately isn't using the parameter, e.g. for a callback)
846   # is to remove the parameter name (leaving just its type), as is done
847   # in src/seltrans.cpp:sp_seltrans_handle_event; this indicates that the
848   # programmer deliberately has an unused parameter (e.g. because it's used
849   # as a callback or similar function pointer use).
851   # Add even more stuff
852   CXXFLAGS="-Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch $CXXFLAGS"
854 fi
856 dnl ******************************
857 dnl   libinkscape
858 dnl ******************************
859 dnl
860 dnl AC_ARG_ENABLE(libinkscape, AC_HELP_STRING([--enable-libinkscape], [Compile dynamic library (experimental)]), [splib=$enableval], [splib=no])
861 dnl
862 dnl AM_CONDITIONAL(ENABLE_LIBINKSCAPE, test "x$splib" != "xno")
863 dnl
865 AC_SUBST(INKSCAPE_CFLAGS)
866 AC_SUBST(INKSCAPE_LIBS)
869 # Checks to see if we should compile in MMX support (there will be
870 # a runtime test when the code is actually run to see if it should
871 # be used - this just checks if we can compile it.)
873 # This code is partially taken from Mesa
875 dnl Let people disable the MMX optimization
876 AC_ARG_ENABLE(mmx, [  --disable-mmx     Don't use MMX optimization [default=auto]], enable_mmx="$enableval", enable_mmx=auto)
878 AC_MSG_CHECKING(for x86 platform)
879 case $host_cpu in
880   i386|i486|i586|i686|i786|k6|k7)
881     use_x86_asm=yes
882     ;;
883   *)
884     use_x86_asm=no
885 esac
886 AC_MSG_RESULT($use_x86_asm)
888 dnl Are we going to use MMX extensions
889 use_mmx_asm=no
891 AC_MSG_CHECKING(compiler support for MMX)
893 if test x$enable_mmx = xauto ; then
894   if test $use_x86_asm = yes; then
895     save_ac_ext=$ac_ext
896     ac_ext=S
897     
898     cp $srcdir/src/libnr/nr_mmx_R8G8B8A8_P_R8G8B8A8_P_A8_RGBAP.S conftest.S
899     if AC_TRY_EVAL(ac_compile); then
900         use_mmx_asm=yes
901     fi
902     dnl rm -f conftest.[oS]
904     ac_ext=$save_ac_ext
905   fi
907 dnl Enforce usage of MMX extensions
908 elif test x$enable_mmx = xyes ; then
909     use_mmx_asm=yes
910 else
911     use_mmx_asm=no
912 fi
914 if test $use_mmx_asm = yes; then
915         AC_DEFINE(WITH_MMX, 1, [Use MMX optimizations, if CPU supports it])
916         AC_MSG_RESULT(yes)
917 else
918         AC_MSG_RESULT(no)
919 fi
921 AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
923 dnl Define our data paths for config.h
924 AC_DEFINE_DIR([INKSCAPE_DATADIR], [datadir], [Base data directory])
925 AC_DEFINE_DIR([PACKAGE_LOCALE_DIR], [localedir], [Locatization directory])
927 AC_CONFIG_FILES([
928 Makefile
929 src/Makefile
930 src/check-header-compile
931 src/algorithms/makefile
932 src/application/makefile
933 src/bind/makefile
934 src/debug/makefile
935 src/dialogs/makefile
936 src/display/makefile
937 src/dom/makefile
938 src/extension/implementation/makefile
939 src/extension/internal/makefile
940 src/extension/makefile
941 src/extension/script/makefile
942 src/filters/makefile
943 src/helper/makefile
944 src/inkjar/makefile
945 src/io/makefile
946 src/libcroco/makefile
947 src/libgdl/makefile
948 src/libnr/makefile
949 src/libnrtype/makefile
950 src/libavoid/makefile
951 src/livarot/makefile
952 src/live_effects/makefile
953 src/live_effects/parameter/makefile
954 src/pedro/makefile
955 src/jabber_whiteboard/makefile
956 src/removeoverlap/makefile
957 src/svg/makefile
958 src/trace/makefile
959 src/traits/makefile
960 src/ui/cache/makefile
961 src/ui/dialog/makefile
962 src/ui/makefile
963 src/ui/view/makefile
964 src/ui/widget/makefile
965 src/util/makefile
966 src/widgets/makefile
967 src/xml/makefile
968 src/2geom/makefile
969 doc/Makefile
970 po/Makefile.in
971 share/Makefile
972 share/clipart/Makefile
973 share/examples/Makefile
974 share/extensions/Makefile
975 share/extensions/alphabet_soup/Makefile
976 share/extensions/Barcode/Makefile
977 share/extensions/Poly3DObjects/Makefile
978 share/extensions/test/Makefile
979 share/extensions/xaml2svg/Makefile
980 share/filters/Makefile
981 share/fonts/Makefile
982 share/gradients/Makefile
983 share/icons/Makefile
984 share/keys/Makefile
985 share/markers/Makefile
986 share/palettes/Makefile
987 share/patterns/Makefile
988 share/screens/Makefile
989 share/templates/Makefile
990 share/tutorials/Makefile
991 share/ui/Makefile
992 packaging/autopackage/default.apspec
993 inkscape.spec
994 Info.plist
995 inkview.1
996 ])
998 AH_BOTTOM([
1001 ])
1003 AC_OUTPUT
1005 echo "
1006 Configuration:
1008         Source code location:     ${srcdir}
1009         Destination path prefix:  ${prefix}
1010         Compiler:                 ${CXX}
1011         CPPFLAGS:                 ${CPPFLAGS}
1012         CXXFLAGS:                 ${CXXFLAGS}
1013         CFLAGS:                   ${CFLAGS}
1014         LDFLAGS:                  ${LDFLAGS}
1016         Use Xft font database:    ${xft_ok}
1017         Use gnome-vfs:            ${gnome_vfs}
1018         Use openoffice files:     ${ij}
1019         Use MMX optimizations:    ${use_mmx_asm}
1020         Use relocation support:   ${enable_binreloc}
1021         Internal Python:          ${with_python}
1022         Internal Perl:            ${with_perl}
1023         Enable LittleCms:         ${enable_lcms}
1024         Enable DBUS               ${with_dbus} 
1025         Enable Inkboard:          ${with_inkboard}
1026         Enable SSL in Inkboard:   ${with_inkboard_ssl}
1027         Enable Poppler-Cairo:     ${enable_poppler_cairo}
1028         ImageMagick Magick++:     ${magick_ok}
1029         Libwpg:                   ${with_libwpg}