Code

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