Code

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