Code

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