Code

clean Imagemagick detection and doesn't link anymore unused related libs (bug #179369)
[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 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])
569                 
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   Unconditional dependencies
615 dnl ******************************
617 dnl sigc++-2.0 >= 2.0.12: using "visit_each" not available in 2.0.10
618 if test $cc_vers_major -gt 3; then
619   min_sigc_version=2.0.12
620 else
621   min_sigc_version=2.0.11
622 fi
623 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)
625 # Check for Apple Mac OS X Carbon framework
626 carbon_ok=no
627 AC_MSG_CHECKING([for Mac OS X Carbon support])
628 AC_TRY_CPP([
629 #include <Carbon/Carbon.h>
630 #include <CoreServices/CoreServices.h>
631 ], carbon_ok=yes)
632 AC_MSG_RESULT($carbon_ok)
633 if test "x$carbon_ok" = "xyes"; then
634   AC_DEFINE(HAVE_CARBON, 1, [define to 1 if Carbon is available])
635   CARBON_LDFLAGS="-framework Carbon"
636   AC_SUBST(CARBON_LDFLAGS)
637 fi
638 AM_CONDITIONAL(HAVE_CARBON, test "x$carbon_ok" = "xyes")
640 # Check for some boost header files
641 AC_CHECK_HEADERS([boost/concept_check.hpp], [], AC_MSG_ERROR([You need the boost package (e.g. libboost-dev)]))
643 PKG_CHECK_MODULES(CAIRO_PDF, cairo-pdf, cairo_pdf=yes, cairo_pdf=no)
644 if test "x$cairo_pdf" = "xyes"; then
645   AC_DEFINE(HAVE_CAIRO_PDF, 1, [Whether the Cairo PDF backend is available])
646 fi
648 dnl Shouldn't we test for libpng and libz?
649 INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz"
651 AC_CHECK_HEADER(popt.h,
652                 [INKSCAPE_LIBS="$INKSCAPE_LIBS -lpopt"],
653                 AC_MSG_ERROR([libpopt is required]))
655 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
656 sp_save_LIBS=$LIBS
657 LIBS="$LIBS $INKSCAPE_LIBS"
658 AC_CHECK_FUNCS(bind_textdomain_codeset)
659 dnl Check for gtk_window_fullscreen in gtk (>= 2.2)
660 AC_CHECK_FUNCS(gtk_window_set_default_icon_from_file)
661 AC_CHECK_FUNCS(gtk_window_fullscreen)
662 LIBS=$sp_save_LIBS
665 dnl Check for binary relocation support
666 dnl Hongli Lai <h.lai@chello.nl>
668 AC_ARG_ENABLE(binreloc,
669        [  --enable-binreloc       compile with binary relocation support],
670        enable_binreloc=$enableval,enable_binreloc=no)
672 AC_MSG_CHECKING(whether binary relocation support should be enabled)
673 if test "$enable_binreloc" = "yes"; then
674        AC_MSG_RESULT(yes)
675        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
676        if test -e /proc/self/maps; then
677                AC_MSG_RESULT(yes)
678        else
679                AC_MSG_RESULT(no)
680                AC_MSG_ERROR(/proc/self/maps is not available. Binary relocation cannot be enabled.)
681                enable_binreloc="no"
682        fi
684 elif test "$enable_binreloc" = "auto"; then
685        AC_MSG_RESULT(yes when available)
686        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
687        if test -e /proc/self/maps; then
688                AC_MSG_RESULT(yes)
689                enable_binreloc=yes
691                AC_MSG_CHECKING(whether everything is installed to the same prefix)
692                if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
693                        "$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
694                        "$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
695                then
696                        AC_MSG_RESULT(yes)
697                else
698                        AC_MSG_RESULT(no)
699                        AC_MSG_NOTICE(Binary relocation support will be disabled.)
700                        enable_binreloc=no
701                fi
703        else
704                AC_MSG_RESULT(no)
705                enable_binreloc=no
706        fi
708 elif test "$enable_binreloc" = "no"; then
709        AC_MSG_RESULT(no)
710 else
711        AC_MSG_RESULT(no (unknown value "$enable_binreloc"))
712        enable_binreloc=no
713 fi
714 AC_DEFINE(BR_PTHREADS,[0],[Use binreloc thread support?])
715 if test "$enable_binreloc" = "yes"; then
716    AC_DEFINE(ENABLE_BINRELOC,,[Use AutoPackage?])
717 fi
719 AC_ARG_ENABLE(osxapp,
720        [  --enable-osxapp         compile with OSX .app data dir paths],
721        enable_osxapp=$enableval,enable_osxapp=no)
722 if test "$enable_osxapp" = "yes"; then
723    AC_DEFINE(ENABLE_OSX_APP_LOCATIONS,,[Build with OSX .app data dir paths?])
724 fi
726 dnl ******************************
727 dnl   Reported by autoscan
728 dnl ******************************
729 AC_CHECK_FUNCS(pow)
730 # if we did not find pow(), see if it's in libm.
731 if test x"$ac_cv_func_pow" = x"no" ; then
732         AC_CHECK_LIB(m,pow)
733 fi
734 AC_CHECK_FUNCS(sqrt)
735 AC_CHECK_FUNCS(floor)
736 AC_CHECK_FUNCS(gettimeofday)
737 AC_CHECK_FUNCS(memmove)
738 AC_CHECK_FUNCS(memset)
739 AC_CHECK_FUNCS(mkdir)
740 AC_CHECK_FUNCS(strncasecmp)
741 AC_CHECK_FUNCS(strpbrk)
742 AC_CHECK_FUNCS(strrchr)
743 AC_CHECK_FUNCS(strspn)
744 AC_CHECK_FUNCS(strstr)
745 AC_CHECK_FUNCS(strtoul)
746 AC_CHECK_FUNCS(fpsetmask)
747 AC_CHECK_FUNCS(ecvt)
748 AC_CHECK_HEADERS(ieeefp.h)
749 AC_CHECK_HEADERS(fcntl.h)
750 AC_CHECK_HEADERS(libintl.h)
751 AC_CHECK_HEADERS(stddef.h)
752 AC_CHECK_HEADERS(sys/time.h)
753 AC_FUNC_STAT
754 AC_FUNC_STRFTIME
755 AC_FUNC_STRTOD
756 AC_HEADER_STAT
757 AC_HEADER_TIME
758 AC_STRUCT_TM
759 AC_TYPE_MODE_T
760 AC_TYPE_SIGNAL
762 dnl Work around broken gcc 3.3 (seen on OSX) where "ENABLE_NLS" isn't
763 dnl set correctly because the gettext function isn't noticed.
764 if test "$ac_cv_header_libintl_h" = "yes" &&
765    test "$ac_cv_func_bind_textdomain_codeset" = "yes"  &&
766    test "$gt_cv_func_have_gettext" != "yes"; then
767     AC_DEFINE(ENABLE_NLS)
768 fi
770 dnl ******************************
771 dnl   Compilation warnings
772 dnl ******************************
773 if test "$GXX" = "yes"; then
774   # Enable some warnings from g++.
776   # Rationale: a number of bugs in inkscape have been fixed by enabling g++
777   # warnings and addressing the produced warnings.  Usually the committing
778   # developer is the best person to address the warnings.
780   ink_svd_CXXFLAGS="$CXXFLAGS"
781   CXXFLAGS="-Wno-unused-parameter $CXXFLAGS"
782   # -Wno-unused-parameter isn't accepted by gcc 2.95.
783   AC_COMPILE_IFELSE([int dummy;
784 ], , CXXFLAGS="-Wno-unused $ink_svd_CXXFLAGS",)
785   # Note: At least one bug has been caught from unused parameter warnings,
786   # so it might be worth trying not to disable it.
787   # One way of selectively disabling the warnings (i.e. only where the
788   # programmer deliberately isn't using the parameter, e.g. for a callback)
789   # is to remove the parameter name (leaving just its type), as is done
790   # in src/seltrans.cpp:sp_seltrans_handle_event; this indicates that the
791   # programmer deliberately has an unused parameter (e.g. because it's used
792   # as a callback or similar function pointer use).
794   # Add even more stuff
795   CXXFLAGS="-Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch $CXXFLAGS"
797   dnl Test for arch-specific situations.
798   case "$host_cpu" in
799     mips|mipsel)
800       dnl Symbol tables can get too large: this uses alternate tables
801       dnl See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=283476
802       CXXFLAGS="$CXXFLAGS -Wa,-xgot"
803       CFLAGS="$CFLAGS -Wa,-xgot"
804       ;;
805   esac
806 fi
808 AC_DEFINE(WITH_MODULES, 1, [Use experimental module support])
810 dnl ******************************
811 dnl   libinkscape
812 dnl ******************************
813 dnl
814 dnl AC_ARG_ENABLE(libinkscape, AC_HELP_STRING([--enable-libinkscape], [Compile dynamic library (experimental)]), [splib=$enableval], [splib=no])
815 dnl
816 dnl AM_CONDITIONAL(ENABLE_LIBINKSCAPE, test "x$splib" != "xno")
817 dnl
819 AC_SUBST(INKSCAPE_CFLAGS)
820 AC_SUBST(INKSCAPE_LIBS)
823 # Checks to see if we should compile in MMX support (there will be
824 # a runtime test when the code is actually run to see if it should
825 # be used - this just checks if we can compile it.)
827 # This code is partially taken from Mesa
829 dnl Let people disable the MMX optimization
830 AC_ARG_ENABLE(mmx, [  --disable-mmx     Don't use MMX optimization [default=auto]], enable_mmx="$enableval", enable_mmx=auto)
832 AC_MSG_CHECKING(for x86 platform)
833 case $host_cpu in
834   i386|i486|i586|i686|i786|k6|k7)
835     use_x86_asm=yes
836     ;;
837   *)
838     use_x86_asm=no
839 esac
840 AC_MSG_RESULT($use_x86_asm)
842 dnl Are we going to use MMX extensions
843 use_mmx_asm=no
845 AC_MSG_CHECKING(compiler support for MMX)
847 if test x$enable_mmx = xauto ; then
848   if test $use_x86_asm = yes; then
849     save_ac_ext=$ac_ext
850     ac_ext=S
851     
852     cp $srcdir/src/libnr/nr_mmx_R8G8B8A8_P_R8G8B8A8_P_A8_RGBAP.S conftest.S
853     if AC_TRY_EVAL(ac_compile); then
854         use_mmx_asm=yes
855     fi
856     dnl rm -f conftest.[oS]
858     ac_ext=$save_ac_ext
859   fi
861 dnl Enforce usage of MMX extensions
862 elif test x$enable_mmx = xyes ; then
863     use_mmx_asm=yes
864 else
865     use_mmx_asm=no
866 fi
868 if test $use_mmx_asm = yes; then
869         AC_DEFINE(WITH_MMX, 1, [Use MMX optimizations, if CPU supports it])
870         AC_MSG_RESULT(yes)
871 else
872         AC_MSG_RESULT(no)
873 fi
875 AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
877 dnl Figure out where the datadir actually is
878 dnl http://autoconf-archive.cryp.to/ac_define_dir.html
879 prefix_NONE=
880 exec_prefix_NONE=
881 test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
882 test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
883 dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
884 dnl refers to ${prefix}.  Thus we have to use `eval' twice.
885 eval runtime_datadir="${datadir}"
886 eval runtime_datadir="${runtime_datadir}"
887 test "$prefix_NONE" && prefix=NONE
888 test "$exec_prefix_NONE" && exec_prefix=NONE
890 inkscape_sharedir="${runtime_datadir}/${PACKAGE_NAME}"
892 dnl Define our data paths for config.h
893 AC_SUBST(INKSCAPE_DATADIR)
894 AC_DEFINE_UNQUOTED([INKSCAPE_DATADIR], "${runtime_datadir}",
895                                         [Base data directory -- only path-prefix.h should use it!])
896 AC_SUBST(PACKAGE_LOCALE_DIR)
897 AC_DEFINE_UNQUOTED([PACKAGE_LOCALE_DIR], "${runtime_datadir}/locale",
898                                         [Localization directory])
899 AC_SUBST(INKSCAPE_LIBDIR)
900 AC_DEFINE_UNQUOTED([INKSCAPE_LIBDIR], "${prefix}/lib",
901                                         [Base library directory -- only path-prefix.h should use it!])
903 dnl Have to add module makefiles (lauris)
905 AC_CONFIG_FILES([
906 Makefile
907 src/Makefile
908 src/check-header-compile
909 src/algorithms/makefile
910 src/application/makefile
911 src/bind/makefile
912 src/debug/makefile
913 src/dialogs/makefile
914 src/display/makefile
915 src/dom/makefile
916 src/extension/implementation/makefile
917 src/extension/internal/makefile
918 src/extension/makefile
919 src/extension/script/makefile
920 src/helper/makefile
921 src/inkjar/makefile
922 src/io/makefile
923 src/libcroco/makefile
924 src/libgdl/makefile
925 src/libnr/makefile
926 src/libnrtype/makefile
927 src/libavoid/makefile
928 src/livarot/makefile
929 src/live_effects/makefile
930 src/live_effects/parameter/makefile
931 src/pedro/makefile
932 src/jabber_whiteboard/makefile
933 src/removeoverlap/makefile
934 src/svg/makefile
935 src/trace/makefile
936 src/traits/makefile
937 src/ui/cache/makefile
938 src/ui/dialog/makefile
939 src/ui/makefile
940 src/ui/view/makefile
941 src/ui/widget/makefile
942 src/utest/makefile
943 src/util/makefile
944 src/widgets/makefile
945 src/xml/makefile
946 src/2geom/makefile
947 doc/Makefile
948 po/Makefile.in
949 share/Makefile
950 share/clipart/Makefile
951 share/examples/Makefile
952 share/extensions/Makefile
953 share/extensions/alphabet_soup/Makefile
954 share/extensions/Barcode/Makefile
955 share/extensions/xaml2svg/Makefile
956 share/fonts/Makefile
957 share/gradients/Makefile
958 share/icons/Makefile
959 share/keys/Makefile
960 share/markers/Makefile
961 share/palettes/Makefile
962 share/patterns/Makefile
963 share/screens/Makefile
964 share/templates/Makefile
965 share/tutorials/Makefile
966 share/ui/Makefile
967 packaging/autopackage/default.apspec
968 inkscape.spec
969 Info.plist
970 inkview.1
971 ])
973 AH_BOTTOM([
976 ])
978 AC_OUTPUT
980 echo "
981 Configuration:
983         Source code location:     ${srcdir}
984         Destination path prefix:  ${prefix}
985         Compiler:                 ${CXX}
986         CPPFLAGS:                 ${CPPFLAGS}
987         CXXFLAGS:                 ${CXXFLAGS}
988         CFLAGS:                   ${CFLAGS}
989         LDFLAGS:                  ${LDFLAGS}
991         Use Xft font database:    ${xft_ok}
992         Use gnome-vfs:            ${gnome_vfs}
993         Use openoffice files:     ${ij}
994         Use MMX optimizations:    ${use_mmx_asm}
995         Use relocation support:   ${enable_binreloc}
996         Internal Python:          ${with_python}
997         Internal Perl:            ${with_perl}
998         Enable LittleCms:         ${enable_lcms}
999         Enable Inkboard:          ${with_inkboard}
1000         Enable SSL in Inkboard:   ${with_inkboard_ssl}
1001         Enable Poppler-Cairo:     ${enable_poppler_cairo}
1002         ImageMagick Magick++:     ${magick_ok}
1003         Libwpg:                   ${with_libwpg}