Code

Move around files to remove some vanity directories.
[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 # Detect a working version of unordered containers.
129 AC_MSG_CHECKING([TR1 unordered_set usability])
130 AC_COMPILE_IFELSE([
131 #include <tr1/unordered_set>
132 int main() {
133   std::tr1::unordered_set<int> i, j;
134   i = j;
135   return 0;
137 ], [unordered_set_works=yes], [unordered_set_works=no])
138 if test "x$unordered_set_works" = "xyes"; then
139         AC_MSG_RESULT([ok])
140         AC_DEFINE(HAVE_TR1_UNORDERED_SET, 1, [Has working standard TR1 unordered_set])
141 else
142         AC_MSG_RESULT([not working])
143 fi
144 AC_CHECK_HEADER([boost/unordered_set.hpp], [AC_DEFINE(HAVE_BOOST_UNORDERED_SET, 1, [Boost unordered_set (Boost >= 1.36)])], [])
145 AC_CHECK_HEADER([ext/hash_set], [AC_DEFINE(HAVE_EXT_HASH_SET, 1, [Legacy GNU ext/hash_set])], [])
147 # Test whether GCC emits a spurious warning when using boost::optional
148 # If yes, turn off strict aliasing warnings to reduce noise
149 # and allow the legitimate warnings to stand out
150 AC_MSG_CHECKING([for overzealous strict aliasing warnings])
151 ignore_strict_aliasing=no
152 CXXFLAGS_SAVE=$CXXFLAGS
153 CXXFLAGS="$CXXFLAGS -Werror=strict-aliasing"
154 AC_COMPILE_IFELSE([
155 #include <boost/optional.hpp>
156 boost::optional<int> x;
157 int func() {
158   return *x;
160 ], [ignore_strict_aliasing=no], [ignore_strict_aliasing=yes])
161 AC_MSG_RESULT($ignore_strict_aliasing)
162 CXXFLAGS=$CXXFLAGS_SAVE
163 if test "x$ignore_strict_aliasing" = "xyes"; then
164   CXXFLAGS="$CXXFLAGS -Wno-strict-aliasing"
165 fi
167 dnl ******************************
168 dnl Gettext stuff
169 dnl ******************************
170 GETTEXT_PACKAGE="AC_PACKAGE_NAME"
171 AC_SUBST(GETTEXT_PACKAGE)
172 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Translation domain used])
173 dnl Add the languages which your application supports here.
174 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"
175 AM_GLIB_GNU_GETTEXT
177 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
178 if test "x$PKG_CONFIG" = "xno"; then
179         AC_MSG_ERROR(You have to install pkg-config to compile inkscape.)
180 fi
182 dnl Find msgfmt.  Without this, po/Makefile fails to set MSGFMT on some platforms.
183 AC_PATH_PROG(MSGFMT, msgfmt, msgfmt)
184 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
186 dnl ******************************
187 dnl Check for OpenMP 
188 dnl Replace this with AC_OPENMP once Autoconf 2.62 is widespread
189 dnl ******************************
190 AX_OPENMP([openmp_ok=yes],[openmp_ok=no])
191 if test "x$openmp_ok" = "xyes"; then
192         dnl We have it, now set up the flags
193         CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
194         AC_CHECK_HEADER(omp.h)
195 fi
197 dnl ******************************
198 dnl Check for libpng 
199 dnl ******************************
200 AC_CHECK_LIB(png, png_read_info, [AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=yes)], png_ok=no, -lz -lm)
201 if test "x$png_ok" != "xyes"; then
202         AC_MSG_ERROR([libpng >= 1.2 is needed to compile inkscape])
203 fi
205 dnl Handle possible dlopen requirement for libgc
206 dnl Isn't this internal to something in autoconf?  Couldn't find it...
207 AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], [AC_CHECK_FUNC([dlopen],
208           [lt_cv_dlopen="dlopen"],
209       [AC_CHECK_LIB([dl], [dlopen],
210             [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
211         [AC_CHECK_LIB([svld], [dlopen],
212               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
213           [AC_CHECK_LIB([dld], [dld_link],
214                 [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
215           ])
216         ])
217       ])
218     ])
220 AC_CHECK_HEADERS([gc.h gc/gc.h],
221                  [
222                     # To test for the different required libs, I have to
223                     # overcome autoconf's caching system, so I change the
224                     # desired function name.  They're all in libgc.
225                     # The "break" will exit from the top level
226                     # AC_CHECK_HEADERS.
227                     gc_libs=""
228                     AC_CHECK_LIB(gc, GC_init,
229                                  [gc_ok=yes;
230                                   LIBS="-lgc $gc_libs $LIBS";
231                                   break], [gc_ok=no], [$gc_libs])
232                     gc_libs="-lpthread"
233                     AC_CHECK_LIB(gc, GC_malloc,
234                                  [gc_ok=yes;
235                                   LIBS="-lgc $gc_libs $LIBS";
236                                   break], [gc_ok=no], [$gc_libs])
237                     gc_libs="$lt_cv_dlopen_libs"
238                     AC_CHECK_LIB(gc, GC_realloc,
239                                  [gc_ok=yes;
240                                   LIBS="-lgc $gc_libs $LIBS";
241                                   break], [gc_ok=no], [$gc_libs])
242                     gc_libs="-lpthread $lt_cv_dlopen_libs"
243                     AC_CHECK_LIB(gc, GC_free,
244                                  [gc_ok=yes;
245                                   LIBS="-lgc $gc_libs $LIBS";
246                                   break], [gc_ok=no], [$gc_libs])
247                     break],
248                  [gc_ok=no])
249 if test "x$gc_ok" = "xyes" && test "x$cross_compiling" = "xno" ; then 
250         AC_MSG_CHECKING([libgc version 6.4+])
251         AC_RUN_IFELSE(
252                 [AC_LANG_SOURCE([[
253                         #ifdef HAVE_GC_GC_H
254                         # include <gc/gc.h>
255                         #else
256                         # include <gc.h>
257                         #endif
258                         #include <stdio.h>
259                         extern unsigned GC_version;
260                         int main(void){
261                                 unsigned min = ((6 << 16) | (4 << 8) | 0);
262                                 printf("%d.%d.%d ",GC_version >> 16, (GC_version >> 8) & 0xFF, GC_version & 0xFF);
263                                 if (GC_version>=min) return 0;
264                                 return 1;
265                         }]])],
266                 [gc_ok=yes],
267                 [gc_ok=no]
268         )
269         AC_MSG_RESULT([$gc_ok])
270 fi
271 if test "x$gc_ok" != "xyes"; then
272         AC_MSG_ERROR([libgc (the Boehm Conservative Collector) 6.4+, is needed to compile inkscape -- http://www.hpl.hp.com/personal/Hans_Boehm/gc])
273 fi
275 dnl This check is to get a FIONREAD definition on Solaris 8
276 AC_CHECK_HEADERS([sys/filio.h])
279 AC_CHECK_HEADERS([malloc.h])
280 AC_CHECK_FUNCS([mallinfo], [
281         AC_CHECK_MEMBERS([struct mallinfo.usmblks,
282                           struct mallinfo.fsmblks,
283                           struct mallinfo.uordblks,
284                           struct mallinfo.fordblks,
285                           struct mallinfo.hblkhd],,,
286                          [#include <malloc.h>])
287 ])
289 AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
290 if test "x$FREETYPE_CONFIG" = "xno"; then
291         AC_MSG_ERROR([Cannot find freetype-config])
292 fi
293 FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
294 FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
295 AC_SUBST(FREETYPE_CFLAGS)
296 AC_SUBST(FREETYPE_LIBS)
298 dnl ******************************
299 dnl Win32
300 dnl ******************************
301 AC_MSG_CHECKING([for Win32 platform])
302 case "$host" in
303   *-*-mingw*)
304     platform_win32=yes
305     WIN32_CFLAGS="-mms-bitfields -DLIBXML_STATIC"
306     ;;
307   *)
308     platform_win32=no
309     ;;
310 esac
311 AC_MSG_RESULT([$platform_win32])
312 AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
313 AC_SUBST(WIN32_CFLAGS)
315 AC_MSG_CHECKING([for Solaris platform])
316 case "$host" in
317   *-solaris2.*)
318     platform_solaris=yes
319     solaris_version=`echo $host|sed -e 's/^.*-solaris2\.//' -e s'/\..*$//'`
320     CFLAGS="$CFLAGS -DSOLARIS=$solaris_version"
321     CXXFLAGS="$CXXFLAGS -DSOLARIS=$solaris_version"
322     ;;
323   *)
324     platform_solaris=no
325     ;;
326 esac
327 AC_MSG_RESULT([$platform_solaris])
328 AM_CONDITIONAL(PLATFORM_SOLARIS, test "$platform_solaris" = "yes")
330 dnl ******************************
331 dnl Xft checking
332 dnl ******************************
334 AC_ARG_WITH(xft,
335             AC_HELP_STRING([--with-xft], [use xft scalable font database (default is auto)]),
336             [with_xft=$withval], [with_xft=auto])
338 if test "x$with_xft" != "xno" ; then
339         dnl Test fontconfig package
340         PKG_CHECK_MODULES(XFT, fontconfig, xft_ok=yes, xft_ok=no)
341         if test "x$xft_ok" != "xyes"; then
342                 dnl test xft package
343                 PKG_CHECK_MODULES(XFT, xft, xft_ok=yes, xft_ok=no)
344                 if test "x$xft_ok" != "xyes"; then
345                         dnl Have to test xft presence
346                         AC_CHECK_HEADER(X11/Xft/Xft.h, xft_ok=yes, xft_ok=no)
347                         if test "x$xft_ok" != "xyes"; then
348                                 dnl No xft found
349                                 if test "x$with_xft" = "xyes"; then
350                                         dnl Xft was explicitly asked, so stop
351                                         AC_MSG_ERROR([--with-xft was specified, but appropriate development packages could not be found])
352                                 fi
353                         else
354                                 dnl Working Xft1
355                                 XFT_LIBS="-L/usr/X11R6/lib -lXft "
356                         fi
357                 fi
358         fi
359 else
360         dnl Asked to ignore xft
361         xft_ok=no
362 fi
364 AC_SUBST(XFT_CFLAGS)
365 AC_SUBST(XFT_LIBS)
367 AM_CONDITIONAL(USE_XFT, test "x$xft_ok" = "xyes")
368 if test "x$xft_ok" = "xyes"; then
369         AC_DEFINE(WITH_XFT, 1, [Use Xft font database])
370 fi
372 dnl ******************************
373 dnl pangoft2 for xft
374 dnl ******************************
376 if test "x$xft_ok" = "xyes"; then
377         PKG_CHECK_MODULES(PANGOFT2, pangoft2, pango_ok=yes, pango_ok=no)
378         if test "x$pango_ok" = "xyes"; then
379                 XFT_LIBS="$XFT_LIBS $PANGOFT2_LIBS"
380         fi
381 fi
384 dnl ******************************
385 dnl gnome vfs checking
386 dnl ******************************
388 AC_ARG_WITH(gnome-vfs,
389         AC_HELP_STRING([--with-gnome-vfs], [use gnome vfs for loading files]),
390         [with_gnome_vfs=$withval], [with_gnome_vfs=auto])
392 if test "x$with_gnome_vfs" = "xno"; then
393         dnl Asked to ignore gnome-vfs
394         gnome_vfs=no
395 else
396         dnl Have to test gnome-vfs presence
397         PKG_CHECK_MODULES(GNOME_VFS, gnome-vfs-2.0 >= 2.0, gnome_vfs=yes, gnome_vfs=no)
398         if test "x$gnome_vfs" != "xyes"; then
399                 dnl No gnome-vfs found
400                 if test "x$with_gnome_vfs" = "xyes"; then
401                         dnl Gnome-VFS was explicitly asked for, so stop
402                         AC_MSG_ERROR([--with-gnome-vfs was specified, but appropriate libgnomevfs development packages could not be found])
403                 else
404                         # gnome-vfs is no, tell us for the log file
405                         AC_MSG_RESULT($gnome_vfs)
406                 fi
407         fi
408 fi
410 AM_CONDITIONAL(USE_GNOME_VFS, test "x$gnome_vfs" = "xyes")
411 if test "x$gnome_vfs" = "xyes"; then
412         AC_DEFINE(WITH_GNOME_VFS, 1, [Use gnome vfs file load functionality])
413 fi
415 AC_SUBST(GNOME_VFS_CFLAGS)
416 AC_SUBST(GNOME_VFS_LIBS)
418 dnl ******************************
419 dnl libinkjar checking
420 dnl ******************************
422 AC_ARG_WITH(inkjar,
423         AC_HELP_STRING([--without-inkjar], [disable openoffice files (SVG jars)]),[with_ij=$withval], [with_ij=yes])
425 if test "x$with_ij" = "xyes"; then
426         AC_DEFINE(WITH_INKJAR, 1, [enable openoffice files (SVG jars)])
427         AC_C_BIGENDIAN
428         AC_CHECK_HEADERS(zlib.h)
429         ij=yes
430 else
431         ij=no
432 fi
433 AM_CONDITIONAL(INKJAR, test "$with_ij" = "yes")
435 ink_spell_pkg=
436 if pkg-config --exists gtkspell-2.0; then
437         ink_spell_pkg=gtkspell-2.0
438         AC_DEFINE(WITH_GTKSPELL, 1, [enable gtk spelling widget])
439 fi
441 dnl ******************************
442 dnl PERL checking
443 dnl ******************************
445 AC_MSG_CHECKING(for Perl development environment)
446 AC_ARG_WITH(perl,
447             AC_HELP_STRING([--with-perl], [use Perl for embedded scripting (EXPERIMENTAL)]),
448             [with_perl=$withval], [with_perl=skipped])
450 if test "x$with_perl" = "xyes"; then
451     checkPERL_CFLAGS=`perl -MExtUtils::Embed -e perl_inc 2>/dev/null`
452     if test "$?" -gt "0"; then
453         with_perl="no"
454     else
455         checkPERL_LIBS=`perl -MExtUtils::Embed -e ldopts 2>/dev/null`
456         if test "$?" -gt "0"; then
457             with_perl="no"
458         else
459             with_perl="yes"
460         fi
461     fi
462 fi
463 AC_MSG_RESULT([$with_perl])
464 if test "x$with_perl" = "xyes"; then
465     # Test that we actually have the perl libraries installed
466     oldCFLAGS="$CFLAGS"
467     oldLIBS="$LIBS"
468     CFLAGS="$CFLAGS $checkPERL_CFLAGS"
469     LIBS="$LIBS $checkPERL_LIBS"
470     AC_CHECK_FUNC([perl_parse],[
471         PERL_CFLAGS="$checkPERL_CFLAGS"
472         PERL_LIBS="$checkPERL_LIBS"
473         AC_DEFINE(WITH_PERL, 1, [use Perl for embedded scripting])
474         ],[
475         with_perl="no"
476         ])
477     CFLAGS="$oldCFLAGS"
478     LIBS="$oldLIBS"
479 fi
480 AM_CONDITIONAL(WITH_PERL, test "x$with_perl" = "xyes")
481 AC_SUBST(PERL_CFLAGS)
482 AC_SUBST(PERL_LIBS)
484 dnl ******************************
485 dnl Python checking
486 dnl ******************************
488 AC_MSG_CHECKING(for Python development environment)
489 AC_ARG_WITH(python,
490             AC_HELP_STRING([--with-python], [use Python for embedded scripting (EXPERIMENTAL)]),
491             [with_python=$withval], [with_python=skipped])
493 if test "x$with_python" = "xyes"; then
494     checkPYTHON_CFLAGS=`python -c "import distutils.sysconfig ; print '-I%s' % distutils.sysconfig.get_config_var('INCLUDEPY')" 2>/dev/null`
495     if test "$?" -gt "0"; then
496         with_python="no"
497     else
498         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`
499         if test "$?" -gt "0"; then
500             with_python="no"
501         else
502             with_python="yes"
503         fi
504     fi
505 fi
506 AC_MSG_RESULT([$with_python])
507 if test "x$with_python" = "xyes"; then
508     # Test that we actually have the python libraries installed
509     oldCFLAGS="$CFLAGS"
510     oldLIBS="$LIBS"
511     CFLAGS="$CFLAGS $checkPYTHON_CFLAGS"
512     LIBS="$LIBS $checkPYTHON_LIBS"
513     AC_CHECK_FUNC([Py_Initialize],[
514         PYTHON_CFLAGS="$checkPYTHON_CFLAGS"
515         PYTHON_LIBS="$checkPYTHON_LIBS"
516         AC_DEFINE(WITH_PYTHON, 1, [use Python for embedded scripting])
517         ],[
518         with_python="no"
519         ])
520     CFLAGS="$oldCFLAGS"
521     LIBS="$oldLIBS"
522 fi
523 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" = "xyes")
524 AC_SUBST(PYTHON_CFLAGS)
525 AC_SUBST(PYTHON_LIBS)
527 dnl ******************************
528 dnl LittleCms checking
529 dnl ******************************
531 AC_ARG_ENABLE(lcms,
532         AC_HELP_STRING([--enable-lcms], [enable LittleCms for color management]),
533         [enable_lcms=$enableval], [enable_lcms=yes])
535 if test "x$enable_lcms" = "xno"; then
536         dnl Asked to ignore LittleCms
537         lcms=no
538 else
539         dnl Have to test LittleCms presence
540         PKG_CHECK_MODULES(LCMS, lcms >= 1.13, lcms=yes, lcms=no)
541         if test "x$lcms" != "xyes"; then
542                 dnl No lcms found
543                 if test "x$enable_lcms" = "xyes"; then
544                         dnl LittleCms was explicitly asked for, so stop
545                         AC_MSG_ERROR([--enable-lcms was specified, but appropriate LittleCms development packages could not be found])
546                 else
547                         # lcms is no, tell us for the log file
548                         AC_MSG_RESULT($lcms)
549                 fi
550         else
551                 dnl Working lcms
552                 LIBS="$LIBS $LCMS_LIBS"
553                 AC_DEFINE(ENABLE_LCMS, 1, [Use LittleCms color management])
554         fi
555 fi
557 AC_SUBST(LCMS_CFLAGS)
558 AC_SUBST(LCMS_LIBS)
560 dnl ******************************
561 dnl Libpoppler checking
562 dnl ******************************
564 AC_ARG_ENABLE(poppler-cairo,
565         AC_HELP_STRING([--enable-poppler-cairo], [Enable libpoppler-cairo for rendering PDF preview]),
566         [enable_poppler_cairo=$enableval], [enable_poppler_cairo=yes])
568 POPPLER_CFLAGS=""
569 PKG_CHECK_MODULES(POPPLER, poppler >= 0.5.9, poppler=yes, poppler=no)
571 if test "x$poppler" = "xyes"; then
572         dnl Working libpoppler
573         POPPLER_LIBS="-lpoppler "
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 -lpoppler-glib "
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 -lpoppler-glib "
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(POPPLERNEW, poppler >= 0.8.3, popplernew=yes, popplernew=no)
610 if test "x$popplernew" = "xyes"; then
611         AC_DEFINE(POPPLER_NEW_GFXFONT, 1, [Poppler version of GfxFont to use (0.8.3 or higher versions of Poppler)])
612 fi
614 dnl ******************************
615 dnl Inkboard dependency checking
616 dnl ******************************
618 dnl with_inkboard="no"
619 dnl with_inkboard_ssl="no"
621 dnl INKBOARD_CFLAGS=""
623 dnl AC_ARG_ENABLE(inkboard,
624 dnl             AS_HELP_STRING([--enable-inkboard], [enable Inkboard online whiteboard facility (disabled by default)]),
625 dnl        with_inkboard=$enableval,with_inkboard=no)
627 dnl if test "x$with_inkboard" = "xyes"; then
628 dnl             with_inkboard="yes"
629 dnl             AC_DEFINE(WITH_INKBOARD,1,[Build in Inkboard support])
630                 
631                 dnl Test for OpenSSL
632 dnl             PKG_CHECK_MODULES(INKBOARD, openssl, with_inkboard_ssl=yes, with_inkboard_ssl=no)
633 dnl             if test "x$with_inkboard_ssl" = "xyes"; then
634                         dnl OpenSSL found; enable SSL support in Pedro
635 dnl                     INKBOARD_CFLAGS="$INKBOARD_CFLAGS -DHAVE_SSL"
636 dnl                     RELAYTOOL([ssl], INKBOARD_LIBS, INKBOARD_CFLAGS, [inkboard_weak=yes])
637 dnl                     RELAYTOOL([crypto], INKBOARD_LIBS, INKBOARD_CFLAGS, [inkboard_weak=yes])
638 dnl                     AC_DEFINE(WITH_INKBOARD_SSL,1,[Build in SSL support for Inkboard])
639 dnl             fi
640 dnl else
641 dnl     with_inkboard="no"
642 dnl fi
644 dnl AM_CONDITIONAL(WITH_INKBOARD, test "x$with_inkboard" = "xyes")
646 INKBOARD_CFLAGS=""
647 INKBOARD_LIBS=""
648 AC_SUBST(INKBOARD_LIBS)
649 AC_SUBST(INKBOARD_CFLAGS)
651 dnl ******************************
652 dnl Check for libwpg for extension
653 dnl ******************************
655 PKG_CHECK_MODULES(LIBWPG, libwpg-0.1 libwpg-stream-0.1, with_libwpg=yes, with_libwpg=no)
656 if test "x$with_libwpg" = "xyes"; then
657         AC_DEFINE(WITH_LIBWPG,1,[Build in libwpg])
658 fi
659 AM_CONDITIONAL(WITH_LIBWPG, test "x$with_libwpg" = "xyes")
661 AC_SUBST(LIBWPG_LIBS)
662 AC_SUBST(LIBWPG_CFLAGS)
664 dnl ******************************
665 dnl Check for ImageMagick Magick++ 
666 dnl ******************************
668 PKG_CHECK_MODULES(IMAGEMAGICK, ImageMagick++, magick_ok=yes, magick_ok=no)
669 if test "x$magick_ok" = "xyes"; then
670       AC_DEFINE(WITH_IMAGE_MAGICK,1,[Image Magick++ support for bitmap effects])
671 fi
672 AM_CONDITIONAL(USE_IMAGE_MAGICK, test "x$magick_ok" = "xyes")
674 AC_SUBST(IMAGEMAGICK_LIBS)
675 AC_SUBST(IMAGEMAGICK_CFLAGS)
677 dnl ***********************************************************************************************************
678 dnl Check for a Cairo version that implements user-fonts feature (with a stable API, that is cairo > 1.7.6),
679 dnl so that we conditionally add SVGFonts support
680 dnl ***********************************************************************************************************
682 PKG_CHECK_MODULES(CAIRO_USER_FONTS, cairo > 1.7.6, cairouserfonts=yes, cairouserfonts=no)
683 if test "x$cairouserfonts" = "xyes"; then
684        AC_DEFINE(ENABLE_SVG_FONTS, 1, [SVG Fonts should be used])
685 fi
687 dnl ******************************
688 dnl   Unconditional dependencies
689 dnl ******************************
691 dnl sigc++-2.0 >= 2.0.12: using "visit_each" not available in 2.0.10
692 if test $cc_vers_major -gt 3; then
693   min_sigc_version=2.0.12
694 else
695   min_sigc_version=2.0.11
696 fi
697 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)
699 # Check for Apple Mac OS X Carbon framework
700 carbon_ok=no
701 AC_MSG_CHECKING([for Mac OS X Carbon support])
702 AC_COMPILE_IFELSE([
703 #include <Carbon/Carbon.h>
704 #include <CoreServices/CoreServices.h>
705 ], [carbon_ok=yes])
706 AC_MSG_RESULT($carbon_ok)
707 if test "x$carbon_ok" = "xyes"; then
708   AC_DEFINE(HAVE_CARBON, 1, [define to 1 if Carbon is available])
709   CARBON_LDFLAGS="-framework Carbon"
710   AC_SUBST(CARBON_LDFLAGS)
711 fi
712 AM_CONDITIONAL(HAVE_CARBON, test "x$carbon_ok" = "xyes")
714 # Check for some boost header files
715 AC_CHECK_HEADERS([boost/concept_check.hpp], [], AC_MSG_ERROR([You need the boost package (e.g. libboost-dev)]))
717 PKG_CHECK_MODULES(CAIRO_PDF, cairo-pdf, cairo_pdf=yes, cairo_pdf=no)
718 if test "x$cairo_pdf" = "xyes"; then
719   AC_DEFINE(HAVE_CAIRO_PDF, 1, [Whether the Cairo PDF backend is available])
720 fi
722 dnl Shouldn't we test for libpng and libz?
723 if test "x$openmp_ok" = "xyes"; then
724         INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz -lgomp"
725 else
726         INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz"
727 fi
729 AC_CHECK_HEADER(popt.h,
730                 [INKSCAPE_LIBS="$INKSCAPE_LIBS -lpopt"],
731                 AC_MSG_ERROR([libpopt is required]))
733 dnl **************************
734 dnl Check for aspell 
735 dnl ******************************
736 AC_CHECK_LIB(aspell, new_aspell_config, [AC_CHECK_HEADER(aspell.h, aspell_ok=yes, aspell_ok=no)], aspell_ok=no, -lz -lm)
737 if test "x$aspell_ok" = "xyes"; then
738         AC_DEFINE(HAVE_ASPELL, 1, [Use aspell for built-in spellchecker])
739   INKSCAPE_LIBS="$INKSCAPE_LIBS -laspell"
740 else
741         AC_MSG_CHECKING([Aspell not found, spell checker will be disabled])
742 fi
744 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
745 sp_save_LIBS=$LIBS
746 LIBS="$LIBS $INKSCAPE_LIBS"
747 AC_CHECK_FUNCS(bind_textdomain_codeset)
748 dnl Check for gtk_window_fullscreen in gtk (>= 2.2)
749 AC_CHECK_FUNCS(gtk_window_set_default_icon_from_file)
750 AC_CHECK_FUNCS(gtk_window_fullscreen)
751 LIBS=$sp_save_LIBS
754 dnl Check for binary relocation support
755 dnl Hongli Lai <h.lai@chello.nl>
757 AC_ARG_ENABLE(binreloc,
758        [  --enable-binreloc       compile with binary relocation support],
759        enable_binreloc=$enableval,enable_binreloc=no)
761 AC_MSG_CHECKING(whether binary relocation support should be enabled)
762 if test "$enable_binreloc" = "yes"; then
763        AC_MSG_RESULT(yes)
764        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
765        if test -e /proc/self/maps; then
766                AC_MSG_RESULT(yes)
767        else
768                AC_MSG_RESULT(no)
769                AC_MSG_ERROR(/proc/self/maps is not available. Binary relocation cannot be enabled.)
770                enable_binreloc="no"
771        fi
773 elif test "$enable_binreloc" = "auto"; then
774        AC_MSG_RESULT(yes when available)
775        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
776        if test -e /proc/self/maps; then
777                AC_MSG_RESULT(yes)
778                enable_binreloc=yes
780                AC_MSG_CHECKING(whether everything is installed to the same prefix)
781                if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
782                        "$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
783                        "$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
784                then
785                        AC_MSG_RESULT(yes)
786                else
787                        AC_MSG_RESULT(no)
788                        AC_MSG_NOTICE(Binary relocation support will be disabled.)
789                        enable_binreloc=no
790                fi
792        else
793                AC_MSG_RESULT(no)
794                enable_binreloc=no
795        fi
797 elif test "$enable_binreloc" = "no"; then
798        AC_MSG_RESULT(no)
799 else
800        AC_MSG_RESULT([no (unknown value "$enable_binreloc")])
801        enable_binreloc=no
802 fi
803 AC_DEFINE(BR_PTHREADS,[0],[Use binreloc thread support?])
804 if test "$enable_binreloc" = "yes"; then
805    AC_DEFINE(ENABLE_BINRELOC,,[Use AutoPackage?])
806 fi
808 AC_ARG_ENABLE(osxapp,
809        [  --enable-osxapp         compile with OSX .app data dir paths],
810        enable_osxapp=$enableval,enable_osxapp=no)
811 if test "$enable_osxapp" = "yes"; then
812    AC_DEFINE(ENABLE_OSX_APP_LOCATIONS,,[Build with OSX .app data dir paths?])
813 fi
815 dnl ******************************
816 dnl   Reported by autoscan
817 dnl ******************************
818 AC_CHECK_FUNCS(pow)
819 # if we did not find pow(), see if it's in libm.
820 if test x"$ac_cv_func_pow" = x"no" ; then
821         AC_CHECK_LIB(m,pow)
822 fi
823 AC_CHECK_FUNCS(sqrt)
824 AC_CHECK_FUNCS(floor)
825 AC_CHECK_FUNCS(gettimeofday)
826 AC_CHECK_FUNCS(memmove)
827 AC_CHECK_FUNCS(memset)
828 AC_CHECK_FUNCS(mkdir)
829 AC_CHECK_FUNCS(strncasecmp)
830 AC_CHECK_FUNCS(strpbrk)
831 AC_CHECK_FUNCS(strrchr)
832 AC_CHECK_FUNCS(strspn)
833 AC_CHECK_FUNCS(strstr)
834 AC_CHECK_FUNCS(strtoul)
835 AC_CHECK_FUNCS(fpsetmask)
836 AC_CHECK_FUNCS(ecvt)
837 AC_CHECK_HEADERS(ieeefp.h)
838 AC_CHECK_HEADERS(fcntl.h)
839 AC_CHECK_HEADERS(libintl.h)
840 AC_CHECK_HEADERS(stddef.h)
841 AC_CHECK_HEADERS(sys/time.h)
842 AC_FUNC_STAT
843 AC_FUNC_STRFTIME
844 AC_FUNC_STRTOD
845 AC_HEADER_STAT
846 AC_HEADER_TIME
847 AC_STRUCT_TM
848 AC_TYPE_MODE_T
849 AC_TYPE_SIGNAL
851 dnl Work around broken gcc 3.3 (seen on OSX) where "ENABLE_NLS" isn't
852 dnl set correctly because the gettext function isn't noticed.
853 if test "$ac_cv_header_libintl_h" = "yes" &&
854    test "$ac_cv_func_bind_textdomain_codeset" = "yes"  &&
855    test "$gt_cv_func_have_gettext" != "yes"; then
856     AC_DEFINE(ENABLE_NLS)
857 fi
859 dnl ******************************
860 dnl   Compilation warnings
861 dnl ******************************
862 if test "$GXX" = "yes"; then
863   # Enable some warnings from g++.
865   # Rationale: a number of bugs in inkscape have been fixed by enabling g++
866   # warnings and addressing the produced warnings.  Usually the committing
867   # developer is the best person to address the warnings.
869   ink_svd_CXXFLAGS="$CXXFLAGS"
870   CXXFLAGS="-Wno-unused-parameter $CXXFLAGS"
871   # -Wno-unused-parameter isn't accepted by gcc 2.95.
872   AC_COMPILE_IFELSE([int dummy;
873 ], , CXXFLAGS="-Wno-unused $ink_svd_CXXFLAGS",)
874   # Note: At least one bug has been caught from unused parameter warnings,
875   # so it might be worth trying not to disable it.
876   # One way of selectively disabling the warnings (i.e. only where the
877   # programmer deliberately isn't using the parameter, e.g. for a callback)
878   # is to remove the parameter name (leaving just its type), as is done
879   # in src/seltrans.cpp:sp_seltrans_handle_event; this indicates that the
880   # programmer deliberately has an unused parameter (e.g. because it's used
881   # as a callback or similar function pointer use).
883   # Add even more stuff
884   CXXFLAGS="-Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch $CXXFLAGS"
886 fi
888 dnl ******************************
889 dnl   libinkscape
890 dnl ******************************
891 dnl
892 dnl AC_ARG_ENABLE(libinkscape, AC_HELP_STRING([--enable-libinkscape], [Compile dynamic library (experimental)]), [splib=$enableval], [splib=no])
893 dnl
894 dnl AM_CONDITIONAL(ENABLE_LIBINKSCAPE, test "x$splib" != "xno")
895 dnl
897 AC_SUBST(INKSCAPE_CFLAGS)
898 AC_SUBST(INKSCAPE_LIBS)
901 # Checks to see if we should compile in MMX support (there will be
902 # a runtime test when the code is actually run to see if it should
903 # be used - this just checks if we can compile it.)
905 # This code is partially taken from Mesa
907 dnl Let people disable the MMX optimization
908 AC_ARG_ENABLE(mmx, [  --disable-mmx     Don't use MMX optimization [default=auto]], enable_mmx="$enableval", enable_mmx=auto)
910 AC_MSG_CHECKING(for x86 platform)
911 case $host_cpu in
912   i386|i486|i586|i686|i786|k6|k7)
913     use_x86_asm=yes
914     ;;
915   *)
916     use_x86_asm=no
917 esac
918 AC_MSG_RESULT($use_x86_asm)
920 dnl Are we going to use MMX extensions
921 use_mmx_asm=no
923 AC_MSG_CHECKING(compiler support for MMX)
925 if test x$enable_mmx = xauto ; then
926   if test $use_x86_asm = yes; then
927     save_ac_ext=$ac_ext
928     ac_ext=S
929     
930     cp $srcdir/src/libnr/nr_mmx_R8G8B8A8_P_R8G8B8A8_P_A8_RGBAP.S conftest.S
931     if AC_TRY_EVAL(ac_compile); then
932         use_mmx_asm=yes
933     fi
934     dnl rm -f conftest.[oS]
936     ac_ext=$save_ac_ext
937   fi
939 dnl Enforce usage of MMX extensions
940 elif test x$enable_mmx = xyes ; then
941     use_mmx_asm=yes
942 else
943     use_mmx_asm=no
944 fi
946 if test $use_mmx_asm = yes; then
947         AC_DEFINE(WITH_MMX, 1, [Use MMX optimizations, if CPU supports it])
948         AC_MSG_RESULT(yes)
949 else
950         AC_MSG_RESULT(no)
951 fi
953 AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
955 dnl Define our data paths for config.h
956 AC_DEFINE_DIR([INKSCAPE_DATADIR], [datadir], [Base data directory])
957 AC_DEFINE_DIR([PACKAGE_LOCALE_DIR], [localedir], [Locatization directory])
959 AC_CONFIG_FILES([
960 Makefile
961 src/Makefile
962 src/check-header-compile
963 src/application/makefile
964 src/bind/makefile
965 src/debug/makefile
966 src/dialogs/makefile
967 src/display/makefile
968 src/dom/makefile
969 src/extension/implementation/makefile
970 src/extension/internal/makefile
971 src/extension/makefile
972 src/extension/script/makefile
973 src/filters/makefile
974 src/helper/makefile
975 src/io/makefile
976 src/libcroco/makefile
977 src/libgdl/makefile
978 src/libnr/makefile
979 src/libnrtype/makefile
980 src/libavoid/makefile
981 src/livarot/makefile
982 src/live_effects/makefile
983 src/live_effects/parameter/makefile
984 src/pedro/makefile
985 src/jabber_whiteboard/makefile
986 src/svg/makefile
987 src/trace/makefile
988 src/ui/cache/makefile
989 src/ui/dialog/makefile
990 src/ui/makefile
991 src/ui/view/makefile
992 src/ui/widget/makefile
993 src/util/makefile
994 src/widgets/makefile
995 src/xml/makefile
996 src/2geom/makefile
997 doc/Makefile
998 po/Makefile.in
999 share/Makefile
1000 share/clipart/Makefile
1001 share/examples/Makefile
1002 share/extensions/Makefile
1003 share/extensions/alphabet_soup/Makefile
1004 share/extensions/Barcode/Makefile
1005 share/extensions/Poly3DObjects/Makefile
1006 share/extensions/test/Makefile
1007 share/extensions/xaml2svg/Makefile
1008 share/filters/Makefile
1009 share/fonts/Makefile
1010 share/gradients/Makefile
1011 share/icons/Makefile
1012 share/icons/application/Makefile
1013 share/icons/application/16x16/Makefile
1014 share/icons/application/22x22/Makefile
1015 share/icons/application/24x24/Makefile
1016 share/icons/application/32x32/Makefile
1017 share/icons/application/48x48/Makefile
1018 share/icons/application/256x256/Makefile
1019 share/keys/Makefile
1020 share/markers/Makefile
1021 share/palettes/Makefile
1022 share/patterns/Makefile
1023 share/screens/Makefile
1024 share/templates/Makefile
1025 share/tutorials/Makefile
1026 share/ui/Makefile
1027 packaging/autopackage/default.apspec
1028 inkscape.spec
1029 Info.plist
1030 inkview.1
1031 ])
1033 AH_BOTTOM([
1036 ])
1038 AC_OUTPUT
1040 echo "
1041 Configuration:
1043         Source code location:     ${srcdir}
1044         Destination path prefix:  ${prefix}
1045         Compiler:                 ${CXX}
1046         CPPFLAGS:                 ${CPPFLAGS}
1047         CXXFLAGS:                 ${CXXFLAGS}
1048         CFLAGS:                   ${CFLAGS}
1049         LDFLAGS:                  ${LDFLAGS}
1051         Use Xft font database:    ${xft_ok}
1052         Use gnome-vfs:            ${gnome_vfs}
1053         Use openoffice files:     ${ij}
1054         Use MMX optimizations:    ${use_mmx_asm}
1055         Use relocation support:   ${enable_binreloc}
1056         Internal Python:          ${with_python}
1057         Internal Perl:            ${with_perl}
1058         Enable LittleCms:         ${enable_lcms}
1059         Enable Poppler-Cairo:     ${enable_poppler_cairo}
1060         ImageMagick Magick++:     ${magick_ok}
1061         Libwpg:                   ${with_libwpg}