Code

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