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