Code

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