Code

Upgrading to trunk
[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.47+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_PROG_LIBTOOL
34 AC_HEADER_STDC
35 INK_BZR_SNAPSHOT_BUILD
37 dnl If automake 1.11 shave the output to look nice
38 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
40 dnl These next few lines are needed only while libcroco is in our source tree.
41 AC_PROG_CC
42 AM_PROG_CC_C_O
43 if test "$GCC" = "yes"; then
44   # Enable some warnings from gcc.
45   AC_LANG_PUSH(C)
47   ####
48   # Generic cpp flags...
50   # What is just plain "-W" ?
51   # Fortify source requires -O2 or higher, which is handled with newer autoconf
52   CPPFLAGS="-W -D_FORTIFY_SOURCE=2 $CPPFLAGS"
53   # Enable format and format security warnings
54   CPPFLAGS="-Wformat -Wformat-security $CPPFLAGS"
55   # Enable all default warnings
56   CPPFLAGS="-Wall $CPPFLAGS"
58   # Test for -Werror=... (introduced some time post-4.0)
59   # If we hit a format error -- it should be fatal.
60   AC_MSG_CHECKING([compiler support for -Werror=format-security])
61   ink_svd_CPPFLAGS="$CPPFLAGS"
62   CPPFLAGS="-Werror=format-security $CPPFLAGS"
63   AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), [ink_opt_ok=yes], [ink_opt_ok=no])
64   AC_MSG_RESULT([$ink_opt_ok])
65   if test "x$ink_opt_ok" != "xyes"; then
66     CPPFLAGS="$ink_svd_CPPFLAGS"
67   fi
69   ####
70   # C-specific flags...
72   # -Wno-pointer-sign is probably new in gcc 4.0; certainly it isn't accepted
73   # by gcc 2.95.
74   AC_MSG_CHECKING([compiler support for -Wno-pointer-sign])
75   ink_svd_CFLAGS="$CFLAGS"
76   CFLAGS="-Wno-pointer-sign $CFLAGS"
77   AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), [ink_opt_ok=yes], [ink_opt_ok=no])
78   AC_MSG_RESULT([$ink_opt_ok])
79   if test "x$ink_opt_ok" != "xyes"; then
80     CFLAGS="$ink_svd_CFLAGS"
81   fi
83   ####
84   # Linker flags...
86   # Have linker produce read-only relocations, if it knows how
87   AC_MSG_CHECKING([linker tolerates -z relro])
88   ink_svd_LDFLAGS="$LDFLAGS"
89   LDFLAGS="-Wl,-z,relro $LDFLAGS"
90   AC_LINK_IFELSE(AC_LANG_PROGRAM([]), [ink_opt_ok=yes], [ink_opt_ok=no])
91   AC_MSG_RESULT([$ink_opt_ok])
92   if test "x$ink_opt_ok" != "xyes"; then
93     LDFLAGS="$ink_svd_LDFLAGS"
94   fi
96   AC_LANG_POP
98   # C++-specific flags are defined further below.  Look for CXXFLAGS...
99 fi
101 dnl Honor aclocal flags
102 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
104 dnl Verify our GCC version
105 if test "x$GXX" = "xyes"; then
106         AC_MSG_CHECKING([GNU compiler version])
108         # Don't pass CXXFLAGS to the following CXX command as some 
109         # of them can't be specified along with '-v'.
110         cc_version=["`$CXX -v 2>&1 </dev/null |grep 'gcc version' |\
111                 sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`"]
113         AC_MSG_RESULT([$cc_version])
115         # Some version numbers
116         cc_vers_major=`echo $cc_version | cut -f1 -d.`
117         cc_vers_minor=`echo $cc_version | cut -f2 -d.`
118         cc_vers_patch=`echo $cc_version | cut -f3 -d.`
119         test -n "$cc_vers_major" || cc_vers_major=0
120         test -n "$cc_vers_minor" || cc_vers_minor=0
121         test -n "$cc_vers_patch" || cc_vers_patch=0
122         cc_vers_all=`expr $cc_vers_major '*' 1000000 + $cc_vers_minor '*' 1000 + $cc_vers_patch`
124         if test $cc_vers_major -lt 3; then
125                 AC_MSG_ERROR([gcc >= 3.0 is needed to compile inkscape])
126         fi
127 fi
129 # Detect a working version of unordered containers.
130 AC_MSG_CHECKING([TR1 unordered_set usability])
131 AC_COMPILE_IFELSE([
132 #include <tr1/unordered_set>
133 int main() {
134   std::tr1::unordered_set<int> i, j;
135   i = j;
136   return 0;
138 ], [unordered_set_works=yes], [unordered_set_works=no])
139 if test "x$unordered_set_works" = "xyes"; then
140         AC_MSG_RESULT([ok])
141         AC_DEFINE(HAVE_TR1_UNORDERED_SET, 1, [Has working standard TR1 unordered_set])
142 else
143         AC_MSG_RESULT([not working])
144 fi
145 AC_CHECK_HEADER([boost/unordered_set.hpp], [AC_DEFINE(HAVE_BOOST_UNORDERED_SET, 1, [Boost unordered_set (Boost >= 1.36)])], [])
146 AC_CHECK_HEADER([ext/hash_set], [AC_DEFINE(HAVE_EXT_HASH_SET, 1, [Legacy GNU ext/hash_set])], [])
148 # Test whether GCC emits a spurious warning when using boost::optional
149 # If yes, turn off strict aliasing warnings to reduce noise
150 # and allow the legitimate warnings to stand out
151 AC_MSG_CHECKING([for overzealous strict aliasing warnings])
152 ignore_strict_aliasing=no
153 CXXFLAGS_SAVE=$CXXFLAGS
154 CXXFLAGS="$CXXFLAGS -Werror=strict-aliasing"
155 AC_COMPILE_IFELSE([
156 #include <boost/optional.hpp>
157 boost::optional<int> x;
158 int func() {
159   return *x;
161 ], [ignore_strict_aliasing=no], [ignore_strict_aliasing=yes])
162 AC_MSG_RESULT($ignore_strict_aliasing)
163 CXXFLAGS=$CXXFLAGS_SAVE
164 if test "x$ignore_strict_aliasing" = "xyes"; then
165   CXXFLAGS="$CXXFLAGS -Wno-strict-aliasing"
166 fi
168 dnl ******************************
169 dnl Gettext stuff
170 dnl ******************************
171 GETTEXT_PACKAGE="AC_PACKAGE_NAME"
172 AC_SUBST(GETTEXT_PACKAGE)
173 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Translation domain used])
174 dnl Add the languages which your application supports here.
175 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 fa 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 te_IN th tr uk vi zh_CN zh_TW"
176 AM_GLIB_GNU_GETTEXT
178 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
179 if test "x$PKG_CONFIG" = "xno"; then
180         AC_MSG_ERROR(You have to install pkg-config to compile inkscape.)
181 fi
183 dnl Find msgfmt.  Without this, po/Makefile fails to set MSGFMT on some platforms.
184 AC_PATH_PROG(MSGFMT, msgfmt, msgfmt)
185 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
187 dnl ******************************
188 dnl Check for OpenMP 
189 dnl Replace this with AC_OPENMP once Autoconf 2.62 is widespread
190 dnl ******************************
191 AX_OPENMP([openmp_ok=yes],[openmp_ok=no])
192 if test "x$openmp_ok" = "xyes"; then
193         dnl We have it, now set up the flags
194         CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
195         AC_CHECK_HEADER(omp.h)
196 fi
198 dnl ******************************
199 dnl Check for libpng 
200 dnl ******************************
201 AC_CHECK_LIB(png, png_read_info, [AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=yes)], png_ok=no, -lz -lm)
202 if test "x$png_ok" != "xyes"; then
203         AC_MSG_ERROR([libpng >= 1.2 is needed to compile inkscape])
204 fi
206 dnl Handle possible dlopen requirement for libgc
207 dnl Isn't this internal to something in autoconf?  Couldn't find it...
208 AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], [AC_CHECK_FUNC([dlopen],
209           [lt_cv_dlopen="dlopen"],
210       [AC_CHECK_LIB([dl], [dlopen],
211             [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
212         [AC_CHECK_LIB([svld], [dlopen],
213               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
214           [AC_CHECK_LIB([dld], [dld_link],
215                 [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
216           ])
217         ])
218       ])
219     ])
221 AC_CHECK_HEADERS([gc.h gc/gc.h],
222                  [
223                     # To test for the different required libs, I have to
224                     # overcome autoconf's caching system, so I change the
225                     # desired function name.  They're all in libgc.
226                     # The "break" will exit from the top level
227                     # AC_CHECK_HEADERS.
228                     gc_libs=""
229                     AC_CHECK_LIB(gc, GC_init,
230                                  [gc_ok=yes;
231                                   LIBS="-lgc $gc_libs $LIBS";
232                                   break], [gc_ok=no], [$gc_libs])
233                     gc_libs="-lpthread"
234                     AC_CHECK_LIB(gc, GC_malloc,
235                                  [gc_ok=yes;
236                                   LIBS="-lgc $gc_libs $LIBS";
237                                   break], [gc_ok=no], [$gc_libs])
238                     gc_libs="$lt_cv_dlopen_libs"
239                     AC_CHECK_LIB(gc, GC_realloc,
240                                  [gc_ok=yes;
241                                   LIBS="-lgc $gc_libs $LIBS";
242                                   break], [gc_ok=no], [$gc_libs])
243                     gc_libs="-lpthread $lt_cv_dlopen_libs"
244                     AC_CHECK_LIB(gc, GC_free,
245                                  [gc_ok=yes;
246                                   LIBS="-lgc $gc_libs $LIBS";
247                                   break], [gc_ok=no], [$gc_libs])
248                     break],
249                  [gc_ok=no])
250 if test "x$gc_ok" = "xyes" && test "x$cross_compiling" = "xno" ; then 
251         AC_MSG_CHECKING([libgc version 6.4+])
252         AC_RUN_IFELSE(
253                 [AC_LANG_SOURCE([[
254                         #ifdef HAVE_GC_GC_H
255                         # include <gc/gc.h>
256                         #else
257                         # include <gc.h>
258                         #endif
259                         #include <stdio.h>
260                         extern unsigned GC_version;
261                         int main(void){
262                                 unsigned min = ((6 << 16) | (4 << 8) | 0);
263                                 printf("%d.%d.%d ",GC_version >> 16, (GC_version >> 8) & 0xFF, GC_version & 0xFF);
264                                 if (GC_version>=min) return 0;
265                                 return 1;
266                         }]])],
267                 [gc_ok=yes],
268                 [gc_ok=no]
269         )
270         AC_MSG_RESULT([$gc_ok])
271 fi
272 if test "x$gc_ok" != "xyes"; then
273         AC_MSG_ERROR([libgc (the Boehm Conservative Collector) 6.4+, is needed to compile inkscape -- http://www.hpl.hp.com/personal/Hans_Boehm/gc])
274 fi
276 dnl This check is to get a FIONREAD definition on Solaris 8
277 AC_CHECK_HEADERS([sys/filio.h])
280 AC_CHECK_HEADERS([malloc.h])
281 AC_CHECK_FUNCS([mallinfo], [
282         AC_CHECK_MEMBERS([struct mallinfo.usmblks,
283                           struct mallinfo.fsmblks,
284                           struct mallinfo.uordblks,
285                           struct mallinfo.fordblks,
286                           struct mallinfo.hblkhd],,,
287                          [#include <malloc.h>])
288 ])
290 AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
291 if test "x$FREETYPE_CONFIG" = "xno"; then
292         AC_MSG_ERROR([Cannot find freetype-config])
293 fi
294 FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
295 FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
296 AC_SUBST(FREETYPE_CFLAGS)
297 AC_SUBST(FREETYPE_LIBS)
299 dnl ******************************
300 dnl Win32
301 dnl ******************************
302 AC_MSG_CHECKING([for Win32 platform])
303 case "$host" in
304   *-*-mingw*)
305     platform_win32=yes
306     WIN32_CFLAGS="-mms-bitfields -DLIBXML_STATIC"
307     ;;
308   *)
309     platform_win32=no
310     ;;
311 esac
312 AC_MSG_RESULT([$platform_win32])
313 AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
314 AC_SUBST(WIN32_CFLAGS)
316 AC_MSG_CHECKING([for Solaris platform])
317 case "$host" in
318   *-solaris2.*)
319     platform_solaris=yes
320     solaris_version=`echo $host|sed -e 's/^.*-solaris2\.//' -e s'/\..*$//'`
321     CFLAGS="$CFLAGS -DSOLARIS=$solaris_version"
322     CXXFLAGS="$CXXFLAGS -DSOLARIS=$solaris_version"
323     ;;
324   *)
325     platform_solaris=no
326     ;;
327 esac
328 AC_MSG_RESULT([$platform_solaris])
329 AM_CONDITIONAL(PLATFORM_SOLARIS, test "$platform_solaris" = "yes")
331 dnl ******************************
332 dnl Xft checking
333 dnl ******************************
335 AC_ARG_WITH(xft,
336             AC_HELP_STRING([--with-xft], [use xft scalable font database (default is auto)]),
337             [with_xft=$withval], [with_xft=auto])
339 if test "x$with_xft" != "xno" ; then
340         dnl Test fontconfig package
341         PKG_CHECK_MODULES(XFT, fontconfig, xft_ok=yes, xft_ok=no)
342         if test "x$xft_ok" != "xyes"; then
343                 dnl test xft package
344                 PKG_CHECK_MODULES(XFT, xft, xft_ok=yes, xft_ok=no)
345                 if test "x$xft_ok" != "xyes"; then
346                         dnl Have to test xft presence
347                         AC_CHECK_HEADER(X11/Xft/Xft.h, xft_ok=yes, xft_ok=no)
348                         if test "x$xft_ok" != "xyes"; then
349                                 dnl No xft found
350                                 if test "x$with_xft" = "xyes"; then
351                                         dnl Xft was explicitly asked, so stop
352                                         AC_MSG_ERROR([--with-xft was specified, but appropriate development packages could not be found])
353                                 fi
354                         else
355                                 dnl Working Xft1
356                                 XFT_LIBS="-L/usr/X11R6/lib -lXft "
357                         fi
358                 fi
359         fi
360 else
361         dnl Asked to ignore xft
362         xft_ok=no
363 fi
365 AC_SUBST(XFT_CFLAGS)
366 AC_SUBST(XFT_LIBS)
368 AM_CONDITIONAL(USE_XFT, test "x$xft_ok" = "xyes")
369 if test "x$xft_ok" = "xyes"; then
370         AC_DEFINE(WITH_XFT, 1, [Use Xft font database])
371 fi
373 dnl ******************************
374 dnl pangoft2 for xft
375 dnl ******************************
377 if test "x$xft_ok" = "xyes"; then
378         PKG_CHECK_MODULES(PANGOFT2, pangoft2, pango_ok=yes, pango_ok=no)
379         if test "x$pango_ok" = "xyes"; then
380                 XFT_LIBS="$XFT_LIBS $PANGOFT2_LIBS"
381         fi
382 fi
385 dnl ******************************
386 dnl gnome vfs checking
387 dnl ******************************
389 AC_ARG_WITH(gnome-vfs,
390         AC_HELP_STRING([--with-gnome-vfs], [use gnome vfs for loading files]),
391         [with_gnome_vfs=$withval], [with_gnome_vfs=auto])
393 if test "x$with_gnome_vfs" = "xno"; then
394         dnl Asked to ignore gnome-vfs
395         gnome_vfs=no
396 else
397         dnl Have to test gnome-vfs presence
398         PKG_CHECK_MODULES(GNOME_VFS, gnome-vfs-2.0 >= 2.0, gnome_vfs=yes, gnome_vfs=no)
399         if test "x$gnome_vfs" != "xyes"; then
400                 dnl No gnome-vfs found
401                 if test "x$with_gnome_vfs" = "xyes"; then
402                         dnl Gnome-VFS was explicitly asked for, so stop
403                         AC_MSG_ERROR([--with-gnome-vfs was specified, but appropriate libgnomevfs development packages could not be found])
404                 else
405                         # gnome-vfs is no, tell us for the log file
406                         AC_MSG_RESULT($gnome_vfs)
407                 fi
408         fi
409 fi
411 AM_CONDITIONAL(USE_GNOME_VFS, test "x$gnome_vfs" = "xyes")
412 if test "x$gnome_vfs" = "xyes"; then
413         AC_DEFINE(WITH_GNOME_VFS, 1, [Use gnome vfs file load functionality])
414 fi
416 AC_SUBST(GNOME_VFS_CFLAGS)
417 AC_SUBST(GNOME_VFS_LIBS)
419 dnl ******************************
420 dnl libinkjar checking
421 dnl ******************************
423 AC_ARG_WITH(inkjar,
424         AC_HELP_STRING([--without-inkjar], [disable openoffice files (SVG jars)]),[with_ij=$withval], [with_ij=yes])
426 if test "x$with_ij" = "xyes"; then
427         AC_DEFINE(WITH_INKJAR, 1, [enable openoffice files (SVG jars)])
428         AC_C_BIGENDIAN
429         AC_CHECK_HEADERS(zlib.h)
430         ij=yes
431 else
432         ij=no
433 fi
434 AM_CONDITIONAL(INKJAR, test "$with_ij" = "yes")
436 ink_spell_pkg=
437 if pkg-config --exists gtkspell-2.0; then
438         ink_spell_pkg=gtkspell-2.0
439         AC_DEFINE(WITH_GTKSPELL, 1, [enable gtk spelling widget])
440 fi
442 dnl ******************************
443 dnl PERL checking
444 dnl ******************************
446 AC_MSG_CHECKING(for Perl development environment)
447 AC_ARG_WITH(perl,
448             AC_HELP_STRING([--with-perl], [use Perl for embedded scripting (EXPERIMENTAL)]),
449             [with_perl=$withval], [with_perl=skipped])
451 if test "x$with_perl" = "xyes"; then
452     checkPERL_CFLAGS=`perl -MExtUtils::Embed -e perl_inc 2>/dev/null`
453     if test "$?" -gt "0"; then
454         with_perl="no"
455     else
456         checkPERL_LIBS=`perl -MExtUtils::Embed -e ldopts 2>/dev/null`
457         if test "$?" -gt "0"; then
458             with_perl="no"
459         else
460             with_perl="yes"
461         fi
462     fi
463 fi
464 AC_MSG_RESULT([$with_perl])
465 if test "x$with_perl" = "xyes"; then
466     # Test that we actually have the perl libraries installed
467     oldCFLAGS="$CFLAGS"
468     oldLIBS="$LIBS"
469     CFLAGS="$CFLAGS $checkPERL_CFLAGS"
470     LIBS="$LIBS $checkPERL_LIBS"
471     AC_CHECK_FUNC([perl_parse],[
472         PERL_CFLAGS="$checkPERL_CFLAGS"
473         PERL_LIBS="$checkPERL_LIBS"
474         AC_DEFINE(WITH_PERL, 1, [use Perl for embedded scripting])
475         ],[
476         with_perl="no"
477         ])
478     CFLAGS="$oldCFLAGS"
479     LIBS="$oldLIBS"
480 fi
481 AM_CONDITIONAL(WITH_PERL, test "x$with_perl" = "xyes")
482 AC_SUBST(PERL_CFLAGS)
483 AC_SUBST(PERL_LIBS)
485 dnl ******************************
486 dnl Python checking
487 dnl ******************************
489 AC_MSG_CHECKING(for Python development environment)
490 AC_ARG_WITH(python,
491             AC_HELP_STRING([--with-python], [use Python for embedded scripting (EXPERIMENTAL)]),
492             [with_python=$withval], [with_python=skipped])
494 if test "x$with_python" = "xyes"; then
495     checkPYTHON_CFLAGS=`python -c "import distutils.sysconfig ; print '-I%s' % distutils.sysconfig.get_config_var('INCLUDEPY')" 2>/dev/null`
496     if test "$?" -gt "0"; then
497         with_python="no"
498     else
499         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`
500         if test "$?" -gt "0"; then
501             with_python="no"
502         else
503             with_python="yes"
504         fi
505     fi
506 fi
507 AC_MSG_RESULT([$with_python])
508 if test "x$with_python" = "xyes"; then
509     # Test that we actually have the python libraries installed
510     oldCFLAGS="$CFLAGS"
511     oldLIBS="$LIBS"
512     CFLAGS="$CFLAGS $checkPYTHON_CFLAGS"
513     LIBS="$LIBS $checkPYTHON_LIBS"
514     AC_CHECK_FUNC([Py_Initialize],[
515         PYTHON_CFLAGS="$checkPYTHON_CFLAGS"
516         PYTHON_LIBS="$checkPYTHON_LIBS"
517         AC_DEFINE(WITH_PYTHON, 1, [use Python for embedded scripting])
518         ],[
519         with_python="no"
520         ])
521     CFLAGS="$oldCFLAGS"
522     LIBS="$oldLIBS"
523 fi
524 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" = "xyes")
525 AC_SUBST(PYTHON_CFLAGS)
526 AC_SUBST(PYTHON_LIBS)
528 dnl ******************************
529 dnl LittleCms checking
530 dnl ******************************
532 AC_ARG_ENABLE(lcms,
533         AC_HELP_STRING([--enable-lcms], [enable LittleCms for color management]),
534         [enable_lcms=$enableval], [enable_lcms=yes])
536 if test "x$enable_lcms" = "xno"; then
537         dnl Asked to ignore LittleCms
538         lcms=no
539 else
540         dnl Have to test LittleCms presence
541         PKG_CHECK_MODULES(LCMS, lcms >= 1.13, lcms=yes, lcms=no)
542         if test "x$lcms" != "xyes"; then
543                 dnl No lcms found
544                 if test "x$enable_lcms" = "xyes"; then
545                         dnl LittleCms was explicitly asked for, so stop
546                         AC_MSG_ERROR([--enable-lcms was specified, but appropriate LittleCms development packages could not be found])
547                 else
548                         # lcms is no, tell us for the log file
549                         AC_MSG_RESULT($lcms)
550                 fi
551         else
552                 dnl Working lcms
553                 LIBS="$LIBS $LCMS_LIBS"
554                 AC_DEFINE(ENABLE_LCMS, 1, [Use LittleCms color management])
555         fi
556 fi
558 AC_SUBST(LCMS_CFLAGS)
559 AC_SUBST(LCMS_LIBS)
561 dnl ******************************
562 dnl Libpoppler checking
563 dnl ******************************
565 AC_ARG_ENABLE(poppler-cairo,
566         AC_HELP_STRING([--enable-poppler-cairo], [Enable libpoppler-cairo for rendering PDF preview]),
567         [enable_poppler_cairo=$enableval], [enable_poppler_cairo=yes])
569 POPPLER_CFLAGS=""
570 PKG_CHECK_MODULES(POPPLER, poppler >= 0.5.9, poppler=yes, poppler=no)
572 if test "x$poppler" = "xyes"; then
573         dnl Working libpoppler
574         dnl Have to test libpoppler-glib presence
575         PKG_CHECK_MODULES(POPPLER_GLIB, poppler-glib >= 0.5.9, poppler_glib=yes, poppler_glib=no)
576         if test "x$poppler_glib" = "xyes"; then
577                 dnl Working libpoppler-glib found
578                 dnl Check whether the Cairo SVG backend is available
579                 PKG_CHECK_MODULES(CAIRO_SVG, cairo-svg, cairo_svg=yes, cairo_svg=no)
580                 if test "x$cairo_svg" = "xyes"; then
581                         POPPLER_LIBS="$POPPLER_LIBS $POPPLER_GLIB_LIBS "
582                 fi
583         fi
584         if test "x$enable_poppler_cairo" = "xyes"; then
585                 dnl Have to test libpoppler-cairo presence for PDF preview
586                 dnl AC_CHECK_HEADER(Magick++.h, magick_ok=yes, magick_ok=no)
587                 PKG_CHECK_MODULES(POPPLER_CAIRO, poppler-cairo >= 0.5.9, poppler_cairo=yes, poppler_cairo=no)
588                 if test "x$poppler_glib" = "xyes" -a "x$poppler_cairo" = "xyes" -a \
589                         "x$cairo_svg" = "xno"
590                 then
591                         POPPLER_LIBS="$POPPLER_LIBS $POPPLER_CAIRO_LIBS "
592                 fi
593         fi
594 fi
596 if test "x$poppler" = "xyes"; then
597         LIBS="$LIBS $POPPLER_LIBS"
598         AC_DEFINE(HAVE_POPPLER, 1, [Use libpoppler for direct PDF import])
599 fi
600 if test "x$poppler_cairo" = "xyes" -a "x$poppler_glib" = "xyes"; then
601         AC_DEFINE(HAVE_POPPLER_CAIRO, 1, [Use libpoppler-cairo for rendering PDF preview])
602 fi
603 if test "x$poppler_glib" = "xyes" -a "x$cairo_svg" = "xyes"; then
604         AC_DEFINE(HAVE_POPPLER_GLIB, 1, [Use libpoppler-glib and Cairo-SVG for PDF import])
605 fi
606 AC_SUBST(POPPLER_CFLAGS)
607 AC_SUBST(POPPLER_LIBS)
609 PKG_CHECK_MODULES(POPPLER_GFXFONT, poppler >= 0.8.3, popplernew=yes, popplernew=no)
610 if test "x$popplernew" = "xyes"; then
611         AC_DEFINE(POPPLER_NEW_GFXFONT, 1, [Use GfxFont from Poppler >= 0.8.3])
612 fi
614 AC_MSG_CHECKING(for new color space API in Poppler)
615 ink_svd_CPPFLAGS=$CPPFLAGS
616 ink_svd_LIBS=$LIBS
617 CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
618 LIBS="$LIBS $POPPLER_LIBS"
619 popplercolor="no"
620 AC_COMPILE_IFELSE([
621 #include <GfxState.h>
623 int main() {
624   typedef GfxColorSpace *(*parse_p)(Object *, Gfx *);
625   parse_p p;
626   p = &GfxColorSpace::parse;
627   return 0;
629 ], [popplercolor=yes])
630 CPPFLAGS=$ink_svd_CPPFLAGS
631 LIBS=$ink_svd_LIBS
633 if test "x$popplercolor" = "xyes"; then
634         AC_DEFINE(POPPLER_NEW_COLOR_SPACE_API, 1, [Use color space API from Poppler >= 0.12.2])
635         AC_MSG_RESULT(yes)
636 else
637         AC_MSG_RESULT(no)
638 fi
640 dnl ******************************
641 dnl Inkboard dependency checking
642 dnl ******************************
644 dnl with_inkboard="no"
645 dnl with_inkboard_ssl="no"
647 dnl INKBOARD_CFLAGS=""
649 dnl AC_ARG_ENABLE(inkboard,
650 dnl             AS_HELP_STRING([--enable-inkboard], [enable Inkboard online whiteboard facility (disabled by default)]),
651 dnl        with_inkboard=$enableval,with_inkboard=no)
653 dnl if test "x$with_inkboard" = "xyes"; then
654 dnl             with_inkboard="yes"
655 dnl             AC_DEFINE(WITH_INKBOARD,1,[Build in Inkboard support])
656                 
657                 dnl Test for OpenSSL
658 dnl             PKG_CHECK_MODULES(INKBOARD, openssl, with_inkboard_ssl=yes, with_inkboard_ssl=no)
659 dnl             if test "x$with_inkboard_ssl" = "xyes"; then
660                         dnl OpenSSL found; enable SSL support in Pedro
661 dnl                     INKBOARD_CFLAGS="$INKBOARD_CFLAGS -DHAVE_SSL"
662 dnl                     RELAYTOOL([ssl], INKBOARD_LIBS, INKBOARD_CFLAGS, [inkboard_weak=yes])
663 dnl                     RELAYTOOL([crypto], INKBOARD_LIBS, INKBOARD_CFLAGS, [inkboard_weak=yes])
664 dnl                     AC_DEFINE(WITH_INKBOARD_SSL,1,[Build in SSL support for Inkboard])
665 dnl             fi
666 dnl else
667 dnl     with_inkboard="no"
668 dnl fi
670 dnl AM_CONDITIONAL(WITH_INKBOARD, test "x$with_inkboard" = "xyes")
672 INKBOARD_CFLAGS=""
673 INKBOARD_LIBS=""
674 AC_SUBST(INKBOARD_LIBS)
675 AC_SUBST(INKBOARD_CFLAGS)
677 dnl ******************************
678 dnl Check for libwpg for extension
679 dnl ******************************
681 PKG_CHECK_MODULES(LIBWPG, libwpg-0.1 libwpg-stream-0.1, with_libwpg=yes, with_libwpg=no)
682 if test "x$with_libwpg" = "xyes"; then
683         AC_DEFINE(WITH_LIBWPG,1,[Build in libwpg])
684 fi
685 AM_CONDITIONAL(WITH_LIBWPG, test "x$with_libwpg" = "xyes")
687 AC_SUBST(LIBWPG_LIBS)
688 AC_SUBST(LIBWPG_CFLAGS)
690 dnl ******************************
691 dnl Support doing a local install
692 dnl   (mostly for distcheck)
693 dnl ******************************
695 with_localinstall="no"
696 AC_ARG_ENABLE(localinstall, AS_HELP_STRING([--enable-localinstall], [install system files in the local path (for distcheck)]), with_localinstall=$enableval, with_localinstall=no)
698 dnl ******************************
699 dnl Check for dbus functionality
700 dnl ******************************
702 AC_ARG_ENABLE(dbusapi,
703        [  --enable-dbusapi       compile with support for DBus interface],
704        enable_dbusapi=$enableval,enable_dbusapi=yes)
705 AC_DEFINE(WITH_DBUS,1,[Build in dbus])
707 if test "x$dbusapi" = "xyes"; then
708         PKG_CHECK_MODULES(DBUS, dbus-glib-1, with_dbus=yes, with_dbus=no)
709         if test "x$with_dbus" = "xyes"; then
710                 if test "x$with_localinstall" = "xyes"; then
711                         DBUSSERVICEDIR="${datadir}/dbus-1/services/"
712                 else
713                         DBUSSERVICEDIR=`$PKG_CONFIG --variable=session_bus_services_dir dbus-1`
714                 fi
715                 AC_SUBST(DBUSSERVICEDIR)
716         fi
718         AC_SUBST(DBUS_LIBS)
719         AC_SUBST(DBUS_CFLAGS)
720 fi
722 AM_CONDITIONAL(WITH_DBUS, test "x$with_dbus" = "xyes")
724 dnl ******************************
725 dnl Check for ImageMagick Magick++ 
726 dnl ******************************
728 PKG_CHECK_MODULES(IMAGEMAGICK, ImageMagick++, magick_ok=yes, magick_ok=no)
729 if test "x$magick_ok" = "xyes"; then
730       AC_DEFINE(WITH_IMAGE_MAGICK,1,[Image Magick++ support for bitmap effects])
731 fi
732 AM_CONDITIONAL(USE_IMAGE_MAGICK, test "x$magick_ok" = "xyes")
734 AC_SUBST(IMAGEMAGICK_LIBS)
735 AC_SUBST(IMAGEMAGICK_CFLAGS)
737 dnl ***********************************************************************************************************
738 dnl Check for a Cairo version that implements user-fonts feature (with a stable API, that is cairo > 1.7.6),
739 dnl so that we conditionally add SVGFonts support
740 dnl ***********************************************************************************************************
742 PKG_CHECK_MODULES(CAIRO_USER_FONTS, cairo > 1.7.6, cairouserfonts=yes, cairouserfonts=no)
743 if test "x$cairouserfonts" = "xyes"; then
744        AC_DEFINE(ENABLE_SVG_FONTS, 1, [SVG Fonts should be used])
745 fi
747 dnl ******************************
748 dnl   Unconditional dependencies
749 dnl ******************************
751 dnl sigc++-2.0 >= 2.0.12: using "visit_each" not available in 2.0.10
752 if test $cc_vers_major -gt 3; then
753   min_sigc_version=2.0.12
754 else
755   min_sigc_version=2.0.11
756 fi
757 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)
759 # Check for Apple Mac OS X Carbon framework
760 carbon_ok=no
761 AC_MSG_CHECKING([for Mac OS X Carbon support])
762 AC_COMPILE_IFELSE([
763 #include <Carbon/Carbon.h>
764 #include <CoreServices/CoreServices.h>
765 ], [carbon_ok=yes])
766 AC_MSG_RESULT($carbon_ok)
767 if test "x$carbon_ok" = "xyes"; then
768   AC_DEFINE(HAVE_CARBON, 1, [define to 1 if Carbon is available])
769   CARBON_LDFLAGS="-framework Carbon"
770   AC_SUBST(CARBON_LDFLAGS)
771 fi
772 AM_CONDITIONAL(HAVE_CARBON, test "x$carbon_ok" = "xyes")
774 # Check for some boost header files
775 AC_CHECK_HEADERS([boost/concept_check.hpp], [], AC_MSG_ERROR([You need the boost package (e.g. libboost-dev)]))
777 PKG_CHECK_MODULES(CAIRO_PDF, cairo-pdf, cairo_pdf=yes, cairo_pdf=no)
778 if test "x$cairo_pdf" = "xyes"; then
779   AC_DEFINE(HAVE_CAIRO_PDF, 1, [Whether the Cairo PDF backend is available])
780 fi
782 dnl Shouldn't we test for libpng and libz?
783 if test "x$openmp_ok" = "xyes"; then
784         INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz -lgomp"
785 else
786         INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz"
787 fi
789 AC_CHECK_HEADER(popt.h,
790                 [INKSCAPE_LIBS="$INKSCAPE_LIBS -lpopt"],
791                 AC_MSG_ERROR([libpopt is required]))
793 dnl **************************
794 dnl Check for aspell 
795 dnl ******************************
796 AC_CHECK_LIB(aspell, new_aspell_config, [AC_CHECK_HEADER(aspell.h, aspell_ok=yes, aspell_ok=no)], aspell_ok=no, -lz -lm)
797 if test "x$aspell_ok" = "xyes"; then
798         AC_DEFINE(HAVE_ASPELL, 1, [Use aspell for built-in spellchecker])
799   INKSCAPE_LIBS="$INKSCAPE_LIBS -laspell"
800 else
801         AC_MSG_CHECKING([Aspell not found, spell checker will be disabled])
802 fi
804 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
805 sp_save_LIBS=$LIBS
806 LIBS="$LIBS $INKSCAPE_LIBS"
807 AC_CHECK_FUNCS(bind_textdomain_codeset)
808 dnl Check for gtk_window_fullscreen in gtk (>= 2.2)
809 AC_CHECK_FUNCS(gtk_window_set_default_icon_from_file)
810 AC_CHECK_FUNCS(gtk_window_fullscreen)
811 LIBS=$sp_save_LIBS
814 dnl Check for binary relocation support
815 dnl Hongli Lai <h.lai@chello.nl>
817 AC_ARG_ENABLE(binreloc,
818        [  --enable-binreloc       compile with binary relocation support],
819        enable_binreloc=$enableval,enable_binreloc=no)
821 AC_MSG_CHECKING(whether binary relocation support should be enabled)
822 if test "$enable_binreloc" = "yes"; then
823        AC_MSG_RESULT(yes)
824        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
825        if test -e /proc/self/maps; then
826                AC_MSG_RESULT(yes)
827        else
828                AC_MSG_RESULT(no)
829                AC_MSG_ERROR(/proc/self/maps is not available. Binary relocation cannot be enabled.)
830                enable_binreloc="no"
831        fi
833 elif test "$enable_binreloc" = "auto"; then
834        AC_MSG_RESULT(yes when available)
835        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
836        if test -e /proc/self/maps; then
837                AC_MSG_RESULT(yes)
838                enable_binreloc=yes
840                AC_MSG_CHECKING(whether everything is installed to the same prefix)
841                if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
842                        "$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
843                        "$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
844                then
845                        AC_MSG_RESULT(yes)
846                else
847                        AC_MSG_RESULT(no)
848                        AC_MSG_NOTICE(Binary relocation support will be disabled.)
849                        enable_binreloc=no
850                fi
852        else
853                AC_MSG_RESULT(no)
854                enable_binreloc=no
855        fi
857 elif test "$enable_binreloc" = "no"; then
858        AC_MSG_RESULT(no)
859 else
860        AC_MSG_RESULT([no (unknown value "$enable_binreloc")])
861        enable_binreloc=no
862 fi
863 AC_DEFINE(BR_PTHREADS,[0],[Use binreloc thread support?])
864 if test "$enable_binreloc" = "yes"; then
865    AC_DEFINE(ENABLE_BINRELOC,,[Use AutoPackage?])
866 fi
868 AC_ARG_ENABLE(osxapp,
869        [  --enable-osxapp         compile with OSX .app data dir paths],
870        enable_osxapp=$enableval,enable_osxapp=no)
871 if test "$enable_osxapp" = "yes"; then
872    AC_DEFINE(ENABLE_OSX_APP_LOCATIONS,,[Build with OSX .app data dir paths?])
873 fi
875 dnl ******************************
876 dnl   Reported by autoscan
877 dnl ******************************
878 AC_CHECK_FUNCS(pow)
879 # if we did not find pow(), see if it's in libm.
880 if test x"$ac_cv_func_pow" = x"no" ; then
881         AC_CHECK_LIB(m,pow)
882 fi
883 AC_CHECK_FUNCS(sqrt)
884 AC_CHECK_FUNCS(floor)
885 AC_CHECK_FUNCS(gettimeofday)
886 AC_CHECK_FUNCS(memmove)
887 AC_CHECK_FUNCS(memset)
888 AC_CHECK_FUNCS(mkdir)
889 AC_CHECK_FUNCS(strncasecmp)
890 AC_CHECK_FUNCS(strpbrk)
891 AC_CHECK_FUNCS(strrchr)
892 AC_CHECK_FUNCS(strspn)
893 AC_CHECK_FUNCS(strstr)
894 AC_CHECK_FUNCS(strtoul)
895 AC_CHECK_FUNCS(fpsetmask)
896 AC_CHECK_FUNCS(ecvt)
897 AC_CHECK_HEADERS(ieeefp.h)
898 AC_CHECK_HEADERS(fcntl.h)
899 AC_CHECK_HEADERS(libintl.h)
900 AC_CHECK_HEADERS(stddef.h)
901 AC_CHECK_HEADERS(sys/time.h)
902 AC_FUNC_STAT
903 AC_FUNC_STRFTIME
904 AC_FUNC_STRTOD
905 AC_HEADER_STAT
906 AC_HEADER_TIME
907 AC_STRUCT_TM
908 AC_TYPE_MODE_T
909 AC_TYPE_SIGNAL
911 dnl Work around broken gcc 3.3 (seen on OSX) where "ENABLE_NLS" isn't
912 dnl set correctly because the gettext function isn't noticed.
913 if test "$ac_cv_header_libintl_h" = "yes" &&
914    test "$ac_cv_func_bind_textdomain_codeset" = "yes"  &&
915    test "$gt_cv_func_have_gettext" != "yes"; then
916     AC_DEFINE(ENABLE_NLS)
917 fi
919 dnl ******************************
920 dnl   Compilation warnings
921 dnl ******************************
922 if test "$GXX" = "yes"; then
923   # Enable some warnings from g++.
925   # Rationale: a number of bugs in inkscape have been fixed by enabling g++
926   # warnings and addressing the produced warnings.  Usually the committing
927   # developer is the best person to address the warnings.
929   ink_svd_CXXFLAGS="$CXXFLAGS"
930   CXXFLAGS="-Wno-unused-parameter $CXXFLAGS"
931   # -Wno-unused-parameter isn't accepted by gcc 2.95.
932   AC_COMPILE_IFELSE([int dummy;
933 ], , CXXFLAGS="-Wno-unused $ink_svd_CXXFLAGS",)
934   # Note: At least one bug has been caught from unused parameter warnings,
935   # so it might be worth trying not to disable it.
936   # One way of selectively disabling the warnings (i.e. only where the
937   # programmer deliberately isn't using the parameter, e.g. for a callback)
938   # is to remove the parameter name (leaving just its type), as is done
939   # in src/seltrans.cpp:sp_seltrans_handle_event; this indicates that the
940   # programmer deliberately has an unused parameter (e.g. because it's used
941   # as a callback or similar function pointer use).
943   # Add even more stuff
944   CXXFLAGS="-Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch $CXXFLAGS"
946 fi
948 dnl ******************************
949 dnl   libinkscape
950 dnl ******************************
951 dnl
952 dnl AC_ARG_ENABLE(libinkscape, AC_HELP_STRING([--enable-libinkscape], [Compile dynamic library (experimental)]), [splib=$enableval], [splib=no])
953 dnl
954 dnl AM_CONDITIONAL(ENABLE_LIBINKSCAPE, test "x$splib" != "xno")
955 dnl
957 AC_SUBST(INKSCAPE_CFLAGS)
958 AC_SUBST(INKSCAPE_LIBS)
960 dnl Define our data paths for config.h
961 AC_DEFINE_DIR([INKSCAPE_DATADIR], [datadir], [Base data directory])
962 AC_DEFINE_DIR([PACKAGE_LOCALE_DIR], [localedir], [Locatization directory])
964 AC_CONFIG_FILES([
965 Makefile
966 src/Makefile
967 src/check-header-compile
968 src/application/makefile
969 src/bind/makefile
970 src/debug/makefile
971 src/dialogs/makefile
972 src/display/makefile
973 src/dom/makefile
974 src/extension/implementation/makefile
975 src/extension/internal/makefile
976 src/extension/makefile
977 src/extension/script/makefile
978 src/extension/dbus/wrapper/inkdbus.pc
979 src/filters/makefile
980 src/helper/makefile
981 src/io/makefile
982 src/libcroco/makefile
983 src/libgdl/makefile
984 src/libnr/makefile
985 src/libnrtype/makefile
986 src/libavoid/makefile
987 src/livarot/makefile
988 src/live_effects/makefile
989 src/live_effects/parameter/makefile
990 src/pedro/makefile
991 src/jabber_whiteboard/makefile
992 src/svg/makefile
993 src/trace/makefile
994 src/ui/cache/makefile
995 src/ui/dialog/makefile
996 src/ui/makefile
997 src/ui/view/makefile
998 src/ui/widget/makefile
999 src/util/makefile
1000 src/widgets/makefile
1001 src/xml/makefile
1002 src/2geom/makefile
1003 doc/Makefile
1004 po/Makefile.in
1005 share/Makefile
1006 share/clipart/Makefile
1007 share/examples/Makefile
1008 share/extensions/Makefile
1009 share/extensions/alphabet_soup/Makefile
1010 share/extensions/Barcode/Makefile
1011 share/extensions/Poly3DObjects/Makefile
1012 share/extensions/test/Makefile
1013 share/extensions/xaml2svg/Makefile
1014 share/filters/Makefile
1015 share/fonts/Makefile
1016 share/gradients/Makefile
1017 share/icons/Makefile
1018 share/icons/application/Makefile
1019 share/icons/application/16x16/Makefile
1020 share/icons/application/22x22/Makefile
1021 share/icons/application/24x24/Makefile
1022 share/icons/application/32x32/Makefile
1023 share/icons/application/48x48/Makefile
1024 share/icons/application/256x256/Makefile
1025 share/keys/Makefile
1026 share/markers/Makefile
1027 share/palettes/Makefile
1028 share/patterns/Makefile
1029 share/screens/Makefile
1030 share/templates/Makefile
1031 share/tutorials/Makefile
1032 share/ui/Makefile
1033 packaging/autopackage/default.apspec
1034 inkscape.spec
1035 Info.plist
1036 inkview.1
1037 ])
1039 AH_BOTTOM([
1042 ])
1044 AC_OUTPUT
1046 echo "
1047 Configuration:
1049         Source code location:     ${srcdir}
1050         Destination path prefix:  ${prefix}
1051         Compiler:                 ${CXX}
1052         CPPFLAGS:                 ${CPPFLAGS}
1053         CXXFLAGS:                 ${CXXFLAGS}
1054         CFLAGS:                   ${CFLAGS}
1055         LDFLAGS:                  ${LDFLAGS}
1057         Use Xft font database:    ${xft_ok}
1058         Use gnome-vfs:            ${gnome_vfs}
1059         Use openoffice files:     ${ij}
1060         Use relocation support:   ${enable_binreloc}
1061         Internal Python:          ${with_python}
1062         Internal Perl:            ${with_perl}
1063         Enable LittleCms:         ${enable_lcms}
1064         Enable DBUS               ${with_dbus} 
1065         Enable Poppler-Cairo:     ${enable_poppler_cairo}
1066         ImageMagick Magick++:     ${magick_ok}
1067         Libwpg:                   ${with_libwpg}
1068         Doing Local Install:      ${with_localinstall}