Code

Warning cleanup
[inkscape.git] / configure.ac
index 0210bd507d0d81cc370a434e220b8d4f1c495d5f..46f255abbcd22c5ab7472963bdb0ec9f30442e33 100644 (file)
@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.50)
-AC_INIT(inkscape, 0.45+devel)
+AC_INIT(inkscape, 0.46+devel)
 dnl N.B. After 0.40, please change to `0.40+cvs' instead of `0.41cvs'.
 dnl Rationale: (i) placate simple version comparison software such as
 dnl `dpkg --compare-versions'.  (ii) We don't always know what the next
@@ -9,7 +9,7 @@ dnl version is going to be called until about the time we release it
 dnl (whereas we always know what the previous version was called).
 AC_CANONICAL_HOST
 AC_CONFIG_SRCDIR(src/main.cpp)
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([dist-zip dist-bzip2 tar-pax])
 
 AC_ARG_ENABLE([lsb], AS_HELP_STRING([--enable-lsb], [LSB-compatible build configuration]), [
   prefix=/opt/inkscape
@@ -33,18 +33,62 @@ AC_HEADER_STDC
 dnl These next few lines are needed only while libcroco is in our source tree.
 AC_PROG_CC
 AM_PROG_CC_C_O
-AC_MSG_NOTICE([Testing -Wno-pointer-sign])
 if test "$GCC" = "yes"; then
   # Enable some warnings from gcc.
-
   AC_LANG_PUSH(C)
+
+  ####
+  # Generic cpp flags...
+
+  # What is just plain "-W" ?
+  # Fortify source requires -O2 or higher, which is handled with newer autoconf
+  CPPFLAGS="-W -D_FORTIFY_SOURCE=2 $CPPFLAGS"
+  # Enable format and format security warnings
+  CPPFLAGS="-Wformat -Wformat-security $CPPFLAGS"
+  # Enable all default warnings
+  CPPFLAGS="-Wall $CPPFLAGS"
+
+  # Test for -Werror=... (introduced some time post-4.0)
+  # If we hit a format error -- it should be fatal.
+  AC_MSG_CHECKING([compiler support for -Werror=format-security])
+  ink_svd_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="-Werror=format-security $CPPFLAGS"
+  AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), [ink_opt_ok=yes], [ink_opt_ok=no])
+  AC_MSG_RESULT([$ink_opt_ok])
+  if test "x$ink_opt_ok" != "xyes"; then
+    CPPFLAGS="$ink_svd_CPPFLAGS"
+  fi
+
+  ####
+  # C-specific flags...
+
   # -Wno-pointer-sign is probably new in gcc 4.0; certainly it isn't accepted
   # by gcc 2.95.
+  AC_MSG_CHECKING([compiler support for -Wno-pointer-sign])
   ink_svd_CFLAGS="$CFLAGS"
   CFLAGS="-Wno-pointer-sign $CFLAGS"
-  AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), AC_MSG_NOTICE([ compiler supports -Wno-pointer-sign]), CFLAGS="$ink_svd_CFLAGS")
-  CFLAGS="-Wall -Wformat-security -W -D_FORTIFY_SOURCE=2 $CFLAGS"
+  AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), [ink_opt_ok=yes], [ink_opt_ok=no])
+  AC_MSG_RESULT([$ink_opt_ok])
+  if test "x$ink_opt_ok" != "xyes"; then
+    CFLAGS="$ink_svd_CFLAGS"
+  fi
+
+  ####
+  # Linker flags...
+
+  # Have linker produce read-only relocations, if it knows how
+  AC_MSG_CHECKING([linker tolerates -z relro])
+  ink_svd_LDFLAGS="$LDFLAGS"
+  LDFLAGS="-Wl,-z,relro $LDFLAGS"
+  AC_LINK_IFELSE(AC_LANG_PROGRAM([]), [ink_opt_ok=yes], [ink_opt_ok=no])
+  AC_MSG_RESULT([$ink_opt_ok])
+  if test "x$ink_opt_ok" != "xyes"; then
+    LDFLAGS="$ink_svd_LDFLAGS"
+  fi
+
   AC_LANG_POP
+
+  # C++-specific flags are defined further below.  Look for CXXFLAGS...
 fi
 
 dnl Honor aclocal flags
@@ -84,7 +128,7 @@ GETTEXT_PACKAGE="AC_PACKAGE_NAME"
 AC_SUBST(GETTEXT_PACKAGE)
 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Translation domain used])
 dnl Add the languages which your application supports here.
-ALL_LINGUAS="am az be bg bn ca cs da de dz el en_AU en_CA en_GB en_US@piglatin eo es_MX es et eu fi fr ga gl he hr hu id it ja km ko lt mk mn nb ne nl nn pa pl pt_BR pt ro ru rw sk sl sq sr@Latn sr sv th tr uk vi zh_CN zh_TW"
+ALL_LINGUAS="am ar az be bg bn br ca ca@valencia cs da de dz el en_AU en_CA en_GB en_US@piglatin eo es_MX es et eu fi fr ga gl he hr hu id it ja km ko lt mk mn nb ne nl nn pa pl pt_BR pt ro ru rw sk sl sq sr@latin sr sv th tr uk vi zh_CN zh_TW"
 AM_GLIB_GNU_GETTEXT
 
 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
@@ -213,19 +257,20 @@ esac
 AC_MSG_RESULT([$platform_win32])
 AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
 
-AC_MSG_CHECKING([for Solaris 2.8 platform])
+AC_MSG_CHECKING([for Solaris platform])
 case "$host" in
-  *-solaris2.8)
-    platform_solaris_2_8=yes
-    CFLAGS="$CFLAGS -DSOLARIS_2_8"
-    CXXFLAGS="$CXXFLAGS -DSOLARIS_2_8"
+  *-solaris2.*)
+    platform_solaris=yes
+    solaris_version=`echo $host|sed -e 's/^.*-solaris2\.//' -e s'/\..*$//'`
+    CFLAGS="$CFLAGS -DSOLARIS=$solaris_version"
+    CXXFLAGS="$CXXFLAGS -DSOLARIS=$solaris_version"
     ;;
   *)
-    platform_solaris_2_8=no
+    platform_solaris=no
     ;;
 esac
-AC_MSG_RESULT([$platform_solaris_2_8])
-AM_CONDITIONAL(PLATFORM_SOLARIS_2_8, test "$platform_solaris_2_8" = "yes")
+AC_MSG_RESULT([$platform_solaris])
+AM_CONDITIONAL(PLATFORM_SOLARIS, test "$platform_solaris" = "yes")
 
 dnl ******************************
 dnl Xft checking
@@ -280,39 +325,6 @@ if test "x$xft_ok" = "xyes"; then
        fi
 fi
 
-dnl ******************************
-dnl GnomePrint checking
-dnl ******************************
-
-AC_ARG_WITH(gnome-print,
-            AC_HELP_STRING([--with-gnome-print], [use gnome print font database and spooler frontend]),
-            [with_gp=$withval], [with_gp=auto])
-
-if test "x$with_gp" = "xyes"; then
-       dnl Have to test gnome-print presence
-       PKG_CHECK_MODULES(GNOME_PRINT, libgnomeprint-2.2 >= 1.116.0  libgnomeprintui-2.2 >= 1.116.0, gp=yes, gp=no)
-       if test "x$gp" != "xyes"; then
-               dnl No gnome-print found
-               if test "x$with_gp" = "xyes"; then
-                       dnl Gnome-print was explicitly asked, so stop
-                       AC_MSG_ERROR([--with-gnome-print was specified, but appropriate libgnomeprint development packages could not be found])
-               else 
-                       # gp is no, tell us for the log file 
-                       AC_MSG_RESULT($gp)
-               fi
-       fi
-else
-       dnl Asked to ignore gnome-print
-       gp=no
-fi
-
-AC_SUBST(GNOME_PRINT_CFLAGS)
-AC_SUBST(GNOME_PRINT_LIBS)
-
-AM_CONDITIONAL(USE_GNOME_PRINT, test "x$gp" = "xyes")
-if test "x$gp" = "xyes"; then
-       AC_DEFINE(WITH_GNOME_PRINT, 1, [Use gnome print font database and spooler frontend])
-fi
 
 dnl ******************************
 dnl gnome vfs checking
@@ -482,15 +494,11 @@ else
                fi
        else
                dnl Working lcms
-               LCMS_LIBS="-llcms "
+               LIBS="$LIBS $LCMS_LIBS"
+               AC_DEFINE(ENABLE_LCMS, 1, [Use LittleCms color management])
        fi
 fi
 
-if test "x$lcms" = "xyes"; then
-       LIBS="$LIBS $LCMS_LIBS"
-       AC_DEFINE(ENABLE_LCMS, 1, [Use LittleCms color management])
-fi
-AM_CONDITIONAL(USE_LCMS, test "x$lcms" = "xyes")
 AC_SUBST(LCMS_CFLAGS)
 AC_SUBST(LCMS_LIBS)
 
@@ -498,6 +506,10 @@ dnl ******************************
 dnl Libpoppler checking
 dnl ******************************
 
+AC_ARG_ENABLE(poppler-cairo,
+       AC_HELP_STRING([--enable-poppler-cairo], [Enable libpoppler-cairo for rendering PDF preview]),
+       [enable_poppler_cairo=$enableval], [enable_poppler_cairo=yes])
+
 POPPLER_CFLAGS=""
 PKG_CHECK_MODULES(POPPLER, poppler >= 0.5.9, poppler=yes, poppler=no)
 
@@ -514,20 +526,23 @@ if test "x$poppler" = "xyes"; then
                        POPPLER_LIBS="$POPPLER_LIBS -lpoppler-glib "
                fi
        fi
-       dnl Have to test libpoppler-cairo presence for PDF preview
-       PKG_CHECK_MODULES(POPPLER_CAIRO, poppler-cairo >= 0.5.9, poppler_cairo=yes, poppler_cairo=no)
-       if test "x$poppler_cairo" = "xyes"; then
-               dnl Working libpoppler-cairo found
-               dnl Check whether the Cairo FreeType backend is available
-               PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, cairo_ft=yes, cairo_ft=no)
-       fi                                                                              
+       if test "x$enable_poppler_cairo" = "xyes"; then
+               dnl Have to test libpoppler-cairo presence for PDF preview
+               dnl AC_CHECK_HEADER(Magick++.h, magick_ok=yes, magick_ok=no)
+               PKG_CHECK_MODULES(POPPLER_CAIRO, poppler-cairo >= 0.5.9, poppler_cairo=yes, poppler_cairo=no)
+               if test "x$poppler_glib" = "xyes" -a "x$poppler_cairo" = "xyes" -a \
+                       "x$cairo_svg" = "xno"
+               then
+                       POPPLER_LIBS="$POPPLER_LIBS -lpoppler-glib "
+               fi
+       fi
 fi
 
 if test "x$poppler" = "xyes"; then
        LIBS="$LIBS $POPPLER_LIBS"
        AC_DEFINE(HAVE_POPPLER, 1, [Use libpoppler for direct PDF import])
 fi
-if test "x$cairo_ft" = "xyes"; then
+if test "x$poppler_cairo" = "xyes" -a "x$poppler_glib" = "xyes"; then
        AC_DEFINE(HAVE_POPPLER_CAIRO, 1, [Use libpoppler-cairo for rendering PDF preview])
 fi
 if test "x$poppler_glib" = "xyes" -a "x$cairo_svg" = "xyes"; then
@@ -536,6 +551,12 @@ fi
 AC_SUBST(POPPLER_CFLAGS)
 AC_SUBST(POPPLER_LIBS)
 
+ink_svd_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$POPPLER_CFLAGS $CPPFLAGS"
+AC_MSG_CHECKING([whether libpoppler has new getNextChar])
+AC_EGREP_CPP([Unicode ..u. int .uLen], [#include "GfxFont.h"], AC_DEFINE([POPPLER_NEW_GFXFONT], [], [True iff libpoppler is 0.8.3 or newer.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
+CPPFLAGS="$ink_svd_CPPFLAGS"
+
 dnl ******************************
 dnl Inkboard dependency checking
 dnl ******************************
@@ -571,22 +592,40 @@ AC_SUBST(INKBOARD_LIBS)
 AC_SUBST(INKBOARD_CFLAGS)
 
 dnl ******************************
-dnl Check for ImageMagick Magick++ 
+dnl Check for libwpg for extension
 dnl ******************************
 
-AC_CHECK_LIB(Magick++, InitializeMagick, [AC_CHECK_HEADER(Magick++.h, magick_ok=yes, magick_ok=no)], magick_ok=no, -llcms -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lz -lpthread -lm -lpthread)
+PKG_CHECK_MODULES(LIBWPG, libwpg-0.1 libwpg-stream-0.1, with_libwpg=yes, with_libwpg=no)
+if test "x$with_libwpg" = "xyes"; then
+       AC_DEFINE(WITH_LIBWPG,1,[Build in libwpg])
+fi
+AM_CONDITIONAL(WITH_LIBWPG, test "x$with_libwpg" = "xyes")
+
+AC_SUBST(LIBWPG_LIBS)
+AC_SUBST(LIBWPG_CFLAGS)
+
+dnl ******************************
+dnl Check for ImageMagick Magick++ 
+dnl ******************************
 
+PKG_CHECK_MODULES(IMAGEMAGICK, ImageMagick++, magick_ok=yes, magick_ok=no)
 if test "x$magick_ok" = "xyes"; then
-       AC_CHECK_PROG(MAGICKPP_CONFIG, Magick++-config, yes, no)
-       if test "x$MAGICKPP_CONFIG" = "xyes"; then
-               IMAGEMAGICK_LIBS=`Magick++-config --libs`
-               AC_SUBST(IMAGEMAGICK_LIBS)
-               AC_DEFINE(WITH_IMAGE_MAGICK,1,[Image Magick++ support for bitmap effects])
-       fi
+      AC_DEFINE(WITH_IMAGE_MAGICK,1,[Image Magick++ support for bitmap effects])
 fi
-
 AM_CONDITIONAL(USE_IMAGE_MAGICK, test "x$magick_ok" = "xyes")
 
+AC_SUBST(IMAGEMAGICK_LIBS)
+AC_SUBST(IMAGEMAGICK_CFLAGS)
+
+dnl ***********************************************************************************************************
+dnl Check for a Cairo version that implements user-fonts feature, so that we conditionally add SVGFonts support
+dnl ***********************************************************************************************************
+
+PKG_CHECK_MODULES(CAIRO_USER_FONTS, cairo > 1.6.4, cairouserfonts=yes, cairouserfonts=no)
+if test "x$cairouserfonts" = "xyes"; then
+       AC_DEFINE(ENABLE_SVG_FONTS, 1, [SVG Fonts should be used])
+fi
+
 dnl ******************************
 dnl   Unconditional dependencies
 dnl ******************************
@@ -597,7 +636,22 @@ if test $cc_vers_major -gt 3; then
 else
   min_sigc_version=2.0.11
 fi
-PKG_CHECK_MODULES(INKSCAPE, gdkmm-2.4  glibmm-2.4  gtkmm-2.4  gtk+-2.0 >= 2.8.0  libxml-2.0 >= 2.6.11  libxslt >= 1.0.15  cairo  sigc++-2.0 >= $min_sigc_version  $ink_spell_pkg  gthread-2.0 >= 2.0 libpng >= 1.2)
+PKG_CHECK_MODULES(INKSCAPE, gdkmm-2.4  glibmm-2.4  gtkmm-2.4 >= 2.10.0  gtk+-2.0  libxml-2.0 >= 2.6.11  libxslt >= 1.0.15  cairo  sigc++-2.0 >= $min_sigc_version  $ink_spell_pkg  gthread-2.0 >= 2.0 libpng >= 1.2 gsl)
+
+# Check for Apple Mac OS X Carbon framework
+carbon_ok=no
+AC_MSG_CHECKING([for Mac OS X Carbon support])
+AC_TRY_CPP([
+#include <Carbon/Carbon.h>
+#include <CoreServices/CoreServices.h>
+], carbon_ok=yes)
+AC_MSG_RESULT($carbon_ok)
+if test "x$carbon_ok" = "xyes"; then
+  AC_DEFINE(HAVE_CARBON, 1, [define to 1 if Carbon is available])
+  CARBON_LDFLAGS="-framework Carbon"
+  AC_SUBST(CARBON_LDFLAGS)
+fi
+AM_CONDITIONAL(HAVE_CARBON, test "x$carbon_ok" = "xyes")
 
 # Check for some boost header files
 AC_CHECK_HEADERS([boost/concept_check.hpp], [], AC_MSG_ERROR([You need the boost package (e.g. libboost-dev)]))
@@ -607,11 +661,6 @@ if test "x$cairo_pdf" = "xyes"; then
   AC_DEFINE(HAVE_CAIRO_PDF, 1, [Whether the Cairo PDF backend is available])
 fi
 
-PKG_CHECK_MODULES(GTK_UNIX_PRINT, gtk+-unix-print-2.0, gtk_unix_print=yes, gtk_unix_print=no)
-if test "x$gtk_unix_print" = "xyes"; then
-  AC_DEFINE(HAVE_GTK_UNIX_PRINT, 1, [Whether the GTK Unix printing backend is available])
-fi
-
 dnl Shouldn't we test for libpng and libz?
 INKSCAPE_LIBS="$INKSCAPE_LIBS -lpng -lz"
 
@@ -758,7 +807,8 @@ if test "$GXX" = "yes"; then
   # programmer deliberately has an unused parameter (e.g. because it's used
   # as a callback or similar function pointer use).
 
-  CXXFLAGS="-Wall -Wformat-security -W -Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch -D_FORTIFY_SOURCE=2 $CXXFLAGS"
+  # Add even more stuff
+  CXXFLAGS="-Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch $CXXFLAGS"
 
   dnl Test for arch-specific situations.
   case "$host_cpu" in
@@ -874,6 +924,7 @@ src/Makefile
 src/check-header-compile
 src/algorithms/makefile
 src/application/makefile
+src/bind/makefile
 src/debug/makefile
 src/dialogs/makefile
 src/display/makefile
@@ -886,6 +937,7 @@ src/helper/makefile
 src/inkjar/makefile
 src/io/makefile
 src/libcroco/makefile
+src/libgdl/makefile
 src/libnr/makefile
 src/libnrtype/makefile
 src/libavoid/makefile
@@ -914,7 +966,10 @@ share/Makefile
 share/clipart/Makefile
 share/examples/Makefile
 share/extensions/Makefile
+share/extensions/alphabet_soup/Makefile
 share/extensions/Barcode/Makefile
+share/extensions/Poly3DObjects/Makefile
+share/extensions/xaml2svg/Makefile
 share/fonts/Makefile
 share/gradients/Makefile
 share/icons/Makefile
@@ -960,5 +1015,7 @@ Configuration:
         Enable LittleCms:         ${enable_lcms}
         Enable Inkboard:          ${with_inkboard}
         Enable SSL in Inkboard:   ${with_inkboard_ssl}
+        Enable Poppler-Cairo:     ${enable_poppler_cairo}
         ImageMagick Magick++:     ${magick_ok}
+        Libwpg:                   ${with_libwpg}
 "