Code

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