-*- mode: m4 -*- AC_PREREQ(2.52) m4_define([present_version_epoch], [0]) m4_define([present_version_major], [0]) m4_define([present_version_minor], [3]) m4_define([present_version_extra], []) m4_define([present_full_version], [present_version_epoch.present_version_major.present_version_minor[]present_version_extra]) dnl Emphasize some of the checks. m4_define([BIG_CHECKING], [AC_MSG_CHECKING([ ======== $1])]) AC_INIT([present], [present_full_version], [http://bugzilla.gnome.org/enter_bug.cgi?product=gnumeric]) AC_CONFIG_SRCDIR(present/gnome-presentation-viewer.c) AM_INIT_AUTOMAKE([dist-bzip2]) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE # Make --disable-static the default AC_DISABLE_STATIC # We need intltool >= 0.27.2 to extract the UTF-8 chars from source code AC_PROG_INTLTOOL([0.27.2]) 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 ***************************** present_reqs=" libgoffice-1 >= 0.0.2 " PKG_CHECK_MODULES(PRESENT, $present_reqs) PRESENT_CFLAGS="$PRESENT_CFLAGS" dnl ***************************** AC_MSG_CHECKING([for native Win32]) case "$host" in *-*-mingw*) native_win32=yes ;; *) native_win32=no ;; esac AC_MSG_RESULT([$native_win32]) AM_CONDITIONAL(OS_WIN32, test "$native_win32" = yes) AC_MSG_CHECKING([for Win32 platform in general]) case "$host" in *-*-mingw*|*-*-cygwin*) platform_win32=yes ;; *) platform_win32=no ;; esac AC_MSG_RESULT($platform_win32) AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = yes) win32=no case $host_os in *mingw* | pw32* | cygwin*) win32=yes AC_CHECK_TOOL(WINDRES, windres, :) ;; esac AM_CONDITIONAL(WITH_WIN32, test x"$win32" = "xyes") dnl **************************** dnl prep the pixmap generator dnl **************************** dnl We need the full pathname here, since some targets depend on $(GLIB_GENMARSHAL). dnl AC_ARG_VAR(GLIB_GENMARSHAL, [Absolute path of the glib-genmarshal executable.]) AC_PATH_PROG(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; 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) # 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, "") AC_SUBST(GETTEXT_PACKAGE, present) 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 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 float_msg=no float_feature=0 AC_C_LONG_DOUBLE if test "x$ac_cv_c_long_double" = "xyes"; 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 "x$need_sunmath" = "x0"; then # FIXME: better idea? LDFLAGS="$LDFLAGS $sunmathlinkstuff" sunmathinclude=`ls -d /opt/SUNWspro/*/include/cc | tail -1` CPPFLAGS="$CPPFLAGS -I$sunmathinclude" fi need_sunmath=1 ], [have_mandatory_funcs=no], [-L/opt/SUNWspro/lib $PRESENT_LIBS])])]) done if test "x$need_sunmath" = "x1"; then AC_SUBST(EXTRA_LIBS, "$EXTRA_LIBS $sunmathlinkstuff") AC_SUBST(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 AC_CHECK_FUNCS(modfl frexpl ldexpl strtold string_to_decimal decimal_to_quadruple) must_prototype_strtold=0 if test "x$ac_cv_func_strtold" = "xyes"; 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) must_prototype_strtold=1 AC_DEFINE(MUST_PROTOTYPE_STRTOLD, 1, [Define if we need to provide a prototype for strtold()] )], [AC_MSG_RESULT(assuming not)]) elif 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 if test "$have_mandatory_funcs" = yes; then float_msg=yes float_feature=1 else AC_MSG_WARN([Long double support disabled because of library problems]) fi unset have_mandatory_funcs if test "x$ac_cv_func_modfl" = "xyes"; then needit=0; else needit=1; fi AC_SUBST(PRESENT_SUPPLIED_MODFL,$needit) if test "x$ac_cv_func_ldexpl" = "xyes"; then needit=0; else needit=1; fi AC_SUBST(PRESENT_SUPPLIED_LDEXPL,$needit) if test "x$ac_cv_func_frexpl" = "xyes"; then needit=0; else needit=1; fi AC_SUBST(PRESENT_SUPPLIED_FREXPL,$needit) if test "x$ac_cv_func_strtold" = "xyes" -a $must_prototype_strtold -eq 0 ; then needit=0; else needit=1; fi AC_SUBST(PRESENT_SUPPLIED_STRTOLD,$needit) fi AC_SUBST(PRESENT_WITH_LONG_DOUBLE,$float_feature) unset float_feature dnl ****************** dnl * Config defaults dnl ****************** dnl AC_SUBST(present_version, "${VERSION}") AC_SUBST(present_prefix, '${prefix}') AC_SUBST(present_exec_prefix, '${exec_prefix}') dnl dnl These are changed in libgnumeric.c for WIN32 packages AC_SUBST(present_datadir, '${datadir}/present/${present_version}') AC_SUBST(present_libdir, '${libdir}/present/${present_version}') AC_SUBST(present_plugindir, '${present_libdir}/plugins') AC_SUBST(present_gladedir, '${present_datadir}/glade') AC_SUBST(present_icondir, '${datadir}/pixmaps/present') AC_SUBST(present_localedir, '${prefix}/${DATADIRNAME}/locale') dnl dnl Version info for libraries = CURRENT:REVISION:AGE PRESENT_LIB_VERSION_EPOCH_PLUS_MAJOR=`expr present_version_epoch + present_version_major` PRESENT_LIB_VERSON=$PRESENT_LIB_VERSION_EPOCH_PLUS_MAJOR:present_version_minor:present_version_major AC_SUBST(PRESENT_LIB_VERSON) dnl Export to present-config.h AC_DEFINE(PRESENT_VERSION, "present_full_version", [The version number of this release, possibly with additional suffix]) AC_DEFINE(GO_VERSION_EPOCH, present_version_epoch, [The Epoch of this release]) AC_DEFINE(GO_VERSION_MAJOR, present_version_major, [The Major version number of this release]) AC_DEFINE(GO_VERSION_MINOR, present_version_minor, [The Minor version number of this release]) AC_DEFINE(GO_VERSION_EXTRA, "present_version_extra", [Extra, possibly empty tag for this release]) AC_CONFIG_FILES([ Makefile present/Makefile libpresent/Makefile tests/Makefile po/Makefile.in stamp.h libpresent-1.pc ]) AC_OUTPUT echo " Configuration: Source code location: ${srcdir} Compiler: ${CC} Compiler flags: ${CFLAGS} "