Code

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