dnl Process this -*- autoconf -*- file with autoconf to produce a dnl configure script. AC_INIT(dia, 0.96.1, http://bugzilla.gnome.org/enter_bug.cgi?product=dia) AC_CONFIG_SRCDIR(app/diagram.c) AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION) AC_PREREQ(2.50) AC_REVISION($Revision: 1.288 $) dnl Specify a header configuration file AM_CONFIG_HEADER(config.h) dnl do this check now, to keep autogen quiet. AC_PROG_CC dnl also c++ AC_PROG_CXX dnl Initialize maintainer mode AM_MAINTAINER_MODE dnl Initialize libtool AC_DISABLE_STATIC AC_PROG_LIBTOOL dnl Build time sanity check AM_SANITY_CHECK dnl Checks for programs. dnl AC_PROG_CC # already done AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_ISC_POSIX dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS(stddef.h fcntl.h unistd.h utime.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST dnl Checks for library functions. AC_CHECK_FUNCS(select strcspn strdup strtol snprintf) dnl stuff for intltool AC_PROG_INTLTOOL(0.21) APP_LIBS="" AC_SUBST(APP_LIBS) dnl Checks for libraries PKG_CHECK_MODULES(GMODULE, gmodule-2.0 gobject-2.0) AC_SUBST(GMODULE_CFLAGS) AC_SUBST(GMODULE_LIBS) AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) GTK_MODULES="gtk+-2.0 >= 2.6.0 glib-2.0 >= 2.6.0 libxml-2.0 gdk-pixbuf-2.0 gthread-2.0" PKG_CHECK_MODULES(PANGOVERSION, pango >= 1.1.5, , AC_MSG_ERROR([Need Pango version 1.1.5 or higher])) AC_ARG_WITH(freetype, [ --without-freetype compile without FreeType support],,with_freetype=yes) if test "x$with_freetype" == "xyes"; then PKG_CHECK_MODULES(PANGOFT2,pangoft2,have_pangoft2=true,have_pangoft2=false) if test "$have_pangoft2" = "true"; then dnl On Solaris with Forte C, at least, need to link app/dia with -lfreetype. dnl It's not enough that -lpangoft2 implicitly pulls it in. have_freetype=false AC_CHECK_LIB(freetype,FT_Init_FreeType,have_freetype=true,have_freetype=false,`freetype-config --libs`) if test "$have_freetype" = "true"; then dnl Need 2.0.9, as a bug was fixed for us there. dnl However, freetype-config doesn't give a meaningful version, so we must dnl do it like this. AC_MSG_CHECKING([if FreeType version is 2.0.9 or higher]) old_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS `freetype-config --cflags`" AC_TRY_CPP([#include #include FT_FREETYPE_H #if (FREETYPE_MAJOR*1000+FREETYPE_MINOR)*1000+FREETYPE_PATCH < 2000009 #error Freetype version too low. #endif ], [AC_MSG_RESULT(yes) FREETYPE_LIBS=`freetype-config --libs` AC_SUBST(FREETYPE_LIBS) FREETYPE_CFLAGS=`freetype-config --cflags` AC_SUBST(FREETYPE_CFLAGS) GTK_MODULES="$GTK_MODULES pangoft2" AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])] , [AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])]) CPPFLAGS="$old_CPPFLAGS" else AC_MSG_ERROR(Can't find FreeType library) fi else AC_MSG_ERROR(Can't find PangoFT2 library) fi fi AM_CONDITIONAL(WITH_FREETYPE, test "x$with_freetype" != "xno") CFLAGS="$FREETYPE_CFLAGS $CFLAGS" dnl Try for libart PKG_CHECK_MODULES(LIBART,libart-2.0,have_libart=yes,have_libart=no) if test "$have_libart" = "yes" ; then GTK_MODULES="$GTK_MODULES libart-2.0" AC_DEFINE(HAVE_LIBART,1,[Define if building with LIBART support]) fi AC_MSG_CHECKING([whether GNOME specific code should be used]) AC_ARG_ENABLE(gnome,[ --enable-gnome enable gnome code], GNOME=$enableval, GNOME=no) if test "$GNOME" = "yes" ; then GTK_MODULES="$GTK_MODULES libgnome-2.0 libgnomeui-2.0" AC_DEFINE(GNOME,1,[Define if building with GNOME support]) AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${prefix}/share/pixmaps", [GNOME icon directory]) have_gnome=true else have_gnome=false fi AM_CONDITIONAL(HAVE_GNOME, $have_gnome) AC_MSG_RESULT($GNOME) dnl GTK2: libgnomecanvas-2.0 ? PKG_CHECK_MODULES(GTK,$GTK_MODULES) AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) AM_CONDITIONAL(HAVE_BONOBO,false) dnl Look for Gnome Print AC_ARG_WITH(gnomeprint, [ --with-gnomeprint compile *experimental* gnomeprint plug-in],,with_gnomeprint=no) if test "x$with_gnomeprint" == "xyes"; then PKG_CHECK_MODULES(GNOMEPRINT, libgnomeprint-2.2, have_gnomeprint=yes,have_gnomeprint=no) AC_SUBST(GNOMEPRINT_LIBS) AC_SUBST(GNOMEPRINT_CFLAGS) AC_DEFINE(HAVE_GNOMEPRINT,1,[Define if building with Gnome Print support]) fi AM_CONDITIONAL(WITH_GNOMEPRINT, test "x$with_gnomeprint" != "xno") dnl Look for Cairo AC_ARG_WITH(cairo, [ --with-cairo compile *experimental* cairo plug-in],,with_cairo=no) if test "x$with_cairo" != "xno"; then PKG_CHECK_MODULES(CAIROVERSION, cairo >= 0.6.0, , AC_MSG_ERROR([Need Cairo version 0.6.0 or higher])) PKG_CHECK_MODULES(CAIRO, cairo,have_cairo=yes,have_cairo=no) AC_SUBST(CAIRO_LIBS) AC_SUBST(CAIRO_CFLAGS) AC_DEFINE(HAVE_CAIRO,1,[Define if building with Cairo support]) fi AM_CONDITIONAL(WITH_CAIRO, test "x$with_cairo" != "xno") dnl XSLT # Check if XSLT is available at all XSLT_DIR="" PKG_CHECK_MODULES(XSLT, libxslt, have_xslt=true, have_xslt=false) AM_CONDITIONAL(HAVE_XSLT, $have_xslt) if test "$have_xslt" = "true"; then XSLT_DIR="xslt" XSLT_LIBS="`$PKG_CONFIG --libs libxslt`" XSLT_CFLAGS="`$PKG_CONFIG --cflags libxslt`" fi AC_SUBST(XSLT_DIR) AC_SUBST(XSLT_LIBS) AC_SUBST(XSLT_CFLAGS) # Figure out a prefix for where to find libxslt at runtime. AC_ARG_WITH(xslt-prefix, [ --with-xslt-prefix=DIR Specify where to find the optional XSLT libraries (default=/usr/lib)], libxslt_prefix=$withval, libxslt_prefix=/usr/lib) AC_DEFINE_UNQUOTED(LIBXSLT_PREFIX,"$libxslt_prefix", [Place to look for XSLT libs]) dnl dnl Popt dnl AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [ AC_DEFINE(HAVE_LIBPOPT,,[popt library available]) POPT_LIBS="-lpopt"]) AC_CHECK_HEADERS(popt.h) AC_SUBST(POPT_LIBS) APP_LIBS="$APP_LIBS $POPT_LIBS" dnl dnl libpng dnl dnl this likely already comes from GTK dnl Something in here pollutes $LIBS with -lpng. Make sure to dnl avoid that. old_LIBS="${LIBS}" png_ok=no AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no) AC_CHECK_LIB(png, png_read_info, ,png_ok=no, -lz -lm) if test "$png_ok" = yes; then AC_MSG_CHECKING([for png_structp in png.h]) dnl Why can't AC_LINK_IFELSE take extra libs? old_LDFLAGS="${LDFLAGS}" LDFLAGS="${LDFLAGS} -lz -lm" AC_LINK_IFELSE([#include png_structp pp; png_infop info; png_colorp cmap; main() { void*foo = png_create_read_struct; }], png_ok=yes, png_ok=no) LDFLAGS="${old_LDFLAGS}" AC_MSG_RESULT($png_ok) if test "$png_ok" = yes; then PNG_LIBS='-lpng -lz -lm' AC_DEFINE(HAVE_LIBPNG,,[PNG library available]) fi fi AC_SUBST(PNG_LIBS) LIBS="${old_LIBS} ${PNG_LIBS}" dnl dnl Debugging dnl AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]], , enable_debug=minimum) if test "x$enable_debug" = "xyes"; then DEBUG_FLAGS="-g -DENABLE_DEBUG" else if test "x$enable_debug" = "xno"; then DEBUG_FLAGS="" else DEBUG_FLAGS="" fi fi AC_SUBST(DEBUG_FLAGS) dnl dnl i18n dnl GETTEXT_PACKAGE=dia AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Needed for glib gettext]) ALL_LINGUAS="am ar az be bg bs ca cs da de el en_CA en_GB es eu fi fr ga gl gu hr hu id is it ja ko lt lv mk ml mn ms nb ne nl nn pl pt pt_BR ro ru rw sk sl sq sr sr@Latn sv th tr uk vi zh_CN zh_TW" AC_CHECK_PROG(XGETTEXT, xgettext, xgettext, none) if test "$XGETTEXT" == none ; then AC_MSG_ERROR([xgettext program not found: $XGETTEXT.]) fi AM_GLIB_GNU_GETTEXT dnl INTLOBJS doesn't seem to always get subst'ed, but I believe it's dnl idempotent AC_SUBST(INTLOBJS) localedir='${prefix}/${DATADIRNAME}/locale' AC_SUBST(localedir) dnl dnl Locate the gnome-xml library dnl dnl GTK2: remove support for libxml1. move check for libxml2 in dnl AM_PATH_GTK_2_0's fourth argument (module is libxml-2.0) found_libxml=false if test $found_libxml = false; then AC_CHECK_PROG(XML2_CONFIG, xml2-config, xml2-config) if test "x$XML2_CONFIG" != x ; then AC_MSG_CHECKING(for libxml >= 2.3.9) vers=`$XML2_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` if test "$vers" -ge 2003009; then AC_MSG_RESULT(found) found_libxml=true XML_LIBS="`$XML2_CONFIG --libs`" XML_CFLAGS="`$XML2_CONFIG --cflags`" if test "$enable_gnome_print" = "yes"; then gnome-config --cflags print | \ grep gnome-xml 2>&1 >/dev/null && \ AC_MSG_ERROR(libxml2 found but gnome-print uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable gnome-print.) fi echo $GNOME_CFLAGS | \ grep gnome-xml 2>&1 >/dev/null && \ AC_MSG_ERROR(libxml2 found but one GNOME component uses libxml1 ; this is a conflict.\nPlease do either provide libxml1 or disable the offending GNOME component.) else AC_MSG_RESULT(not found) fi fi fi if test $found_libxml = false; then AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config) if test "x$XML_CONFIG" != x ; then AC_MSG_CHECKING(for libxml >= 1.8.14) vers=`$XML_CONFIG --version | sed -e "s/libxml //" | awk 'BEGIN {FS=".";} { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` dnl 1.18.14 is required for xmlUseNewParser() if test "$vers" -ge 1008014; then AC_MSG_RESULT(found) found_libxml=true XML_LIBS="`$XML_CONFIG --libs`" XML_CFLAGS="`$XML_CONFIG --cflags`" else AC_MSG_RESULT(not found) fi fi fi if test $found_libxml = false; then AC_MSG_ERROR(Neither libxml1 or libxml2 found. You must install one (libxml1, preferably)) fi AC_SUBST(XML_LIBS) AC_SUBST(XML_CFLAGS) CFLAGS="$XML_CFLAGS $CFLAGS" dnl LibZ AC_CHECK_HEADERS(zlib.h, AC_CHECK_LIB(z, gzread,[ AC_DEFINE(HAVE_LIBZ,, we have the libz compression library) if test "x${Z_DIR}" != "x"; then Z_CFLAGS="-I${Z_DIR}/include" Z_LIBS="-L${Z_DIR}/lib -lz" else Z_LIBS="-lz" fi])) AC_SUBST(Z_LIBS) CFLAGS="${CFLAGS} ${Z_CFLAGS}" LIBS="${LIBS} ${Z_LIBS}" dnl Path to UI resources AC_SUBST(uidatadir, '${pkgdatadir}/ui') dnl Platform-specific fixes. dnl dnl Sun Forte C provides isinf() in the unbundled -lsunmath. Solaris dnl declares finite() in ieeefp.h. It's preferrable not to link dnl to -lsunmath as it's not present on all machines. have_isinf=no AC_CHECK_HEADERS(math.h, AC_CHECK_LIB(m,isinf, have_isinf=yes)) if test "$have_isinf" = "no"; then AC_CHECK_HEADER(ieeefp.h, [AC_CHECK_FUNC(finite, AC_DEFINE(HAVE_IEEEFP_H,1, [Define if finite() is defined in ieeefp.h]), AC_MSG_ERROR([Can't find a definition of neither finite nor isinf]))], [AC_MSG_ERROR(Can't find neither a definition of isinf nor ieeefp.h)]) else AC_DEFINE([HAVE_ISINF], 1, [Define if the isinf() function is available]) fi dnl Alpha needs -mieee or we get a segfault dnl This shouldn't be needed but is here until a real solution is found case "$host" in alpha*-*-linux*) CFLAGS="$CFLAGS -mieee" ;; esac if test "$GCC" = yes; then dnl Relieve register pressure on i386. Other architectures may become unable dnl to debug, and usually have more registers anyway. dnl case "$host" in dnl i?86-pc-*) dnl DIA_CHECK_CFLAG(-fomit-frame-pointer) dnl ;; dnl esac dnl (it looks like gdb is very confused by this now even on x86. We might be dnl getting poor stack traces with bug-buddy because of this) DIA_CHECK_CFLAG(-Wall) DIA_CHECK_CFLAG(-Wunused) DIA_CHECK_CFLAG(--std=c89) DIA_CHECK_CFLAG(-Wdeclaration-after-statement) dnl I'd rather like to enable this but it fails on isnan() with -std=c89 dnl DIA_CHECK_CFLAG(-Werror-implicit-function-declaration) dnl Premature optimization is the root of all evil. Uncomment this if dnl you want ti figure out functions that should have been inlined but aint. dnl DIA_CHECK_CFLAG(-Winline) DIA_CHECK_CFLAG(-Wmissing-prototypes) DIA_CHECK_CFLAG(-Wmissing-declarations) DIA_CHECK_CFLAG(-finline-functions) DIA_CHECK_CFLAG(-fstrict-aliasing) fi AM_CONDITIONAL(HAVE_GCC, test "$GCC" = yes) dnl Do we have the db2html script to build the documentation? AC_ARG_ENABLE(db2html, [ --enable-db2html don't rebuild documentation],,enable_db2html=no) AC_PATH_PROG(DB2HTML, db2html, no) AM_CONDITIONAL(HAVE_DB2HTML, test "x$enable_db2html" != xno && test "x$DB2HTML" != xno) dnl Only enable man page generation if we have db2man (in maintainer mode) dnl Have to have the nwalsh docbook.xsl, which does manpages. dnl RedHat installs it in a version-numbered place. Grumpf. AC_PATH_PROG(XSLTPROC, xsltproc, no) AM_CONDITIONAL(HAVE_DB2MAN, test "x$XSLTPROC" != xno) AC_SUBST(DB2MAN, "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl") dnl Handling for Python AC_ARG_WITH(python, [ --with-python compile python plug-in],,with_python=no) if test "x$with_python" != xno; then AM_PATH_PYTHON(1.5.2) AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)]) AM_CHECK_PYTHON_HEADERS AM_CHECK_PYTHON_LIB if test -z "$PYTHON_INCLUDES" || test -z "$PYTHON_LIBS"; then AC_MSG_ERROR([could not find files required to build python plugin]) fi fi AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" != "xno") AC_OUTPUT( Makefile lib/Makefile lib/pixmaps/Makefile po/Makefile.in objects/Makefile dnl objects/sybase/Makefile objects/AADL/Makefile objects/bondgraph/Makefile objects/chronogram/Makefile objects/custom/Makefile objects/ER/Makefile objects/flowchart/Makefile objects/FS/Makefile objects/GRAFCET/Makefile objects/Istar/Makefile objects/Jackson/Makefile objects/KAOS/Makefile objects/Misc/Makefile objects/network/Makefile objects/SADT/Makefile objects/standard/Makefile objects/UML/Makefile shapes/Makefile shapes/Assorted/Makefile shapes/BPMN/Makefile shapes/ChemEng/Makefile shapes/Circuit/Makefile shapes/Cisco/Makefile shapes/Civil/Makefile shapes/Contact/Makefile shapes/Cybernetics/Makefile shapes/Electric/Makefile shapes/flowchart/Makefile shapes/Gane_and_Sarson/Makefile shapes/jigsaw/Makefile shapes/Logic/Makefile shapes/Map/Makefile shapes/Map/Isometric/Makefile shapes/Misc/Makefile shapes/MSE/Makefile shapes/network/Makefile shapes/Pneumatic/Makefile shapes/RDP/Makefile shapes/SDL/Makefile shapes/sybase/Makefile app/Makefile app/pixmaps/Makefile samples/Makefile sheets/Makefile sheets/ER/Makefile sheets/GRAFCET/Makefile sheets/Istar/Makefile sheets/Jackson/Makefile sheets/KAOS/Makefile sheets/UML/Makefile plug-ins/Makefile plug-ins/cgm/Makefile plug-ins/cairo/Makefile plug-ins/dxf/Makefile plug-ins/gprint/Makefile plug-ins/hpgl/Makefile plug-ins/metapost/Makefile plug-ins/pixbuf/Makefile plug-ins/pstricks/Makefile plug-ins/pgf/Makefile plug-ins/python/Makefile plug-ins/shape/Makefile plug-ins/svg/Makefile plug-ins/vdx/Makefile plug-ins/wmf/Makefile plug-ins/wpg/Makefile plug-ins/xfig/Makefile plug-ins/xslt/Makefile tests/Makefile tests/exports/Makefile data/Makefile doc/Makefile doc/en/Makefile doc/eu/Makefile doc/pl/Makefile ) dnl GTK2: simplify this, we will have much less options. echo " Configuration: Source code location: ${srcdir} Compiler: ${CC} Gnome support: ${GNOME} Python support: ${with_python} Libart support (PNG export): ${have_libart} Cairo support (experimental): ${with_cairo} Gnome Print support (experimental): ${with_gnomeprint} " echo "Now type make to build dia..."