Code

48e13cbaf735fadbf749ba3132bcaf7fdac3a769
[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 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 ImageMagick Magick++ 
621 dnl ******************************
623 PKG_CHECK_MODULES(IMAGEMAGICK, ImageMagick++, magick_ok=yes, magick_ok=no)
624 if test "x$magick_ok" = "xyes"; then
625       AC_DEFINE(WITH_IMAGE_MAGICK,1,[Image Magick++ support for bitmap effects])
626 fi
627 AM_CONDITIONAL(USE_IMAGE_MAGICK, test "x$magick_ok" = "xyes")
629 AC_SUBST(IMAGEMAGICK_LIBS)
630 AC_SUBST(IMAGEMAGICK_CFLAGS)
632 dnl ***********************************************************************************************************
633 dnl Check for a Cairo version that implements user-fonts feature (with a stable API, that is cairo > 1.7.6),
634 dnl so that we conditionally add SVGFonts support
635 dnl ***********************************************************************************************************
637 PKG_CHECK_MODULES(CAIRO_USER_FONTS, cairo > 1.7.6, cairouserfonts=yes, cairouserfonts=no)
638 if test "x$cairouserfonts" = "xyes"; then
639        AC_DEFINE(ENABLE_SVG_FONTS, 1, [SVG Fonts should be used])
640 fi
642 dnl ******************************
643 dnl   Unconditional dependencies
644 dnl ******************************
646 dnl sigc++-2.0 >= 2.0.12: using "visit_each" not available in 2.0.10
647 if test $cc_vers_major -gt 3; then
648   min_sigc_version=2.0.12
649 else
650   min_sigc_version=2.0.11
651 fi
652 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)
654 # Check for Apple Mac OS X Carbon framework
655 carbon_ok=no
656 AC_MSG_CHECKING([for Mac OS X Carbon support])
657 AC_TRY_CPP([
658 #include <Carbon/Carbon.h>
659 #include <CoreServices/CoreServices.h>
660 ], carbon_ok=yes)
661 AC_MSG_RESULT($carbon_ok)
662 if test "x$carbon_ok" = "xyes"; then
663   AC_DEFINE(HAVE_CARBON, 1, [define to 1 if Carbon is available])
664   CARBON_LDFLAGS="-framework Carbon"
665   AC_SUBST(CARBON_LDFLAGS)
666 fi
667 AM_CONDITIONAL(HAVE_CARBON, test "x$carbon_ok" = "xyes")
669 # Check for some boost header files
670 AC_CHECK_HEADERS([boost/concept_check.hpp], [], AC_MSG_ERROR([You need the boost package (e.g. libboost-dev)]))
672 PKG_CHECK_MODULES(CAIRO_PDF, cairo-pdf, cairo_pdf=yes, cairo_pdf=no)
673 if test "x$cairo_pdf" = "xyes"; then
674   AC_DEFINE(HAVE_CAIRO_PDF, 1, [Whether the Cairo PDF backend is available])
675 fi
677 dnl Shouldn't we test for libpng and libz?
678 if test "x$openmp_ok" = "xyes"; then
679         INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz -lgomp"
680 else
681         INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz"
682 fi
684 AC_CHECK_HEADER(popt.h,
685                 [INKSCAPE_LIBS="$INKSCAPE_LIBS -lpopt"],
686                 AC_MSG_ERROR([libpopt is required]))
688 dnl **************************
689 dnl Check for aspell 
690 dnl ******************************
691 AC_CHECK_LIB(aspell, new_aspell_config, [AC_CHECK_HEADER(aspell.h, aspell_ok=yes, aspell_ok=no)], aspell_ok=no, -lz -lm)
692 if test "x$aspell_ok" = "xyes"; then
693         AC_DEFINE(HAVE_ASPELL, 1, [Use aspell for built-in spellchecker])
694   INKSCAPE_LIBS="$INKSCAPE_LIBS -laspell"
695 else
696         AC_MSG_CHECKING([Aspell not found, spell checker will be disabled])
697 fi
699 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
700 sp_save_LIBS=$LIBS
701 LIBS="$LIBS $INKSCAPE_LIBS"
702 AC_CHECK_FUNCS(bind_textdomain_codeset)
703 dnl Check for gtk_window_fullscreen in gtk (>= 2.2)
704 AC_CHECK_FUNCS(gtk_window_set_default_icon_from_file)
705 AC_CHECK_FUNCS(gtk_window_fullscreen)
706 LIBS=$sp_save_LIBS
709 dnl Check for binary relocation support
710 dnl Hongli Lai <h.lai@chello.nl>
712 AC_ARG_ENABLE(binreloc,
713        [  --enable-binreloc       compile with binary relocation support],
714        enable_binreloc=$enableval,enable_binreloc=no)
716 AC_MSG_CHECKING(whether binary relocation support should be enabled)
717 if test "$enable_binreloc" = "yes"; then
718        AC_MSG_RESULT(yes)
719        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
720        if test -e /proc/self/maps; then
721                AC_MSG_RESULT(yes)
722        else
723                AC_MSG_RESULT(no)
724                AC_MSG_ERROR(/proc/self/maps is not available. Binary relocation cannot be enabled.)
725                enable_binreloc="no"
726        fi
728 elif test "$enable_binreloc" = "auto"; then
729        AC_MSG_RESULT(yes when available)
730        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
731        if test -e /proc/self/maps; then
732                AC_MSG_RESULT(yes)
733                enable_binreloc=yes
735                AC_MSG_CHECKING(whether everything is installed to the same prefix)
736                if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
737                        "$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
738                        "$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
739                then
740                        AC_MSG_RESULT(yes)
741                else
742                        AC_MSG_RESULT(no)
743                        AC_MSG_NOTICE(Binary relocation support will be disabled.)
744                        enable_binreloc=no
745                fi
747        else
748                AC_MSG_RESULT(no)
749                enable_binreloc=no
750        fi
752 elif test "$enable_binreloc" = "no"; then
753        AC_MSG_RESULT(no)
754 else
755        AC_MSG_RESULT(no (unknown value "$enable_binreloc"))
756        enable_binreloc=no
757 fi
758 AC_DEFINE(BR_PTHREADS,[0],[Use binreloc thread support?])
759 if test "$enable_binreloc" = "yes"; then
760    AC_DEFINE(ENABLE_BINRELOC,,[Use AutoPackage?])
761 fi
763 AC_ARG_ENABLE(osxapp,
764        [  --enable-osxapp         compile with OSX .app data dir paths],
765        enable_osxapp=$enableval,enable_osxapp=no)
766 if test "$enable_osxapp" = "yes"; then
767    AC_DEFINE(ENABLE_OSX_APP_LOCATIONS,,[Build with OSX .app data dir paths?])
768 fi
770 dnl ******************************
771 dnl   Reported by autoscan
772 dnl ******************************
773 AC_CHECK_FUNCS(pow)
774 # if we did not find pow(), see if it's in libm.
775 if test x"$ac_cv_func_pow" = x"no" ; then
776         AC_CHECK_LIB(m,pow)
777 fi
778 AC_CHECK_FUNCS(sqrt)
779 AC_CHECK_FUNCS(floor)
780 AC_CHECK_FUNCS(gettimeofday)
781 AC_CHECK_FUNCS(memmove)
782 AC_CHECK_FUNCS(memset)
783 AC_CHECK_FUNCS(mkdir)
784 AC_CHECK_FUNCS(strncasecmp)
785 AC_CHECK_FUNCS(strpbrk)
786 AC_CHECK_FUNCS(strrchr)
787 AC_CHECK_FUNCS(strspn)
788 AC_CHECK_FUNCS(strstr)
789 AC_CHECK_FUNCS(strtoul)
790 AC_CHECK_FUNCS(fpsetmask)
791 AC_CHECK_FUNCS(ecvt)
792 AC_CHECK_HEADERS(ieeefp.h)
793 AC_CHECK_HEADERS(fcntl.h)
794 AC_CHECK_HEADERS(libintl.h)
795 AC_CHECK_HEADERS(stddef.h)
796 AC_CHECK_HEADERS(sys/time.h)
797 AC_FUNC_STAT
798 AC_FUNC_STRFTIME
799 AC_FUNC_STRTOD
800 AC_HEADER_STAT
801 AC_HEADER_TIME
802 AC_STRUCT_TM
803 AC_TYPE_MODE_T
804 AC_TYPE_SIGNAL
806 dnl Work around broken gcc 3.3 (seen on OSX) where "ENABLE_NLS" isn't
807 dnl set correctly because the gettext function isn't noticed.
808 if test "$ac_cv_header_libintl_h" = "yes" &&
809    test "$ac_cv_func_bind_textdomain_codeset" = "yes"  &&
810    test "$gt_cv_func_have_gettext" != "yes"; then
811     AC_DEFINE(ENABLE_NLS)
812 fi
814 dnl ******************************
815 dnl   Compilation warnings
816 dnl ******************************
817 if test "$GXX" = "yes"; then
818   # Enable some warnings from g++.
820   # Rationale: a number of bugs in inkscape have been fixed by enabling g++
821   # warnings and addressing the produced warnings.  Usually the committing
822   # developer is the best person to address the warnings.
824   ink_svd_CXXFLAGS="$CXXFLAGS"
825   CXXFLAGS="-Wno-unused-parameter $CXXFLAGS"
826   # -Wno-unused-parameter isn't accepted by gcc 2.95.
827   AC_COMPILE_IFELSE([int dummy;
828 ], , CXXFLAGS="-Wno-unused $ink_svd_CXXFLAGS",)
829   # Note: At least one bug has been caught from unused parameter warnings,
830   # so it might be worth trying not to disable it.
831   # One way of selectively disabling the warnings (i.e. only where the
832   # programmer deliberately isn't using the parameter, e.g. for a callback)
833   # is to remove the parameter name (leaving just its type), as is done
834   # in src/seltrans.cpp:sp_seltrans_handle_event; this indicates that the
835   # programmer deliberately has an unused parameter (e.g. because it's used
836   # as a callback or similar function pointer use).
838   # Add even more stuff
839   CXXFLAGS="-Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch $CXXFLAGS"
841 fi
843 dnl ******************************
844 dnl   libinkscape
845 dnl ******************************
846 dnl
847 dnl AC_ARG_ENABLE(libinkscape, AC_HELP_STRING([--enable-libinkscape], [Compile dynamic library (experimental)]), [splib=$enableval], [splib=no])
848 dnl
849 dnl AM_CONDITIONAL(ENABLE_LIBINKSCAPE, test "x$splib" != "xno")
850 dnl
852 AC_SUBST(INKSCAPE_CFLAGS)
853 AC_SUBST(INKSCAPE_LIBS)
856 # Checks to see if we should compile in MMX support (there will be
857 # a runtime test when the code is actually run to see if it should
858 # be used - this just checks if we can compile it.)
860 # This code is partially taken from Mesa
862 dnl Let people disable the MMX optimization
863 AC_ARG_ENABLE(mmx, [  --disable-mmx     Don't use MMX optimization [default=auto]], enable_mmx="$enableval", enable_mmx=auto)
865 AC_MSG_CHECKING(for x86 platform)
866 case $host_cpu in
867   i386|i486|i586|i686|i786|k6|k7)
868     use_x86_asm=yes
869     ;;
870   *)
871     use_x86_asm=no
872 esac
873 AC_MSG_RESULT($use_x86_asm)
875 dnl Are we going to use MMX extensions
876 use_mmx_asm=no
878 AC_MSG_CHECKING(compiler support for MMX)
880 if test x$enable_mmx = xauto ; then
881   if test $use_x86_asm = yes; then
882     save_ac_ext=$ac_ext
883     ac_ext=S
884     
885     cp $srcdir/src/libnr/nr_mmx_R8G8B8A8_P_R8G8B8A8_P_A8_RGBAP.S conftest.S
886     if AC_TRY_EVAL(ac_compile); then
887         use_mmx_asm=yes
888     fi
889     dnl rm -f conftest.[oS]
891     ac_ext=$save_ac_ext
892   fi
894 dnl Enforce usage of MMX extensions
895 elif test x$enable_mmx = xyes ; then
896     use_mmx_asm=yes
897 else
898     use_mmx_asm=no
899 fi
901 if test $use_mmx_asm = yes; then
902         AC_DEFINE(WITH_MMX, 1, [Use MMX optimizations, if CPU supports it])
903         AC_MSG_RESULT(yes)
904 else
905         AC_MSG_RESULT(no)
906 fi
908 AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
910 dnl Define our data paths for config.h
911 AC_DEFINE_DIR([INKSCAPE_DATADIR], [datadir], [Base data directory])
912 AC_DEFINE_DIR([PACKAGE_LOCALE_DIR], [localedir], [Locatization directory])
914 AC_CONFIG_FILES([
915 Makefile
916 src/Makefile
917 src/check-header-compile
918 src/algorithms/makefile
919 src/application/makefile
920 src/bind/makefile
921 src/debug/makefile
922 src/dialogs/makefile
923 src/display/makefile
924 src/dom/makefile
925 src/extension/implementation/makefile
926 src/extension/internal/makefile
927 src/extension/makefile
928 src/extension/script/makefile
929 src/filters/makefile
930 src/helper/makefile
931 src/inkjar/makefile
932 src/io/makefile
933 src/libcroco/makefile
934 src/libgdl/makefile
935 src/libnr/makefile
936 src/libnrtype/makefile
937 src/libavoid/makefile
938 src/livarot/makefile
939 src/live_effects/makefile
940 src/live_effects/parameter/makefile
941 src/pedro/makefile
942 src/jabber_whiteboard/makefile
943 src/removeoverlap/makefile
944 src/svg/makefile
945 src/trace/makefile
946 src/traits/makefile
947 src/ui/cache/makefile
948 src/ui/dialog/makefile
949 src/ui/makefile
950 src/ui/view/makefile
951 src/ui/widget/makefile
952 src/util/makefile
953 src/widgets/makefile
954 src/xml/makefile
955 src/2geom/makefile
956 doc/Makefile
957 po/Makefile.in
958 share/Makefile
959 share/clipart/Makefile
960 share/examples/Makefile
961 share/extensions/Makefile
962 share/extensions/alphabet_soup/Makefile
963 share/extensions/Barcode/Makefile
964 share/extensions/Poly3DObjects/Makefile
965 share/extensions/test/Makefile
966 share/extensions/xaml2svg/Makefile
967 share/filters/Makefile
968 share/fonts/Makefile
969 share/gradients/Makefile
970 share/icons/Makefile
971 share/keys/Makefile
972 share/markers/Makefile
973 share/palettes/Makefile
974 share/patterns/Makefile
975 share/screens/Makefile
976 share/templates/Makefile
977 share/tutorials/Makefile
978 share/ui/Makefile
979 packaging/autopackage/default.apspec
980 inkscape.spec
981 Info.plist
982 inkview.1
983 ])
985 AH_BOTTOM([
988 ])
990 AC_OUTPUT
992 echo "
993 Configuration:
995         Source code location:     ${srcdir}
996         Destination path prefix:  ${prefix}
997         Compiler:                 ${CXX}
998         CPPFLAGS:                 ${CPPFLAGS}
999         CXXFLAGS:                 ${CXXFLAGS}
1000         CFLAGS:                   ${CFLAGS}
1001         LDFLAGS:                  ${LDFLAGS}
1003         Use Xft font database:    ${xft_ok}
1004         Use gnome-vfs:            ${gnome_vfs}
1005         Use openoffice files:     ${ij}
1006         Use MMX optimizations:    ${use_mmx_asm}
1007         Use relocation support:   ${enable_binreloc}
1008         Internal Python:          ${with_python}
1009         Internal Perl:            ${with_perl}
1010         Enable LittleCms:         ${enable_lcms}
1011         Enable Inkboard:          ${with_inkboard}
1012         Enable SSL in Inkboard:   ${with_inkboard_ssl}
1013         Enable Poppler-Cairo:     ${enable_poppler_cairo}
1014         ImageMagick Magick++:     ${magick_ok}
1015         Libwpg:                   ${with_libwpg}