Code

Split off first portion of icons into separate files to begin working on
[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([openmp_ok=yes],[openmp_ok=no])
148 AC_MSG_CHECKING([for OpenMP support])
149 dnl a bit odd, but AX_OPENMP does its own check message, so we're not wrapping it at the moment
150 AC_MSG_RESULT([$openmp_ok])
151 if test "x$openmp_ok" = "xyes"; then
152         dnl We have it, now set up the flags
153         CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
154         AC_CHECK_HEADER(omp.h)
155 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=no)], 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 with_inkboard="no"
580 with_inkboard_ssl="no"
582 INKBOARD_CFLAGS=""
584 AC_ARG_ENABLE(inkboard,
585                 AS_HELP_STRING([--enable-inkboard], [enable Inkboard online whiteboard facility (disabled by default)]),
586        with_inkboard=$enableval,with_inkboard=no)
588 if test "x$with_inkboard" = "xyes"; then
589                 with_inkboard="yes"
590                 AC_DEFINE(WITH_INKBOARD,1,[Build in Inkboard support])
591                 
592                 dnl Test for OpenSSL
593                 PKG_CHECK_MODULES(INKBOARD, openssl, with_inkboard_ssl=yes, with_inkboard_ssl=no)
594                 if test "x$with_inkboard_ssl" = "xyes"; then
595                         dnl OpenSSL found; enable SSL support in Pedro
596                         INKBOARD_CFLAGS="$INKBOARD_CFLAGS -DHAVE_SSL"
597                         RELAYTOOL([ssl], INKBOARD_LIBS, INKBOARD_CFLAGS, [inkboard_weak=yes])
598                         RELAYTOOL([crypto], INKBOARD_LIBS, INKBOARD_CFLAGS, [inkboard_weak=yes])
599                         AC_DEFINE(WITH_INKBOARD_SSL,1,[Build in SSL support for Inkboard])
600                 fi
601 else
602         with_inkboard="no"
603 fi
605 AM_CONDITIONAL(WITH_INKBOARD, test "x$with_inkboard" = "xyes")
606 AC_SUBST(INKBOARD_LIBS)
607 AC_SUBST(INKBOARD_CFLAGS)
609 dnl ******************************
610 dnl Check for libwpg for extension
611 dnl ******************************
613 PKG_CHECK_MODULES(LIBWPG, libwpg-0.1 libwpg-stream-0.1, with_libwpg=yes, with_libwpg=no)
614 if test "x$with_libwpg" = "xyes"; then
615         AC_DEFINE(WITH_LIBWPG,1,[Build in libwpg])
616 fi
617 AM_CONDITIONAL(WITH_LIBWPG, test "x$with_libwpg" = "xyes")
619 AC_SUBST(LIBWPG_LIBS)
620 AC_SUBST(LIBWPG_CFLAGS)
622 dnl ******************************
623 dnl Check for ImageMagick Magick++ 
624 dnl ******************************
626 PKG_CHECK_MODULES(IMAGEMAGICK, ImageMagick++, magick_ok=yes, magick_ok=no)
627 if test "x$magick_ok" = "xyes"; then
628       AC_DEFINE(WITH_IMAGE_MAGICK,1,[Image Magick++ support for bitmap effects])
629 fi
630 AM_CONDITIONAL(USE_IMAGE_MAGICK, test "x$magick_ok" = "xyes")
632 AC_SUBST(IMAGEMAGICK_LIBS)
633 AC_SUBST(IMAGEMAGICK_CFLAGS)
635 dnl ***********************************************************************************************************
636 dnl Check for a Cairo version that implements user-fonts feature (with a stable API, that is cairo > 1.7.6),
637 dnl so that we conditionally add SVGFonts support
638 dnl ***********************************************************************************************************
640 PKG_CHECK_MODULES(CAIRO_USER_FONTS, cairo > 1.7.6, cairouserfonts=yes, cairouserfonts=no)
641 if test "x$cairouserfonts" = "xyes"; then
642        AC_DEFINE(ENABLE_SVG_FONTS, 1, [SVG Fonts should be used])
643 fi
645 dnl ******************************
646 dnl   Unconditional dependencies
647 dnl ******************************
649 dnl sigc++-2.0 >= 2.0.12: using "visit_each" not available in 2.0.10
650 if test $cc_vers_major -gt 3; then
651   min_sigc_version=2.0.12
652 else
653   min_sigc_version=2.0.11
654 fi
655 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 giomm-2.4)
657 # Check for Apple Mac OS X Carbon framework
658 carbon_ok=no
659 AC_MSG_CHECKING([for Mac OS X Carbon support])
660 AC_TRY_CPP([
661 #include <Carbon/Carbon.h>
662 #include <CoreServices/CoreServices.h>
663 ], carbon_ok=yes)
664 AC_MSG_RESULT($carbon_ok)
665 if test "x$carbon_ok" = "xyes"; then
666   AC_DEFINE(HAVE_CARBON, 1, [define to 1 if Carbon is available])
667   CARBON_LDFLAGS="-framework Carbon"
668   AC_SUBST(CARBON_LDFLAGS)
669 fi
670 AM_CONDITIONAL(HAVE_CARBON, test "x$carbon_ok" = "xyes")
672 # Check for some boost header files
673 AC_CHECK_HEADERS([boost/concept_check.hpp], [], AC_MSG_ERROR([You need the boost package (e.g. libboost-dev)]))
675 PKG_CHECK_MODULES(CAIRO_PDF, cairo-pdf, cairo_pdf=yes, cairo_pdf=no)
676 if test "x$cairo_pdf" = "xyes"; then
677   AC_DEFINE(HAVE_CAIRO_PDF, 1, [Whether the Cairo PDF backend is available])
678 fi
680 dnl Shouldn't we test for libpng and libz?
681 if test "x$openmp_ok" = "xyes"; then
682         INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz -lgomp"
683 else
684         INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz"
685 fi
687 AC_CHECK_HEADER(popt.h,
688                 [INKSCAPE_LIBS="$INKSCAPE_LIBS -lpopt"],
689                 AC_MSG_ERROR([libpopt is required]))
691 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
692 sp_save_LIBS=$LIBS
693 LIBS="$LIBS $INKSCAPE_LIBS"
694 AC_CHECK_FUNCS(bind_textdomain_codeset)
695 dnl Check for gtk_window_fullscreen in gtk (>= 2.2)
696 AC_CHECK_FUNCS(gtk_window_set_default_icon_from_file)
697 AC_CHECK_FUNCS(gtk_window_fullscreen)
698 LIBS=$sp_save_LIBS
701 dnl Check for binary relocation support
702 dnl Hongli Lai <h.lai@chello.nl>
704 AC_ARG_ENABLE(binreloc,
705        [  --enable-binreloc       compile with binary relocation support],
706        enable_binreloc=$enableval,enable_binreloc=no)
708 AC_MSG_CHECKING(whether binary relocation support should be enabled)
709 if test "$enable_binreloc" = "yes"; then
710        AC_MSG_RESULT(yes)
711        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
712        if test -e /proc/self/maps; then
713                AC_MSG_RESULT(yes)
714        else
715                AC_MSG_RESULT(no)
716                AC_MSG_ERROR(/proc/self/maps is not available. Binary relocation cannot be enabled.)
717                enable_binreloc="no"
718        fi
720 elif test "$enable_binreloc" = "auto"; then
721        AC_MSG_RESULT(yes when available)
722        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
723        if test -e /proc/self/maps; then
724                AC_MSG_RESULT(yes)
725                enable_binreloc=yes
727                AC_MSG_CHECKING(whether everything is installed to the same prefix)
728                if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
729                        "$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
730                        "$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
731                then
732                        AC_MSG_RESULT(yes)
733                else
734                        AC_MSG_RESULT(no)
735                        AC_MSG_NOTICE(Binary relocation support will be disabled.)
736                        enable_binreloc=no
737                fi
739        else
740                AC_MSG_RESULT(no)
741                enable_binreloc=no
742        fi
744 elif test "$enable_binreloc" = "no"; then
745        AC_MSG_RESULT(no)
746 else
747        AC_MSG_RESULT(no (unknown value "$enable_binreloc"))
748        enable_binreloc=no
749 fi
750 AC_DEFINE(BR_PTHREADS,[0],[Use binreloc thread support?])
751 if test "$enable_binreloc" = "yes"; then
752    AC_DEFINE(ENABLE_BINRELOC,,[Use AutoPackage?])
753 fi
755 AC_ARG_ENABLE(osxapp,
756        [  --enable-osxapp         compile with OSX .app data dir paths],
757        enable_osxapp=$enableval,enable_osxapp=no)
758 if test "$enable_osxapp" = "yes"; then
759    AC_DEFINE(ENABLE_OSX_APP_LOCATIONS,,[Build with OSX .app data dir paths?])
760 fi
762 dnl ******************************
763 dnl   Reported by autoscan
764 dnl ******************************
765 AC_CHECK_FUNCS(pow)
766 # if we did not find pow(), see if it's in libm.
767 if test x"$ac_cv_func_pow" = x"no" ; then
768         AC_CHECK_LIB(m,pow)
769 fi
770 AC_CHECK_FUNCS(sqrt)
771 AC_CHECK_FUNCS(floor)
772 AC_CHECK_FUNCS(gettimeofday)
773 AC_CHECK_FUNCS(memmove)
774 AC_CHECK_FUNCS(memset)
775 AC_CHECK_FUNCS(mkdir)
776 AC_CHECK_FUNCS(strncasecmp)
777 AC_CHECK_FUNCS(strpbrk)
778 AC_CHECK_FUNCS(strrchr)
779 AC_CHECK_FUNCS(strspn)
780 AC_CHECK_FUNCS(strstr)
781 AC_CHECK_FUNCS(strtoul)
782 AC_CHECK_FUNCS(fpsetmask)
783 AC_CHECK_FUNCS(ecvt)
784 AC_CHECK_HEADERS(ieeefp.h)
785 AC_CHECK_HEADERS(fcntl.h)
786 AC_CHECK_HEADERS(libintl.h)
787 AC_CHECK_HEADERS(stddef.h)
788 AC_CHECK_HEADERS(sys/time.h)
789 AC_FUNC_STAT
790 AC_FUNC_STRFTIME
791 AC_FUNC_STRTOD
792 AC_HEADER_STAT
793 AC_HEADER_TIME
794 AC_STRUCT_TM
795 AC_TYPE_MODE_T
796 AC_TYPE_SIGNAL
798 dnl Work around broken gcc 3.3 (seen on OSX) where "ENABLE_NLS" isn't
799 dnl set correctly because the gettext function isn't noticed.
800 if test "$ac_cv_header_libintl_h" = "yes" &&
801    test "$ac_cv_func_bind_textdomain_codeset" = "yes"  &&
802    test "$gt_cv_func_have_gettext" != "yes"; then
803     AC_DEFINE(ENABLE_NLS)
804 fi
806 dnl ******************************
807 dnl   Compilation warnings
808 dnl ******************************
809 if test "$GXX" = "yes"; then
810   # Enable some warnings from g++.
812   # Rationale: a number of bugs in inkscape have been fixed by enabling g++
813   # warnings and addressing the produced warnings.  Usually the committing
814   # developer is the best person to address the warnings.
816   ink_svd_CXXFLAGS="$CXXFLAGS"
817   CXXFLAGS="-Wno-unused-parameter $CXXFLAGS"
818   # -Wno-unused-parameter isn't accepted by gcc 2.95.
819   AC_COMPILE_IFELSE([int dummy;
820 ], , CXXFLAGS="-Wno-unused $ink_svd_CXXFLAGS",)
821   # Note: At least one bug has been caught from unused parameter warnings,
822   # so it might be worth trying not to disable it.
823   # One way of selectively disabling the warnings (i.e. only where the
824   # programmer deliberately isn't using the parameter, e.g. for a callback)
825   # is to remove the parameter name (leaving just its type), as is done
826   # in src/seltrans.cpp:sp_seltrans_handle_event; this indicates that the
827   # programmer deliberately has an unused parameter (e.g. because it's used
828   # as a callback or similar function pointer use).
830   # Add even more stuff
831   CXXFLAGS="-Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch $CXXFLAGS"
833   dnl Test for arch-specific situations.
834   case "$host_cpu" in
835     mips|mipsel)
836       dnl Symbol tables can get too large: this uses alternate tables
837       dnl See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=283476
838       CXXFLAGS="$CXXFLAGS -Wa,-xgot"
839       CFLAGS="$CFLAGS -Wa,-xgot"
840       ;;
841   esac
842 fi
844 AC_DEFINE(WITH_MODULES, 1, [Use experimental module support])
846 dnl ******************************
847 dnl   libinkscape
848 dnl ******************************
849 dnl
850 dnl AC_ARG_ENABLE(libinkscape, AC_HELP_STRING([--enable-libinkscape], [Compile dynamic library (experimental)]), [splib=$enableval], [splib=no])
851 dnl
852 dnl AM_CONDITIONAL(ENABLE_LIBINKSCAPE, test "x$splib" != "xno")
853 dnl
855 AC_SUBST(INKSCAPE_CFLAGS)
856 AC_SUBST(INKSCAPE_LIBS)
859 # Checks to see if we should compile in MMX support (there will be
860 # a runtime test when the code is actually run to see if it should
861 # be used - this just checks if we can compile it.)
863 # This code is partially taken from Mesa
865 dnl Let people disable the MMX optimization
866 AC_ARG_ENABLE(mmx, [  --disable-mmx     Don't use MMX optimization [default=auto]], enable_mmx="$enableval", enable_mmx=auto)
868 AC_MSG_CHECKING(for x86 platform)
869 case $host_cpu in
870   i386|i486|i586|i686|i786|k6|k7)
871     use_x86_asm=yes
872     ;;
873   *)
874     use_x86_asm=no
875 esac
876 AC_MSG_RESULT($use_x86_asm)
878 dnl Are we going to use MMX extensions
879 use_mmx_asm=no
881 AC_MSG_CHECKING(compiler support for MMX)
883 if test x$enable_mmx = xauto ; then
884   if test $use_x86_asm = yes; then
885     save_ac_ext=$ac_ext
886     ac_ext=S
887     
888     cp $srcdir/src/libnr/nr_mmx_R8G8B8A8_P_R8G8B8A8_P_A8_RGBAP.S conftest.S
889     if AC_TRY_EVAL(ac_compile); then
890         use_mmx_asm=yes
891     fi
892     dnl rm -f conftest.[oS]
894     ac_ext=$save_ac_ext
895   fi
897 dnl Enforce usage of MMX extensions
898 elif test x$enable_mmx = xyes ; then
899     use_mmx_asm=yes
900 else
901     use_mmx_asm=no
902 fi
904 if test $use_mmx_asm = yes; then
905         AC_DEFINE(WITH_MMX, 1, [Use MMX optimizations, if CPU supports it])
906         AC_MSG_RESULT(yes)
907 else
908         AC_MSG_RESULT(no)
909 fi
911 AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
913 dnl Figure out where the datadir actually is
914 dnl http://autoconf-archive.cryp.to/ac_define_dir.html
915 prefix_NONE=
916 exec_prefix_NONE=
917 test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
918 test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
919 dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
920 dnl refers to ${prefix}.  Thus we have to use `eval' twice.
921 eval runtime_datadir="${datadir}"
922 eval runtime_datadir="${runtime_datadir}"
923 test "$prefix_NONE" && prefix=NONE
924 test "$exec_prefix_NONE" && exec_prefix=NONE
926 inkscape_sharedir="${runtime_datadir}/${PACKAGE_NAME}"
928 dnl Define our data paths for config.h
929 AC_SUBST(INKSCAPE_DATADIR)
930 AC_DEFINE_UNQUOTED([INKSCAPE_DATADIR], "${runtime_datadir}",
931                                         [Base data directory -- only path-prefix.h should use it!])
932 AC_SUBST(PACKAGE_LOCALE_DIR)
933 AC_DEFINE_UNQUOTED([PACKAGE_LOCALE_DIR], "${runtime_datadir}/locale",
934                                         [Localization directory])
935 AC_SUBST(INKSCAPE_LIBDIR)
936 AC_DEFINE_UNQUOTED([INKSCAPE_LIBDIR], "${prefix}/lib",
937                                         [Base library directory -- only path-prefix.h should use it!])
939 dnl Have to add module makefiles (lauris)
941 AC_CONFIG_FILES([
942 Makefile
943 src/Makefile
944 src/check-header-compile
945 src/algorithms/makefile
946 src/application/makefile
947 src/bind/makefile
948 src/debug/makefile
949 src/dialogs/makefile
950 src/display/makefile
951 src/dom/makefile
952 src/extension/implementation/makefile
953 src/extension/internal/makefile
954 src/extension/makefile
955 src/extension/script/makefile
956 src/filters/makefile
957 src/helper/makefile
958 src/inkjar/makefile
959 src/io/makefile
960 src/libcroco/makefile
961 src/libgdl/makefile
962 src/libnr/makefile
963 src/libnrtype/makefile
964 src/libavoid/makefile
965 src/livarot/makefile
966 src/live_effects/makefile
967 src/live_effects/parameter/makefile
968 src/pedro/makefile
969 src/jabber_whiteboard/makefile
970 src/removeoverlap/makefile
971 src/svg/makefile
972 src/trace/makefile
973 src/traits/makefile
974 src/ui/cache/makefile
975 src/ui/dialog/makefile
976 src/ui/makefile
977 src/ui/view/makefile
978 src/ui/widget/makefile
979 src/util/makefile
980 src/widgets/makefile
981 src/xml/makefile
982 src/2geom/makefile
983 doc/Makefile
984 po/Makefile.in
985 share/Makefile
986 share/clipart/Makefile
987 share/examples/Makefile
988 share/extensions/Makefile
989 share/extensions/alphabet_soup/Makefile
990 share/extensions/Barcode/Makefile
991 share/extensions/Poly3DObjects/Makefile
992 share/extensions/xaml2svg/Makefile
993 share/filters/Makefile
994 share/fonts/Makefile
995 share/gradients/Makefile
996 share/icons/Makefile
997 share/icons/hicolor/Makefile
998 share/icons/hicolor/scalable/Makefile
999 share/icons/hicolor/scalable/actions/Makefile
1000 share/icons/hicolor/scalable/devices/Makefile
1001 share/keys/Makefile
1002 share/markers/Makefile
1003 share/palettes/Makefile
1004 share/patterns/Makefile
1005 share/screens/Makefile
1006 share/templates/Makefile
1007 share/tutorials/Makefile
1008 share/ui/Makefile
1009 packaging/autopackage/default.apspec
1010 inkscape.spec
1011 Info.plist
1012 inkview.1
1013 ])
1015 AH_BOTTOM([
1018 ])
1020 AC_OUTPUT
1022 echo "
1023 Configuration:
1025         Source code location:     ${srcdir}
1026         Destination path prefix:  ${prefix}
1027         Compiler:                 ${CXX}
1028         CPPFLAGS:                 ${CPPFLAGS}
1029         CXXFLAGS:                 ${CXXFLAGS}
1030         CFLAGS:                   ${CFLAGS}
1031         LDFLAGS:                  ${LDFLAGS}
1033         Use Xft font database:    ${xft_ok}
1034         Use gnome-vfs:            ${gnome_vfs}
1035         Use openoffice files:     ${ij}
1036         Use MMX optimizations:    ${use_mmx_asm}
1037         Use relocation support:   ${enable_binreloc}
1038         Internal Python:          ${with_python}
1039         Internal Perl:            ${with_perl}
1040         Enable LittleCms:         ${enable_lcms}
1041         Enable Inkboard:          ${with_inkboard}
1042         Enable SSL in Inkboard:   ${with_inkboard_ssl}
1043         Enable Poppler-Cairo:     ${enable_poppler_cairo}
1044         ImageMagick Magick++:     ${magick_ok}
1045         Libwpg:                   ${with_libwpg}