Code

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