Code

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