# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. #AC_PREREQ(2.59) AC_INIT([Agave], [0.4.2], [https://gna.org/bugs/?group=colorscheme], [agave]) AC_CONFIG_SRCDIR([src/main.cc]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE GNOME_DOC_INIT dnl Custom macro that checks if the git binary exists, and if it does, it tries dnl to check the git repository version of the working copy and uses that in dnl the application's 'About' window GIT_REPOSITORY_REVISION() PACKAGE_WEBSITE=[http://home.gna.org/colorscheme/] AC_DEFINE_UNQUOTED([PACKAGE_WEBSITE], ["$PACKAGE_WEBSITE"], [The website of Agave]) AC_SUBST([PACKAGE_WEBSITE]) AC_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE dnl Set Language to C++ and make sure proper tools exist AC_LANG(C++) AC_PROG_CXX AC_PROG_RANLIB AC_CHECK_PROGS(SED, sed) AC_CHECK_PROGS(SORT, sort) AC_CHECK_PROGS(UNIQ, uniq) AC_CHECK_PROGS(TR, tr) dnl i18n AC_PROG_INTLTOOL([0.35.0]) GETTEXT_PACKAGE=agave AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [The domain name to use with gettext]) AM_GLIB_GNU_GETTEXT PKG_CHECK_MODULES(GTKMM, [ gtkmm-2.4 >= 2.8.0 ]) PKG_CHECK_MODULES(LIBGLADEMM, [ libglademm-2.4 ]) dnl Check to see if the version of gtkmm is recent enough to support the new dnl printing support PKG_CHECK_MODULES(PRINTING, [gtkmm-2.4 >= 2.10.0], have_gtk_printing=yes, have_gtk_printing=no) if test "x$have_gtk_printing" = "xyes"; then AC_DEFINE([HAVE_GTK_PRINTING], 1, [using at least gtkmm version 2.10.0]) else AC_MSG_RESULT(no) fi dnl Determine whether to compile with support for GNOME libraries (i.e. dnl libgnome and libgnomeui) AC_ARG_ENABLE(gnome, [AC_HELP_STRING([--enable-gnome], [build with libgnome support [default=yes]])],, [enable_gnome=yes]) if test "x$enable_gnome" = "xyes"; then PKG_CHECK_MODULES([GNOME], [libgnomeui-2.0]) AC_DEFINE([HAVE_GNOME], [1], [Compile with libgnome support]) fi dnl Determine whether to compile with support for GConfmm AC_ARG_ENABLE(gconf, [AC_HELP_STRING([--enable-gconf], [build with gconfmm support [default=yes]])],, [enable_gconf=yes]) if test "x$enable_gconf" = "xyes"; then PKG_CHECK_MODULES([GCONFMM], [gconfmm-2.6]) AC_DEFINE([HAVE_GCONFMM], [1], [Compile with gconfmm support]) dnl *************** dnl gconf tool and path info dnl *************** AC_PATH_PROG(GCONFTOOL, gconftool-2) dnl FIXME: this may break if gconf is not installed even if the user dnl requests that gconf be disabled. Do I need to copy this macro into my dnl source tree?? AM_GCONF_SOURCE_2 AC_SUBST(GCONFTOOL) else dnl workaround for automake complaining about this not being defined if dnl AM_GCONF_SOURCE_2 is not executed. AM_CONDITIONAL(GCONF_SCHEMAS_INSTALL, false) fi dnl Determine whether to compile with debug settings. Essentially this just dnl disables compiler optimizations for now AC_ARG_ENABLE(debug-mode, [AC_HELP_STRING([--enable-debug-mode], [build with debug settings (no optimization, test coverage)])],, [enable_debug_mode=no]) AC_MSG_CHECKING(whether to compile with debug settings) if test "x$enable_debug_mode" = "xyes"; then AC_MSG_RESULT(yes) dnl remove optimization settings from CFLAGS CXXFLAGS=[`echo "$CXXFLAGS" | $SED -e 's/-O[0-9]*//g'`] CFLAGS=[`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`] else AC_MSG_RESULT(no) fi dnl always compile with Wall CXXFLAGS="$CXXFLAGS -Wall" dnl Turn on the additional warnings last, so -Werror doesn't affect other tests. AC_ARG_ENABLE(more-warnings, [AC_HELP_STRING([--enable-more-warnings], [Maximum compiler warnings])], set_more_warnings="$enableval",[set_more_warnings=no]) AC_MSG_CHECKING(for more warnings, including -Werror) if test "$GXX" = "yes" -a "$set_more_warnings" != "no"; then AC_MSG_RESULT(yes) CXXFLAGS="-Wextra -Weffc++ -Wctor-dtor-privacy -Woverloaded-virtual -Wchar-subscripts -Wpointer-arith \ -Wcast-align -Wsign-compare -Werror \ $CXXFLAGS" for option in -Wno-strict-aliasing -Wno-sign-compare; do SAVE_CFLAGS="$CXXFLAGS" CFLAGS="$CXXFLAGS $option" AC_MSG_CHECKING([whether gcc understands $option]) AC_TRY_COMPILE([], [], has_option=yes, has_option=no,) if test $has_option = no; then CXXFLAGS="$SAVE_CFLAGS" fi AC_MSG_RESULT($has_option) unset has_option unset SAVE_CFLAGS done unset option else AC_MSG_RESULT(no) fi dnl Get the cppunit path for doing unit tests AC_ARG_ENABLE(cppunit, [AC_HELP_STRING([--enable-cppunit], [build unit tests [default = yes]])],, [enable_cppunit=yes], [enable_cppunit=no]) AM_CONDITIONAL(HAVE_CPPUNIT, test "x$enable_cppunit" = "xyes") if test -n HAVE_CPPUNIT; then AM_PATH_CPPUNIT(1.10.0) fi dnl test for boost::shared_ptr AC_CHECK_HEADER([boost/shared_ptr.hpp], ,AC_MSG_ERROR(dnl [Boost header shared_ptr.hpp not found])) dnl Sort and remove any duplicates from the whitespace separated list of 'words' dnl so that the compile commandline doesn't get huge because of duplicated flags dnl and libraries dnl FIXME: this won't work if paths contain spaces AC_DEFUN([PRUNE_DUPS], [`echo $1 | $TR -s "[[:blank:]]" "\n" | $SORT | $UNIQ | $TR "\n" " "`]) dnl Consolidate all libraries and flags into one variable AGAVE_LIBS=PRUNE_DUPS("$GTKMM_LIBS $LIBGLADEMM_LIBS $GCONFMM_LIBS $GNOME_LIBS") AGAVE_CFLAGS=PRUNE_DUPS("$GTKMM_CFLAGS $LIBGLADEMM_CFLAGS $GCONFMM_CFLAGS $GNOME_CFLAGS") AC_SUBST(AGAVE_LIBS) AC_SUBST(AGAVE_CFLAGS) dnl Define directory locations for use in the program AGAVE_LOCALEDIR=[${datadir}/locale] AGAVE_COMMONDIR=[${datadir}/agave] AGAVE_ICONDIR=[${AGAVE_COMMONDIR}/pixmaps] AGAVE_UIDIR=[${AGAVE_COMMONDIR}/ui] AGAVE_PALETTEDIR=[${AGAVE_COMMONDIR}/palettes] dnl pass the variables to automake AC_SUBST([AGAVE_LOCALEDIR]) AC_SUBST([AGAVE_ICONDIR]) AC_SUBST([AGAVE_UIDIR]) AC_SUBST([AGAVE_PALETTEDIR]) AC_CONFIG_FILES([Makefile po/Makefile.in src/Makefile src/core/Makefile src/paletteparser/Makefile src/widgets/Makefile src/dialogs/Makefile pixmaps/Makefile data/Makefile data/agave.desktop.in data/ui/Makefile data/palettes/Makefile tests/Makefile tests/core/Makefile tests/paletteparser/Makefile tests/widgets/Makefile help/Makefile ]) AC_OUTPUT() dnl ================================================== echo "" echo "======================================================================" echo "" echo "$PACKAGE_NAME configuration:" echo " C compiler : $CC" echo " C++ compiler : $CXX" echo " Prefix : $prefix" echo "" echo "$PACKAGE_NAME will be compiled with the following features:" echo " Gconfmm support : $enable_gconf" echo " GNOME library support : $enable_gnome" echo " Printing support : $have_gtk_printing" echo "" echo "The following options will be passed to the compiler:" echo " CFLAGS: $CFLAGS" echo " CXXFLAGS: $CXXFLAGS" echo "" echo " AGAVE_CFLAGS: $AGAVE_CFLAGS" echo "" echo " AGAVE_LIBS: $AGAVE_LIBS" echo "" echo "======================================================================" echo ""