Code

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