Code

committed patch 1702352 from John Faith.
[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.45+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
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 AC_MSG_NOTICE([Testing -Wno-pointer-sign])
37 if test "$GCC" = "yes"; then
38   # Enable some warnings from gcc.
40   AC_LANG_PUSH(C)
41   # -Wno-pointer-sign is probably new in gcc 4.0; certainly it isn't accepted
42   # by gcc 2.95.
43   ink_svd_CFLAGS="$CFLAGS"
44   CFLAGS="-Wno-pointer-sign $CFLAGS"
45   AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), AC_MSG_NOTICE([ compiler supports -Wno-pointer-sign]), CFLAGS="$ink_svd_CFLAGS")
46   CFLAGS="-Wall -Wformat-security -W -D_FORTIFY_SOURCE=2 $CFLAGS"
47   AC_LANG_POP
48 fi
50 dnl Honor aclocal flags
51 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
53 AC_PROG_RANLIB
55 dnl Verify our GCC version
56 if test "x$GXX" = "xyes"; then
57         AC_MSG_CHECKING([GNU compiler version])
59         # Don't pass CXXFLAGS to the following CXX command as some 
60         # of them can't be specified along with '-v'.
61         cc_version=["`$CXX -v 2>&1 </dev/null |grep 'gcc version' |\
62                 sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`"]
64         AC_MSG_RESULT([$cc_version])
66         # Some version numbers
67         cc_vers_major=`echo $cc_version | cut -f1 -d.`
68         cc_vers_minor=`echo $cc_version | cut -f2 -d.`
69         cc_vers_patch=`echo $cc_version | cut -f3 -d.`
70         test -n "$cc_vers_major" || cc_vers_major=0
71         test -n "$cc_vers_minor" || cc_vers_minor=0
72         test -n "$cc_vers_patch" || cc_vers_patch=0
73         cc_vers_all=`expr $cc_vers_major '*' 1000000 + $cc_vers_minor '*' 1000 + $cc_vers_patch`
75         if test $cc_vers_major -lt 3; then
76                 AC_MSG_ERROR([gcc >= 3.0 is needed to compile inkscape])
77         fi
78 fi
80 dnl ******************************
81 dnl Gettext stuff
82 dnl ******************************
83 GETTEXT_PACKAGE="AC_PACKAGE_NAME"
84 AC_SUBST(GETTEXT_PACKAGE)
85 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Translation domain used])
86 dnl Add the languages which your application supports here.
87 ALL_LINGUAS="am az be bg bn ca 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@Latn sr sv th tr uk vi zh_CN zh_TW"
88 AM_GLIB_GNU_GETTEXT
90 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
91 if test "x$PKG_CONFIG" = "xno"; then
92         AC_MSG_ERROR(You have to install pkg-config to compile inkscape.)
93 fi
95 dnl ******************************
96 dnl Check for libpng 
97 dnl ******************************
98 AC_CHECK_LIB(png, png_read_info, [AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)], png_ok=no, -lz -lm)
99 if test "x$png_ok" != "xyes"; then
100         AC_MSG_ERROR([libpng >= 1.2 is needed to compile inkscape])
101 fi
103 dnl Handle possible dlopen requirement for libgc
104 dnl Isn't this internal to something in autoconf?  Couldn't find it...
105 AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], [AC_CHECK_FUNC([dlopen],
106           [lt_cv_dlopen="dlopen"],
107       [AC_CHECK_LIB([dl], [dlopen],
108             [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
109         [AC_CHECK_LIB([svld], [dlopen],
110               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
111           [AC_CHECK_LIB([dld], [dld_link],
112                 [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
113           ])
114         ])
115       ])
116     ])
118 AC_CHECK_HEADERS([gc.h gc/gc.h],
119                  [
120                     # To test for the different required libs, I have to
121                     # overcome autoconf's caching system, so I change the
122                     # desired function name.  They're all in libgc.
123                     # The "break" will exit from the top level
124                     # AC_CHECK_HEADERS.
125                     gc_libs=""
126                     AC_CHECK_LIB(gc, GC_init,
127                                  [gc_ok=yes;
128                                   LIBS="-lgc $gc_libs $LIBS";
129                                   break], [gc_ok=no], [$gc_libs])
130                     gc_libs="-lpthread"
131                     AC_CHECK_LIB(gc, GC_malloc,
132                                  [gc_ok=yes;
133                                   LIBS="-lgc $gc_libs $LIBS";
134                                   break], [gc_ok=no], [$gc_libs])
135                     gc_libs="$lt_cv_dlopen_libs"
136                     AC_CHECK_LIB(gc, GC_realloc,
137                                  [gc_ok=yes;
138                                   LIBS="-lgc $gc_libs $LIBS";
139                                   break], [gc_ok=no], [$gc_libs])
140                     gc_libs="-lpthread $lt_cv_dlopen_libs"
141                     AC_CHECK_LIB(gc, GC_free,
142                                  [gc_ok=yes;
143                                   LIBS="-lgc $gc_libs $LIBS";
144                                   break], [gc_ok=no], [$gc_libs])
145                     break],
146                  [gc_ok=no])
147 if test "x$gc_ok" = "xyes"; then
148         AC_MSG_CHECKING([libgc version 6.4+])
149         AC_RUN_IFELSE(
150                 [AC_LANG_SOURCE([[
151                         #ifdef HAVE_GC_GC_H
152                         # include <gc/gc.h>
153                         #else
154                         # include <gc.h>
155                         #endif
156                         #include <stdio.h>
157                         extern unsigned GC_version;
158                         int main(void){
159                                 unsigned min = ((6 << 16) | (4 << 8) | 0);
160                                 printf("%d.%d.%d ",GC_version >> 16, (GC_version >> 8) & 0xFF, GC_version & 0xFF);
161                                 if (GC_version>=min) return 0;
162                                 return 1;
163                         }]])],
164                 [gc_ok=yes],
165                 [gc_ok=no]
166         )
167         AC_MSG_RESULT([$gc_ok])
168 fi
169 if test "x$gc_ok" != "xyes"; then
170         AC_MSG_ERROR([libgc (the Boehm Conservative Collector) 6.4+, is needed to compile inkscape -- http://www.hpl.hp.com/personal/Hans_Boehm/gc])
171 fi
173 dnl This check is to get a FIONREAD definition on Solaris 8
174 AC_CHECK_HEADERS([sys/filio.h])
177 AC_CHECK_HEADERS([malloc.h])
178 AC_CHECK_FUNCS([mallinfo], [
179         AC_CHECK_MEMBERS([struct mallinfo.usmblks,
180                           struct mallinfo.fsmblks,
181                           struct mallinfo.uordblks,
182                           struct mallinfo.fordblks,
183                           struct mallinfo.hblkhd],,,
184                          [#include <malloc.h>])
185 ])
187 AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
188 if test "x$FREETYPE_CONFIG" = "xno"; then
189         AC_MSG_ERROR([Cannot find freetype-config])
190 fi
191 FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
192 FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
193 AC_SUBST(FREETYPE_CFLAGS)
194 AC_SUBST(FREETYPE_LIBS)
196 dnl ******************************
197 dnl Win32
198 dnl ******************************
199 AC_MSG_CHECKING([for Win32 platform])
200 case "$host" in
201   *-*-mingw*)
202     platform_win32=yes
203     INKSCAPE_CFLAGS="$INKSCAPE_CFLAGS -mms-bitfields -DLIBXML_STATIC"
204     ;;
205   *)
206     platform_win32=no
207     ;;
208 esac
209 AC_MSG_RESULT([$platform_win32])
210 AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
212 AC_MSG_CHECKING([for Solaris 2.8 platform])
213 case "$host" in
214   *-solaris2.8)
215     platform_solaris_2_8=yes
216     CFLAGS="$CFLAGS -DSOLARIS_2_8"
217     CXXFLAGS="$CXXFLAGS -DSOLARIS_2_8"
218     ;;
219   *)
220     platform_solaris_2_8=no
221     ;;
222 esac
223 AC_MSG_RESULT([$platform_solaris_2_8])
224 AM_CONDITIONAL(PLATFORM_SOLARIS_2_8, test "$platform_solaris_2_8" = "yes")
226 dnl ******************************
227 dnl Xft checking
228 dnl ******************************
230 AC_ARG_WITH(xft,
231             AC_HELP_STRING([--with-xft], [use xft scalable font database (default is auto)]),
232             [with_xft=$withval], [with_xft=auto])
234 if test "x$with_xft" != "xno" ; then
235         dnl Test fontconfig package
236         PKG_CHECK_MODULES(XFT, xft, xft_ok=yes, xft_ok=no)
237         if test "x$xft_ok" != "xyes"; then
238                 dnl test xft package
239                 PKG_CHECK_MODULES(XFT, fontconfig, xft_ok=yes, xft_ok=no)
240                 if test "x$xft_ok" != "xyes"; then
241                         dnl Have to test xft presence
242                         AC_CHECK_HEADER(X11/Xft/Xft.h, xft_ok=yes, xft_ok=no)
243                         if test "x$xft_ok" != "xyes"; then
244                                 dnl No xft found
245                                 if test "x$with_xft" = "xyes"; then
246                                         dnl Xft was explicitly asked, so stop
247                                         AC_MSG_ERROR([--with-xft was specified, but appropriate development packages could not be found])
248                                 fi
249                         else
250                                 dnl Working Xft1
251                                 XFT_LIBS="-L/usr/X11R6/lib -lXft "
252                         fi
253                 fi
254         fi
255 else
256         dnl Asked to ignore xft
257         xft_ok=no
258 fi
260 AC_SUBST(XFT_CFLAGS)
261 AC_SUBST(XFT_LIBS)
263 AM_CONDITIONAL(USE_XFT, test "x$xft_ok" = "xyes")
264 if test "x$xft_ok" = "xyes"; then
265         AC_DEFINE(WITH_XFT, 1, [Use Xft font database])
266 fi
268 dnl ******************************
269 dnl pangoft2 for xft
270 dnl ******************************
272 if test "x$xft_ok" = "xyes"; then
273         PKG_CHECK_MODULES(PANGOFT2, pangoft2, pango_ok=yes, pango_ok=no)
274         if test "x$pango_ok" = "xyes"; then
275                 XFT_LIBS="$XFT_LIBS $PANGOFT2_LIBS"
276         fi
277 fi
279 dnl ******************************
280 dnl GnomePrint checking
281 dnl ******************************
283 AC_ARG_WITH(gnome-print,
284             AC_HELP_STRING([--with-gnome-print], [use gnome print font database and spooler frontend]),
285             [with_gp=$withval], [with_gp=auto])
287 if test "x$with_gp" = "xyes"; then
288         dnl Have to test gnome-print presence
289         PKG_CHECK_MODULES(GNOME_PRINT, libgnomeprint-2.2 >= 1.116.0  libgnomeprintui-2.2 >= 1.116.0, gp=yes, gp=no)
290         if test "x$gp" != "xyes"; then
291                 dnl No gnome-print found
292                 if test "x$with_gp" = "xyes"; then
293                         dnl Gnome-print was explicitly asked, so stop
294                         AC_MSG_ERROR([--with-gnome-print was specified, but appropriate libgnomeprint development packages could not be found])
295                 else 
296                         # gp is no, tell us for the log file 
297                         AC_MSG_RESULT($gp)
298                 fi
299         fi
300 else
301         dnl Asked to ignore gnome-print
302         gp=no
303 fi
305 AC_SUBST(GNOME_PRINT_CFLAGS)
306 AC_SUBST(GNOME_PRINT_LIBS)
308 AM_CONDITIONAL(USE_GNOME_PRINT, test "x$gp" = "xyes")
309 if test "x$gp" = "xyes"; then
310         AC_DEFINE(WITH_GNOME_PRINT, 1, [Use gnome print font database and spooler frontend])
311 fi
313 dnl ******************************
314 dnl gnome vfs checking
315 dnl ******************************
317 AC_ARG_WITH(gnome-vfs,
318         AC_HELP_STRING([--with-gnome-vfs], [use gnome vfs for loading files]),
319         [with_gnome_vfs=$withval], [with_gnome_vfs=auto])
321 if test "x$with_gnome_vfs" = "xno"; then
322         dnl Asked to ignore gnome-vfs
323         gnome_vfs=no
324 else
325         dnl Have to test gnome-vfs presence
326         PKG_CHECK_MODULES(GNOME_VFS, gnome-vfs-2.0 >= 2.0, gnome_vfs=yes, gnome_vfs=no)
327         if test "x$gnome_vfs" != "xyes"; then
328                 dnl No gnome-vfs found
329                 if test "x$with_gnome_vfs" = "xyes"; then
330                         dnl Gnome-VFS was explicitly asked for, so stop
331                         AC_MSG_ERROR([--with-gnome-vfs was specified, but appropriate libgnomevfs development packages could not be found])
332                 else
333                         # gnome-vfs is no, tell us for the log file
334                         AC_MSG_RESULT($gnome_vfs)
335                 fi
336         fi
337 fi
339 AM_CONDITIONAL(USE_GNOME_VFS, test "x$gnome_vfs" = "xyes")
340 if test "x$gnome_vfs" = "xyes"; then
341         AC_DEFINE(WITH_GNOME_VFS, 1, [Use gnome vfs file load functionality])
342 fi
344 AC_SUBST(GNOME_VFS_CFLAGS)
345 AC_SUBST(GNOME_VFS_LIBS)
347 dnl ******************************
348 dnl libinkjar checking
349 dnl ******************************
351 AC_ARG_WITH(inkjar,
352         AC_HELP_STRING([--without-inkjar], [disable openoffice files (SVG jars)]),[with_ij=$withval], [with_ij=yes])
354 if test "x$with_ij" = "xyes"; then
355         AC_DEFINE(WITH_INKJAR, 1, [enable openoffice files (SVG jars)])
356         AC_C_BIGENDIAN
357         AC_CHECK_HEADERS(zlib.h)
358         ij=yes
359 else
360         ij=no
361 fi
362 AM_CONDITIONAL(INKJAR, test "$with_ij" = "yes")
364 ink_spell_pkg=
365 if pkg-config --exists gtkspell-2.0; then
366         ink_spell_pkg=gtkspell-2.0
367         AC_DEFINE(WITH_GTKSPELL, 1, [enable gtk spelling widget])
368 fi
370 dnl ******************************
371 dnl PERL checking
372 dnl ******************************
374 AC_MSG_CHECKING(for Perl development environment)
375 AC_ARG_WITH(perl,
376             AC_HELP_STRING([--with-perl], [use Perl for embedded scripting (EXPERIMENTAL)]),
377             [with_perl=$withval], [with_perl=skipped])
379 if test "x$with_perl" = "xyes"; then
380     checkPERL_CFLAGS=`perl -MExtUtils::Embed -e perl_inc 2>/dev/null`
381     if test "$?" -gt "0"; then
382         with_perl="no"
383     else
384         checkPERL_LIBS=`perl -MExtUtils::Embed -e ldopts 2>/dev/null`
385         if test "$?" -gt "0"; then
386             with_perl="no"
387         else
388             with_perl="yes"
389         fi
390     fi
391 fi
392 AC_MSG_RESULT([$with_perl])
393 if test "x$with_perl" = "xyes"; then
394     # Test that we actually have the perl libraries installed
395     oldCFLAGS="$CFLAGS"
396     oldLIBS="$LIBS"
397     CFLAGS="$CFLAGS $checkPERL_CFLAGS"
398     LIBS="$LIBS $checkPERL_LIBS"
399     AC_CHECK_FUNC([perl_parse],[
400         PERL_CFLAGS="$checkPERL_CFLAGS"
401         PERL_LIBS="$checkPERL_LIBS"
402         AC_DEFINE(WITH_PERL, 1, [use Perl for embedded scripting])
403         ],[
404         with_perl="no"
405         ])
406     CFLAGS="$oldCFLAGS"
407     LIBS="$oldLIBS"
408 fi
409 AM_CONDITIONAL(WITH_PERL, test "x$with_perl" = "xyes")
410 AC_SUBST(PERL_CFLAGS)
411 AC_SUBST(PERL_LIBS)
413 dnl ******************************
414 dnl Python checking
415 dnl ******************************
417 AC_MSG_CHECKING(for Python development environment)
418 AC_ARG_WITH(python,
419             AC_HELP_STRING([--with-python], [use Python for embedded scripting (EXPERIMENTAL)]),
420             [with_python=$withval], [with_python=skipped])
422 if test "x$with_python" = "xyes"; then
423     checkPYTHON_CFLAGS=`python -c "import distutils.sysconfig ; print '-I%s' % distutils.sysconfig.get_config_var('INCLUDEPY')" 2>/dev/null`
424     if test "$?" -gt "0"; then
425         with_python="no"
426     else
427         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`
428         if test "$?" -gt "0"; then
429             with_python="no"
430         else
431             with_python="yes"
432         fi
433     fi
434 fi
435 AC_MSG_RESULT([$with_python])
436 if test "x$with_python" = "xyes"; then
437     # Test that we actually have the python libraries installed
438     oldCFLAGS="$CFLAGS"
439     oldLIBS="$LIBS"
440     CFLAGS="$CFLAGS $checkPYTHON_CFLAGS"
441     LIBS="$LIBS $checkPYTHON_LIBS"
442     AC_CHECK_FUNC([Py_Initialize],[
443         PYTHON_CFLAGS="$checkPYTHON_CFLAGS"
444         PYTHON_LIBS="$checkPYTHON_LIBS"
445         AC_DEFINE(WITH_PYTHON, 1, [use Python for embedded scripting])
446         ],[
447         with_python="no"
448         ])
449     CFLAGS="$oldCFLAGS"
450     LIBS="$oldLIBS"
451 fi
452 AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" = "xyes")
453 AC_SUBST(PYTHON_CFLAGS)
454 AC_SUBST(PYTHON_LIBS)
456 dnl ******************************
457 dnl LittleCms checking
458 dnl ******************************
460 AC_ARG_ENABLE(lcms,
461         AC_HELP_STRING([--enable-lcms], [enable LittleCms for color management]),
462         [enable_lcms=$enableval], [enable_lcms=yes])
464 if test "x$enable_lcms" = "xno"; then
465         dnl Asked to ignore LittleCms
466         lcms=no
467 else
468         dnl Have to test LittleCms presence
469         PKG_CHECK_MODULES(LCMS, lcms >= 1.13, lcms=yes, lcms=no)
470         if test "x$lcms" != "xyes"; then
471                 dnl No lcms found
472                 if test "x$enable_lcms" = "xyes"; then
473                         dnl LittleCms was explicitly asked for, so stop
474                         AC_MSG_ERROR([--enable-lcms was specified, but appropriate LittleCms development packages could not be found])
475                 else
476                         # lcms is no, tell us for the log file
477                         AC_MSG_RESULT($lcms)
478                 fi
479         else
480                 dnl Working lcms
481                 LCMS_LIBS="-llcms "
482         fi
483 fi
485 if test "x$lcms" = "xyes"; then
486         LIBS="$LIBS $LCMS_LIBS"
487         AC_DEFINE(ENABLE_LCMS, 1, [Use LittleCms color management])
488 fi
489 AM_CONDITIONAL(USE_LCMS, test "x$lcms" = "xyes")
490 AC_SUBST(LCMS_CFLAGS)
491 AC_SUBST(LCMS_LIBS)
493 dnl ******************************
494 dnl Inkboard dependency checking
495 dnl ******************************
497 with_inkboard="no"
498 with_inkboard_ssl="no"
500 INKBOARD_CFLAGS=""
502 AC_ARG_ENABLE(inkboard,
503                 AS_HELP_STRING([--enable-inkboard], [enable Inkboard online whiteboard facility (disabled by default)]),
504        with_inkboard=$enableval,with_inkboard=no)
506 if test "x$with_inkboard" = "xyes"; then
507                 with_inkboard="yes"
508                 AC_DEFINE(WITH_INKBOARD,1,[Build in Inkboard support])
509                 
510                 dnl Test for OpenSSL
511                 PKG_CHECK_MODULES(INKBOARD, openssl, with_inkboard_ssl=yes, with_inkboard_ssl=no)
512                 if test "x$with_inkboard_ssl" = "xyes"; then
513                         dnl OpenSSL found; enable SSL support in Pedro
514                         INKBOARD_CFLAGS="$INKBOARD_CFLAGS -DHAVE_SSL"
515                         RELAYTOOL([ssl], INKBOARD_LIBS, INKBOARD_CFLAGS, [inkboard_weak=yes])
516                         RELAYTOOL([crypto], INKBOARD_LIBS, INKBOARD_CFLAGS, [inkboard_weak=yes])
517                         AC_DEFINE(WITH_INKBOARD_SSL,1,[Build in SSL support for Inkboard])
518                 fi
519 else
520         with_inkboard="no"
521 fi
523 AM_CONDITIONAL(WITH_INKBOARD, test "x$with_inkboard" = "xyes")
524 AC_SUBST(INKBOARD_LIBS)
525 AC_SUBST(INKBOARD_CFLAGS)
527 dnl ******************************
528 dnl   Unconditional dependencies
529 dnl ******************************
531 dnl sigc++-2.0 >= 2.0.12: using "visit_each" not available in 2.0.10
532 if test $cc_vers_major -gt 3; then
533   min_sigc_version=2.0.12
534 else
535   min_sigc_version=2.0.11
536 fi
537 PKG_CHECK_MODULES(INKSCAPE, gdkmm-2.4  glibmm-2.4  gtkmm-2.4  gtk+-2.0 >= 2.8.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)
539 PKG_CHECK_MODULES(CAIRO_PDF, cairo-pdf, cairo_pdf=yes, cairo_pdf=no)
540 if test "x$cairo_pdf" = "xyes"; then
541   AC_DEFINE(HAVE_CAIRO_PDF, 1, [Whether the Cairo PDF backend is available])
542 fi
544 PKG_CHECK_MODULES(GTK_UNIX_PRINT, gtk+-unix-print-2.0, gtk_unix_print=yes, gtk_unix_print=no)
545 if test "x$gtk_unix_print" = "xyes"; then
546   AC_DEFINE(HAVE_GTK_UNIX_PRINT, 1, [Whether the GTK Unix printing backend is available])
547 fi
549 dnl Shouldn't we test for libpng and libz?
550 INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz"
552 AC_CHECK_HEADER(popt.h,
553                 [INKSCAPE_LIBS="$INKSCAPE_LIBS -lpopt"],
554                 AC_MSG_ERROR([libpopt is required]))
556 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
557 sp_save_LIBS=$LIBS
558 LIBS="$LIBS $INKSCAPE_LIBS"
559 AC_CHECK_FUNCS(bind_textdomain_codeset)
560 dnl Check for gtk_window_fullscreen in gtk (>= 2.2)
561 AC_CHECK_FUNCS(gtk_window_set_default_icon_from_file)
562 AC_CHECK_FUNCS(gtk_window_fullscreen)
563 LIBS=$sp_save_LIBS
566 dnl Check for binary relocation support
567 dnl Hongli Lai <h.lai@chello.nl>
569 AC_ARG_ENABLE(binreloc,
570        [  --enable-binreloc       compile with binary relocation support],
571        enable_binreloc=$enableval,enable_binreloc=no)
573 AC_MSG_CHECKING(whether binary relocation support should be enabled)
574 if test "$enable_binreloc" = "yes"; then
575        AC_MSG_RESULT(yes)
576        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
577        if test -e /proc/self/maps; then
578                AC_MSG_RESULT(yes)
579        else
580                AC_MSG_RESULT(no)
581                AC_MSG_ERROR(/proc/self/maps is not available. Binary relocation cannot be enabled.)
582                enable_binreloc="no"
583        fi
585 elif test "$enable_binreloc" = "auto"; then
586        AC_MSG_RESULT(yes when available)
587        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
588        if test -e /proc/self/maps; then
589                AC_MSG_RESULT(yes)
590                enable_binreloc=yes
592                AC_MSG_CHECKING(whether everything is installed to the same prefix)
593                if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
594                        "$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
595                        "$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
596                then
597                        AC_MSG_RESULT(yes)
598                else
599                        AC_MSG_RESULT(no)
600                        AC_MSG_NOTICE(Binary relocation support will be disabled.)
601                        enable_binreloc=no
602                fi
604        else
605                AC_MSG_RESULT(no)
606                enable_binreloc=no
607        fi
609 elif test "$enable_binreloc" = "no"; then
610        AC_MSG_RESULT(no)
611 else
612        AC_MSG_RESULT(no (unknown value "$enable_binreloc"))
613        enable_binreloc=no
614 fi
615 AC_DEFINE(BR_PTHREADS,[0],[Use binreloc thread support?])
616 if test "$enable_binreloc" = "yes"; then
617    AC_DEFINE(ENABLE_BINRELOC,,[Use AutoPackage?])
618 fi
620 AC_ARG_ENABLE(osxapp,
621        [  --enable-osxapp         compile with OSX .app data dir paths],
622        enable_osxapp=$enableval,enable_osxapp=no)
623 if test "$enable_osxapp" = "yes"; then
624    AC_DEFINE(ENABLE_OSX_APP_LOCATIONS,,[Build with OSX .app data dir paths?])
625 fi
627 dnl ******************************
628 dnl   Reported by autoscan
629 dnl ******************************
630 AC_CHECK_FUNCS(pow)
631 # if we did not find pow(), see if it's in libm.
632 if test x"$ac_cv_func_pow" = x"no" ; then
633         AC_CHECK_LIB(m,pow)
634 fi
635 AC_CHECK_FUNCS(sqrt)
636 AC_CHECK_FUNCS(floor)
637 AC_CHECK_FUNCS(gettimeofday)
638 AC_CHECK_FUNCS(memmove)
639 AC_CHECK_FUNCS(memset)
640 AC_CHECK_FUNCS(mkdir)
641 AC_CHECK_FUNCS(strncasecmp)
642 AC_CHECK_FUNCS(strpbrk)
643 AC_CHECK_FUNCS(strrchr)
644 AC_CHECK_FUNCS(strspn)
645 AC_CHECK_FUNCS(strstr)
646 AC_CHECK_FUNCS(strtoul)
647 AC_CHECK_FUNCS(fpsetmask)
648 AC_CHECK_FUNCS(ecvt)
649 AC_CHECK_HEADERS(ieeefp.h)
650 AC_CHECK_HEADERS(fcntl.h)
651 AC_CHECK_HEADERS(libintl.h)
652 AC_CHECK_HEADERS(stddef.h)
653 AC_CHECK_HEADERS(sys/time.h)
654 AC_FUNC_STAT
655 AC_FUNC_STRFTIME
656 AC_FUNC_STRTOD
657 AC_HEADER_STAT
658 AC_HEADER_TIME
659 AC_STRUCT_TM
660 AC_TYPE_MODE_T
661 AC_TYPE_SIGNAL
663 dnl Work around broken gcc 3.3 (seen on OSX) where "ENABLE_NLS" isn't
664 dnl set correctly because the gettext function isn't noticed.
665 if test "$ac_cv_header_libintl_h" = "yes" &&
666    test "$ac_cv_func_bind_textdomain_codeset" = "yes"  &&
667    test "$gt_cv_func_have_gettext" != "yes"; then
668     AC_DEFINE(ENABLE_NLS)
669 fi
671 dnl ******************************
672 dnl   Compilation warnings
673 dnl ******************************
674 if test "$GXX" = "yes"; then
675   # Enable some warnings from g++.
677   # Rationale: a number of bugs in inkscape have been fixed by enabling g++
678   # warnings and addressing the produced warnings.  Usually the committing
679   # developer is the best person to address the warnings.
681   ink_svd_CXXFLAGS="$CXXFLAGS"
682   CXXFLAGS="-Wno-unused-parameter $CXXFLAGS"
683   # -Wno-unused-parameter isn't accepted by gcc 2.95.
684   AC_COMPILE_IFELSE([int dummy;
685 ], , CXXFLAGS="-Wno-unused $ink_svd_CXXFLAGS",)
686   # Note: At least one bug has been caught from unused parameter warnings,
687   # so it might be worth trying not to disable it.
688   # One way of selectively disabling the warnings (i.e. only where the
689   # programmer deliberately isn't using the parameter, e.g. for a callback)
690   # is to remove the parameter name (leaving just its type), as is done
691   # in src/seltrans.cpp:sp_seltrans_handle_event; this indicates that the
692   # programmer deliberately has an unused parameter (e.g. because it's used
693   # as a callback or similar function pointer use).
695   CXXFLAGS="-Wall -Wformat-security -W -Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch -D_FORTIFY_SOURCE=2 $CXXFLAGS"
697   dnl Test for arch-specific situations.
698   case "$host_cpu" in
699     mips|mipsel)
700       dnl Symbol tables can get too large: this uses alternate tables
701       dnl See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=283476
702       CXXFLAGS="$CXXFLAGS -Wa,-xgot"
703       CFLAGS="$CFLAGS -Wa,-xgot"
704       ;;
705   esac
706 fi
708 AC_DEFINE(WITH_MODULES, 1, [Use experimental module support])
710 dnl ******************************
711 dnl   libinkscape
712 dnl ******************************
713 dnl
714 dnl AC_ARG_ENABLE(libinkscape, AC_HELP_STRING([--enable-libinkscape], [Compile dynamic library (experimental)]), [splib=$enableval], [splib=no])
715 dnl
716 dnl AM_CONDITIONAL(ENABLE_LIBINKSCAPE, test "x$splib" != "xno")
717 dnl
719 AC_SUBST(INKSCAPE_CFLAGS)
720 AC_SUBST(INKSCAPE_LIBS)
723 # Checks to see if we should compile in MMX support (there will be
724 # a runtime test when the code is actually run to see if it should
725 # be used - this just checks if we can compile it.)
727 # This code is partially taken from Mesa
729 dnl Let people disable the MMX optimization
730 AC_ARG_ENABLE(mmx, [  --disable-mmx     Don't use MMX optimization [default=auto]], enable_mmx="$enableval", enable_mmx=auto)
732 AC_MSG_CHECKING(for x86 platform)
733 case $host_cpu in
734   i386|i486|i586|i686|i786|k6|k7)
735     use_x86_asm=yes
736     ;;
737   *)
738     use_x86_asm=no
739 esac
740 AC_MSG_RESULT($use_x86_asm)
742 dnl Are we going to use MMX extensions
743 use_mmx_asm=no
745 AC_MSG_CHECKING(compiler support for MMX)
747 if test x$enable_mmx = xauto ; then
748   if test $use_x86_asm = yes; then
749     save_ac_ext=$ac_ext
750     ac_ext=S
751     
752     cp $srcdir/src/libnr/nr_mmx_R8G8B8A8_P_R8G8B8A8_P_A8_RGBAP.S conftest.S
753     if AC_TRY_EVAL(ac_compile); then
754         use_mmx_asm=yes
755     fi
756     dnl rm -f conftest.[oS]
758     ac_ext=$save_ac_ext
759   fi
761 dnl Enforce usage of MMX extensions
762 elif test x$enable_mmx = xyes ; then
763     use_mmx_asm=yes
764 else
765     use_mmx_asm=no
766 fi
768 if test $use_mmx_asm = yes; then
769         AC_DEFINE(WITH_MMX, 1, [Use MMX optimizations, if CPU supports it])
770         AC_MSG_RESULT(yes)
771 else
772         AC_MSG_RESULT(no)
773 fi
775 AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
777 dnl Figure out where the datadir actually is
778 dnl http://autoconf-archive.cryp.to/ac_define_dir.html
779 prefix_NONE=
780 exec_prefix_NONE=
781 test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
782 test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
783 dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
784 dnl refers to ${prefix}.  Thus we have to use `eval' twice.
785 eval runtime_datadir="${datadir}"
786 eval runtime_datadir="${runtime_datadir}"
787 test "$prefix_NONE" && prefix=NONE
788 test "$exec_prefix_NONE" && exec_prefix=NONE
790 inkscape_sharedir="${runtime_datadir}/${PACKAGE_NAME}"
792 dnl Define our data paths for config.h
793 AC_SUBST(INKSCAPE_DATADIR)
794 AC_DEFINE_UNQUOTED([INKSCAPE_DATADIR], "${runtime_datadir}",
795                                         [Base data directory -- only path-prefix.h should use it!])
796 AC_SUBST(PACKAGE_LOCALE_DIR)
797 AC_DEFINE_UNQUOTED([PACKAGE_LOCALE_DIR], "${runtime_datadir}/locale",
798                                         [Localization directory])
799 AC_SUBST(INKSCAPE_LIBDIR)
800 AC_DEFINE_UNQUOTED([INKSCAPE_LIBDIR], "${prefix}/lib",
801                                         [Base library directory -- only path-prefix.h should use it!])
803 dnl Have to add module makefiles (lauris)
805 AC_CONFIG_FILES([
806 Makefile
807 src/Makefile
808 src/check-header-compile
809 src/algorithms/makefile
810 src/application/makefile
811 src/debug/makefile
812 src/dialogs/makefile
813 src/display/makefile
814 src/dom/makefile
815 src/extension/implementation/makefile
816 src/extension/internal/makefile
817 src/extension/makefile
818 src/extension/script/makefile
819 src/helper/makefile
820 src/inkjar/makefile
821 src/io/makefile
822 src/libcroco/makefile
823 src/libnr/makefile
824 src/libnrtype/makefile
825 src/libavoid/makefile
826 src/livarot/makefile
827 src/pedro/makefile
828 src/jabber_whiteboard/makefile
829 src/removeoverlap/makefile
830 src/svg/makefile
831 src/trace/makefile
832 src/traits/makefile
833 src/ui/cache/makefile
834 src/ui/dialog/makefile
835 src/ui/makefile
836 src/ui/view/makefile
837 src/ui/widget/makefile
838 src/utest/makefile
839 src/util/makefile
840 src/widgets/makefile
841 src/xml/makefile
842 doc/Makefile
843 po/Makefile.in
844 share/Makefile
845 share/clipart/Makefile
846 share/examples/Makefile
847 share/extensions/Makefile
848 share/extensions/Barcode/Makefile
849 share/fonts/Makefile
850 share/gradients/Makefile
851 share/icons/Makefile
852 share/keys/Makefile
853 share/markers/Makefile
854 share/palettes/Makefile
855 share/patterns/Makefile
856 share/screens/Makefile
857 share/templates/Makefile
858 share/tutorials/Makefile
859 share/ui/Makefile
860 packaging/autopackage/default.apspec
861 inkscape.spec
862 Info.plist
863 inkview.1
864 ])
866 AH_BOTTOM([
869 ])
871 AC_OUTPUT
873 echo "
874 Configuration:
876         Source code location:     ${srcdir}
877         Destination path prefix:  ${prefix}
878         Compiler:                 ${CXX}
879         CPPFLAGS:                 ${CPPFLAGS}
880         CXXFLAGS:                 ${CXXFLAGS}
881         CFLAGS:                   ${CFLAGS}
882         LDFLAGS:                  ${LDFLAGS}
884         Use Xft font database:    ${xft_ok}
885         Use gnome-vfs:            ${gnome_vfs}
886         Use openoffice files:     ${ij}
887         Use MMX optimizations:    ${use_mmx_asm}
888         Use relocation support:   ${enable_binreloc}
889         Internal Python:          ${with_python}
890         Internal Perl:            ${with_perl}
891         Enable LittleCms:         ${enable_lcms}
892         Enable Inkboard:          ${with_inkboard}
893         Enable SSL in Inkboard:   ${with_inkboard_ssl}