-*- mode: m4 -*- dnl We require Automake 1.7.2, which requires Autoconf 2.54. dnl (It needs _AC_AM_CONFIG_HEADER_HOOK, for example.) AC_PREREQ(2.54) m4_define([goffice_version_epoch], [0]) m4_define([goffice_version_major], [4]) m4_define([goffice_version_minor], [3]) m4_define([goffice_version_extra], []) m4_define([goffice_full_version], [goffice_version_epoch.goffice_version_major.goffice_version_minor[]goffice_version_extra]) dnl Emphasize some of the checks. m4_define([BIG_CHECKING], [AC_MSG_CHECKING([ ======== $1])]) AC_INIT([goffice], [goffice_full_version], [http://bugzilla.gnome.org/enter_bug.cgi?product=libgoffice]) AC_CONFIG_SRCDIR(goffice/goffice.h) AM_INIT_AUTOMAKE([dist-bzip2]) dnl Version info for libraries = CURRENT:REVISION:AGE dnl dnl Within each x.y.*, ABI is maintained backward and _forward_ compatible. dnl (As a consequence, no exported function may be added.) dnl So it's enough to have one interface number per each x.y.* branch. dnl dnl OTOH, we are not able to keep ABI strictly backward compatible throughout dnl the whole x.*.*. dnl The easiest way is to declare no ABI compatibility, ie. AGE is always 0. dnl m4_define([version_iface], m4_eval(100 * goffice_version_epoch + goffice_version_major)) AC_SUBST([VERSION_INFO], [version_iface:goffice_version_minor:0]) AC_SUBST([VERSION_IFACE], [version_iface]) dnl This one is created by autoheader, ... AC_CONFIG_HEADERS(goffice/goffice-config.h) dnl ... and this one is a small subset, maintained manually, dnl which will be installed. AC_CONFIG_HEADERS(goffice/goffice-features.h) dnl dnl Make sure these two won't clash. Put the following to goffice-config.h: AH_BOTTOM([/* Don't include goffice-features.h, it's a subset of goffice-config.h. */ #define GOFFICE_FEATURES_H]) AM_MAINTAINER_MODE # Make --disable-static the default AC_DISABLE_STATIC dnl We need intltool >= 0.27.2 to extract the UTF-8 chars from source code AC_PROG_INTLTOOL([0.27.2]) dnl We use $host_os: AC_CANONICAL_HOST AC_ISC_POSIX AC_PROG_CC AC_PROG_YACC AM_PROG_LEX AC_PROG_LN_S AM_PROG_LIBTOOL AC_STDC_HEADERS AC_SYS_LARGEFILE dnl Propagate Gnome-specific variable ACLOCAL_FLAGS to Makefile. AC_SUBST(ACLOCAL_AMFLAGS, $ACLOCAL_FLAGS) dnl The first call to PKG_CHECK_MODULES is inside an `if.' dnl We have to call PKG_PROG_PKG_CONFIG explicitly; otherwise it would dnl get expanded just before the first occurence of PKG_CHECK_MODULES dnl and might escape execution. dnl dnl While we're at it, we might require a version that supports private libraries dnl PKG_PROG_PKG_CONFIG([0.18]) dnl but there are two problems: dnl 1) we cannot rule out something as new as SuSE 9.3 dnl 2) current versions of PKG_PROG_PKG_CONFIG choke on old versions and woe a dnl "syntax error" instead of "your pkgconfig/pkg-config is too old". dnl Let it be, for now. PKG_PROG_PKG_CONFIG dnl ***************************** goffice_reqs=" glib-2.0 >= 2.8.0 gobject-2.0 >= 2.6.3 gmodule-2.0 >= 2.6.3 libgsf-1 >= 1.13.3 libxml-2.0 >= 2.4.12 pango >= 1.8.1 pangocairo >= 1.8.1 libart-2.0 >= 2.3.11 cairo >= 1.0.0 " goffice_gtk_reqs=" gtk+-2.0 >= 2.6.0 libglade-2.0 >= 2.3.6 libgnomeprint-2.2 >= 2.8.2 " goffice_gnome_reqs=" gconf-2.0 libgnomeui-2.0 >= 2.0.0 libgsf-gnome-1 >= 1.12.2 " dnl ******************* dnl Should we use gtk ? dnl ******************* goffice_with_gtk=true AC_ARG_WITH(gtk, [ --without-gtk Build without UI]) if test "x$with_gtk" = xno; then ui_msg="None (Gtk disabled by request)" goffice_with_gtk=false else dnl We shouldn't silently default to --without-gtk. dnl If the requirements are not met, fail. ui_msg="Gtk" PKG_CHECK_MODULES(GTK, [$goffice_gtk_reqs]) fi goffice_with_gnome=$goffice_with_gtk if test "x$goffice_with_gtk" = "xtrue" ; then AC_DEFINE(GOFFICE_WITH_GTK, 1, [Define if UI is built]) goffice_reqs="$goffice_reqs $goffice_gtk_reqs" dnl ************************************ dnl Are the GNOME extensions available ? dnl ************************************ goffice_with_gnome=true AC_ARG_WITH(gnome, [ --{with,without}-gnome Use GNOME extensions], [if test "x$withval" = xno; then goffice_with_gnome=false ui_msg="Gtk+ (Gnome disabled by request)" fi] ) if test "x$goffice_with_gnome" = "xtrue"; then PKG_CHECK_MODULES(GNOME, [$goffice_gnome_reqs], [ui_msg="Gnome"], [ui_msg="Gtk (missing gnome dependencies)" ; goffice_with_gnome=false]) fi if test "x$goffice_with_gnome" = "xtrue"; then AC_DEFINE(GOFFICE_WITH_GNOME, 1, [Define if GNOME extensions are available]) goffice_reqs="$goffice_reqs $goffice_gnome_reqs" fi fi AM_CONDITIONAL(WITH_GTK, $goffice_with_gtk) AM_CONDITIONAL(WITH_GNOME, $goffice_with_gnome) AC_DEFINE(GOFFICE_WITH_CAIRO, 1, [Goffice uses Cairo]) PKG_CHECK_MODULES(CAIRO_SVG, [cairo-svg >= 1.2.0], [goffice_use_svg_renderer=false], [goffice_use_svg_renderer=true AC_MSG_RESULT(no)]) AM_CONDITIONAL(GOFFICE_USE_SVG_RENDERER, $goffice_use_svg_renderer) AC_SUBST(GOFFICE_USE_SVG_RENDERER) EXTRA_LIBS= EXTRA_INCLUDES= dnl **************************** dnl now that we have selected out libraries the whole collection in one dnl shot so that we can have a nice neat compile/link line dnl **************************** PKG_CHECK_MODULES(GOFFICE, $goffice_reqs) dnl Checks for Xft/XRender AC_CHECK_LIB(Xrender, XRenderFindFormat, [AC_SUBST(RENDER_LIBS, "-lXrender -lXext") AC_DEFINE(HAVE_RENDER, 1, [Define if libXrender is available.])], [AC_SUBST(RENDER_LIBS, "")], [-lXext]) dnl Check for working pcre AC_CHECK_HEADER(pcre.h,[], AC_MSG_ERROR([Header files for PCRE were not found])) AC_CHECK_LIB(pcre,pcre_compile2,[], AC_MSG_ERROR([The PCRE library is missing or too old])) AC_MSG_CHECKING([for UTF-8 support in pcre]) if (pcretest -C 2>&1) | grep -i "^ *UTF-8 support" >/dev/null; then AC_MSG_RESULT(yes) LIBS="$LIBS -lpcre" EXTRA_LIBS="$EXTRA_LIBS -lpcre" else AC_MSG_ERROR([The installed PCRE library is not configured for UTF-8 support.]) fi dnl ***************************** AC_MSG_CHECKING([for Win32 platform]) with_win32=no with_native_win32=no case $host_os in mingw* | pw32* | cygwin*) with_win32=yes GOFFICE_PLUGIN_LDFLAGS="-Wl,--enable-runtime-pseudo-relo,--export-all-symbols $GOFFICE_PLUGIN_LDFLAGS" ;; esac AC_MSG_RESULT($with_win32) AM_CONDITIONAL(WITH_WIN32, test $with_win32 = yes) AC_MSG_CHECKING([for Win32 platform with no Cygwin]) case $host_os in mingw* | pw32*) with_native_win32=yes AC_ARG_VAR(WINDRES, [The windres executable (used by win32 builds only).]) AC_CHECK_TOOL(WINDRES, windres) AC_ARG_VAR(LIBEXE, [The lib.exe executable (used by win32 builds only).]) AC_CHECK_PROG(LIBEXE, lib.exe, yes, no) ;; esac AC_MSG_RESULT($with_native_win32) AM_CONDITIONAL(WITH_NATIVE_WIN32, test $with_native_win32 = yes) AM_CONDITIONAL(HAVE_LIBEXE, test x$LIBEXE = xyes) dnl ***************************** dnl FIXME: perhaps declare with AC_ARG_VAR? dnl If we use the initial value of a variable, we have to make it precious. dnl GOFFICE_PLUGIN_LDFLAGS="-avoid-version -no-undefined $GOFFICE_PLUGIN_LDFLAGS" GOFFICE_PLUGIN_LIBADD="\$(top_builddir)/goffice/libgoffice-0.la $GOFFICE_LIBS $GOFFICE_PLUGIN_LIBADD" AC_SUBST(GOFFICE_PLUGIN_LDFLAGS) AC_SUBST(GOFFICE_PLUGIN_LIBADD) dnl disable for in stable release, re-enable for development series CFLAGS="$CFLAGS -DG_DISABLE_DEPRECATED" CFLAGS="$CFLAGS -DPANGO_DISABLE_DEPRECATED" if test "x$goffice_with_gtk" = "xtrue"; then CFLAGS="$CFLAGS -DGDK_PIXBUF_DISABLE_DEPRECATED" CFLAGS="$CFLAGS -DGDK_DISABLE_DEPRECATED" CFLAGS="$CFLAGS -DGDK_MULTIHEAD_SAFE" #CFLAGS="$CFLAGS -DGTK_DISABLE_DEPRECATED" We need GtkTooltips CFLAGS="$CFLAGS -DLIBGLADE_DISABLE_DEPRECATED" fi if test "x$goffice_with_gnome" = "xtrue"; then CFLAGS="$CFLAGS -DGNOME_DISABLE_DEPRECATED" CFLAGS="$CFLAGS -DBONOBO_DISABLE_DEPRECATED" CFLAGS="$CFLAGS -DBONOBO_UI_DISABLE_DEPRECATED" fi dnl **************************** dnl prep the pixmap generator dnl **************************** AC_ARG_VAR(GLIB_GENMARSHAL, [The glib-genmarshal executable.]) AC_CHECK_PROG(GLIB_GENMARSHAL, glib-genmarshal, glib-genmarshal) AC_ARG_VAR(GDK_PIXBUF_CSOURCE, [The gdk-pixbuf-csource executable.]) AC_CHECK_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, gdk-pixbuf-csource) ## this should come after `AC_PROG_CC' ifdef([GNOME_COMPILE_WARNINGS], [GNOME_COMPILE_WARNINGS] CFLAGS="$CFLAGS $WARN_CFLAGS", [] ) set_more_warnings=yes if test "$GCC" = "yes" -a "x$set_more_warnings" != "xno"; then for option in -Wsign-compare -Wpointer-arith -Wnested-externs -Wchar-subscripts -Wwrite-strings -Wdeclaration-after-statement -Wmissing-noreturn -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-pointer-sign; do SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $option" AC_MSG_CHECKING([whether gcc understands $option]) AC_TRY_COMPILE([], [], has_option=yes, has_option=no,) if test $has_option = no; then CFLAGS="$SAVE_CFLAGS" fi AC_MSG_RESULT($has_option) unset has_option unset SAVE_CFLAGS done unset option fi AC_SUBST(WARN_CFLAGS) AC_CHECK_DECL(fdopen, fdopen_works=yes, fdopen_works=no) if test $fdopen_works = no ; then unset ac_cv_have_decl_fdopen CFLAGS="$CFLAGS -D_POSIX_SOURCE" AC_MSG_NOTICE([adding -D_POSIX_SOURCE to CFLAGS]) AC_CHECK_DECL(fdopen, fdopen_works=yes, fdopen_works=no) if test $fdopen_works = no ; then AC_MSG_ERROR([fdopen is not available]) fi fi # Unfortunately, -D_POSIX_SOURCE turns off struct timeval on Solaris AC_MSG_CHECKING([whether struct timeval is available]) AC_TRY_COMPILE([#include ], [struct timeval tv;], struct_timeval_works=yes, struct_timeval_works=no) AC_MSG_RESULT($struct_timeval_works) if test $struct_timeval_works = no ; then CFLAGS="$CFLAGS -D__EXTENSIONS__" AC_MSG_CHECKING([whether struct timeval is available with -D__EXTENSIONS__]) AC_TRY_COMPILE([#include ], [struct timeval tv;], struct_timeval_works=yes, struct_timeval_works=no) AC_MSG_RESULT($struct_timeval_works) if test $struct_timeval_works = no ; then AC_MSG_ERROR([struct timeval is not available]) fi fi AC_CHECK_FUNC(gettimeofday, [AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Define if the gettimeofday function is available] )]) dnl M_PI AC_MSG_CHECKING([whether M_PI is available]) AC_TRY_COMPILE([#include ], [double f = M_PI], works_without_bsd_source=yes, works_without_bsd_source=no) AC_MSG_RESULT($works_without_bsd_source) if test $works_without_bsd_source = no ; then CFLAGS="$CFLAGS -D_BSD_SOURCE" AC_MSG_CHECKING([whether M_PI is available with -D_BSD_SOURCE]) AC_TRY_COMPILE([#include ], [double f = M_PI], m_pi_works=yes, m_pi_works=no) AC_MSG_RESULT($m_pi_works) if test $m_pi_works = no ; then AC_MSG_ERROR([M_PI is not available]) fi fi dnl ************************************************** AC_SUBST(ALL_LINGUAS, "am az bg ca cs da de el en_CA en_GB es et fi fr ga gl he hr hu it ja ko lv ml mr ms nb nl nn oc pl pt pt_BR ro ru sk sr sr@Latn sv tr uk vi zh_CN zh_TW") AC_SUBST(GETTEXT_PACKAGE, goffice-${VERSION}) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The package name, for gettext]) AM_GLIB_GNU_GETTEXT dnl dnl On Solaris finite() needs ieeefp.h dnl Either of these seem to signal IEEE754 math, see mathfunc.c dnl AC_CHECK_HEADERS(ieeefp.h ieee754.h) dnl Check for implementations of passwd/group file entry functions AC_CHECK_HEADERS(pwd.h grp.h) dnl Check for some functions AC_CHECK_FUNCS(random drand48 finite memmove mkdtemp uname times sysconf) dnl FIXME: Does this really belong here? AC_CHECK_FUNC(bind_textdomain_codeset,,[AC_CHECK_LIB(intl,bind_textdomain_codeset)]) dnl isfinite is a macro on HPUX AC_TRY_COMPILE([#include ], [int a = isfinite(0.0)], [AC_DEFINE(HAVE_ISFINITE, 1, [Define if the isfinite() macro is available] ) ], []) dnl dnl On BSD, we seem to need -lm for finite dnl if test $ac_cv_func_finite = no; then AC_CHECK_LIB(m, finite, [AC_DEFINE(HAVE_FINITE, 1, [Define if the finite function is available] ) LIBS="$LIBS -lm"]) fi dnl check for complete locale implementation AC_CHECK_HEADERS(langinfo.h) dnl Handle systems that have stuff in -lm. AC_CHECK_FUNCS(log) if test $ac_cv_func_log = no; then AC_CHECK_LIB(m, log, [AC_DEFINE(HAVE_LOG, 1, [Define if the log function is available] ) LIBS="$LIBS -lm"]) fi SAVE_LIBS=$LIBS LIBS="$GOFFICE_LIBS $LIBS" AC_CHECK_FUNCS(cairo_surface_set_fallback_resolution) LIBS=$SAVE_LIBS SAVE_CFLAGS=$CFLAGS SAVE_LIBS=$LIBS CFLAGS="$CFLAGS $GOFFICE_CFLAGS" LIBS="$GOFFICE_LIBS $LIBS" AC_MSG_CHECKING([for g_chmod]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[(void)g_chmod("/xxx",0777);]])], [AC_DEFINE(HAVE_G_CHMOD, 1, [Define if g_chmod is available as macro or function]) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]) AC_MSG_CHECKING([for g_access]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[(void)g_access("/xxx",0);]])], [AC_DEFINE(HAVE_G_ACCESS, 1, [Define if g_access is available as macro or function]) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]) if test "x$goffice_with_gtk" = "xtrue" ; then AC_CHECK_FUNCS(gtk_dialog_get_response_for_widget) AC_CHECK_FUNCS(gdk_cairo_set_source_pixbuf) fi CFLAGS=$SAVE_CFLAGS LIBS=$SAVE_LIBS AC_DEFUN([GOFFICE_CHECK_FUNC], [AC_CHECK_FUNC([$1], [], [AC_DEFINE([GOFFICE_SUPPLIED_]AS_TR_CPP([$1]), 1, [Define if G Office supplies $1.])])dnl ]) GOFFICE_CHECK_FUNC(log1p) GOFFICE_CHECK_FUNC(expm1) GOFFICE_CHECK_FUNC(asinh) GOFFICE_CHECK_FUNC(acosh) GOFFICE_CHECK_FUNC(atanh) float_msg=no AC_C_LONG_DOUBLE if test $ac_cv_c_long_double = yes; then have_mandatory_funcs=yes need_sunmath=0 sunmathlinkstuff='-L/opt/SUNWspro/lib -R/opt/SUNWspro/lib -lsunmath' for ldfunc in fabsl logl log10l ceill floorl powl isnanl finitel; do AC_CHECK_FUNC($ldfunc, , [AC_CHECK_LIB(m, $ldfunc, , [AC_CHECK_LIB(sunmath, $ldfunc, [ if test $need_sunmath = 0; then # FIXME: better idea? LDFLAGS="$LDFLAGS $sunmathlinkstuff" sunmathinclude=`ls -d /opt/SUNWspro/*/include/cc | sed '$!d'` CPPFLAGS="$CPPFLAGS -I$sunmathinclude" fi need_sunmath=1 ], [have_mandatory_funcs=no], [-L/opt/SUNWspro/lib $GOFFICE_LIBS])])]) done if test $need_sunmath = 1; then EXTRA_LIBS="$EXTRA_LIBS $sunmathlinkstuff" EXTRA_INCLUDES="$EXTRA_INCLUDES -I$sunmathinclude" AC_CHECK_HEADERS([sunmath.h floatingpoint.h], , [AC_MSG_WARN([Long doubles require the $ac_header header.]) have_mandatory_funcs=no]) fi unset need_sunmath unset sunmathlinkstuff unset sunmathinclude GOFFICE_CHECK_FUNC(modfl) GOFFICE_CHECK_FUNC(ldexpl) GOFFICE_CHECK_FUNC(frexpl) AC_CHECK_FUNCS(strtold) if test "$ac_cv_func_strtold" = yes; then AC_MSG_CHECKING([if we must prototype strtold ourselves]) AC_TRY_RUN([#include int main () { const char *s = "+3.1415e+0"; char *theend; long double res = strtold (s, &theend); return !(*theend == 0 && finitel (res) && res >= 3.14 && res <= 3.15); }], [AC_MSG_RESULT(no)], [AC_MSG_RESULT(yes) AC_DEFINE([GOFFICE_SUPPLIED_STRTOLD], 1, [Define if G Office supplies strtold.]) ], [AC_MSG_RESULT(assuming not)]) else AC_DEFINE([GOFFICE_SUPPLIED_STRTOLD], 1, [Define if G Office supplies strtold.]) AC_CHECK_FUNCS(string_to_decimal decimal_to_quadruple) if test "x$ac_cv_func_string_to_decimal" != "xyes" || \ test "x$ac_cv_func_decimal_to_quadruple" != "xyes" || \ test "x$ac_cv_header_floatingpoint_h" != "xyes"; then AC_MSG_WARN([You lack the strtold function -- precision will be impaired]) fi fi if test "$have_mandatory_funcs" = yes; then float_msg=yes AC_DEFINE([GOFFICE_WITH_LONG_DOUBLE], 1, [Define if G Office supports long double.]) else AC_MSG_WARN([Long double support disabled because of library problems]) fi unset have_mandatory_funcs fi AC_SUBST(EXTRA_LIBS) AC_SUBST(EXTRA_INCLUDES) dnl ****************** dnl * Config defaults dnl ****************** dnl dnl These are changed in goffice.c for WIN32 packages AC_SUBST(goffice_datadir, '${datadir}/goffice/${VERSION}') AC_SUBST(goffice_libdir, '${libdir}/goffice/${VERSION}') AC_SUBST(goffice_icondir, '${datadir}/pixmaps/goffice/${VERSION}') AC_SUBST(goffice_localedir, '${prefix}/${DATADIRNAME}/locale') dnl AC_SUBST(goffice_plugindir, '${goffice_libdir}/plugins') AC_SUBST(goffice_gladedir, '${goffice_datadir}/glade') dnl Export to goffice-config.h and goffice-features.h AC_DEFINE(GOFFICE_VERSION, "goffice_full_version", [The version number of this release, possibly with additional suffix]) AC_DEFINE(GO_VERSION_EPOCH, goffice_version_epoch, [The Epoch of this release]) AC_DEFINE(GO_VERSION_MAJOR, goffice_version_major, [The Major version number of this release]) AC_DEFINE(GO_VERSION_MINOR, goffice_version_minor, [The Minor version number of this release]) AC_DEFINE(GO_VERSION_EXTRA, "goffice_version_extra", [Extra, possibly empty tag for this release]) GTK_DOC_CHECK([1.4]) AC_CONFIG_FILES([ Makefile libgoffice-0.4.pc goffice/Makefile goffice/app/Makefile goffice/utils/Makefile goffice/data/Makefile goffice/gtk/Makefile goffice/graph/Makefile goffice/drawing/Makefile goffice/ms-compat/Makefile goffice/component/Makefile goffice/cut-n-paste/Makefile goffice/cut-n-paste/foocanvas/Makefile plugins/Makefile plugins/plot_barcol/Makefile plugins/plot_pie/Makefile plugins/plot_radar/Makefile plugins/plot_xy/Makefile plugins/plot_surface/Makefile plugins/plot_boxes/Makefile plugins/reg_linear/Makefile plugins/reg_logfit/Makefile plugins/smoothing/Makefile pixmaps/Makefile po/Makefile.in tests/Makefile docs/Makefile docs/reference/Makefile docs/reference/version.xml ]) AC_OUTPUT echo " Configuration: Source code location: ${srcdir} Compiler: ${CC} Compiler flags: ${CFLAGS} Long double support: ${float_msg} UI: ${ui_msg} "