From 3c1eeefb77c64559ffa704ad4cfa425a29b58290 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 4 Jul 2011 23:03:57 +0000 Subject: Add macros required by kmymoney git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kde-common/admin@1239832 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- acinclude.m4.in | 391 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 391 insertions(+) (limited to 'acinclude.m4.in') diff --git a/acinclude.m4.in b/acinclude.m4.in index 9e250a9..b2f1c4b 100644 --- a/acinclude.m4.in +++ b/acinclude.m4.in @@ -6377,3 +6377,394 @@ AC_DEFUN([KDE_CHECK_PIE_SUPPORT], KDE_USE_PIE="-pie" fi ]) + +dnl +dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl +AC_DEFUN([AM_PATH_CPPUNIT], +[ + +AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)], + cppunit_config_prefix="$withval", cppunit_config_prefix="") +AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)], + cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="") +AC_MSG_CHECKING(if CPPUNIT tests should be built (default=yes)) +AC_ARG_ENABLE(cppunit, + [ --disable-cppunit Do not try to build with CPPUNIT tests],, + enable_cppunit=yes) +AC_MSG_RESULT($enable_cppunit) + +if test "x$enable_cppunit" = "xyes"; then + + AC_MSG_CHECKING(if unit-tests requiring an online connection should be built (default=no)) + AC_ARG_ENABLE(online_tests, + [ --enable-online-tests Include online tests with CPPUNIT tests],, + enable_online_tests=no) + AC_MSG_RESULT($enable_online_tests) + + if test x$cppunit_config_exec_prefix != x ; then + cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix" + if test x${CPPUNIT_CONFIG+set} != xset ; then + CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config + fi + fi + if test x$cppunit_config_prefix != x ; then + cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix" + if test x${CPPUNIT_CONFIG+set} != xset ; then + CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config + fi + fi + + AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no) + cppunit_version_min=$1 + + AC_MSG_CHECKING(for CPPUNIT - version >= $cppunit_version_min) + no_cppunit="" + if test "$CPPUNIT_CONFIG" = "no" ; then + AC_MSG_RESULT(no) + AC_MSG_WARN(Unable to locate cppunit-config. Tests will not be built) + no_cppunit=yes + else + CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags` + CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs` + cppunit_version=`$CPPUNIT_CONFIG --version` + + cppunit_major_version=`echo $cppunit_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + cppunit_minor_version=`echo $cppunit_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + cppunit_micro_version=`echo $cppunit_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + + cppunit_major_min=`echo $cppunit_version_min | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + cppunit_minor_min=`echo $cppunit_version_min | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + cppunit_micro_min=`echo $cppunit_version_min | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + + cppunit_version_proper=`expr \ + $cppunit_major_version \> $cppunit_major_min \| \ + $cppunit_major_version \= $cppunit_major_min \& \ + $cppunit_minor_version \> $cppunit_minor_min \| \ + $cppunit_major_version \= $cppunit_major_min \& \ + $cppunit_minor_version \= $cppunit_minor_min \& \ + $cppunit_micro_version \>= $cppunit_micro_min ` + + if test "$cppunit_version_proper" = "1" ; then + AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version]) + else + AC_MSG_RESULT(no) + AC_MSG_WARN(Minimum version of CPPUNIT couldn't be found. Tests will not be built) + no_cppunit=yes + fi + fi +else + no_cppunit=user +fi + + if test "x$no_cppunit" = x ; then + ifelse([$2], , :, [$2]) + if test "x$enable_online_tests" = "xyes"; then + AC_DEFINE_UNQUOTED(PERFORM_ONLINE_UNITTESTS, 1, [Define if unit tests requiring online access should be compiled]) + fi + else + CPPUNIT_CFLAGS="" + CPPUNIT_LIBS="" + ifelse([$3], , :, [$3]) + fi + + AC_SUBST(CPPUNIT_CFLAGS) + AC_SUBST(CPPUNIT_LIBS) +]) + +dnl +dnl AM_KDE_MIN_VERSION(MIN-VERSION-MAJOR, MIN-VERSION-MINOR, MIN-VERSION-MICRO) +dnl +AC_DEFUN([AM_KDE_MIN_VERSION], +[ + AC_MSG_CHECKING([if minimum KDE version is available]) + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + save_CXXFLAGS=$CXXFLAGS + CXXFLAGS="$CXXFLAGS -I$srcdir $all_includes" + AC_TRY_COMPILE([ + #include "kdecompat.h" + #if !( KDE_IS_VERSION( $1, $2, $3 ) ) + #error KDE version does not meet KMyMoney minimum requirement + #endif + ], [], AC_MSG_RESULT(yes), AC_MSG_ERROR(no) + ) + CXXFLAGS=$save_CXXFLAGS + AC_LANG_RESTORE +]) + + +AC_DEFUN([AC_LIBOFX], +[ +AC_MSG_CHECKING(if the OFX importer plugin is desired) +AC_ARG_ENABLE(ofxplugin, + AC_HELP_STRING([--enable-ofxplugin],[enable OFX importer plugin (default=auto)]), + [enable_ofxplugin="$enableval"], + [enable_ofxplugin="auto"]) +AC_MSG_RESULT($enable_ofxplugin) + +AC_MSG_CHECKING(if OFX direct connect is desired) +AC_ARG_ENABLE(ofxbanking, + AC_HELP_STRING([--enable-ofxbanking],[enable OFX direct connect (default=auto)]), + [enable_ofxbanking="$enableval"], + [enable_ofxbanking="auto"]) +AC_MSG_RESULT($enable_ofxbanking) + +# make sure we include the plugin even if not mentioned explicitly +if test "$enable_ofxbanking" != "no" -a "$enable_ofxplugin" != "yes"; then + enable_ofxplugin=$enable_ofxbanking +fi + +if test "$enable_ofxplugin" != "no" -o "$enable_ofxbanking" != "no"; then + ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" + AC_CHECK_HEADER([OpenSP/macros.h], + [], + [ + if test "$enable_ofxplugin" != "auto" -o "$enable_ofxbanking" != "auto"; then + AC_MSG_ERROR([cannot find OpenSP headers. Please ensure you have OpenSP installed.]) + fi + AC_MSG_RESULT([cannot find OpenSP headers. Skipping OFX support]) + enable_ofxbanking=no + enable_ofxplugin=no + ]) + if test "$enable_ofxplugin" != "no"; then + CFLAGS="$ac_save_CFLAGS" + PKG_CHECK_MODULES(OFX,libofx >= 0.8.2) + fi +fi +if test "$enable_ofxplugin" != "no"; then + OFX_IMPORTERPLUGIN="ofximport" + enable_ofxplugin=yes +fi + +if test "$enable_ofxbanking" != "no"; then + enable_ofxbanking=yes +fi + +AM_CONDITIONAL(OFXBANKING, test "$enable_ofxbanking" != "no" ) +AC_SUBST(OFX_LIBS) +AC_SUBST(OFX_IMPORTERPLUGIN) +]) + +dnl +dnl check the memory leakage checker option +dnl if enabled or disabled, directly controlled +dnl if not given, follows --enable-debug and if +dnl debugging support is turned on, the memory +dnl leakage checker is turned on also +dnl +dnl Need AC_CHECK_COMPILERS to be run before +AC_DEFUN([AC_MEMORY_LEAK_CHECK], [ + AC_ARG_ENABLE( + leak-check, + AC_HELP_STRING([--enable-leak-check],[enable memory leak checker (default=no)]), + use_memory_leak_check=$enableval,use_memory_leak_check=no) + + if test "x$use_memory_leak_check" != "xno"; then + CPPFLAGS="$CPPFLAGS -D_CHECK_MEMORY" + fi + if test "x$kde_use_debug_code" != "xno"; then + CPPFLAGS="$CPPFLAGS -DKMM_DEBUG=1" + else + CPPFLAGS="$CPPFLAGS -DKMM_DEBUG=0" + fi +]) + +dnl +dnl check the pdf generation option +dnl if enabled or disabled, directly controlled +dnl +AC_DEFUN([AC_PDF_GENERATION], [ + AC_MSG_CHECKING(if the PDF document generation is desired) + AC_ARG_ENABLE( pdf-docs, + [ --enable-pdf-docs enable generation of PDF documents (default=auto)], + enable_pdfdocs="$enableval", + enable_pdfdocs="auto") + + AC_MSG_RESULT($enable_pdfdocs) + if test "x$enable_pdfdocs" != "xno"; then + AC_CHECK_PROG(found_recode, recode, yes, no) + AC_CHECK_PROG(found_html2ps, html2ps, yes, no) + AC_CHECK_PROG(found_ps2pdf, ps2pdf, yes, no) + if test "x$found_recode" != "xyes" -o "x$found_html2ps" != "xyes" -o "x$found_ps2pdf" != "xyes"; then + if test "x$enable_pdfdocs" = "xyes"; then + AC_MSG_ERROR(At least one of the tools for PDF generation is missing) + fi + enable_pdfdocs="no" + else + enable_pdfdocs="yes" + fi + fi + + AM_CONDITIONAL(GENERATE_PDF, test "x$enable_pdfdocs" = "xyes") +]) + +dnl Macro to check for KDChart include and library files +dnl Availability of KDChart defaults to 'no' + +AC_DEFUN([AC_QTDESIGNER_SUPPORT], +[ +AC_MSG_CHECKING([if library for Qt-Designer widgets should be installed]) +AC_ARG_ENABLE(qtdesigner, + AC_HELP_STRING([--enable-qtdesigner],[Install KMyMoney specific widget library for Qt-Designer (default=no)]), + [ + enable_qtdesigner="$enableval" + AC_MSG_RESULT($enable_qtdesigner) + ], + [ + enable_qtdesigner="no" + AC_MSG_RESULT($enable_qtdesigner) + ]) + AM_CONDITIONAL(INSTALL_QTDESIGNER_SUPPORT, test "$enable_qtdesigner" = "yes") +]) +# sqlite3.m4 +# ---------- +# +# Copyright 2008 by Thomas Baumgart +# +# License: See file COPYING +# +# Checks for the necessity to build our own qt-sqlite3 support library +# and the presence of the sqlite3 development headers. +# +# Supports the following options: +# +# --enable-sqlite3 +# --disable-sqlite3 +# +# If none of them is present, the detection is automatic. If the development +# headers are not found for automatic detection, the generation will be +# disabled w/o error. If --enable-sqlite3 is provided in the same stage, +# an error is given if the sqlite3 development files are not installed. +# +# The following variables are provided via AC_SUBST: +# +# SQLITE3 - contains the subdirectory to visit for compilation +# LIBSQLITE3 - contains the full pathname for the Qt plugin driver + + +AC_DEFUN([AC_SQLITE3], [ + AC_MSG_CHECKING(if the SQLITE3 support is desired) + AC_ARG_ENABLE(sqlite3, + AC_HELP_STRING([--enable-sqlite3],[build SQLITE3 support library (default=auto)]), + enable_sqlite3="$enableval", + enable_sqlite3="auto") + AC_MSG_RESULT($enable_sqlite3) + + if test ! $enable_sqlite3 = no; then + # determine name and path of sqlite3 plugin library + qtlib="" + if test ! "lib${kdelibsuff}" = "lib"; then + qtlib=".lib64" + fi + if test x$QTDIR = x; then + QTDIR=`dirname $MOC` + QTDIR=${QTDIR%/bin} + fi + LIBSQLITE3=${QTDIR}/plugins/sqldrivers/libsqlite3${qtlib}.so + + # do the checks + if test $enable_sqlite3 = auto; then + AC_MSG_CHECKING(if the SQLITE3 support is already present) + if test ! -e ${LIBSQLITE3}; then + result=no + else + # add check for local qt-sqlite3 directory here + result=yes + enable_sqlite3=no + # in case a previous run unpacked the SQLITE3 support stuff + # it is pretty sure that we have build the existing support + # if that's the case, we just enable it again + if test -d qt-sqlite3-0.2; then + enable_sqlite3=auto + fi + fi + AC_MSG_RESULT($result) + fi + + # we only need to check for the headers in case we need to build + if test ! $enable_sqlite3 = no; then + # now check for the presence of SQLITE libraries + AC_CHECK_HEADER([sqlite3.h], [enable_sqlite3=yes], + [ + if test $enable_sqlite3 = auto; then + enable_sqlite3=no + else + AC_MSG_ERROR(SQLITE development files not found) + fi + ]) + fi + fi + + if test $enable_sqlite3 = yes; then + AC_MSG_CHECKING(if the environment variable QTDIR is set) + if test x$QTDIR = x; then + AC_MSG_ERROR(QTDIR not set) + fi + AC_MSG_RESULT($QTDIR) + ac_qmake=${QTDIR}/bin/qmake + AC_ARG_WITH(qmake, + AC_HELP_STRING([--with-qmake=PATH],[which version of QMake to use ]), + [ ac_qmake="$withval" ]) + fi + + if test $enable_sqlite3 = yes; then + rm -rf qt-sqlite3-0.2 + gunzip -c `dirname -- ${0}`/23011-qt-sqlite3-0.2.tar.gz | tar -xf - + cd qt-sqlite3-0.2 + ${ac_qmake} QMAKE=${ac_qmake} + SQLITE3=qt-sqlite3-0.2 + sed -i s/^install:.*$// Makefile + sed -i s/^uninstall:.*$// Makefile + # create the targets required for 'make distcheck' and 'make [un]install' + cat >> Makefile <