Code

applying patch #1368738 from yselkowitz
[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+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 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 mk nb nl nn pa pl pt pt_BR ru sk sl sr sr@Latn sv tr uk zh_CN"
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 native Win32])
183 case "$host" in
184   *-*-mingw*)
185     os_win32=yes
186     INKSCAPE_CFLAGS="$INKSCAPE_CFLAGS -mms-bitfields -DLIBXML_STATIC"
187     ;;
188   *)
189     os_win32=no
190     ;;
191 esac
192 AC_MSG_RESULT([$os_win32])
193 AM_CONDITIONAL(OS_WIN32, test "$os_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]),
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_LIBS=`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     oldLIBS="$LIBS"
366     CFLAGS="$CFLAGS $checkPERL_CFLAGS"
367     LIBS="$LIBS $checkPERL_LIBS"
368     AC_CHECK_FUNC([perl_parse],[
369         PERL_CFLAGS="$checkPERL_CFLAGS"
370         PERL_LIBS="$checkPERL_LIBS"
371         AC_DEFINE(WITH_PERL, 1, [use Perl for embedded scripting])
372         ],[
373         with_perl="no"
374         ])
375     CFLAGS="$oldCFLAGS"
376     LIBS="$oldLIBS"
377 fi
378 AM_CONDITIONAL(WITH_PERL, test "x$with_perl" = "xyes")
379 AC_SUBST(PERL_CFLAGS)
380 AC_SUBST(PERL_LIBS)
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]),
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('LDLIBRARY'),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 Inkboard dependency checking
427 dnl ******************************
429 with_inkboard="no"
431 AC_MSG_CHECKING(for loudmouth-1.0+)
433 AC_ARG_ENABLE(inkboard,
434                 AS_HELP_STRING([--enable-inkboard], [enable Inkboard online whiteboard facility (disabled by default)]),
435        with_inkboard=$enableval,with_inkboard=no)
437 if test "x$with_inkboard" = "xyes"; then
438         PKG_CHECK_MODULES(LIBLOUDMOUTH, loudmouth-1.0, loudmouth_ok=yes, loudmouth_ok=no)
439         if test "x$loudmouth_ok" = "xyes"; then
440                 with_inkboard="yes"
441                 AC_DEFINE(WITH_INKBOARD,1,[Build in Inkboard support])
442         else
443                 with_inkboard="no"
444         fi
445 else
446         with_inkboard="no"
447 fi
449 AC_MSG_RESULT($with_inkboard)
450 AM_CONDITIONAL(WITH_INKBOARD, test "x$with_inkboard" = "xyes")
451 AC_SUBST(LIBLOUDMOUTH_CFLAGS)
452 AC_SUBST(LIBLOUDMOUTH_LIBS)
454 dnl ******************************
455 dnl   Unconditional dependencies
456 dnl ******************************
458 dnl *** NOTE: when we move to gtk 2.6 or later, we can remove the 
459 dnl ********* the override for g_ascii_strtod below...
460 PKG_CHECK_MODULES(INKSCAPE, gdkmm-2.4  glibmm-2.4  gtkmm-2.4  gtk+-2.0 >= 2.4.0  libxml-2.0 >= 2.6.0  libxslt >= 1.0.15  sigc++-2.0 >= 2.0.3  $ink_spell_pkg  gthread-2.0 >= 2.0)
462 dnl Shouldn't we test for libpng and libz?
463 INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz"
465 AC_CHECK_HEADER(popt.h,
466                 [INKSCAPE_LIBS="$INKSCAPE_LIBS -lpopt"],
467                 AC_MSG_ERROR([libpopt is required]))
469 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
470 sp_save_LIBS=$LIBS
471 LIBS="$LIBS $INKSCAPE_LIBS"
472 AC_CHECK_FUNCS(bind_textdomain_codeset)
473 dnl Check for gtk_window_fullscreen in gtk (>= 2.2)
474 AC_CHECK_FUNCS(gtk_window_set_default_icon_from_file)
475 AC_CHECK_FUNCS(gtk_window_fullscreen)
476 LIBS=$sp_save_LIBS
479 dnl Check for binary relocation support
480 dnl Hongli Lai <h.lai@chello.nl>
482 AC_ARG_ENABLE(binreloc,
483        [  --enable-binreloc       compile with binary relocation support],
484        enable_binreloc=$enableval,enable_binreloc=no)
486 AC_MSG_CHECKING(whether binary relocation support should be enabled)
487 if test "$enable_binreloc" = "yes"; then
488        AC_MSG_RESULT(yes)
489        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
490        if test -e /proc/self/maps; then
491                AC_MSG_RESULT(yes)
492        else
493                AC_MSG_RESULT(no)
494                AC_MSG_ERROR(/proc/self/maps is not available. Binary relocation cannot be enabled.)
495                enable_binreloc="no"
496        fi
498 elif test "$enable_binreloc" = "auto"; then
499        AC_MSG_RESULT(yes when available)
500        AC_MSG_CHECKING(for linker mappings at /proc/self/maps)
501        if test -e /proc/self/maps; then
502                AC_MSG_RESULT(yes)
503                enable_binreloc=yes
505                AC_MSG_CHECKING(whether everything is installed to the same prefix)
506                if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
507                        "$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
508                        "$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
509                then
510                        AC_MSG_RESULT(yes)
511                else
512                        AC_MSG_RESULT(no)
513                        AC_MSG_NOTICE(Binary relocation support will be disabled.)
514                        enable_binreloc=no
515                fi
517        else
518                AC_MSG_RESULT(no)
519                enable_binreloc=no
520        fi
522 elif test "$enable_binreloc" = "no"; then
523        AC_MSG_RESULT(no)
524 else
525        AC_MSG_RESULT(no (unknown value "$enable_binreloc"))
526        enable_binreloc=no
527 fi
528 AC_DEFINE(BR_PTHREADS,[0],[Use binreloc thread support?])
529 if test "$enable_binreloc" = "yes"; then
530    AC_DEFINE(ENABLE_BINRELOC,,[Use AutoPackage?])
531 fi
533 AC_ARG_ENABLE(osxapp,
534        [  --enable-osxapp         compile with OSX .app data dir paths],
535        enable_osxapp=$enableval,enable_osxapp=no)
536 if test "$enable_osxapp" = "yes"; then
537    AC_DEFINE(ENABLE_OSX_APP_LOCATIONS,,[Build with OSX .app data dir paths?])
538 fi
540 dnl ******************************
541 dnl   Reported by autoscan
542 dnl ******************************
543 AC_CHECK_FUNCS(pow)
544 # if we did not find pow(), see if it's in libm.
545 if test x"$ac_cv_func_pow" = x"no" ; then
546         AC_CHECK_LIB(m,pow)
547 fi
548 AC_CHECK_FUNCS(sqrt)
549 AC_CHECK_FUNCS(floor)
550 AC_CHECK_FUNCS(gettimeofday)
551 AC_CHECK_FUNCS(memmove)
552 AC_CHECK_FUNCS(memset)
553 AC_CHECK_FUNCS(mkdir)
554 AC_CHECK_FUNCS(strncasecmp)
555 AC_CHECK_FUNCS(strpbrk)
556 AC_CHECK_FUNCS(strrchr)
557 AC_CHECK_FUNCS(strspn)
558 AC_CHECK_FUNCS(strstr)
559 AC_CHECK_FUNCS(strtoul)
560 AC_CHECK_FUNCS(fpsetmask)
561 AC_CHECK_FUNCS(ecvt)
562 AC_CHECK_HEADERS(ieeefp.h)
563 AC_CHECK_HEADERS(fcntl.h)
564 AC_CHECK_HEADERS(libintl.h)
565 AC_CHECK_HEADERS(stddef.h)
566 AC_CHECK_HEADERS(sys/time.h)
567 AC_FUNC_STAT
568 AC_FUNC_STRFTIME
569 AC_FUNC_STRTOD
570 AC_HEADER_STAT
571 AC_HEADER_TIME
572 AC_STRUCT_TM
573 AC_TYPE_MODE_T
574 AC_TYPE_SIGNAL
576 dnl Work around broken gcc 3.3 (seen on OSX) where "ENABLE_NLS" isn't
577 dnl set correctly because the gettext function isn't noticed.
578 if test "$ac_cv_header_libintl_h" = "yes" &&
579    test "$ac_cv_func_bind_textdomain_codeset" = "yes"  &&
580    test "$gt_cv_func_have_gettext" != "yes"; then
581     AC_DEFINE(ENABLE_NLS)
582 fi
584 dnl ******************************
585 dnl   Compilation warnings
586 dnl ******************************
587 if test "$GXX" = "yes"; then
588   # Enable some warnings from g++.
590   # Rationale: a number of bugs in inkscape have been fixed by enabling g++
591   # warnings and addressing the produced warnings.  Usually the committing
592   # developer is the best person to address the warnings.
594   ink_svd_CXXFLAGS="$CXXFLAGS"
595   CXXFLAGS="-Wno-unused-parameter $CXXFLAGS"
596   # -Wno-unused-parameter isn't accepted by gcc 2.95.
597   AC_COMPILE_IFELSE([int dummy;
598 ], , CXXFLAGS="-Wno-unused $ink_svd_CXXFLAGS",)
599   # Note: At least one bug has been caught from unused parameter warnings,
600   # so it might be worth trying not to disable it.
601   # One way of selectively disabling the warnings (i.e. only where the
602   # programmer deliberately isn't using the parameter, e.g. for a callback)
603   # is to remove the parameter name (leaving just its type), as is done
604   # in src/seltrans.cpp:sp_seltrans_handle_event; this indicates that the
605   # programmer deliberately has an unused parameter (e.g. because it's used
606   # as a callback or similar function pointer use).
608   CXXFLAGS="-Wall -W -Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch  $CXXFLAGS"
610   dnl Test for arch-specific situations.
611   case "$host_cpu" in
612     mips|mipsel)
613       dnl Symbol tables can get too large: this uses alternate tables
614       dnl See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=283476
615       CXXFLAGS="$CXXFLAGS -Wa,-xgot"
616       CFLAGS="$CFLAGS -Wa,-xgot"
617       ;;
618   esac
619 fi
621 dnl ******************************
622 dnl   Plugin Support
623 dnl ******************************
624 dnl
625 dnl UPDATE: This is unconditional now (Lauris)
626 dnl
627 dnl AC_ARG_WITH(modules, AC_HELP_STRING([--with-modules], [Compile with plugin support (experimental)]), [mod=$withval], [mod=yes])
628 dnl
629 dnl AM_CONDITIONAL(USE_MODULES, test "x$mod" = "xyes")
630 dnl if test "x$mod" = "xyes"; then
631 dnl     AC_DEFINE(WITH_MODULES, 1, [Use experimental module support])
632 dnl fi
634 AC_DEFINE(WITH_MODULES, 1, [Use experimental module support])
636 dnl ******************************
637 dnl   libinkscape
638 dnl ******************************
639 dnl
640 dnl AC_ARG_ENABLE(libinkscape, AC_HELP_STRING([--enable-libinkscape], [Compile dynamic library (experimental)]), [splib=$enableval], [splib=no])
641 dnl
642 dnl AM_CONDITIONAL(ENABLE_LIBINKSCAPE, test "x$splib" != "xno")
643 dnl
645 AC_SUBST(INKSCAPE_CFLAGS)
646 AC_SUBST(INKSCAPE_LIBS)
649 # Checks to see if we should compile in MMX support (there will be
650 # a runtime test when the code is actually run to see if it should
651 # be used - this just checks if we can compile it.)
653 # This code is partially taken from Mesa
655 dnl Let people disable the MMX optimization
656 AC_ARG_ENABLE(mmx, [  --disable-mmx     Don't use MMX optimization [default=auto]], enable_mmx="$enableval", enable_mmx=auto)
658 AC_MSG_CHECKING(for x86 platform)
659 case $host_cpu in
660   i386|i486|i586|i686|i786|k6|k7)
661     use_x86_asm=yes
662     ;;
663   *)
664     use_x86_asm=no
665 esac
666 AC_MSG_RESULT($use_x86_asm)
668 dnl Are we going to use MMX extensions
669 use_mmx_asm=no
671 AC_MSG_CHECKING(compiler support for MMX)
673 if test x$enable_mmx = xauto ; then
674   if test $use_x86_asm = yes; then
675     save_ac_ext=$ac_ext
676     ac_ext=S
677     
678     cp $srcdir/src/libnr/nr_mmx_R8G8B8A8_P_R8G8B8A8_P_A8_RGBAP.S conftest.S
679     if AC_TRY_EVAL(ac_compile); then
680         use_mmx_asm=yes
681     fi
682     dnl rm -f conftest.[oS]
684     ac_ext=$save_ac_ext
685   fi
687 dnl Enforce usage of MMX extensions
688 elif test x$enable_mmx = xyes ; then
689     use_mmx_asm=yes
690 else
691     use_mmx_asm=no
692 fi
694 if test $use_mmx_asm = yes; then
695         AC_DEFINE(WITH_MMX, 1, [Use MMX optimizations, if CPU supports it])
696         AC_MSG_RESULT(yes)
697 else
698         AC_MSG_RESULT(no)
699 fi
701 AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
703 dnl Override the default g_ascii_strtod
704 AC_DEFINE(g_ascii_strtod, fixed_g_ascii_strtod, [Pre-1.107 gstrfuncs.c version of g_ascii_strtod is broken])
706 dnl Figure out where the datadir actually is
707 if test "x${datadir}" = 'x${prefix}/share'; then
708   if test "x${prefix}" = "xNONE"; then
709     runtime_datadir="${ac_default_prefix}/share"
710   else
711     runtime_datadir="${prefix}/share"
712   fi
713 else
714   runtime_datadir="${datadir}"
715 fi
717 inkscape_sharedir="${runtime_datadir}/${PACKAGE_NAME}"
719 dnl Define our data paths for config.h
720 AC_SUBST(INKSCAPE_DATADIR)
721 AC_DEFINE_UNQUOTED([INKSCAPE_DATADIR], "${runtime_datadir}",
722                                         [Base data directory -- only path-prefix.h should use it!])
723 AC_SUBST(PACKAGE_LOCALE_DIR)
724 AC_DEFINE_UNQUOTED([PACKAGE_LOCALE_DIR], "${runtime_datadir}/locale",
725                                         [Localization directory])
726 AC_SUBST(INKSCAPE_LIBDIR)
727 AC_DEFINE_UNQUOTED([INKSCAPE_LIBDIR], "${prefix}/lib",
728                                         [Base library directory -- only path-prefix.h should use it!])
730 dnl Have to add module makefiles (lauris)
732 AC_CONFIG_FILES([
733 Makefile
734 src/Makefile
735 src/check-header-compile
736 src/algorithms/makefile
737 src/application/makefile
738 src/debug/makefile
739 src/dialogs/makefile
740 src/display/makefile
741 src/dom/makefile
742 src/extension/implementation/makefile
743 src/extension/internal/makefile
744 src/extension/makefile
745 src/extension/plugin/makefile
746 src/extension/script/makefile
747 src/helper/makefile
748 src/inkjar/makefile
749 src/io/makefile
750 src/libcroco/makefile
751 src/libnr/makefile
752 src/libnrtype/makefile
753 src/libavoid/makefile
754 src/livarot/makefile
755 src/jabber_whiteboard/makefile
756 src/removeoverlap/makefile
757 src/svg/makefile
758 src/trace/makefile
759 src/traits/makefile
760 src/ui/dialog/makefile
761 src/ui/makefile
762 src/ui/view/makefile
763 src/ui/widget/makefile
764 src/utest/makefile
765 src/util/makefile
766 src/widgets/makefile
767 src/xml/makefile
768 doc/Makefile
769 po/Makefile.in
770 share/Makefile
771 share/clipart/Makefile
772 share/examples/Makefile
773 share/extensions/Makefile
774 share/fonts/Makefile
775 share/gradients/Makefile
776 share/icons/Makefile
777 share/keyboards/Makefile
778 share/markers/Makefile
779 share/palettes/Makefile
780 share/patterns/Makefile
781 share/screens/Makefile
782 share/templates/Makefile
783 share/tutorials/Makefile
784 share/ui/Makefile
785 packaging/autopackage/default.apspec
786 inkscape.spec
787 Info.plist
788 inkview.1
789 ])
791 AH_BOTTOM([
794 ])
796 AC_OUTPUT
798 echo "
799 Configuration:
801         Source code location:     ${srcdir}
802         Destination path prefix:  ${prefix}
803         Compiler:                 ${CXX}
804         CPPFLAGS:                 ${CPPFLAGS}
805         CXXFLAGS:                 ${CXXFLAGS}
806         CFLAGS:                   ${CFLAGS}
807         LDFLAGS:                  ${LDFLAGS}
809         Use Xft font database:    ${xft_ok}
810         Use gnome-print:          ${gp}
811         Use gnome-vfs:            ${gnome_vfs}
812         Use openoffice files:     ${ij}
813         Use MMX optimizations:    ${use_mmx_asm}
814         Use relocation support:   ${enable_binreloc}
815         Use Python extensions:    ${with_python}
816         Use Perl extensions:      ${with_perl}
817         Enable Inkboard:          ${with_inkboard}