dnl =======================================================
dnl FILE: ./admin/configure.in.min
dnl =======================================================

dnl    This file is part of the KDE libraries/packages
dnl    Copyright (C) 2001 Stephan Kulow (coolo@kde.org)
 
dnl    This file is free software; you can redistribute it and/or
dnl    modify it under the terms of the GNU Library General Public
dnl    License as published by the Free Software Foundation; either
dnl    version 2 of the License, or (at your option) any later version.
 
dnl    This library is distributed in the hope that it will be useful,
dnl    but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dnl    Library General Public License for more details.
 
dnl    You should have received a copy of the GNU Library General Public License
dnl    along with this library; see the file COPYING.LIB.  If not, write to
dnl    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
dnl    Boston, MA 02111-1307, USA.

# Original Author was Kalle@kde.org
# I lifted it in some mater. (Stephan Kulow)
# I used much code from Janos Farkas

dnl Process this file with autoconf to produce a configure script.

AC_INIT(acinclude.m4) dnl a source file from your sub dir

dnl This is so we can use kde-common
AC_CONFIG_AUX_DIR(admin)

dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
unset CDPATH

dnl Checking host/target/build systems, for make, install etc.
AC_CANONICAL_SYSTEM 
dnl Perform program name transformation
AC_ARG_PROGRAM

dnl Automake doc recommends to do this only here. (Janos)
AM_INIT_AUTOMAKE(kmymoney2, 1.0.4) dnl searches for some needed programs

KDE_SET_PREFIX

dnl generate the config header
AM_CONFIG_HEADER(config.h) dnl at the distribution this done

dnl Checks for programs.
AC_CHECK_COMPILERS
AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
KDE_PROG_LIBTOOL

dnl for NLS support. Call them in this order!
dnl WITH_NLS is for the po files
AM_KDE_WITH_NLS

KDE_USE_QT(3.3.1)
AC_PATH_KDE
dnl =======================================================
dnl FILE: configure.in.in
dnl =======================================================

#MIN_CONFIG(3.3.1)

dnl PACKAGE set before

KDE_ENABLE_HIDDEN_VISIBILITY

AM_KDE_MIN_VERSION(3, 4, 0)

dnl
dnl check for a recent autoconf version
dnl
AC_PREREQ(2.53)

dnl
dnl check for atoll and strtoll
dnl
AC_FUNC_CHECK(atoll, [AC_DEFINE_UNQUOTED(HAVE_ATOLL, 1, [define if you have atoll])])
AC_FUNC_CHECK(strtoll, [AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1, [define if you have strtoll])])
AC_CHECK_LIB(m, round, [AC_DEFINE_UNQUOTED(HAVE_ROUND, 1, [define if you have round])]
)

dnl
dnl add check for project's memory leak checker
dnl
AC_MEMORY_LEAK_CHECK()

dnl
dnl add checks for cppunit
dnl
AM_PATH_CPPUNIT(1.8.0,
	AM_CONDITIONAL(CPPUNIT, test "x$no_cppunit" = x)
	AC_DEFINE_UNQUOTED(HAVE_LIBCPPUNIT, 1, [Define if you have libcppunit])
	AC_SUBST(CPPUNIT_LIBS),
	AM_CONDITIONAL(CPPUNIT, test "x$no_cppunit" = x)
	AC_SUBST(CPPUNIT_LIBS)
	)

dnl
dnl check for tools required for generation of PDF documentation 
dnl
AC_PDF_GENERATION()

dnl
dnl check for kdchart
dnl 
dnl AC_KDCHART()
AC_DEFINE_UNQUOTED(HAVE_KDCHART, "1", [Define if you have libkdchart])
AC_DEFINE_UNQUOTED(HAVE_KDCHART_SETPROP, "1", [Define if you have KDChartListTableData::setProp method])


dnl
dnl check for libofx
dnl 
AC_LIBOFX()

dnl
dnl check for library build for Qt-Designer
dnl
AC_QTDESIGNER_SUPPORT()

dnl
dnl check for sqlite3 support
dnl
AC_SQLITE3()

dnl CXXFLAGS="$NOOPT_CXXFLAGS" dnl __tdevelop[noopt]__
CXXFLAGS="$CXXFLAGS $USE_EXCEPTIONS" dnl __tdevelop[exc]__
dnl KDE_NEED_FLEX dnl __tdevelop__
dnl AC_PROG_YACC dnl __tdevelop__

#
# make sure the UIC compiler uses our own widget lib
#
X=`echo $UIC | grep -- -L`
if test "x$X" = "x"; then
	echo "UIC does not support -L option!!";
fi
UIC=`echo $UIC -L \$\(top_builddir\)/kmymoney2/widgets/.libs`

#
# create header directory, make symlinks
#

rm -rf kmymoney
mkdir kmymoney

echo Generating symlinks to header files
CURDIR=
if test "x${srcdir}" = "x${srcdir#/}"; then
  CURDIR=`pwd`/
fi
BASEDIR=$CURDIR$srcdir


while read a; do
  MFILES=$(find $BASEDIR/$a -name Makefile.am);
  for MFILE in $MFILES; do
    DIR=$(dirname $MFILE)
    HFILES=$(grep -v noinst_HEADERS $MFILE | grep _HEADERS)
    for HFILE in $HFILES; do
      case $HFILE in
        =|*_HEADERS|\\)
          ;;
        *)
          ln -s $DIR/$HFILE kmymoney/$HFILE
          ;;
      esac
    done
  done
done < $srcdir/inst-apps

dnl =======================================================
dnl FILE: kmymoney2/widgets/configure.in.in
dnl =======================================================

AC_CONFIG_FILES([ kmymoney2/widgets/makekdewidgets ])
KDE_CREATE_SUBDIRSLIST
AC_CONFIG_FILES([ Makefile ])
AC_CONFIG_FILES([ libkgpgfile/Makefile ])
AC_CONFIG_FILES([ libkdchart/Makefile ])
AC_CONFIG_FILES([ kmymoney2/Makefile ])
AC_CONFIG_FILES([ kmymoney2/converter/Makefile ])
AC_CONFIG_FILES([ kmymoney2/dialogs/Makefile ])
AC_CONFIG_FILES([ kmymoney2/dialogs/settings/Makefile ])
AC_CONFIG_FILES([ kmymoney2/html/Makefile ])
AC_CONFIG_FILES([ kmymoney2/html/images/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/Tango/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/Tango/128x128/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/Tango/128x128/apps/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/Tango/16x16/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/Tango/16x16/actions/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/Tango/22x22/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/Tango/22x22/actions/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/Tango/32x32/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/Tango/32x32/apps/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/Tango/48x48/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/Tango/48x48/apps/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/Tango/64x64/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/Tango/64x64/apps/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/Tango/scalable/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/hicolor/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/hicolor/16x16/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/hicolor/16x16/actions/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/hicolor/22x22/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/hicolor/22x22/actions/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/hicolor/32x32/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/hicolor/32x32/apps/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/hicolor/48x48/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/hicolor/48x48/apps/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/hicolor/64x64/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/hicolor/64x64/apps/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/oxygen/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/oxygen/128x128/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/oxygen/128x128/apps/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/oxygen/16x16/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/oxygen/16x16/actions/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/oxygen/22x22/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/oxygen/22x22/actions/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/oxygen/32x32/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/oxygen/32x32/apps/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/oxygen/48x48/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/oxygen/48x48/apps/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/oxygen/64x64/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/oxygen/64x64/apps/Makefile ])
AC_CONFIG_FILES([ kmymoney2/icons/oxygen/scalable/Makefile ])
AC_CONFIG_FILES([ kmymoney2/misc/Makefile ])
AC_CONFIG_FILES([ kmymoney2/mymoney/Makefile ])
AC_CONFIG_FILES([ kmymoney2/mymoney/storage/Makefile ])
AC_CONFIG_FILES([ kmymoney2/pics/Makefile ])
AC_CONFIG_FILES([ kmymoney2/plugins/Makefile ])
AC_CONFIG_FILES([ kmymoney2/plugins/interfaces/Makefile ])
AC_CONFIG_FILES([ kmymoney2/plugins/ofximport/Makefile ])
AC_CONFIG_FILES([ kmymoney2/plugins/ofximport/dialogs/Makefile ])
AC_CONFIG_FILES([ kmymoney2/reports/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/C/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/de_AT/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/de_CH/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/de_DE/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/dk/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/el_GR/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/en_GB/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/en_US/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/es_AR/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/es_ES/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/es_MX/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/fr_CA/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/fr_CH/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/fr_FR/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/gl_ES/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/hu_HU/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/it/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/jp/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/nl_NL/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/pt_BR/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/pt_PT/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/ro_RO/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/ru_RU/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/sk/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/tr_TR/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/zh_CN/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/zh_HK/Makefile ])
AC_CONFIG_FILES([ kmymoney2/templates/zh_TW/Makefile ])
AC_CONFIG_FILES([ kmymoney2/views/Makefile ])
AC_CONFIG_FILES([ kmymoney2/widgets/Makefile ])
AC_CONFIG_FILES([ kmymoney2/wizards/Makefile ])
AC_CONFIG_FILES([ kmymoney2/wizards/newaccountwizard/Makefile ])
AC_CONFIG_FILES([ kmymoney2/wizards/newuserwizard/Makefile ])
AC_CONFIG_FILES([ kmymoney2/wizards/wizardpages/Makefile ])
AC_CONFIG_FILES([ po/Makefile ])
AC_CONFIG_FILES([ developer-doc/Makefile ])
AC_CONFIG_FILES([ developer-doc/phb/Makefile ])
AC_CONFIG_FILES([ doc/Makefile ])
AC_CONFIG_FILES([ doc/en/Makefile ])
AC_CONFIG_FILES([ contrib/Makefile ])
AC_OUTPUT
echo ""
echo ""
echo "Configure results (user options):"
echo "------------------------------------------"
echo "OFX plugin:                            $enable_ofxplugin"

echo ""

echo "OFX direct connect:                    $enable_ofxbanking"

echo ""

echo "Chart support:                         yes"

echo ""

echo "SQLITE3 support:                       $enable_sqlite3"

echo "------------------------------------------"
echo ""
echo ""
echo "Configure results (developer options):"
echo "------------------------------------------"
if test "x$use_memory_leak_check" != "xno"; then
	echo "Memory leak check support:             yes"
else
	echo "Memory leak check support:             no"
fi

echo ""

if test "$enable_qtdesigner" = "yes"; then
	echo "Qt-Designer library support:           yes"
else
	echo "Qt-Designer library support:           no"
fi

echo ""

echo "PDF document generation:               $enable_pdfdocs"

echo ""

if test x$no_cppunit = x; then
	echo "CPPUNIT support:                       yes"
	echo "        online tests:                  "$enable_online_tests;
elif test x$no_cppunit = xuser; then
	echo "CPPUNIT support:                       disabled"
else
	echo "CPPUNIT support:                       no"
	echo "    You are missing the CPPUNIT headers and libraries"
	echo "    The unit test framework support won't be compiled."
	echo "    This is not relevant for the usage of the application.";
	echo "    Unit tests are only required by the developers.";
fi

echo "------------------------------------------"
# Check if KDE_SET_PREFIX was called, and --prefix was passed to configure
if test -n "$kde_libs_prefix" -a -n "$given_prefix"; then
  # And if so, warn when they don't match
  if test "$kde_libs_prefix" != "$given_prefix"; then
    # And if kde doesn't know about the prefix yet
    echo ":"`kde-config --path exe`":" | grep ":$given_prefix/bin/:" 2>&1 >/dev/null
    if test $? -ne 0; then
      echo ""
      echo "Warning: you chose to install this package in $given_prefix,"
      echo "but KDE was found in $kde_libs_prefix."
      echo "For this to work, you will need to tell KDE about the new prefix, by ensuring"
      echo "that TDEDIRS contains it, e.g. export TDEDIRS=$given_prefix:$kde_libs_prefix"
      echo "Then restart KDE."
      echo ""
    fi
  fi
fi

if test "$all_tests" = "bad"; then
  if test ! "$cache_file" = "/dev/null"; then
    echo ""
    echo "Please remove the file $cache_file after changing your setup"
    echo "so that configure will find the changes next time."
    echo ""
  fi
else
  echo ""
  echo "Good - your configure finished. Start make now"
  echo ""
fi