Code

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