Code

Adding all of the library stuff in. Including libtool in configure and libtoolize...
[inkscape.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.53)
5 # Always use 0.xx+devel instead of 0.xxdevel for the version, e.g. 0.46+devel.
6 # Rationale: (i) placate simple version comparison software such as
7 # `dpkg --compare-versions'.  (ii) We don't always know what the next
8 # version is going to be called until about the time we release it
9 # (whereas we always know what the previous version was called).
10 AC_INIT(inkscape, 0.47+devel)
12 AC_CANONICAL_HOST
13 AC_CONFIG_SRCDIR([src/main.cpp])
14 AM_INIT_AUTOMAKE([dist-zip dist-bzip2 tar-pax])
16 AC_ARG_ENABLE([lsb], AS_HELP_STRING([--enable-lsb], [LSB-compatible build configuration]), [
17   prefix=/opt/inkscape
18   PATH="/opt/lsb/bin:$PATH"
19   CC=lsbcc
20   CXX=lsbc++
21   export CC CXX
22 ])
24 AM_CONFIG_HEADER(config.h)
26 AC_LANG(C++)
27 AC_ISC_POSIX
28 AC_PROG_CXX
29 AM_PROG_CC_STDC
30 AM_PROG_AS
31 AC_PROG_RANLIB
32 AC_PROG_INTLTOOL(0.22)
33 AC_PROG_LIBTOOL
34 AC_HEADER_STDC
35 INK_SVN_SNAPSHOT_BUILD
37 dnl If automake 1.11 shave the output to look nice
38 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
40 dnl These next few lines are needed only while libcroco is in our source tree.
41 AC_PROG_CC
42 AM_PROG_CC_C_O
43 if test "$GCC" = "yes"; then
44   # Enable some warnings from gcc.
45   AC_LANG_PUSH(C)
47   ####
48   # Generic cpp flags...
50   # What is just plain "-W" ?
51   # Fortify source requires -O2 or higher, which is handled with newer autoconf
52   CPPFLAGS="-W -D_FORTIFY_SOURCE=2 $CPPFLAGS"
53   # Enable format and format security warnings
54   CPPFLAGS="-Wformat -Wformat-security $CPPFLAGS"
55   # Enable all default warnings
56   CPPFLAGS="-Wall $CPPFLAGS"
58   # Test for -Werror=... (introduced some time post-4.0)
59   # If we hit a format error -- it should be fatal.
60   AC_MSG_CHECKING([compiler support for -Werror=format-security])
61   ink_svd_CPPFLAGS="$CPPFLAGS"
62   CPPFLAGS="-Werror=format-security $CPPFLAGS"
63   AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), [ink_opt_ok=yes], [ink_opt_ok=no])
64   AC_MSG_RESULT([$ink_opt_ok])
65   if test "x$ink_opt_ok" != "xyes"; then
66     CPPFLAGS="$ink_svd_CPPFLAGS"
67   fi
69   ####
70   # C-specific flags...
72   # -Wno-pointer-sign is probably new in gcc 4.0; certainly it isn't accepted
73   # by gcc 2.95.
74   AC_MSG_CHECKING([compiler support for -Wno-pointer-sign])
75   ink_svd_CFLAGS="$CFLAGS"
76   CFLAGS="-Wno-pointer-sign $CFLAGS"
77   AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), [ink_opt_ok=yes], [ink_opt_ok=no])
78   AC_MSG_RESULT([$ink_opt_ok])
79   if test "x$ink_opt_ok" != "xyes"; then
80     CFLAGS="$ink_svd_CFLAGS"
81   fi
83   ####
84   # Linker flags...
86   # Have linker produce read-only relocations, if it knows how
87   AC_MSG_CHECKING([linker tolerates -z relro])
88   ink_svd_LDFLAGS="$LDFLAGS"
89   LDFLAGS="-Wl,-z,relro $LDFLAGS"
90   AC_LINK_IFELSE(AC_LANG_PROGRAM([]), [ink_opt_ok=yes], [ink_opt_ok=no])
91   AC_MSG_RESULT([$ink_opt_ok])
92   if test "x$ink_opt_ok" != "xyes"; then
93     LDFLAGS="$ink_svd_LDFLAGS"
94   fi
96   AC_LANG_POP
98   # C++-specific flags are defined further below.  Look for CXXFLAGS...
99 fi
101 dnl Honor aclocal flags
102 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
104 dnl Verify our GCC version
105 if test "x$GXX" = "xyes"; then
106         AC_MSG_CHECKING([GNU compiler version])
108         # Don't pass CXXFLAGS to the following CXX command as some 
109         # of them can't be specified along with '-v'.
110         cc_version=["`$CXX -v 2>&1 </dev/null |grep 'gcc version' |\
111                 sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`"]
113         AC_MSG_RESULT([$cc_version])
115         # Some version numbers
116         cc_vers_major=`echo $cc_version | cut -f1 -d.`
117         cc_vers_minor=`echo $cc_version | cut -f2 -d.`
118         cc_vers_patch=`echo $cc_version | cut -f3 -d.`
119         test -n "$cc_vers_major" || cc_vers_major=0
120         test -n "$cc_vers_minor" || cc_vers_minor=0
121         test -n "$cc_vers_patch" || cc_vers_patch=0
122         cc_vers_all=`expr $cc_vers_major '*' 1000000 + $cc_vers_minor '*' 1000 + $cc_vers_patch`
124         if test $cc_vers_major -lt 3; then
125                 AC_MSG_ERROR([gcc >= 3.0 is needed to compile inkscape])
126         fi
127 fi
129 dnl ******************************
130 dnl Gettext stuff
131 dnl ******************************
132 GETTEXT_PACKAGE="AC_PACKAGE_NAME"
133 AC_SUBST(GETTEXT_PACKAGE)
134 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Translation domain used])
135 dnl Add the languages which your application supports here.
136 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 hy 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"
137 AM_GLIB_GNU_GETTEXT
139 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
140 if test "x$PKG_CONFIG" = "xno"; then
141         AC_MSG_ERROR(You have to install pkg-config to compile inkscape.)
142 fi
144 dnl Find msgfmt.  Without this, po/Makefile fails to set MSGFMT on some platforms.
145 AC_PATH_PROG(MSGFMT, msgfmt, msgfmt)
146 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
148 dnl ******************************
149 dnl Check for OpenMP 
150 dnl Replace this with AC_OPENMP once Autoconf 2.62 is widespread
151 dnl ******************************
152 AX_OPENMP([openmp_ok=yes],[openmp_ok=no])
153 if test "x$openmp_ok" = "xyes"; then
154         dnl We have it, now set up the flags
155         CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
156         AC_CHECK_HEADER(omp.h)
157 fi
159 dnl ******************************
160 dnl Check for libpng 
161 dnl ******************************
162 AC_CHECK_LIB(png, png_read_info, [AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=yes)], png_ok=no, -lz -lm)
163 if test "x$png_ok" != "xyes"; then
164         AC_MSG_ERROR([libpng >= 1.2 is needed to compile inkscape])
165 fi
167 dnl Handle possible dlopen requirement for libgc
168 dnl Isn't this internal to something in autoconf?  Couldn't find it...
169 AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], [AC_CHECK_FUNC([dlopen],
170           [lt_cv_dlopen="dlopen"],
171       [AC_CHECK_LIB([dl], [dlopen],
172             [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
173         [AC_CHECK_LIB([svld], [dlopen],
174               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
175           [AC_CHECK_LIB([dld], [dld_link],
176                 [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
177           ])
178         ])
179       ])
180     ])
182 AC_CHECK_HEADERS([gc.h gc/gc.h],
183                  [
184                     # To test for the different required libs, I have to
185                     # overcome autoconf's caching system, so I change the
186                     # desired function name.  They're all in libgc.
187                     # The "break" will exit from the top level
188                     # AC_CHECK_HEADERS.
189                     gc_libs=""
190                     AC_CHECK_LIB(gc, GC_init,
191                                  [gc_ok=yes;
192                                   LIBS="-lgc $gc_libs $LIBS";
193                                   break], [gc_ok=no], [$gc_libs])
194                     gc_libs="-lpthread"
195                     AC_CHECK_LIB(gc, GC_malloc,
196                                  [gc_ok=yes;
197                                   LIBS="-lgc $gc_libs $LIBS";
198                                   break], [gc_ok=no], [$gc_libs])
199                     gc_libs="$lt_cv_dlopen_libs"
200                     AC_CHECK_LIB(gc, GC_realloc,
201                                  [gc_ok=yes;
202                                   LIBS="-lgc $gc_libs $LIBS";
203                                   break], [gc_ok=no], [$gc_libs])
204                     gc_libs="-lpthread $lt_cv_dlopen_libs"
205                     AC_CHECK_LIB(gc, GC_free,
206                                  [gc_ok=yes;
207                                   LIBS="-lgc $gc_libs $LIBS";
208                                   break], [gc_ok=no], [$gc_libs])
209                     break],
210                  [gc_ok=no])
211 if test "x$gc_ok" = "xyes" && test "x$cross_compiling" = "xno" ; then 
212         AC_MSG_CHECKING([libgc version 6.4+])
213         AC_RUN_IFELSE(
214                 [AC_LANG_SOURCE([[
215                         #ifdef HAVE_GC_GC_H
216                         # include <gc/gc.h>
217                         #else
218                         # include <gc.h>
219                         #endif
220                         #include <stdio.h>
221                         extern unsigned GC_version;
222                         int main(void){
223                                 unsigned min = ((6 << 16) | (4 << 8) | 0);
224                                 printf("%d.%d.%d ",GC_version >> 16, (GC_version >> 8) & 0xFF, GC_version & 0xFF);
225                                 if (GC_version>=min) return 0;
226                                 return 1;
227                         }]])],
228                 [gc_ok=yes],
229                 [gc_ok=no]
230         )
231         AC_MSG_RESULT([$gc_ok])
232 fi
233 if test "x$gc_ok" != "xyes"; then
234         AC_MSG_ERROR([libgc (the Boehm Conservative Collector) 6.4+, is needed to compile inkscape -- http://www.hpl.hp.com/personal/Hans_Boehm/gc])
235 fi
237 dnl This check is to get a FIONREAD definition on Solaris 8
238 AC_CHECK_HEADERS([sys/filio.h])
241 AC_CHECK_HEADERS([malloc.h])
242 AC_CHECK_FUNCS([mallinfo], [
243         AC_CHECK_MEMBERS([struct mallinfo.usmblks,
244                           struct mallinfo.fsmblks,
245                           struct mallinfo.uordblks,
246                           struct mallinfo.fordblks,
247                           struct mallinfo.hblkhd],,,
248                          [#include <malloc.h>])
249 ])
251 AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
252 if test "x$FREETYPE_CONFIG" = "xno"; then
253         AC_MSG_ERROR([Cannot find freetype-config])
254 fi
255 FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
256 FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
257 AC_SUBST(FREETYPE_CFLAGS)
258 AC_SUBST(FREETYPE_LIBS)
260 dnl ******************************
261 dnl Win32
262 dnl ******************************
263 AC_MSG_CHECKING([for Win32 platform])
264 case "$host" in
265   *-*-mingw*)
266     platform_win32=yes
267     WIN32_CFLAGS="-mms-bitfields -DLIBXML_STATIC"
268     ;;
269   *)
270     platform_win32=no
271     ;;
272 esac
273 AC_MSG_RESULT([$platform_win32])
274 AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
275 AC_SUBST(WIN32_CFLAGS)
277 AC_MSG_CHECKING([for Solaris platform])
278 case "$host" in
279   *-solaris2.*)
280     platform_solaris=yes
281     solaris_version=`echo $host|sed -e 's/^.*-solaris2\.//' -e s'/\..*$//'`
282     CFLAGS="$CFLAGS -DSOLARIS=$solaris_version"
283     CXXFLAGS="$CXXFLAGS -DSOLARIS=$solaris_version"
284     ;;
285   *)
286     platform_solaris=no
287     ;;
288 esac
289 AC_MSG_RESULT([$platform_solaris])
290 AM_CONDITIONAL(PLATFORM_SOLARIS, test "$platform_solaris" = "yes")
292 dnl ******************************
293 dnl Xft checking
294 dnl ******************************
296 AC_ARG_WITH(xft,
297             AC_HELP_STRING([--with-xft], [use xft scalable font database (default is auto)]),
298             [with_xft=$withval], [with_xft=auto])
300 if test "x$with_xft" != "xno" ; then
301         dnl Test fontconfig package
302         PKG_CHECK_MODULES(XFT, fontconfig, xft_ok=yes, xft_ok=no)
303         if test "x$xft_ok" != "xyes"; then
304                 dnl test xft package
305                 PKG_CHECK_MODULES(XFT, xft, xft_ok=yes, xft_ok=no)
306                 if test "x$xft_ok" != "xyes"; then
307                         dnl Have to test xft presence
308                         AC_CHECK_HEADER(X11/Xft/Xft.h, xft_ok=yes, xft_ok=no)
309                         if test "x$xft_ok" != "xyes"; then
310                                 dnl No xft found
311                                 if test "x$with_xft" = "xyes"; then
312                                         dnl Xft was explicitly asked, so stop
313                                         AC_MSG_ERROR([--with-xft was specified, but appropriate development packages could not be found])
314                                 fi
315                         else
316                                 dnl Working Xft1
317                                 XFT_LIBS="-L/usr/X11R6/lib -lXft "
318                         fi
319                 fi
320         fi
321 else
322         dnl Asked to ignore xft
323         xft_ok=no
324 fi
326 AC_SUBST(XFT_CFLAGS)
327 AC_SUBST(XFT_LIBS)
329 AM_CONDITIONAL(USE_XFT, test "x$xft_ok" = "xyes")
330 if test "x$xft_ok" = "xyes"; then
331         AC_DEFINE(WITH_XFT, 1, [Use Xft font database])
332 fi
334 dnl ******************************
335 dnl pangoft2 for xft
336 dnl ******************************
338 if test "x$xft_ok" = "xyes"; then
339         PKG_CHECK_MODULES(PANGOFT2, pangoft2, pango_ok=yes, pango_ok=no)
340         if test "x$pango_ok" = "xyes"; then
341                 XFT_LIBS="$XFT_LIBS $PANGOFT2_LIBS"
342         fi
343 fi
346 dnl ******************************
347 dnl gnome vfs checking
348 dnl ******************************
350 AC_ARG_WITH(gnome-vfs,
351         AC_HELP_STRING([--with-gnome-vfs], [use gnome vfs for loading files]),
352         [with_gnome_vfs=$withval], [with_gnome_vfs=auto])
354 if test "x$with_gnome_vfs" = "xno"; then
355         dnl Asked to ignore gnome-vfs
356         gnome_vfs=no
357 else
358         dnl Have to test gnome-vfs presence
359         PKG_CHECK_MODULES(GNOME_VFS, gnome-vfs-2.0 >= 2.0, gnome_vfs=yes, gnome_vfs=no)
360         if test "x$gnome_vfs" != "xyes"; then
361                 dnl No gnome-vfs found
362                 if test "x$with_gnome_vfs" = "xyes"; then
363                         dnl Gnome-VFS was explicitly asked for, so stop
364                         AC_MSG_ERROR([--with-gnome-vfs was specified, but appropriate libgnomevfs development packages could not be found])
365                 else
366                         # gnome-vfs is no, tell us for the log file
367                         AC_MSG_RESULT($gnome_vfs)
368                 fi
369         fi
370 fi
372 AM_CONDITIONAL(USE_GNOME_VFS, test "x$gnome_vfs" = "xyes")
373 if test "x$gnome_vfs" = "xyes"; then
374         AC_DEFINE(WITH_GNOME_VFS, 1, [Use gnome vfs file load functionality])
375 fi
377 AC_SUBST(GNOME_VFS_CFLAGS)
378 AC_SUBST(GNOME_VFS_LIBS)
380 dnl ******************************
381 dnl libinkjar checking
382 dnl ******************************
384 AC_ARG_WITH(inkjar,
385         AC_HELP_STRING([--without-inkjar], [disable openoffice files (SVG jars)]),[with_ij=$withval], [with_ij=yes])
387 if test "x$with_ij" = "xyes"; then
388         AC_DEFINE(WITH_INKJAR, 1, [enable openoffice files (SVG jars)])
389         AC_C_BIGENDIAN
390         AC_CHECK_HEADERS(zlib.h)
391         ij=yes
392 else
393         ij=no
394 fi
395 AM_CONDITIONAL(INKJAR, test "$with_ij" = "yes")
397 ink_spell_pkg=
398 if pkg-config --exists gtkspell-2.0; then
399         ink_spell_pkg=gtkspell-2.0
400         AC_DEFINE(WITH_GTKSPELL, 1, [enable gtk spelling widget])
401 fi
403 dnl ******************************
404 dnl PERL checking
405 dnl ******************************
407 AC_MSG_CHECKING(for Perl development environment)
408 AC_ARG_WITH(perl,
409             AC_HELP_STRING([--with-perl], [use Perl for embedded scripting (EXPERIMENTAL)]),
410             [with_perl=$withval], [with_perl=skipped])
412 if test "x$with_perl" = "xyes"; then
413     checkPERL_CFLAGS=`perl -MExtUtils::Embed -e perl_inc 2>/dev/null`
414     if test "$?" -gt "0"; then
415         with_perl="no"
416     else
417         checkPERL_LIBS=`perl -MExtUtils::Embed -e ldopts 2>/dev/null`
418         if test "$?" -gt "0"; then
419             with_perl="no"
420         else
421             with_perl="yes"
422         fi
423     fi
424 fi
425 AC_MSG_RESULT([$with_perl])
426 if test "x$with_perl" = "xyes"; then
427     # Test that we actually have the perl libraries installed
428     oldCFLAGS="$CFLAGS"
429     oldLIBS="$LIBS"
430     CFLAGS="$CFLAGS $checkPERL_CFLAGS"
431     LIBS="$LIBS $checkPERL_LIBS"
432     AC_CHECK_FUNC([perl_parse],[
433         PERL_CFLAGS="$checkPERL_CFLAGS"
434         PERL_LIBS="$checkPERL_LIBS"
435         AC_DEFINE(WITH_PERL, 1, [use Perl for embedded scripting])
436         ],[
437         with_perl="no"
438         ])
439     CFLAGS="$oldCFLAGS"
440     LIBS="$oldLIBS"
441 fi
442 AM_CONDITIONAL(WITH_PERL, test "x$with_perl" = "xyes")
443 AC_SUBST(PERL_CFLAGS)
444 AC_SUBST(PERL_LIBS)
446 dnl ******************************
447 dnl Python checking
448 dnl ******************************
450 AC_MSG_CHECKING(for Python development environment)
451 AC_ARG_WITH(python,
452             AC_HELP_STRING([--with-python], [use Python for embedded scripting (EXPERIMENTAL)]),
453             [with_python=$withval], [with_python=skipped])
455 if test "x$with_python" = "xyes"; then
456     checkPYTHON_CFLAGS=`python -c "import distutils.sysconfig ; print '-I%s' % distutils.sysconfig.get_config_var('INCLUDEPY')" 2>/dev/null`
457     if test "$?" -gt "0"; then
458         with_python="no"
459     else
460         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`
461         if test "$?" -gt "0"; then
462             with_python="no"
463         else
464             with_python="yes"
465         fi
466     fi
467 fi
468 AC_MSG_RESULT([$with_python])
469 if test "x$with_python" = "xyes"; then
470     # Test that we actually have the python libraries installed
471     oldCFLAGS="$CFLAGS"
472     oldLIBS="$LIBS"
473     CFLAGS="$CFLAGS $checkPYTHON_CFLAGS"
474     LIBS="$LIBS $checkPYTHON_LIBS"
475     AC_CHECK_FUNC([Py_Initialize],[
476         PYTHON_CFLAGS="$checkPYTHON_CFLAGS"
477         PYTHON_LIBS="$checkPYTHON_LIBS"
478         AC_DEFINE(WITH_PYTHON, 1, [use Python for embedded scripting])
479         ],[
480         with_python="no"
481         ])
482     CFLAGS="$oldCFLAGS"
483     LIBS="$oldLIBS"
484 fi
485 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" = "xyes")
486 AC_SUBST(PYTHON_CFLAGS)
487 AC_SUBST(PYTHON_LIBS)
489 dnl ******************************
490 dnl LittleCms checking
491 dnl ******************************
493 AC_ARG_ENABLE(lcms,
494         AC_HELP_STRING([--enable-lcms], [enable LittleCms for color management]),
495         [enable_lcms=$enableval], [enable_lcms=yes])
497 if test "x$enable_lcms" = "xno"; then
498         dnl Asked to ignore LittleCms
499         lcms=no
500 else
501         dnl Have to test LittleCms presence
502         PKG_CHECK_MODULES(LCMS, lcms >= 1.13, lcms=yes, lcms=no)
503         if test "x$lcms" != "xyes"; then
504                 dnl No lcms found
505                 if test "x$enable_lcms" = "xyes"; then
506                         dnl LittleCms was explicitly asked for, so stop
507                         AC_MSG_ERROR([--enable-lcms was specified, but appropriate LittleCms development packages could not be found])
508                 else
509                         # lcms is no, tell us for the log file
510                         AC_MSG_RESULT($lcms)
511                 fi
512         else
513                 dnl Working lcms
514                 LIBS="$LIBS $LCMS_LIBS"
515                 AC_DEFINE(ENABLE_LCMS, 1, [Use LittleCms color management])
516         fi
517 fi
519 AC_SUBST(LCMS_CFLAGS)
520 AC_SUBST(LCMS_LIBS)
522 dnl ******************************
523 dnl Libpoppler checking
524 dnl ******************************
526 AC_ARG_ENABLE(poppler-cairo,
527         AC_HELP_STRING([--enable-poppler-cairo], [Enable libpoppler-cairo for rendering PDF preview]),
528         [enable_poppler_cairo=$enableval], [enable_poppler_cairo=yes])
530 POPPLER_CFLAGS=""
531 PKG_CHECK_MODULES(POPPLER, poppler >= 0.5.9, poppler=yes, poppler=no)
533 if test "x$poppler" = "xyes"; then
534         dnl Working libpoppler
535         POPPLER_LIBS="-lpoppler "
536         dnl Have to test libpoppler-glib presence
537         PKG_CHECK_MODULES(POPPLER_GLIB, poppler-glib >= 0.5.9, poppler_glib=yes, poppler_glib=no)
538         if test "x$poppler_glib" = "xyes"; then
539                 dnl Working libpoppler-glib found
540                 dnl Check whether the Cairo SVG backend is available
541                 PKG_CHECK_MODULES(CAIRO_SVG, cairo-svg, cairo_svg=yes, cairo_svg=no)
542                 if test "x$cairo_svg" = "xyes"; then
543                         POPPLER_LIBS="$POPPLER_LIBS -lpoppler-glib "
544                 fi
545         fi
546         if test "x$enable_poppler_cairo" = "xyes"; then
547                 dnl Have to test libpoppler-cairo presence for PDF preview
548                 dnl AC_CHECK_HEADER(Magick++.h, magick_ok=yes, magick_ok=no)
549                 PKG_CHECK_MODULES(POPPLER_CAIRO, poppler-cairo >= 0.5.9, poppler_cairo=yes, poppler_cairo=no)
550                 if test "x$poppler_glib" = "xyes" -a "x$poppler_cairo" = "xyes" -a \
551                         "x$cairo_svg" = "xno"
552                 then
553                         POPPLER_LIBS="$POPPLER_LIBS -lpoppler-glib "
554                 fi
555         fi
556 fi
558 if test "x$poppler" = "xyes"; then
559         LIBS="$LIBS $POPPLER_LIBS"
560         AC_DEFINE(HAVE_POPPLER, 1, [Use libpoppler for direct PDF import])
561 fi
562 if test "x$poppler_cairo" = "xyes" -a "x$poppler_glib" = "xyes"; then
563         AC_DEFINE(HAVE_POPPLER_CAIRO, 1, [Use libpoppler-cairo for rendering PDF preview])
564 fi
565 if test "x$poppler_glib" = "xyes" -a "x$cairo_svg" = "xyes"; then
566         AC_DEFINE(HAVE_POPPLER_GLIB, 1, [Use libpoppler-glib and Cairo-SVG for PDF import])
567 fi
568 AC_SUBST(POPPLER_CFLAGS)
569 AC_SUBST(POPPLER_LIBS)
571 PKG_CHECK_MODULES(POPPLERNEW, poppler >= 0.8.3, popplernew=yes, popplernew=no)
572 if test "x$popplernew" = "xyes"; then
573         AC_DEFINE(POPPLER_NEW_GFXFONT, 1, [Poppler version of GfxFont to use (0.8.3 or higher versions of Poppler)])
574 fi
576 dnl ******************************
577 dnl Inkboard dependency checking
578 dnl ******************************
580 dnl with_inkboard="no"
581 dnl with_inkboard_ssl="no"
583 dnl INKBOARD_CFLAGS=""
585 dnl AC_ARG_ENABLE(inkboard,
586 dnl             AS_HELP_STRING([--enable-inkboard], [enable Inkboard online whiteboard facility (disabled by default)]),
587 dnl        with_inkboard=$enableval,with_inkboard=no)
589 dnl if test "x$with_inkboard" = "xyes"; then
590 dnl             with_inkboard="yes"
591 dnl             AC_DEFINE(WITH_INKBOARD,1,[Build in Inkboard support])
592                 
593                 dnl Test for OpenSSL
594 dnl             PKG_CHECK_MODULES(INKBOARD, openssl, with_inkboard_ssl=yes, with_inkboard_ssl=no)
595 dnl             if test "x$with_inkboard_ssl" = "xyes"; then
596                         dnl OpenSSL found; enable SSL support in Pedro
597 dnl                     INKBOARD_CFLAGS="$INKBOARD_CFLAGS -DHAVE_SSL"
598 dnl                     RELAYTOOL([ssl], INKBOARD_LIBS, INKBOARD_CFLAGS, [inkboard_weak=yes])
599 dnl                     RELAYTOOL([crypto], INKBOARD_LIBS, INKBOARD_CFLAGS, [inkboard_weak=yes])
600 dnl                     AC_DEFINE(WITH_INKBOARD_SSL,1,[Build in SSL support for Inkboard])
601 dnl             fi
602 dnl else
603 dnl     with_inkboard="no"
604 dnl fi
606 dnl AM_CONDITIONAL(WITH_INKBOARD, test "x$with_inkboard" = "xyes")
607 dnl AC_SUBST(INKBOARD_LIBS)
608 dnl AC_SUBST(INKBOARD_CFLAGS)
610 dnl ******************************
611 dnl Check for libwpg for extension
612 dnl ******************************
614 PKG_CHECK_MODULES(LIBWPG, libwpg-0.1 libwpg-stream-0.1, with_libwpg=yes, with_libwpg=no)
615 if test "x$with_libwpg" = "xyes"; then
616         AC_DEFINE(WITH_LIBWPG,1,[Build in libwpg])
617 fi
618 AM_CONDITIONAL(WITH_LIBWPG, test "x$with_libwpg" = "xyes")
620 AC_SUBST(LIBWPG_LIBS)
621 AC_SUBST(LIBWPG_CFLAGS)
623 dnl ******************************
624 dnl Support doing a local install
625 dnl   (mostly for distcheck)
626 dnl ******************************
628 with_localinstall="no"
629 AC_ARG_ENABLE(localinstall, AS_HELP_STRING([--enable-localinstall], [install system files in the local path (for distcheck)]), with_localinstall=$enableval, with_localinstall=no)
631 dnl ******************************
632 dnl Check for dbus functionality
633 dnl ******************************
635 PKG_CHECK_MODULES(DBUS, dbus-glib-1, with_dbus=yes, with_dbus=no)
636 if test "x$with_dbus" = "xyes"; then
637         AC_DEFINE(WITH_DBUS,1,[Build in dbus])
638         if test "x$with_localinstall" = "xyes"; then
639                 DBUSSERVICEDIR="${datadir}/dbus-1/services/"
640         else
641                 DBUSSERVICEDIR=`$PKG_CONFIG --variable=session_bus_services_dir dbus-1`
642         fi
643         AC_SUBST(DBUSSERVICEDIR)
644 fi
645 AM_CONDITIONAL(WITH_DBUS, test "x$with_dbus" = "xyes")
647 AC_SUBST(DBUS_LIBS)
648 AC_SUBST(DBUS_CFLAGS)
650 dnl ******************************
651 dnl Check for ImageMagick Magick++ 
652 dnl ******************************
654 PKG_CHECK_MODULES(IMAGEMAGICK, ImageMagick++, magick_ok=yes, magick_ok=no)
655 if test "x$magick_ok" = "xyes"; then
656       AC_DEFINE(WITH_IMAGE_MAGICK,1,[Image Magick++ support for bitmap effects])
657 fi
658 AM_CONDITIONAL(USE_IMAGE_MAGICK, test "x$magick_ok" = "xyes")
660 AC_SUBST(IMAGEMAGICK_LIBS)
661 AC_SUBST(IMAGEMAGICK_CFLAGS)
663 dnl ***********************************************************************************************************
664 dnl Check for a Cairo version that implements user-fonts feature (with a stable API, that is cairo > 1.7.6),
665 dnl so that we conditionally add SVGFonts support
666 dnl ***********************************************************************************************************
668 PKG_CHECK_MODULES(CAIRO_USER_FONTS, cairo > 1.7.6, cairouserfonts=yes, cairouserfonts=no)
669 if test "x$cairouserfonts" = "xyes"; then
670        AC_DEFINE(ENABLE_SVG_FONTS, 1, [SVG Fonts should be used])
671 fi
673 dnl ******************************
674 dnl   Unconditional dependencies
675 dnl ******************************
677 dnl sigc++-2.0 >= 2.0.12: using "visit_each" not available in 2.0.10
678 if test $cc_vers_major -gt 3; then
679   min_sigc_version=2.0.12
680 else
681   min_sigc_version=2.0.11
682 fi
683 PKG_CHECK_MODULES(INKSCAPE, gdkmm-2.4  glibmm-2.4 giomm-2.4 gtkmm-2.4 >= 2.10.0  gtk+-2.0  libxml-2.0 >= 2.6.11  libxslt >= 1.0.15  cairo  sigc++-2.0 >= $min_sigc_version  $ink_spell_pkg  gthread-2.0 >= 2.0 libpng >= 1.2 gsl)
685 # Check for Apple Mac OS X Carbon framework
686 carbon_ok=no
687 AC_MSG_CHECKING([for Mac OS X Carbon support])
688 AC_TRY_CPP([
689 #include <Carbon/Carbon.h>
690 #include <CoreServices/CoreServices.h>
691 ], carbon_ok=yes)
692 AC_MSG_RESULT($carbon_ok)
693 if test "x$carbon_ok" = "xyes"; then
694   AC_DEFINE(HAVE_CARBON, 1, [define to 1 if Carbon is available])
695   CARBON_LDFLAGS="-framework Carbon"
696   AC_SUBST(CARBON_LDFLAGS)
697 fi
698 AM_CONDITIONAL(HAVE_CARBON, test "x$carbon_ok" = "xyes")
700 # Check for some boost header files
701 AC_CHECK_HEADERS([boost/concept_check.hpp], [], AC_MSG_ERROR([You need the boost package (e.g. libboost-dev)]))
703 PKG_CHECK_MODULES(CAIRO_PDF, cairo-pdf, cairo_pdf=yes, cairo_pdf=no)
704 if test "x$cairo_pdf" = "xyes"; then
705   AC_DEFINE(HAVE_CAIRO_PDF, 1, [Whether the Cairo PDF backend is available])
706 fi
708 dnl Shouldn't we test for libpng and libz?
709 if test "x$openmp_ok" = "xyes"; then
710         INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz -lgomp"
711 else
712         INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz"
713 fi
715 AC_CHECK_HEADER(popt.h,
716                 [INKSCAPE_LIBS="$INKSCAPE_LIBS -lpopt"],
717                 AC_MSG_ERROR([libpopt is required]))
719 dnl **************************
720 dnl Check for aspell 
721 dnl ******************************
722 AC_CHECK_LIB(aspell, new_aspell_config, [AC_CHECK_HEADER(aspell.h, aspell_ok=yes, aspell_ok=no)], aspell_ok=no, -lz -lm)
723 if test "x$aspell_ok" = "xyes"; then
724         AC_DEFINE(HAVE_ASPELL, 1, [Use aspell for built-in spellchecker])
725   INKSCAPE_LIBS="$INKSCAPE_LIBS -laspell"
726 else
727         AC_MSG_CHECKING([Aspell not found, spell checker will be disabled])
728 fi
730 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
731 sp_save_LIBS=$LIBS
732 LIBS="$LIBS $INKSCAPE_LIBS"
733 AC_CHECK_FUNCS(bind_textdomain_codeset)
734 dnl Check for gtk_window_fullscreen in gtk (>= 2.2)
735 AC_CHECK_FUNCS(gtk_window_set_default_icon_from_file)
736 AC_CHECK_FUNCS(gtk_window_fullscreen)
737 LIBS=$sp_save_LIBS
740 dnl Check for binary relocation support
741 dnl Hongli Lai <h.lai@chello.nl>
743 AC_ARG_ENABLE(binreloc,
744        [  --enable-binreloc       compile with binary relocation support],
745        enable_binreloc=$enableval,enable_binreloc=no)
747 AC_MSG_CHECKING(whether binary relocation support should be enabled)
748 if test "$enable_binreloc" = "yes"; then
749        AC_MSG_RESULT(yes)
750        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
751        if test -e /proc/self/maps; then
752                AC_MSG_RESULT(yes)
753        else
754                AC_MSG_RESULT(no)
755                AC_MSG_ERROR(/proc/self/maps is not available. Binary relocation cannot be enabled.)
756                enable_binreloc="no"
757        fi
759 elif test "$enable_binreloc" = "auto"; then
760        AC_MSG_RESULT(yes when available)
761        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
762        if test -e /proc/self/maps; then
763                AC_MSG_RESULT(yes)
764                enable_binreloc=yes
766                AC_MSG_CHECKING(whether everything is installed to the same prefix)
767                if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
768                        "$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
769                        "$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
770                then
771                        AC_MSG_RESULT(yes)
772                else
773                        AC_MSG_RESULT(no)
774                        AC_MSG_NOTICE(Binary relocation support will be disabled.)
775                        enable_binreloc=no
776                fi
778        else
779                AC_MSG_RESULT(no)
780                enable_binreloc=no
781        fi
783 elif test "$enable_binreloc" = "no"; then
784        AC_MSG_RESULT(no)
785 else
786        AC_MSG_RESULT(no (unknown value "$enable_binreloc"))
787        enable_binreloc=no
788 fi
789 AC_DEFINE(BR_PTHREADS,[0],[Use binreloc thread support?])
790 if test "$enable_binreloc" = "yes"; then
791    AC_DEFINE(ENABLE_BINRELOC,,[Use AutoPackage?])
792 fi
794 AC_ARG_ENABLE(osxapp,
795        [  --enable-osxapp         compile with OSX .app data dir paths],
796        enable_osxapp=$enableval,enable_osxapp=no)
797 if test "$enable_osxapp" = "yes"; then
798    AC_DEFINE(ENABLE_OSX_APP_LOCATIONS,,[Build with OSX .app data dir paths?])
799 fi
801 dnl ******************************
802 dnl   Reported by autoscan
803 dnl ******************************
804 AC_CHECK_FUNCS(pow)
805 # if we did not find pow(), see if it's in libm.
806 if test x"$ac_cv_func_pow" = x"no" ; then
807         AC_CHECK_LIB(m,pow)
808 fi
809 AC_CHECK_FUNCS(sqrt)
810 AC_CHECK_FUNCS(floor)
811 AC_CHECK_FUNCS(gettimeofday)
812 AC_CHECK_FUNCS(memmove)
813 AC_CHECK_FUNCS(memset)
814 AC_CHECK_FUNCS(mkdir)
815 AC_CHECK_FUNCS(strncasecmp)
816 AC_CHECK_FUNCS(strpbrk)
817 AC_CHECK_FUNCS(strrchr)
818 AC_CHECK_FUNCS(strspn)
819 AC_CHECK_FUNCS(strstr)
820 AC_CHECK_FUNCS(strtoul)
821 AC_CHECK_FUNCS(fpsetmask)
822 AC_CHECK_FUNCS(ecvt)
823 AC_CHECK_HEADERS(ieeefp.h)
824 AC_CHECK_HEADERS(fcntl.h)
825 AC_CHECK_HEADERS(libintl.h)
826 AC_CHECK_HEADERS(stddef.h)
827 AC_CHECK_HEADERS(sys/time.h)
828 AC_FUNC_STAT
829 AC_FUNC_STRFTIME
830 AC_FUNC_STRTOD
831 AC_HEADER_STAT
832 AC_HEADER_TIME
833 AC_STRUCT_TM
834 AC_TYPE_MODE_T
835 AC_TYPE_SIGNAL
837 dnl Work around broken gcc 3.3 (seen on OSX) where "ENABLE_NLS" isn't
838 dnl set correctly because the gettext function isn't noticed.
839 if test "$ac_cv_header_libintl_h" = "yes" &&
840    test "$ac_cv_func_bind_textdomain_codeset" = "yes"  &&
841    test "$gt_cv_func_have_gettext" != "yes"; then
842     AC_DEFINE(ENABLE_NLS)
843 fi
845 dnl ******************************
846 dnl   Compilation warnings
847 dnl ******************************
848 if test "$GXX" = "yes"; then
849   # Enable some warnings from g++.
851   # Rationale: a number of bugs in inkscape have been fixed by enabling g++
852   # warnings and addressing the produced warnings.  Usually the committing
853   # developer is the best person to address the warnings.
855   ink_svd_CXXFLAGS="$CXXFLAGS"
856   CXXFLAGS="-Wno-unused-parameter $CXXFLAGS"
857   # -Wno-unused-parameter isn't accepted by gcc 2.95.
858   AC_COMPILE_IFELSE([int dummy;
859 ], , CXXFLAGS="-Wno-unused $ink_svd_CXXFLAGS",)
860   # Note: At least one bug has been caught from unused parameter warnings,
861   # so it might be worth trying not to disable it.
862   # One way of selectively disabling the warnings (i.e. only where the
863   # programmer deliberately isn't using the parameter, e.g. for a callback)
864   # is to remove the parameter name (leaving just its type), as is done
865   # in src/seltrans.cpp:sp_seltrans_handle_event; this indicates that the
866   # programmer deliberately has an unused parameter (e.g. because it's used
867   # as a callback or similar function pointer use).
869   # Add even more stuff
870   CXXFLAGS="-Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch $CXXFLAGS"
872 fi
874 dnl ******************************
875 dnl   libinkscape
876 dnl ******************************
877 dnl
878 dnl AC_ARG_ENABLE(libinkscape, AC_HELP_STRING([--enable-libinkscape], [Compile dynamic library (experimental)]), [splib=$enableval], [splib=no])
879 dnl
880 dnl AM_CONDITIONAL(ENABLE_LIBINKSCAPE, test "x$splib" != "xno")
881 dnl
883 AC_SUBST(INKSCAPE_CFLAGS)
884 AC_SUBST(INKSCAPE_LIBS)
887 # Checks to see if we should compile in MMX support (there will be
888 # a runtime test when the code is actually run to see if it should
889 # be used - this just checks if we can compile it.)
891 # This code is partially taken from Mesa
893 dnl Let people disable the MMX optimization
894 AC_ARG_ENABLE(mmx, [  --disable-mmx     Don't use MMX optimization [default=auto]], enable_mmx="$enableval", enable_mmx=auto)
896 AC_MSG_CHECKING(for x86 platform)
897 case $host_cpu in
898   i386|i486|i586|i686|i786|k6|k7)
899     use_x86_asm=yes
900     ;;
901   *)
902     use_x86_asm=no
903 esac
904 AC_MSG_RESULT($use_x86_asm)
906 dnl Are we going to use MMX extensions
907 use_mmx_asm=no
909 AC_MSG_CHECKING(compiler support for MMX)
911 if test x$enable_mmx = xauto ; then
912   if test $use_x86_asm = yes; then
913     save_ac_ext=$ac_ext
914     ac_ext=S
915     
916     cp $srcdir/src/libnr/nr_mmx_R8G8B8A8_P_R8G8B8A8_P_A8_RGBAP.S conftest.S
917     if AC_TRY_EVAL(ac_compile); then
918         use_mmx_asm=yes
919     fi
920     dnl rm -f conftest.[oS]
922     ac_ext=$save_ac_ext
923   fi
925 dnl Enforce usage of MMX extensions
926 elif test x$enable_mmx = xyes ; then
927     use_mmx_asm=yes
928 else
929     use_mmx_asm=no
930 fi
932 if test $use_mmx_asm = yes; then
933         AC_DEFINE(WITH_MMX, 1, [Use MMX optimizations, if CPU supports it])
934         AC_MSG_RESULT(yes)
935 else
936         AC_MSG_RESULT(no)
937 fi
939 AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
941 dnl Define our data paths for config.h
942 AC_DEFINE_DIR([INKSCAPE_DATADIR], [datadir], [Base data directory])
943 AC_DEFINE_DIR([PACKAGE_LOCALE_DIR], [localedir], [Locatization directory])
945 AC_CONFIG_FILES([
946 Makefile
947 src/Makefile
948 src/check-header-compile
949 src/algorithms/makefile
950 src/application/makefile
951 src/bind/makefile
952 src/debug/makefile
953 src/dialogs/makefile
954 src/display/makefile
955 src/dom/makefile
956 src/extension/implementation/makefile
957 src/extension/internal/makefile
958 src/extension/makefile
959 src/extension/script/makefile
960 src/filters/makefile
961 src/helper/makefile
962 src/inkjar/makefile
963 src/io/makefile
964 src/libcroco/makefile
965 src/libgdl/makefile
966 src/libnr/makefile
967 src/libnrtype/makefile
968 src/libavoid/makefile
969 src/livarot/makefile
970 src/live_effects/makefile
971 src/live_effects/parameter/makefile
972 src/pedro/makefile
973 src/jabber_whiteboard/makefile
974 src/removeoverlap/makefile
975 src/svg/makefile
976 src/trace/makefile
977 src/traits/makefile
978 src/ui/cache/makefile
979 src/ui/dialog/makefile
980 src/ui/makefile
981 src/ui/view/makefile
982 src/ui/widget/makefile
983 src/util/makefile
984 src/widgets/makefile
985 src/xml/makefile
986 src/2geom/makefile
987 doc/Makefile
988 po/Makefile.in
989 share/Makefile
990 share/clipart/Makefile
991 share/examples/Makefile
992 share/extensions/Makefile
993 share/extensions/alphabet_soup/Makefile
994 share/extensions/Barcode/Makefile
995 share/extensions/Poly3DObjects/Makefile
996 share/extensions/test/Makefile
997 share/extensions/xaml2svg/Makefile
998 share/filters/Makefile
999 share/fonts/Makefile
1000 share/gradients/Makefile
1001 share/icons/Makefile
1002 share/icons/application/Makefile
1003 share/icons/application/16x16/Makefile
1004 share/icons/application/22x22/Makefile
1005 share/icons/application/24x24/Makefile
1006 share/icons/application/32x32/Makefile
1007 share/icons/application/48x48/Makefile
1008 share/icons/application/256x256/Makefile
1009 share/keys/Makefile
1010 share/markers/Makefile
1011 share/palettes/Makefile
1012 share/patterns/Makefile
1013 share/screens/Makefile
1014 share/templates/Makefile
1015 share/tutorials/Makefile
1016 share/ui/Makefile
1017 packaging/autopackage/default.apspec
1018 inkscape.spec
1019 Info.plist
1020 inkview.1
1021 ])
1023 AH_BOTTOM([
1026 ])
1028 AC_OUTPUT
1030 echo "
1031 Configuration:
1033         Source code location:     ${srcdir}
1034         Destination path prefix:  ${prefix}
1035         Compiler:                 ${CXX}
1036         CPPFLAGS:                 ${CPPFLAGS}
1037         CXXFLAGS:                 ${CXXFLAGS}
1038         CFLAGS:                   ${CFLAGS}
1039         LDFLAGS:                  ${LDFLAGS}
1041         Use Xft font database:    ${xft_ok}
1042         Use gnome-vfs:            ${gnome_vfs}
1043         Use openoffice files:     ${ij}
1044         Use MMX optimizations:    ${use_mmx_asm}
1045         Use relocation support:   ${enable_binreloc}
1046         Internal Python:          ${with_python}
1047         Internal Perl:            ${with_perl}
1048         Enable LittleCms:         ${enable_lcms}
1049         Enable DBUS               ${with_dbus} 
1050         Enable Poppler-Cairo:     ${enable_poppler_cairo}
1051         ImageMagick Magick++:     ${magick_ok}
1052         Libwpg:                   ${with_libwpg}
1053         Doing Local Install:      ${with_localinstall}