dnl Process this -*- autoconf -*- file with autoconf to produce a dnl configure script. AC_INIT(app/diagram.c) dnl AC_PREREQ(2.50) dnl AC_REVISION($Revision: 1.152 $) AM_INIT_AUTOMAKE(dia, 0.90) dnl Specify a header configuration file AM_CONFIG_HEADER(config.h) dnl do this check now, to keep autogen quiet. AC_PROG_CC 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 stuff for xml-i18n-tools AC_PROG_INTLTOOL(0.12) dnl we will update this to 0.21 soon. dnl Checks for libraries. dnl AM_PATH_GLIB(1.2.9) dnl (for g_critical) AM_PATH_GTK(1.2.0) dnl XIM support (on by default) AC_ARG_ENABLE(xim, [ --disable-xim enable gnome code],,enable_xim=yes) AC_MSG_CHECKING([whether to enable XIM support]) if test "x$enable_xim" != xno; then AC_DEFINE(USE_XIM) fi AC_MSG_RESULT($enable_xim) APP_LIBS="" AC_SUBST(APP_LIBS) dnl dnl GNOME dnl AC_MSG_CHECKING([whether GNOME specific code should be used]) AC_ARG_ENABLE(gnome, [ --enable-gnome enable gnome code], GNOME=$enableval, GNOME=no) AC_ARG_ENABLE(gnome-print, [ --enable-gnome-print enable gnome-print support],,enable_gnome_print=no) AC_ARG_ENABLE(bonobo, [ --enable-bonobo enable bonobo support],,enable_bonobo=no) AC_MSG_RESULT($GNOME) GNOME_CFLAGS="" GNOME_LIBS="" BONOBO_LIBS="" bonobo_msg=no have_gnome=false have_bonobo=false if test "$GNOME" = "yes"; then AC_DEFINE(GNOME) have_gnome=true components="gnomeui" hcomponents="" if test "$enable_gnome_print" = "yes"; then AC_DEFINE(GNOME_PRINT) components="$components print" fi if test "$enable_bonobo" = "yes"; then AC_MSG_CHECKING(for Bonobo >= 0.31) if gnome-config --libs bonobox_print > /dev/null 2>&1; then vers=`gnome-config --modversion bonobo | sed -e "s/bonobo-//" | \ awk 'BEGIN { FS = "."; } { printf "%d", $1 * 1000 + $2;}'` if test "$vers" -ge 31; then bonobo_ok=true else bonobo_ok=false fi else bonobo_ok=false fi if $bonobo_ok; then AC_MSG_RESULT([found ("$vers")]) have_bonobo=true bonobo_msg=yes else AC_MSG_RESULT([not found]) fi hcomponents="$hcomponents bonobox_print" BONOBO_LIBS=`gnome-config bonobox_print $components --libs` fi GNOME_CFLAGS=`gnome-config $hcomponents $components --cflags` GNOME_LIBS=`gnome-config $components --libs` fi AM_CONDITIONAL(HAVE_GNOME, $have_gnome) AM_CONDITIONAL(HAVE_GNOME_PRINT, $have_gnome && test "$enable_gnome_print" = "yes") AM_CONDITIONAL(HAVE_BONOBO, $have_bonobo) AC_SUBST(GNOME_CFLAGS) AC_SUBST(GNOME_LIBS) AC_SUBST(BONOBO_LIBS) dnl Check if this Gnome has Bonobo OLDCPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS `glib-config --cflags`" dnl This is required to play character set games AM_LANGINFO_CODESET AM_ICONV dnl check for libunicode UNICODE_CFLAGS= UNICODE_LIBS= have_unicode=false yn_have_unicode=no AC_MSG_CHECKING(for libunicode) if unicode-config --libs > /dev/null 2>&1; then vers=`unicode-config --version` have_unicode=true yn_have_unicode=yes UNICODE_CFLAGS=`unicode-config --cflags` UNICODE_LIBS=`unicode-config --libs` AC_DEFINE(HAVE_UNICODE,, Unicode support library available) AC_MSG_RESULT([found, version $vers]) else AC_MSG_RESULT([not found]) fi AC_SUBST(UNICODE_CFLAGS) AC_SUBST(UNICODE_LIBS) AM_CONDITIONAL(HAVE_UNICODE,$have_unicode) CPPFLAGS=$OLDCPPFLAGS dnl check for libfreetype AC_ARG_ENABLE(freetype, [ --enable-freetype enable (LIMITED, EXPERIMENTAL) freetype support],, freetype=yes) FREETYPE_CFLAGS= FREETYPE_LIBS= have_freetype=false yn_have_freetype=no if test "$enable_freetype" = "yes"; then AC_CHECK_FT2(2.0.5, [have_freetype=true FREETYPE_CFLAGS=$FT2_CFLAGS FREETYPE_LIBS=$FT2_LIBS AC_DEFINE(HAVE_FREETYPE,, Freetype support library available) yn_have_freetype=yes]) fi AC_SUBST(FREETYPE_CFLAGS) AC_SUBST(FREETYPE_LIBS) AM_CONDITIONAL(HAVE_FREETYPE,$have_freetype) CPPFLAGS=$OLDCPPFLAGS dnl dnl Popt dnl AC_CHECK_LIB(popt, poptSetOtherOptionHelp, [AC_DEFINE(HAVE_LIBPOPT) APP_LIBS="$APP_LIBS -lpopt"]) AC_CHECK_HEADERS(popt.h) dnl dnl libart_lgpl dnl AM_PATH_LIBART(2.1.0,dnl [have_libart=yes AC_DEFINE(HAVE_LIBART)], [have_libart=no]) dnl dnl gdk_pixbuf dnl AM_PATH_GDK_PIXBUF(0.7.0,,AC_MSG_ERROR([gdk-pixbuf >= 0.7.0 is required])) dnl dnl libpng dnl 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]) AC_TRY_COMPILE([#include ], [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;], png_ok=yes, png_ok=no) AC_MSG_RESULT($png_ok) if test "$png_ok" = yes; then PNG_LIBS='-lpng -lz -lm' AC_DEFINE(HAVE_LIBPNG) fi fi AC_SUBST(PNG_LIBS) LIBS="${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 ALL_LINGUAS="az ca da de el en_GB es fi fr ga hu it ja ko nl nn no pl pt pt_BR ru sk sl sv tr uk vi zh_CN zh_TW" AM_GNU_GETTEXT localedir='${prefix}/${DATADIRNAME}/locale' AC_SUBST(localedir) dnl dnl Locate the gnome-xml library dnl found_libxml=false 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 if ! $found_libxml; 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 ! $found_libxml; 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])) CFLAGS="${CFLAGS} ${Z_CFLAGS}" LIBS="${LIBS} ${Z_LIBS}" 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 Set some variables we'll need for the UTF-8 transition. gtk_advancement=dia_talks_utf8 if test "$gtk_advancement" = "initial"; then AC_DEFINE(GTK_DOESNT_SPEAK_UTF8_NEITHER_DO_WE,, We haven't begun the transition yet) elif test "$gtk_advancement" = "dia_talks_utf8"; then AC_DEFINE(UNICODE_WORK_IN_PROGRESS,,Cyrille's work towards UTF-8) AC_DEFINE(GTK_DOESNT_TALK_UTF8_WE_DO,,...) AC_DEFINE(GTK_CHARSET_MISMATCH,, Mismatch between the charset dia uses and the charset GTK uses) elif test "$gtk_advancement" = "dia_under_win32"; then dnl please check this with Hans. I believe this is true -- CC AC_DEFINE(GTK_TALKS_UTF8,,...) AC_DEFINE(GTK_TALKS_UTF8_WE_DONT,,...) AC_DEFINE(GTK_CHARSET_MISMATCH,, Mismatch between the charset dia uses and the charset GTK uses) elif test "$gtk_advancement" = "gtk2"; then AC_DEFINE(GTK_TALKS_UTF8,,...) AC_DEFINE(UNICODE_WORK_IN_PROGRESS,,Cyrille's work towards UTF-8) dnl the latter shouldn't appear anymore by then (manually compiled) fi dnl Solaris provides isinf() in -lsunmath and defines finite() in math.h have_isinf=no AC_CHECK_HEADERS(math.h, AC_CHECK_LIB(m,isinf, have_isinf=yes)) AC_CHECK_HEADER(sunmath.h, AC_CHECK_LIB(sunmath,isinf, have_isinf=yes)) if test "$have_isinf" = "no"; then AC_CHECK_HEADERS(ieeefp.h, AC_CHECK_FUNC(finite, , AC_MSG_ERROR(Can't find a definition of neither finite nor isinf)), AC_MSG_ERROR(Can't find a definition of neither finite nor isinf)) 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 DIA_CHECK_CFLAG(-Wall) DIA_CHECK_CFLAG(-Wunused) DIA_CHECK_CFLAG(-Winline) DIA_CHECK_CFLAG(-Wmissing-prototypes) DIA_CHECK_CFLAG(-Wmissing-declarations) 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(-finline-functions) DIA_CHECK_CFLAG(-fstrict-aliasing) 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 Handling for Python AC_ARG_WITH(python, [ --with-python compile python plug-in],,with_python=no) #hello 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 po/Makefile.in intl/Makefile objects/Makefile objects/standard/Makefile objects/network/Makefile objects/UML/Makefile objects/ER/Makefile objects/FS/Makefile dnl objects/sybase/Makefile objects/flowchart/Makefile objects/custom/Makefile objects/GRAFCET/Makefile objects/chronogram/Makefile objects/SADT/Makefile shapes/Makefile shapes/Circuit/Makefile shapes/flowchart/Makefile shapes/Contact/Makefile shapes/network/Makefile shapes/Pneumatic/Makefile shapes/Electric/Makefile shapes/Civil/Makefile shapes/jigsaw/Makefile shapes/MSE/Makefile shapes/SDL/Makefile shapes/Logic/Makefile shapes/sybase/Makefile shapes/Misc/Makefile app/Makefile samples/Makefile sheets/Makefile sheets/UML/Makefile sheets/ER/Makefile sheets/GRAFCET/Makefile plug-ins/Makefile plug-ins/cgm/Makefile plug-ins/pstricks/Makefile plug-ins/dxf/Makefile plug-ins/hpgl/Makefile plug-ins/wpg/Makefile plug-ins/wmf/Makefile plug-ins/metapost/Makefile plug-ins/svg/Makefile plug-ins/shape/Makefile plug-ins/xfig/Makefile plug-ins/python/Makefile doc/Makefile doc/en/Makefile doc/pl/Makefile ) echo " Configuration: Source code location: ${srcdir} Compiler: ${CC} Libart (AA rendering, png export): ${have_libart} Gnome support: ${GNOME} Build bonobo component (not supported): ${bonobo_msg} Gnome-print support (not recommended): ${enable_gnome_print} Python support: ${with_python} (LIMITED) Freetype support: ${yn_have_freetype} " if test "$yn_have_unicode" != "yes" ; then echo "Unicode not present. This will NOT build." fi echo "Now type make to build dia."