Code

Merge from trunk
[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_HEADER_STDC
33 dnl These next few lines are needed only while libcroco is in our source tree.
34 AC_PROG_CC
35 AM_PROG_CC_C_O
36 if test "$GCC" = "yes"; then
37   # Enable some warnings from gcc.
38   AC_LANG_PUSH(C)
40   ####
41   # Generic cpp flags...
43   # What is just plain "-W" ?
44   # Fortify source requires -O2 or higher, which is handled with newer autoconf
45   CPPFLAGS="-W -D_FORTIFY_SOURCE=2 $CPPFLAGS"
46   # Enable format and format security warnings
47   CPPFLAGS="-Wformat -Wformat-security $CPPFLAGS"
48   # Enable all default warnings
49   CPPFLAGS="-Wall $CPPFLAGS"
51   # Test for -Werror=... (introduced some time post-4.0)
52   # If we hit a format error -- it should be fatal.
53   AC_MSG_CHECKING([compiler support for -Werror=format-security])
54   ink_svd_CPPFLAGS="$CPPFLAGS"
55   CPPFLAGS="-Werror=format-security $CPPFLAGS"
56   AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), [ink_opt_ok=yes], [ink_opt_ok=no])
57   AC_MSG_RESULT([$ink_opt_ok])
58   if test "x$ink_opt_ok" != "xyes"; then
59     CPPFLAGS="$ink_svd_CPPFLAGS"
60   fi
62   ####
63   # C-specific flags...
65   # -Wno-pointer-sign is probably new in gcc 4.0; certainly it isn't accepted
66   # by gcc 2.95.
67   AC_MSG_CHECKING([compiler support for -Wno-pointer-sign])
68   ink_svd_CFLAGS="$CFLAGS"
69   CFLAGS="-Wno-pointer-sign $CFLAGS"
70   AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), [ink_opt_ok=yes], [ink_opt_ok=no])
71   AC_MSG_RESULT([$ink_opt_ok])
72   if test "x$ink_opt_ok" != "xyes"; then
73     CFLAGS="$ink_svd_CFLAGS"
74   fi
76   ####
77   # Linker flags...
79   # Have linker produce read-only relocations, if it knows how
80   AC_MSG_CHECKING([linker tolerates -z relro])
81   ink_svd_LDFLAGS="$LDFLAGS"
82   LDFLAGS="-Wl,-z,relro $LDFLAGS"
83   AC_LINK_IFELSE(AC_LANG_PROGRAM([]), [ink_opt_ok=yes], [ink_opt_ok=no])
84   AC_MSG_RESULT([$ink_opt_ok])
85   if test "x$ink_opt_ok" != "xyes"; then
86     LDFLAGS="$ink_svd_LDFLAGS"
87   fi
89   AC_LANG_POP
91   # C++-specific flags are defined further below.  Look for CXXFLAGS...
92 fi
94 dnl Honor aclocal flags
95 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
97 AC_PROG_RANLIB
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 libpng 
145 dnl ******************************
146 AC_CHECK_LIB(png, png_read_info, [AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)], png_ok=no, -lz -lm)
147 if test "x$png_ok" != "xyes"; then
148         AC_MSG_ERROR([libpng >= 1.2 is needed to compile inkscape])
149 fi
151 dnl Handle possible dlopen requirement for libgc
152 dnl Isn't this internal to something in autoconf?  Couldn't find it...
153 AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], [AC_CHECK_FUNC([dlopen],
154           [lt_cv_dlopen="dlopen"],
155       [AC_CHECK_LIB([dl], [dlopen],
156             [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
157         [AC_CHECK_LIB([svld], [dlopen],
158               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
159           [AC_CHECK_LIB([dld], [dld_link],
160                 [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
161           ])
162         ])
163       ])
164     ])
166 AC_CHECK_HEADERS([gc.h gc/gc.h],
167                  [
168                     # To test for the different required libs, I have to
169                     # overcome autoconf's caching system, so I change the
170                     # desired function name.  They're all in libgc.
171                     # The "break" will exit from the top level
172                     # AC_CHECK_HEADERS.
173                     gc_libs=""
174                     AC_CHECK_LIB(gc, GC_init,
175                                  [gc_ok=yes;
176                                   LIBS="-lgc $gc_libs $LIBS";
177                                   break], [gc_ok=no], [$gc_libs])
178                     gc_libs="-lpthread"
179                     AC_CHECK_LIB(gc, GC_malloc,
180                                  [gc_ok=yes;
181                                   LIBS="-lgc $gc_libs $LIBS";
182                                   break], [gc_ok=no], [$gc_libs])
183                     gc_libs="$lt_cv_dlopen_libs"
184                     AC_CHECK_LIB(gc, GC_realloc,
185                                  [gc_ok=yes;
186                                   LIBS="-lgc $gc_libs $LIBS";
187                                   break], [gc_ok=no], [$gc_libs])
188                     gc_libs="-lpthread $lt_cv_dlopen_libs"
189                     AC_CHECK_LIB(gc, GC_free,
190                                  [gc_ok=yes;
191                                   LIBS="-lgc $gc_libs $LIBS";
192                                   break], [gc_ok=no], [$gc_libs])
193                     break],
194                  [gc_ok=no])
195 if test "x$gc_ok" = "xyes" && "x$cross_compiling" = "xno" ; then 
196         AC_MSG_CHECKING([libgc version 6.4+])
197         AC_RUN_IFELSE(
198                 [AC_LANG_SOURCE([[
199                         #ifdef HAVE_GC_GC_H
200                         # include <gc/gc.h>
201                         #else
202                         # include <gc.h>
203                         #endif
204                         #include <stdio.h>
205                         extern unsigned GC_version;
206                         int main(void){
207                                 unsigned min = ((6 << 16) | (4 << 8) | 0);
208                                 printf("%d.%d.%d ",GC_version >> 16, (GC_version >> 8) & 0xFF, GC_version & 0xFF);
209                                 if (GC_version>=min) return 0;
210                                 return 1;
211                         }]])],
212                 [gc_ok=yes],
213                 [gc_ok=no]
214         )
215         AC_MSG_RESULT([$gc_ok])
216 fi
217 if test "x$gc_ok" != "xyes"; then
218         AC_MSG_ERROR([libgc (the Boehm Conservative Collector) 6.4+, is needed to compile inkscape -- http://www.hpl.hp.com/personal/Hans_Boehm/gc])
219 fi
221 dnl This check is to get a FIONREAD definition on Solaris 8
222 AC_CHECK_HEADERS([sys/filio.h])
225 AC_CHECK_HEADERS([malloc.h])
226 AC_CHECK_FUNCS([mallinfo], [
227         AC_CHECK_MEMBERS([struct mallinfo.usmblks,
228                           struct mallinfo.fsmblks,
229                           struct mallinfo.uordblks,
230                           struct mallinfo.fordblks,
231                           struct mallinfo.hblkhd],,,
232                          [#include <malloc.h>])
233 ])
235 AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
236 if test "x$FREETYPE_CONFIG" = "xno"; then
237         AC_MSG_ERROR([Cannot find freetype-config])
238 fi
239 FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
240 FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
241 AC_SUBST(FREETYPE_CFLAGS)
242 AC_SUBST(FREETYPE_LIBS)
244 dnl ******************************
245 dnl Win32
246 dnl ******************************
247 AC_MSG_CHECKING([for Win32 platform])
248 case "$host" in
249   *-*-mingw*)
250     platform_win32=yes
251     WIN32_CFLAGS="-mms-bitfields -DLIBXML_STATIC"
252     ;;
253   *)
254     platform_win32=no
255     ;;
256 esac
257 AC_MSG_RESULT([$platform_win32])
258 AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
259 AC_SUBST(WIN32_CFLAGS)
261 AC_MSG_CHECKING([for Solaris platform])
262 case "$host" in
263   *-solaris2.*)
264     platform_solaris=yes
265     solaris_version=`echo $host|sed -e 's/^.*-solaris2\.//' -e s'/\..*$//'`
266     CFLAGS="$CFLAGS -DSOLARIS=$solaris_version"
267     CXXFLAGS="$CXXFLAGS -DSOLARIS=$solaris_version"
268     ;;
269   *)
270     platform_solaris=no
271     ;;
272 esac
273 AC_MSG_RESULT([$platform_solaris])
274 AM_CONDITIONAL(PLATFORM_SOLARIS, test "$platform_solaris" = "yes")
276 dnl ******************************
277 dnl Xft checking
278 dnl ******************************
280 AC_ARG_WITH(xft,
281             AC_HELP_STRING([--with-xft], [use xft scalable font database (default is auto)]),
282             [with_xft=$withval], [with_xft=auto])
284 if test "x$with_xft" != "xno" ; then
285         dnl Test fontconfig package
286         PKG_CHECK_MODULES(XFT, fontconfig, xft_ok=yes, xft_ok=no)
287         if test "x$xft_ok" != "xyes"; then
288                 dnl test xft package
289                 PKG_CHECK_MODULES(XFT, xft, xft_ok=yes, xft_ok=no)
290                 if test "x$xft_ok" != "xyes"; then
291                         dnl Have to test xft presence
292                         AC_CHECK_HEADER(X11/Xft/Xft.h, xft_ok=yes, xft_ok=no)
293                         if test "x$xft_ok" != "xyes"; then
294                                 dnl No xft found
295                                 if test "x$with_xft" = "xyes"; then
296                                         dnl Xft was explicitly asked, so stop
297                                         AC_MSG_ERROR([--with-xft was specified, but appropriate development packages could not be found])
298                                 fi
299                         else
300                                 dnl Working Xft1
301                                 XFT_LIBS="-L/usr/X11R6/lib -lXft "
302                         fi
303                 fi
304         fi
305 else
306         dnl Asked to ignore xft
307         xft_ok=no
308 fi
310 AC_SUBST(XFT_CFLAGS)
311 AC_SUBST(XFT_LIBS)
313 AM_CONDITIONAL(USE_XFT, test "x$xft_ok" = "xyes")
314 if test "x$xft_ok" = "xyes"; then
315         AC_DEFINE(WITH_XFT, 1, [Use Xft font database])
316 fi
318 dnl ******************************
319 dnl pangoft2 for xft
320 dnl ******************************
322 if test "x$xft_ok" = "xyes"; then
323         PKG_CHECK_MODULES(PANGOFT2, pangoft2, pango_ok=yes, pango_ok=no)
324         if test "x$pango_ok" = "xyes"; then
325                 XFT_LIBS="$XFT_LIBS $PANGOFT2_LIBS"
326         fi
327 fi
330 dnl ******************************
331 dnl gnome vfs checking
332 dnl ******************************
334 AC_ARG_WITH(gnome-vfs,
335         AC_HELP_STRING([--with-gnome-vfs], [use gnome vfs for loading files]),
336         [with_gnome_vfs=$withval], [with_gnome_vfs=auto])
338 if test "x$with_gnome_vfs" = "xno"; then
339         dnl Asked to ignore gnome-vfs
340         gnome_vfs=no
341 else
342         dnl Have to test gnome-vfs presence
343         PKG_CHECK_MODULES(GNOME_VFS, gnome-vfs-2.0 >= 2.0, gnome_vfs=yes, gnome_vfs=no)
344         if test "x$gnome_vfs" != "xyes"; then
345                 dnl No gnome-vfs found
346                 if test "x$with_gnome_vfs" = "xyes"; then
347                         dnl Gnome-VFS was explicitly asked for, so stop
348                         AC_MSG_ERROR([--with-gnome-vfs was specified, but appropriate libgnomevfs development packages could not be found])
349                 else
350                         # gnome-vfs is no, tell us for the log file
351                         AC_MSG_RESULT($gnome_vfs)
352                 fi
353         fi
354 fi
356 AM_CONDITIONAL(USE_GNOME_VFS, test "x$gnome_vfs" = "xyes")
357 if test "x$gnome_vfs" = "xyes"; then
358         AC_DEFINE(WITH_GNOME_VFS, 1, [Use gnome vfs file load functionality])
359 fi
361 AC_SUBST(GNOME_VFS_CFLAGS)
362 AC_SUBST(GNOME_VFS_LIBS)
364 dnl ******************************
365 dnl libinkjar checking
366 dnl ******************************
368 AC_ARG_WITH(inkjar,
369         AC_HELP_STRING([--without-inkjar], [disable openoffice files (SVG jars)]),[with_ij=$withval], [with_ij=yes])
371 if test "x$with_ij" = "xyes"; then
372         AC_DEFINE(WITH_INKJAR, 1, [enable openoffice files (SVG jars)])
373         AC_C_BIGENDIAN
374         AC_CHECK_HEADERS(zlib.h)
375         ij=yes
376 else
377         ij=no
378 fi
379 AM_CONDITIONAL(INKJAR, test "$with_ij" = "yes")
381 ink_spell_pkg=
382 if pkg-config --exists gtkspell-2.0; then
383         ink_spell_pkg=gtkspell-2.0
384         AC_DEFINE(WITH_GTKSPELL, 1, [enable gtk spelling widget])
385 fi
387 dnl ******************************
388 dnl PERL checking
389 dnl ******************************
391 AC_MSG_CHECKING(for Perl development environment)
392 AC_ARG_WITH(perl,
393             AC_HELP_STRING([--with-perl], [use Perl for embedded scripting (EXPERIMENTAL)]),
394             [with_perl=$withval], [with_perl=skipped])
396 if test "x$with_perl" = "xyes"; then
397     checkPERL_CFLAGS=`perl -MExtUtils::Embed -e perl_inc 2>/dev/null`
398     if test "$?" -gt "0"; then
399         with_perl="no"
400     else
401         checkPERL_LIBS=`perl -MExtUtils::Embed -e ldopts 2>/dev/null`
402         if test "$?" -gt "0"; then
403             with_perl="no"
404         else
405             with_perl="yes"
406         fi
407     fi
408 fi
409 AC_MSG_RESULT([$with_perl])
410 if test "x$with_perl" = "xyes"; then
411     # Test that we actually have the perl libraries installed
412     oldCFLAGS="$CFLAGS"
413     oldLIBS="$LIBS"
414     CFLAGS="$CFLAGS $checkPERL_CFLAGS"
415     LIBS="$LIBS $checkPERL_LIBS"
416     AC_CHECK_FUNC([perl_parse],[
417         PERL_CFLAGS="$checkPERL_CFLAGS"
418         PERL_LIBS="$checkPERL_LIBS"
419         AC_DEFINE(WITH_PERL, 1, [use Perl for embedded scripting])
420         ],[
421         with_perl="no"
422         ])
423     CFLAGS="$oldCFLAGS"
424     LIBS="$oldLIBS"
425 fi
426 AM_CONDITIONAL(WITH_PERL, test "x$with_perl" = "xyes")
427 AC_SUBST(PERL_CFLAGS)
428 AC_SUBST(PERL_LIBS)
430 dnl ******************************
431 dnl Python checking
432 dnl ******************************
434 AC_MSG_CHECKING(for Python development environment)
435 AC_ARG_WITH(python,
436             AC_HELP_STRING([--with-python], [use Python for embedded scripting (EXPERIMENTAL)]),
437             [with_python=$withval], [with_python=skipped])
439 if test "x$with_python" = "xyes"; then
440     checkPYTHON_CFLAGS=`python -c "import distutils.sysconfig ; print '-I%s' % distutils.sysconfig.get_config_var('INCLUDEPY')" 2>/dev/null`
441     if test "$?" -gt "0"; then
442         with_python="no"
443     else
444         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`
445         if test "$?" -gt "0"; then
446             with_python="no"
447         else
448             with_python="yes"
449         fi
450     fi
451 fi
452 AC_MSG_RESULT([$with_python])
453 if test "x$with_python" = "xyes"; then
454     # Test that we actually have the python libraries installed
455     oldCFLAGS="$CFLAGS"
456     oldLIBS="$LIBS"
457     CFLAGS="$CFLAGS $checkPYTHON_CFLAGS"
458     LIBS="$LIBS $checkPYTHON_LIBS"
459     AC_CHECK_FUNC([Py_Initialize],[
460         PYTHON_CFLAGS="$checkPYTHON_CFLAGS"
461         PYTHON_LIBS="$checkPYTHON_LIBS"
462         AC_DEFINE(WITH_PYTHON, 1, [use Python for embedded scripting])
463         ],[
464         with_python="no"
465         ])
466     CFLAGS="$oldCFLAGS"
467     LIBS="$oldLIBS"
468 fi
469 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" = "xyes")
470 AC_SUBST(PYTHON_CFLAGS)
471 AC_SUBST(PYTHON_LIBS)
473 dnl ******************************
474 dnl LittleCms checking
475 dnl ******************************
477 AC_ARG_ENABLE(lcms,
478         AC_HELP_STRING([--enable-lcms], [enable LittleCms for color management]),
479         [enable_lcms=$enableval], [enable_lcms=yes])
481 if test "x$enable_lcms" = "xno"; then
482         dnl Asked to ignore LittleCms
483         lcms=no
484 else
485         dnl Have to test LittleCms presence
486         PKG_CHECK_MODULES(LCMS, lcms >= 1.13, lcms=yes, lcms=no)
487         if test "x$lcms" != "xyes"; then
488                 dnl No lcms found
489                 if test "x$enable_lcms" = "xyes"; then
490                         dnl LittleCms was explicitly asked for, so stop
491                         AC_MSG_ERROR([--enable-lcms was specified, but appropriate LittleCms development packages could not be found])
492                 else
493                         # lcms is no, tell us for the log file
494                         AC_MSG_RESULT($lcms)
495                 fi
496         else
497                 dnl Working lcms
498                 LIBS="$LIBS $LCMS_LIBS"
499                 AC_DEFINE(ENABLE_LCMS, 1, [Use LittleCms color management])
500         fi
501 fi
503 AC_SUBST(LCMS_CFLAGS)
504 AC_SUBST(LCMS_LIBS)
506 dnl ******************************
507 dnl Libpoppler checking
508 dnl ******************************
510 AC_ARG_ENABLE(poppler-cairo,
511         AC_HELP_STRING([--enable-poppler-cairo], [Enable libpoppler-cairo for rendering PDF preview]),
512         [enable_poppler_cairo=$enableval], [enable_poppler_cairo=yes])
514 POPPLER_CFLAGS=""
515 PKG_CHECK_MODULES(POPPLER, poppler >= 0.5.9, poppler=yes, poppler=no)
517 if test "x$poppler" = "xyes"; then
518         dnl Working libpoppler
519         POPPLER_LIBS="-lpoppler "
520         dnl Have to test libpoppler-glib presence
521         PKG_CHECK_MODULES(POPPLER_GLIB, poppler-glib >= 0.5.9, poppler_glib=yes, poppler_glib=no)
522         if test "x$poppler_glib" = "xyes"; then
523                 dnl Working libpoppler-glib found
524                 dnl Check whether the Cairo SVG backend is available
525                 PKG_CHECK_MODULES(CAIRO_SVG, cairo-svg, cairo_svg=yes, cairo_svg=no)
526                 if test "x$cairo_svg" = "xyes"; then
527                         POPPLER_LIBS="$POPPLER_LIBS -lpoppler-glib "
528                 fi
529         fi
530         if test "x$enable_poppler_cairo" = "xyes"; then
531                 dnl Have to test libpoppler-cairo presence for PDF preview
532                 dnl AC_CHECK_HEADER(Magick++.h, magick_ok=yes, magick_ok=no)
533                 PKG_CHECK_MODULES(POPPLER_CAIRO, poppler-cairo >= 0.5.9, poppler_cairo=yes, poppler_cairo=no)
534                 if test "x$poppler_glib" = "xyes" -a "x$poppler_cairo" = "xyes" -a \
535                         "x$cairo_svg" = "xno"
536                 then
537                         POPPLER_LIBS="$POPPLER_LIBS -lpoppler-glib "
538                 fi
539         fi
540 fi
542 if test "x$poppler" = "xyes"; then
543         LIBS="$LIBS $POPPLER_LIBS"
544         AC_DEFINE(HAVE_POPPLER, 1, [Use libpoppler for direct PDF import])
545 fi
546 if test "x$poppler_cairo" = "xyes" -a "x$poppler_glib" = "xyes"; then
547         AC_DEFINE(HAVE_POPPLER_CAIRO, 1, [Use libpoppler-cairo for rendering PDF preview])
548 fi
549 if test "x$poppler_glib" = "xyes" -a "x$cairo_svg" = "xyes"; then
550         AC_DEFINE(HAVE_POPPLER_GLIB, 1, [Use libpoppler-glib and Cairo-SVG for PDF import])
551 fi
552 AC_SUBST(POPPLER_CFLAGS)
553 AC_SUBST(POPPLER_LIBS)
555 PKG_CHECK_MODULES(POPPLERNEW, poppler >= 0.8.3, popplernew=yes, popplernew=no)
556 if test "x$popplernew" = "xyes"; then
557         AC_DEFINE(POPPLER_NEW_GFXFONT, 1, [Poppler version of GfxFont to use (0.8.3 or higher versions of Poppler)])
558 fi
560 dnl ******************************
561 dnl Inkboard dependency checking
562 dnl ******************************
564 with_inkboard="no"
565 with_inkboard_ssl="no"
567 INKBOARD_CFLAGS=""
569 AC_ARG_ENABLE(inkboard,
570                 AS_HELP_STRING([--enable-inkboard], [enable Inkboard online whiteboard facility (disabled by default)]),
571        with_inkboard=$enableval,with_inkboard=no)
573 if test "x$with_inkboard" = "xyes"; then
574                 with_inkboard="yes"
575                 AC_DEFINE(WITH_INKBOARD,1,[Build in Inkboard support])
576                 
577                 dnl Test for OpenSSL
578                 PKG_CHECK_MODULES(INKBOARD, openssl, with_inkboard_ssl=yes, with_inkboard_ssl=no)
579                 if test "x$with_inkboard_ssl" = "xyes"; then
580                         dnl OpenSSL found; enable SSL support in Pedro
581                         INKBOARD_CFLAGS="$INKBOARD_CFLAGS -DHAVE_SSL"
582                         RELAYTOOL([ssl], INKBOARD_LIBS, INKBOARD_CFLAGS, [inkboard_weak=yes])
583                         RELAYTOOL([crypto], INKBOARD_LIBS, INKBOARD_CFLAGS, [inkboard_weak=yes])
584                         AC_DEFINE(WITH_INKBOARD_SSL,1,[Build in SSL support for Inkboard])
585                 fi
586 else
587         with_inkboard="no"
588 fi
590 AM_CONDITIONAL(WITH_INKBOARD, test "x$with_inkboard" = "xyes")
591 AC_SUBST(INKBOARD_LIBS)
592 AC_SUBST(INKBOARD_CFLAGS)
594 dnl ******************************
595 dnl Check for libwpg for extension
596 dnl ******************************
598 PKG_CHECK_MODULES(LIBWPG, libwpg-0.1 libwpg-stream-0.1, with_libwpg=yes, with_libwpg=no)
599 if test "x$with_libwpg" = "xyes"; then
600         AC_DEFINE(WITH_LIBWPG,1,[Build in libwpg])
601 fi
602 AM_CONDITIONAL(WITH_LIBWPG, test "x$with_libwpg" = "xyes")
604 AC_SUBST(LIBWPG_LIBS)
605 AC_SUBST(LIBWPG_CFLAGS)
607 dnl ******************************
608 dnl Check for ImageMagick Magick++ 
609 dnl ******************************
611 PKG_CHECK_MODULES(IMAGEMAGICK, ImageMagick++, magick_ok=yes, magick_ok=no)
612 if test "x$magick_ok" = "xyes"; then
613       AC_DEFINE(WITH_IMAGE_MAGICK,1,[Image Magick++ support for bitmap effects])
614 fi
615 AM_CONDITIONAL(USE_IMAGE_MAGICK, test "x$magick_ok" = "xyes")
617 AC_SUBST(IMAGEMAGICK_LIBS)
618 AC_SUBST(IMAGEMAGICK_CFLAGS)
620 dnl ***********************************************************************************************************
621 dnl Check for a Cairo version that implements user-fonts feature (with a stable API, that is cairo > 1.7.6),
622 dnl so that we conditionally add SVGFonts support
623 dnl ***********************************************************************************************************
625 PKG_CHECK_MODULES(CAIRO_USER_FONTS, cairo > 1.7.6, cairouserfonts=yes, cairouserfonts=no)
626 if test "x$cairouserfonts" = "xyes"; then
627        AC_DEFINE(ENABLE_SVG_FONTS, 1, [SVG Fonts should be used])
628 fi
630 dnl ******************************
631 dnl   Unconditional dependencies
632 dnl ******************************
634 dnl sigc++-2.0 >= 2.0.12: using "visit_each" not available in 2.0.10
635 if test $cc_vers_major -gt 3; then
636   min_sigc_version=2.0.12
637 else
638   min_sigc_version=2.0.11
639 fi
640 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)
642 # Check for Apple Mac OS X Carbon framework
643 carbon_ok=no
644 AC_MSG_CHECKING([for Mac OS X Carbon support])
645 AC_TRY_CPP([
646 #include <Carbon/Carbon.h>
647 #include <CoreServices/CoreServices.h>
648 ], carbon_ok=yes)
649 AC_MSG_RESULT($carbon_ok)
650 if test "x$carbon_ok" = "xyes"; then
651   AC_DEFINE(HAVE_CARBON, 1, [define to 1 if Carbon is available])
652   CARBON_LDFLAGS="-framework Carbon"
653   AC_SUBST(CARBON_LDFLAGS)
654 fi
655 AM_CONDITIONAL(HAVE_CARBON, test "x$carbon_ok" = "xyes")
657 # Check for some boost header files
658 AC_CHECK_HEADERS([boost/concept_check.hpp], [], AC_MSG_ERROR([You need the boost package (e.g. libboost-dev)]))
660 PKG_CHECK_MODULES(CAIRO_PDF, cairo-pdf, cairo_pdf=yes, cairo_pdf=no)
661 if test "x$cairo_pdf" = "xyes"; then
662   AC_DEFINE(HAVE_CAIRO_PDF, 1, [Whether the Cairo PDF backend is available])
663 fi
665 dnl Shouldn't we test for libpng and libz?
666 INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz"
668 AC_CHECK_HEADER(popt.h,
669                 [INKSCAPE_LIBS="$INKSCAPE_LIBS -lpopt"],
670                 AC_MSG_ERROR([libpopt is required]))
672 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
673 sp_save_LIBS=$LIBS
674 LIBS="$LIBS $INKSCAPE_LIBS"
675 AC_CHECK_FUNCS(bind_textdomain_codeset)
676 dnl Check for gtk_window_fullscreen in gtk (>= 2.2)
677 AC_CHECK_FUNCS(gtk_window_set_default_icon_from_file)
678 AC_CHECK_FUNCS(gtk_window_fullscreen)
679 LIBS=$sp_save_LIBS
682 dnl Check for binary relocation support
683 dnl Hongli Lai <h.lai@chello.nl>
685 AC_ARG_ENABLE(binreloc,
686        [  --enable-binreloc       compile with binary relocation support],
687        enable_binreloc=$enableval,enable_binreloc=no)
689 AC_MSG_CHECKING(whether binary relocation support should be enabled)
690 if test "$enable_binreloc" = "yes"; then
691        AC_MSG_RESULT(yes)
692        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
693        if test -e /proc/self/maps; then
694                AC_MSG_RESULT(yes)
695        else
696                AC_MSG_RESULT(no)
697                AC_MSG_ERROR(/proc/self/maps is not available. Binary relocation cannot be enabled.)
698                enable_binreloc="no"
699        fi
701 elif test "$enable_binreloc" = "auto"; then
702        AC_MSG_RESULT(yes when available)
703        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
704        if test -e /proc/self/maps; then
705                AC_MSG_RESULT(yes)
706                enable_binreloc=yes
708                AC_MSG_CHECKING(whether everything is installed to the same prefix)
709                if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
710                        "$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
711                        "$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
712                then
713                        AC_MSG_RESULT(yes)
714                else
715                        AC_MSG_RESULT(no)
716                        AC_MSG_NOTICE(Binary relocation support will be disabled.)
717                        enable_binreloc=no
718                fi
720        else
721                AC_MSG_RESULT(no)
722                enable_binreloc=no
723        fi
725 elif test "$enable_binreloc" = "no"; then
726        AC_MSG_RESULT(no)
727 else
728        AC_MSG_RESULT(no (unknown value "$enable_binreloc"))
729        enable_binreloc=no
730 fi
731 AC_DEFINE(BR_PTHREADS,[0],[Use binreloc thread support?])
732 if test "$enable_binreloc" = "yes"; then
733    AC_DEFINE(ENABLE_BINRELOC,,[Use AutoPackage?])
734 fi
736 AC_ARG_ENABLE(osxapp,
737        [  --enable-osxapp         compile with OSX .app data dir paths],
738        enable_osxapp=$enableval,enable_osxapp=no)
739 if test "$enable_osxapp" = "yes"; then
740    AC_DEFINE(ENABLE_OSX_APP_LOCATIONS,,[Build with OSX .app data dir paths?])
741 fi
743 dnl ******************************
744 dnl   Reported by autoscan
745 dnl ******************************
746 AC_CHECK_FUNCS(pow)
747 # if we did not find pow(), see if it's in libm.
748 if test x"$ac_cv_func_pow" = x"no" ; then
749         AC_CHECK_LIB(m,pow)
750 fi
751 AC_CHECK_FUNCS(sqrt)
752 AC_CHECK_FUNCS(floor)
753 AC_CHECK_FUNCS(gettimeofday)
754 AC_CHECK_FUNCS(memmove)
755 AC_CHECK_FUNCS(memset)
756 AC_CHECK_FUNCS(mkdir)
757 AC_CHECK_FUNCS(strncasecmp)
758 AC_CHECK_FUNCS(strpbrk)
759 AC_CHECK_FUNCS(strrchr)
760 AC_CHECK_FUNCS(strspn)
761 AC_CHECK_FUNCS(strstr)
762 AC_CHECK_FUNCS(strtoul)
763 AC_CHECK_FUNCS(fpsetmask)
764 AC_CHECK_FUNCS(ecvt)
765 AC_CHECK_HEADERS(ieeefp.h)
766 AC_CHECK_HEADERS(fcntl.h)
767 AC_CHECK_HEADERS(libintl.h)
768 AC_CHECK_HEADERS(stddef.h)
769 AC_CHECK_HEADERS(sys/time.h)
770 AC_FUNC_STAT
771 AC_FUNC_STRFTIME
772 AC_FUNC_STRTOD
773 AC_HEADER_STAT
774 AC_HEADER_TIME
775 AC_STRUCT_TM
776 AC_TYPE_MODE_T
777 AC_TYPE_SIGNAL
779 dnl Work around broken gcc 3.3 (seen on OSX) where "ENABLE_NLS" isn't
780 dnl set correctly because the gettext function isn't noticed.
781 if test "$ac_cv_header_libintl_h" = "yes" &&
782    test "$ac_cv_func_bind_textdomain_codeset" = "yes"  &&
783    test "$gt_cv_func_have_gettext" != "yes"; then
784     AC_DEFINE(ENABLE_NLS)
785 fi
787 dnl ******************************
788 dnl   Compilation warnings
789 dnl ******************************
790 if test "$GXX" = "yes"; then
791   # Enable some warnings from g++.
793   # Rationale: a number of bugs in inkscape have been fixed by enabling g++
794   # warnings and addressing the produced warnings.  Usually the committing
795   # developer is the best person to address the warnings.
797   ink_svd_CXXFLAGS="$CXXFLAGS"
798   CXXFLAGS="-Wno-unused-parameter $CXXFLAGS"
799   # -Wno-unused-parameter isn't accepted by gcc 2.95.
800   AC_COMPILE_IFELSE([int dummy;
801 ], , CXXFLAGS="-Wno-unused $ink_svd_CXXFLAGS",)
802   # Note: At least one bug has been caught from unused parameter warnings,
803   # so it might be worth trying not to disable it.
804   # One way of selectively disabling the warnings (i.e. only where the
805   # programmer deliberately isn't using the parameter, e.g. for a callback)
806   # is to remove the parameter name (leaving just its type), as is done
807   # in src/seltrans.cpp:sp_seltrans_handle_event; this indicates that the
808   # programmer deliberately has an unused parameter (e.g. because it's used
809   # as a callback or similar function pointer use).
811   # Add even more stuff
812   CXXFLAGS="-Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch $CXXFLAGS"
814   dnl Test for arch-specific situations.
815   case "$host_cpu" in
816     mips|mipsel)
817       dnl Symbol tables can get too large: this uses alternate tables
818       dnl See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=283476
819       CXXFLAGS="$CXXFLAGS -Wa,-xgot"
820       CFLAGS="$CFLAGS -Wa,-xgot"
821       ;;
822   esac
823 fi
825 AC_DEFINE(WITH_MODULES, 1, [Use experimental module support])
827 dnl ******************************
828 dnl   libinkscape
829 dnl ******************************
830 dnl
831 dnl AC_ARG_ENABLE(libinkscape, AC_HELP_STRING([--enable-libinkscape], [Compile dynamic library (experimental)]), [splib=$enableval], [splib=no])
832 dnl
833 dnl AM_CONDITIONAL(ENABLE_LIBINKSCAPE, test "x$splib" != "xno")
834 dnl
836 AC_SUBST(INKSCAPE_CFLAGS)
837 AC_SUBST(INKSCAPE_LIBS)
840 # Checks to see if we should compile in MMX support (there will be
841 # a runtime test when the code is actually run to see if it should
842 # be used - this just checks if we can compile it.)
844 # This code is partially taken from Mesa
846 dnl Let people disable the MMX optimization
847 AC_ARG_ENABLE(mmx, [  --disable-mmx     Don't use MMX optimization [default=auto]], enable_mmx="$enableval", enable_mmx=auto)
849 AC_MSG_CHECKING(for x86 platform)
850 case $host_cpu in
851   i386|i486|i586|i686|i786|k6|k7)
852     use_x86_asm=yes
853     ;;
854   *)
855     use_x86_asm=no
856 esac
857 AC_MSG_RESULT($use_x86_asm)
859 dnl Are we going to use MMX extensions
860 use_mmx_asm=no
862 AC_MSG_CHECKING(compiler support for MMX)
864 if test x$enable_mmx = xauto ; then
865   if test $use_x86_asm = yes; then
866     save_ac_ext=$ac_ext
867     ac_ext=S
868     
869     cp $srcdir/src/libnr/nr_mmx_R8G8B8A8_P_R8G8B8A8_P_A8_RGBAP.S conftest.S
870     if AC_TRY_EVAL(ac_compile); then
871         use_mmx_asm=yes
872     fi
873     dnl rm -f conftest.[oS]
875     ac_ext=$save_ac_ext
876   fi
878 dnl Enforce usage of MMX extensions
879 elif test x$enable_mmx = xyes ; then
880     use_mmx_asm=yes
881 else
882     use_mmx_asm=no
883 fi
885 if test $use_mmx_asm = yes; then
886         AC_DEFINE(WITH_MMX, 1, [Use MMX optimizations, if CPU supports it])
887         AC_MSG_RESULT(yes)
888 else
889         AC_MSG_RESULT(no)
890 fi
892 AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
894 dnl Figure out where the datadir actually is
895 dnl http://autoconf-archive.cryp.to/ac_define_dir.html
896 prefix_NONE=
897 exec_prefix_NONE=
898 test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
899 test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
900 dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
901 dnl refers to ${prefix}.  Thus we have to use `eval' twice.
902 eval runtime_datadir="${datadir}"
903 eval runtime_datadir="${runtime_datadir}"
904 test "$prefix_NONE" && prefix=NONE
905 test "$exec_prefix_NONE" && exec_prefix=NONE
907 inkscape_sharedir="${runtime_datadir}/${PACKAGE_NAME}"
909 dnl Define our data paths for config.h
910 AC_SUBST(INKSCAPE_DATADIR)
911 AC_DEFINE_UNQUOTED([INKSCAPE_DATADIR], "${runtime_datadir}",
912                                         [Base data directory -- only path-prefix.h should use it!])
913 AC_SUBST(PACKAGE_LOCALE_DIR)
914 AC_DEFINE_UNQUOTED([PACKAGE_LOCALE_DIR], "${runtime_datadir}/locale",
915                                         [Localization directory])
916 AC_SUBST(INKSCAPE_LIBDIR)
917 AC_DEFINE_UNQUOTED([INKSCAPE_LIBDIR], "${prefix}/lib",
918                                         [Base library directory -- only path-prefix.h should use it!])
920 dnl Have to add module makefiles (lauris)
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/helper/makefile
938 src/inkjar/makefile
939 src/io/makefile
940 src/libcroco/makefile
941 src/libgdl/makefile
942 src/libnr/makefile
943 src/libnrtype/makefile
944 src/libavoid/makefile
945 src/livarot/makefile
946 src/live_effects/makefile
947 src/live_effects/parameter/makefile
948 src/pedro/makefile
949 src/jabber_whiteboard/makefile
950 src/removeoverlap/makefile
951 src/svg/makefile
952 src/trace/makefile
953 src/traits/makefile
954 src/ui/cache/makefile
955 src/ui/dialog/makefile
956 src/ui/makefile
957 src/ui/view/makefile
958 src/ui/widget/makefile
959 src/utest/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/fonts/Makefile
975 share/gradients/Makefile
976 share/icons/Makefile
977 share/keys/Makefile
978 share/markers/Makefile
979 share/palettes/Makefile
980 share/patterns/Makefile
981 share/screens/Makefile
982 share/templates/Makefile
983 share/tutorials/Makefile
984 share/ui/Makefile
985 packaging/autopackage/default.apspec
986 inkscape.spec
987 Info.plist
988 inkview.1
989 ])
991 AH_BOTTOM([
994 ])
996 AC_OUTPUT
998 echo "
999 Configuration:
1001         Source code location:     ${srcdir}
1002         Destination path prefix:  ${prefix}
1003         Compiler:                 ${CXX}
1004         CPPFLAGS:                 ${CPPFLAGS}
1005         CXXFLAGS:                 ${CXXFLAGS}
1006         CFLAGS:                   ${CFLAGS}
1007         LDFLAGS:                  ${LDFLAGS}
1009         Use Xft font database:    ${xft_ok}
1010         Use gnome-vfs:            ${gnome_vfs}
1011         Use openoffice files:     ${ij}
1012         Use MMX optimizations:    ${use_mmx_asm}
1013         Use relocation support:   ${enable_binreloc}
1014         Internal Python:          ${with_python}
1015         Internal Perl:            ${with_perl}
1016         Enable LittleCms:         ${enable_lcms}
1017         Enable Inkboard:          ${with_inkboard}
1018         Enable SSL in Inkboard:   ${with_inkboard_ssl}
1019         Enable Poppler-Cairo:     ${enable_poppler_cairo}
1020         ImageMagick Magick++:     ${magick_ok}
1021         Libwpg:                   ${with_libwpg}