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(kdepim, "3.1.3") 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

dnl KDE_USE_QT
AC_PATH_KDE
#MIN_CONFIG
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/sysctl.h sys/param.h sys/time.h sys/types.h unistd.h)

AC_CONFIG_SUBDIRS(libical)
KDE_NEED_FLEX
KDE_CHECK_STRLCPY

KDE_INIT_DOXYGEN([The KDE-PIM API Reference], [Version $VERSION])
#DO_NOT_COMPILE="$DO_NOT_COMPILE kalarm"
#MIN_CONFIG
dnl Kaplan is not yet ready. Make sure it doesn't hit a release yet...
DO_NOT_COMPILE="$DO_NOT_COMPILE kaplan"
ac_ldflags_safe="$LDFLAGS"
ac_libs_safe="$LIBS" 
LIBS="-lXext -lX11 $X_LDFLAGS" 

LIBXSS=""
AC_CHECK_LIB(Xss, XScreenSaverAllocInfo, [LIBXSS="-lXext -lXss"]) 
if test "x$LIBXSS" != "x"; then
     AC_DEFINE(HAVE_LIBXSS,1,[Define if you have libXss installed])
fi

LIBS="$ac_libs_safe" 
LDFLAGS="$ac_ldflags_safe" 
AC_SUBST(LIBXSS)
DO_NOT_COMPILE="$DO_NOT_COMPILE kitchensync"

dnl Checks if we want to use insure++ to debug
KDE_CHECK_INSURE

# the following is to allow programs, that are known to 
# have problems when compiled with -O2
if test -n "$CXXFLAGS"; then
  safe_IFS=$IFS
  IFS=" "
  NOOPT_CXXFLAGS=""
  for i in $CXXFLAGS; do
    if test "$i" = "-O2"; then
      i=""
    fi
    NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS $i"
  done
  IFS=$safe_IFS
fi
AC_SUBST(NOOPT_CXXFLAGS)

KDE_FIND_PATH(perl, PERL, [], 
	[
	  AC_MSG_WARN([Couldn't find perl 5 or later. ical2vcal will no work.])		],
	[-e 'require 5.000;']
)
	
AC_SUBST(PERL)

KDE_CHECK_STL
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h sys/select.h \
	sys/ioctl.h sys/stropts.h malloc.h sys/sockio.h \
	sys/m_wait.h sys/param.h libgen.h)
AC_HEADER_TIME

AC_LANG_C
AC_C_LONG_DOUBLE
AC_TYPE_GETGROUPS

dnl Checks for library functions.
AC_CHECK_FUNCS(socket strdup vsnprintf basename setenv unsetenv)
AC_CHECK_GETDOMAINNAME
AC_CHECK_GETHOSTNAME
AC_CHECK_USLEEP

dnl AC_OUTPUT(korganizer/ical2vcal)

dnl AC_OUTPUT(korganizer/korganizerIn)

dnl Configure.in.in for KPilot.
dnl
dnl Copyright (C) 2000,2001 Adriaan de Groot
dnl
dnl This file is released under the terms of the Gnu General Public
dnl Licence (GPL) Version 2.

dnl
dnl Check to see if pisock header and library are available
dnl

dnl
dnl Questions and comments can be sent to groot@kde.org
dnl

dnl Check for the headers first. The first test is the somewhat-
dnl sophisticated one AC uses, and incorporates all the extra-includes
dnl and whatnot stuff.
dnl
dnl We need to explicitly use the --with-extra-includes passed in,
dnl since AC_CHECK_HEADER does not do so.
dnl

AC_DEFUN(KPILOT_CHECK_PISOCK,
[

AC_LANG_PUSH(C++)

kpilot_save_cflags="$CPPFLAGS"
kpilot_save_ldflags="$LDFLAGS"


CPPFLAGS="$CPPFLAGS $all_includes"
LDFLAGS="$LDFLAGS $all_libraries"

HAVE_PISOCK=0
PISOCK_LIB=""
PISOCK_INCLUDE=""
pisock_path=""

dnl Try looking normally
dnl
dnl
AC_CHECK_HEADER(pi-file.h,[HAVE_PISOCK=1], )


dnl If nothing found, try some other places that might have
dnl pilot-link installed. These can be extended for particular
dnl distro's; /vol/kde is where I install stuff on Suns and BSD.
dnl
dnl
if  test "$HAVE_PISOCK" = "0" ; then
	pisock_path=""
	AC_MSG_CHECKING([for pi-file.h alternate])
	for i in /usr/local/pilot/include /usr/local/include /vol/kde/support/include /usr/include/libpisock ; do
		test -f $i/pi-file.h && HAVE_PISOCK=1
		test -f $i/pi-file.h && PISOCK_INCLUDE="-I$i"
		test -f $i/pi-file.h && pisock_path="$i"
	done

	if test "$pisock_path" ; then
		AC_MSG_RESULT([found $pisock_path])
	else
		AC_MSG_RESULT([still not found])
		HAVE_PISOCK="0"
	fi

fi

dnl Next, check the version of pilot-link to make sure it's sufficiently new.
dnl
dnl
if test -z "$pisock_path" ; then
	AC_CHECK_HEADER(pi-version.h,[HAVE_PISOCK=1], )
else
	test -d "$pisock_path" || HAVE_PISOCK="0"
	test -f "$pisock_path/pi-version.h" || HAVE_PISOCK="0"
fi

if test "$HAVE_PISOCK" = "0" ; then
	AC_MSG_WARN([KPILOT: no pilot-link headers found.])
fi


dnl Now we know where the includes are, we need to
dnl check the version more closely.
dnl
dnl
CPPFLAGS="$CPPFLAGS $PISOCK_INCLUDE"
if test "$HAVE_PISOCK" = "1" ; then
	AC_MSG_CHECKING([pilot-link version])
	AC_TRY_RUN([
	#include <pi-version.h>
	int main()
	{ if (PILOT_LINK_VERSION==0) {
	    if ((PILOT_LINK_MAJOR==9) && (PILOT_LINK_MINOR>=5)) return (0);
	    if ((PILOT_LINK_MAJOR==10) || (PILOT_LINK_MAJOR==11)) return (0);
	  }
	  return (1);
	}
	]
	,
	[AC_MSG_RESULT([pilot-link version 0.10 or 0.11 found])],
	[AC_MSG_RESULT([Your version of pilot-link won't work with KPilot])]
	HAVE_PISOCK="0"
	,
	[AC_MSG_RESULT([Cross-compiling KPilot is doomed])
	HAVE_PISOCK="0"
	])
fi



if test "$HAVE_PISOCK" = "1" ; then
	HAVE_PISOCK=0

	AC_CHECK_LIB(pisock,
		pi_accept,
		[PISOCK_LIB="-lpisock"
		HAVE_PISOCK=1
		],
		[
		unset ac_cv_lib_pisock_pi_accept
		AC_CHECK_LIB(pisock,
			pi_accept,
			[PISOCK_LIB="-lpisock -lsocket"
			HAVE_PISOCK=1
			],
			[
			unset ac_cv_lib_pisock_pi_accept
			AC_CHECK_LIB(pisock,
				pi_accept,
				[PISOCK_LIB="-lpisock -lsocket -lxnet"
				HAVE_PISOCK=1
				],
				[HAVE_PISOCK=0],
				[-lsocket -lxnet]
				)
			],
			[-lsocket]
			)
		]
		)

dnl Run through the loop *anyway*, even if we've already found
dnl the library. The inner if makes sure that we only check until
dnl we've found the library once.
dnl
dnl
for i in /usr/local/pilot/lib /usr/local/lib /vol/kde/support/lib ; do
	if test "$HAVE_PISOCK" = "0" ; then
		CPPFLAGS="$kpilot_save_cflags  $all_includes $PISOCK_INCLUDE"
		LDFLAGS="$kpilot_save_ldflags  $all_libraries -L$i -R$i"

		unset ac_cv_lib_pisock_pi_accept
		AC_CHECK_LIB(pisock,pi_accept,
			[PISOCK_LIB="-L$i -R$i -lpisock"
			HAVE_PISOCK=1],[],[])
	fi
done

else
	HAVE_PISOCK="0"
	PISOCK_LIB=""
	PISOCK_INCLUDE=""
fi

if test "$HAVE_PISOCK" = "0" ; then
	AC_MSG_WARN([KPILOT: pisock library not found])
	DO_NOT_COMPILE="$DO_NOT_COMPILE kpilot"
fi

AC_SUBST(PISOCK_LIB)
AC_SUBST(PISOCK_INCLUDE)


CPPFLAGS="$kpilot_save_cflags"
LDFLAGS="$kpilot_save_ldflags"
unset kpilot_save_cflags
unset kpilot_save_ldflags


AC_LANG_POP(C++)

dnl Remainder is for standalone use
AC_HEADER_TIME
AC_CHECK_GETDOMAINNAME

])
KPILOT_CHECK_PISOCK

if /bin/false ; then

dnl Configure.in.in for the JPilotPlugin proxy conduit for KPilot.
dnl
dnl Copyright (C) 2000,2001 Adriaan de Groot
dnl Copyright (C) 2002 Reinhold Kainhofer
dnl
dnl This file is released under the terms of the Gnu General Public
dnl Licence (GPL) Version 2.

dnl
dnl Check to see if gtk header and library are available
dnl Also check for jpilot??
dnl

dnl
dnl Questions and comments can be sent to reinhold@kainhofer.com
dnl

dnl Check for the headers first. The first test is the somewhat-
dnl sophisticated one AC uses, and incorporates all the extra-includes
dnl and whatnot stuff.
dnl
HAVE_GTK=0
HAVE_GDK=0
HAVE_GLIB=0
HAVE_GDBM=0
HAVE_JPILOT=0

kpilot_save_cflags="$CPPFLAGS"
kpilot_save_ldflags="$LDFLAGS"




dnl
dnl First check for GTK, then for gdk, then for glib, and finally for gdbm
dnl



dnl ********************************************************************************
dnl *                                       GLIB                                 
dnl ********************************************************************************

CPPFLAGS="$CPPFLAGS $all_includes"
LDFLAGS="$LDFLAGS $all_libraries"


GLIB_LIB=""
GLIB_INCLUDE=""

AC_CHECK_HEADER(glib.h,[HAVE_GLIB=1], )

dnl Warn if no headers found. Maybe this should be collected at the end
dnl of the build as well, like other this-won't-be-built messages?

if  test "$HAVE_GLIB" = "0" ; then
	AC_MSG_CHECKING([for glib.h alternate])
	for i in /usr/local/include /usr/include/glib /usr/include/glib-1.2 /vol/gnome/support/include ; do
		test -f $i/glib.h && HAVE_GLIB=1
		test -f $i/glib.h && GLIB_INCLUDE="-I$i"
	done


	if test "$HAVE_GLIB" = "0" ; then
		AC_MSG_WARN([JPilotPluginProxy: no glib headers found.])
	else
		AC_MSG_RESULT([found])
	fi
fi


dnl Search the library

CPPFLAGS="$kpilot_save_cflags  $all_includes $GLIB_INCLUDE"
LDFLAGS="$kpilot_save_ldflags  $all_libraries"

if test "$HAVE_GLIB" = "1" ; then
	HAVE_GLIB=0
	AC_CHECK_LIB(glib, g_free,
			[GLIB_LIB="-lglib"
			HAVE_GLIB=1],[],[])

	for i in /usr/local/glib /usr/local/lib /usr/lib /vol/kde/support/lib ; do
		if test "$HAVE_GLIB" = "0" ; then
			CPPFLAGS="$kpilot_save_cflags  $all_includes $GLIB_INCLUDE"
			LDFLAGS="$kpilot_save_ldflags  $all_libraries -L$i -R$i"

			unset ac_cv_lib_glib_g_free
			AC_CHECK_LIB(glib, g_free,
				[GLIB_LIB="-L$i -R$i -lglib"
				HAVE_GLIB=1],[],[])
		fi
	done
fi

if test "$HAVE_GLIB" = "0" ; then
	AC_MSG_WARN([JPilotPluginProxy: glib library or header files not found])
	DO_NOT_COMPILE="$DO_NOT_COMPILE kpilot/conduits/JPilotPluginProxy"
fi

AC_SUBST(GLIB_LIB)
AC_SUBST(GLIB_INCLUDE)



dnl ********************************************************************************
dnl *                                       GDK                                 
dnl ********************************************************************************

CPPFLAGS="$CPPFLAGS $all_includes"
LDFLAGS="$LDFLAGS $all_libraries"


GDK_LIB=""
GDK_INCLUDE=""

AC_CHECK_HEADER(gdk/gdk.h,[HAVE_GDK=1], )

dnl Warn if no headers found. Maybe this should be collected at the end
dnl of the build as well, like other this-won't-be-built messages?

if  test "$HAVE_GDK" = "0" ; then
	AC_MSG_CHECKING([for gdk.h alternate])
	for i in /usr/local/include /usr/include/gtk-1.2 /vol/gnome/support/include  ; do
		test -f $i/gdk/gdk.h && HAVE_GDK=1
		test -f $i/gdk/gdk.h && GDK_INCLUDE="-I$i"
	done


	if test "$HAVE_GDK" = "0" ; then
		AC_MSG_WARN([JPilotPluginProxy: no gdk headers found.])
	else
		AC_MSG_RESULT([found])
	fi
fi


dnl Search the library

CPPFLAGS="$kpilot_save_cflags  $all_includes $GDK_INCLUDE"
LDFLAGS="$kpilot_save_ldflags  $all_libraries"

if test "$HAVE_GDK" = "1" ; then
	AC_CHECK_LIB(gdk, gdk_init,
			[GDK_LIB="-lgdk"
			HAVE_GDK=1],[],[])

	for i in /usr/local/gtk /usr/local/lib /usr/lib /vol/kde/support/lib ; do
		if test "$HAVE_GDK" = "0" ; then
			CPPFLAGS="$kpilot_save_cflags  $all_includes $GDK_INCLUDE"
			LDFLAGS="$kpilot_save_ldflags  $all_libraries -L$i -R$i"

			unset ac_cv_lib_gdk_gdk_init
			AC_CHECK_LIB(gdk, gdk_init,
				[GDK_LIB="-L$i -R$i -lgdk"
				HAVE_GDK=1],[],[])
		fi
	done
fi

if test "$HAVE_GDK" = "0" ; then
	AC_MSG_WARN([JPilotPluginProxy: gdk library or header files not found])
	DO_NOT_COMPILE="$DO_NOT_COMPILE kpilot/conduits/JPilotPluginProxy"
fi

AC_SUBST(GDK_LIB)
AC_SUBST(GDK_INCLUDE)


dnl ********************************************************************************
dnl *                                       GTK                                 
dnl ********************************************************************************

CPPFLAGS="$CPPFLAGS $all_includes"
LDFLAGS="$LDFLAGS $all_libraries"


GTK_LIB=""
GTK_INCLUDE=""

AC_CHECK_HEADER(gtk/gtk.h,[HAVE_GTK=1], )

dnl Warn if no headers found. Maybe this should be collected at the end
dnl of the build as well, like other this-won't-be-built messages?

if  test "$HAVE_GTK" = "0" ; then
	AC_MSG_CHECKING([for gtk.h alternate])
	for i in /usr/local/include /usr/include/gtk-1.2 /vol/gnome/support/include  ; do
		test -f $i/gtk/gtk.h && HAVE_GTK=1
		test -f $i/gtk/gtk.h && GTK_INCLUDE="-I$i"
	done


	if test "$HAVE_GTK" = "0" ; then
		AC_MSG_WARN([JPilotPluginProxy: no gtk headers found.])
	else
		AC_MSG_RESULT([found])
	fi
fi


dnl Search the library

CPPFLAGS="$kpilot_save_cflags  $all_includes $GTK_INCLUDE"
LDFLAGS="$kpilot_save_ldflags  $all_libraries $GDK_LIB"

if test "$HAVE_GTK" = "1" ; then
	HAVE_GTK=0
	AC_CHECK_LIB(gtk, gtk_main,
			[GTK_LIB="-lgtk"
			HAVE_GTK=1],[],[])

	for i in /usr/local/gtk /usr/local/lib /usr/lib /vol/kde/support/lib ; do
		if test "$HAVE_GTK" = "0" ; then
			CPPFLAGS="$kpilot_save_cflags  $all_includes $GTK_INCLUDE"
			LDFLAGS="$kpilot_save_ldflags  $all_libraries -L$i -R$i"

			unset ac_cv_lib_gtk_gtk_main
			AC_CHECK_LIB(gtk, gtk_main,
				[GTK_LIB="-L$i -R$i -lgtk"
				HAVE_GTK=1],[],[])
		fi
	done
fi

if test "$HAVE_GTK" = "0" ; then
	AC_MSG_WARN([JPilotPluginProxy: gtk library or header files not found])
	DO_NOT_COMPILE="$DO_NOT_COMPILE kpilot/conduits/JPilotPluginProxy"
fi

AC_SUBST(GTK_LIB)
AC_SUBST(GTK_INCLUDE)





CPPFLAGS="$kpilot_save_cflags"
LDFLAGS="$kpilot_save_ldflags"
unset kpilot_save_cflags
unset kpilot_save_ldflags
fi
dnl Configure.in.in for KPilot conduits.
dnl
dnl Copyright (C) 2000,2001 Adriaan de Groot
dnl Copyright (C) 2002 Reinhold Kainhofer
dnl
dnl This file is released under the terms of the Gnu General Public
dnl Licence (GPL) Version 2.




dnl ----------------------------------------------------------------------------
dnl
dnl                     checks for the MAL conduit
dnl
dnl ----------------------------------------------------------------------------

dnl 
dnl
dnl Check to see if MAL header and library are available
dnl

dnl
dnl Questions and comments can be sent to kde-pim@kde.org
dnl
dnl This was copied and adapted from kabc's ldap configure.in.in


AC_DEFUN(KPILOT_CHECK_MAL, 
[
AC_REQUIRE([KDE_CHECK_LIB64])
AC_REQUIRE([KPILOT_CHECK_PISOCK])

AC_MSG_CHECKING(for libmal (for KPilots MAL conduit))
AC_ARG_WITH(mal,
[  --with-mal=PATH        set path for libmal files @<:@default=check@:>@],
[ case "$withval" in
  yes)
    with_mal=CHECK
    ;;
  esac ],
[ with_mal=CHECK ]
)dnl

if test "x$with_mal" = "xCHECK" ; then
  with_mal=NOTFOUND
  search_incs="$kde_includes /usr/include /usr/local/include /usr/include/libmal /usr/local/include/libmal"
  AC_FIND_FILE(libmal.h, $search_incs, mal_incdir)
  if test -r $mal_incdir/libmal.h ; then
    test "x$mal_incdir" != "x/usr/include" && MAL_INCLUDE="-I$mal_incdir"
    with_mal=FOUND
  fi
  if test $with_mal = FOUND ; then
    with_mal=NOTFOUND
    for ext in la so sl a ; do
      AC_FIND_FILE(libmal.$ext, $kde_libraries $libdir /usr/lib$kdelibsuff /usr/local/lib$kdelibsuff $libdir/libmal /usr/lib/libmal /usr/local/lib/libmal,
        mal_libdir)
      if test -r $mal_libdir/libmal.$ext ; then
        if test "x$mal_libdir" != "x/usr/lib$kdelibsuff" ; then
          MAL_LIB="-L$mal_libdir "
          test "$USE_RPATH" = yes && MAL_RPATH="-R $mal_libdir"
        fi
        MAL_LIB="${MAL_LIB}-lmal"
        with_mal=FOUND
        break
      fi
    done
  fi
fi

case "$with_mal" in
no) AC_MSG_RESULT(no) ;;
NOTFOUND) AC_MSG_RESULT(searched but not found) 
	AC_MSG_WARN([KPILOT: MAL headers or library not found. AvantGo conduit will not be compiled.])
	AC_MSG_WARN([KPILOT: Download libmal>=0.20 from http://jasonday.home.att.net/code/libmal/])
	;;
*)
  if test "x$with_mal" = "xFOUND" ; then
    msg="incs=$mal_incdir libs=$mal_libdir"
  else
    msg="$with_mal"
    MAL_ROOT="$with_mal"
    if test "x$MAL_ROOT" != "x/usr" ; then
      MAL_INCLUDE="-I${MAL_ROOT}/include"
      MAL_LIB="-L${MAL_ROOT}/lib$kdelibsuff "
      if test "$USE_RPATH" = "yes" ; then
        MAL_RPATH="-R ${MAL_ROOT}/lib$kdelibsuff"
      fi
    fi
    MAL_LIB="${MAL_LIBS}-lmal"
  fi

  CPPFLAGS="$CPPFLAGS $all_includes"
  LDFLAGS="$LDFLAGS $all_libraries"

  kde_safe_LIBS="$LIBS"
  kde_safe_CFLAGS="$CFLAGS"
  kde_safe_CPPFLAGS="$CPPFLAGS"
  LIBS="$LIBS $PISOCK_LIB $MAL_LIB -ldl"
  CFLAGS="$CFLAGS $MAL_INCLUDE"
  CPPFLAGS="$CPPFLAGS $PISOCK_INCLUDE $MAL_INCLUDE"
  AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_TRY_LINK(dnl
  [
  #include <libmal.h>
  ],
  [
  PalmSyncInfo *psi;
  ],
  , with_mal=no
  )
  AC_LANG_RESTORE
  CFLAGS=$kde_safe_CFLAGS
  CPPFLAGS=$kde_safe_CPPFLAGS
  LIBS=$kde_safe_LIBS
  if test "$with_mal" = "no" ; then
    MAL_INCLUDE=
    MAL_LIB=
    MAL_RPATH=
    AC_MSG_RESULT(no (but first try gave $msg))
    AC_MSG_WARN([KPILOT: MAL headers or library not found. AvantGo conduit will not be compiled.])
    AC_MSG_WARN([KPILOT: Download libmal>=0.20 from http://jasonday.home.att.net/code/libmal/])
  else
    AC_DEFINE(HAVE_LIBMAL, 1, [Define if you have MAL libraries])
    HAVE_LIBMAL=1
    AC_MSG_RESULT($msg)
  fi
  ;;
esac

AC_SUBST(MAL_INCLUDE)
AC_SUBST(MAL_LIB)
AC_SUBST(MAL_RPATH)

AM_CONDITIONAL(include_malconduit, test "$HAVE_LIBMAL" = 1)

])
KPILOT_CHECK_MAL


#DO_NOT_COMPILE="$DO_NOT_COMPILE ksync"
dnl build with exchange support
ac_use_exchange="no"
AC_ARG_ENABLE(exchange,
        [  --disable-exchange      disable Microsoft Exchange 2000 support for korganizer [default=enable]], ac_use_exchange=$enableval, ac_use_exchange=yes)
AM_CONDITIONAL(include_exchange_SUBDIR, test "$ac_use_exchange" = "yes")

if test "x$ac_use_exchange" != "xyes"; then
        DO_NOT_COMPILE="$DO_NOT_COMPILE libkpimexchange"
else
	AC_DEFINE(KDEPIM_ENABLE_EXCHANGE, 1, [Define if you want Microsoft Exchange 2000 support])
fi

KDE_CREATE_SUBDIRSLIST
AM_CONDITIONAL(calendarsystem_SUBDIR_included, test "x$calendarsystem_SUBDIR_included" = xyes)
AM_CONDITIONAL(doc_SUBDIR_included, test "x$doc_SUBDIR_included" = xyes)
AM_CONDITIONAL(kabc_SUBDIR_included, test "x$kabc_SUBDIR_included" = xyes)
AM_CONDITIONAL(karm_SUBDIR_included, test "x$karm_SUBDIR_included" = xyes)
AM_CONDITIONAL(kfile_plugins_SUBDIR_included, test "x$kfile_plugins_SUBDIR_included" = xyes)
AM_CONDITIONAL(kgantt_SUBDIR_included, test "x$kgantt_SUBDIR_included" = xyes)
AM_CONDITIONAL(knotes_SUBDIR_included, test "x$knotes_SUBDIR_included" = xyes)
AM_CONDITIONAL(libical_SUBDIR_included, test "x$libical_SUBDIR_included" = xyes)
AM_CONDITIONAL(libkdepim_SUBDIR_included, test "x$libkdepim_SUBDIR_included" = xyes)
AM_CONDITIONAL(libkcal_SUBDIR_included, test "x$libkcal_SUBDIR_included" = xyes)
AM_CONDITIONAL(kandy_SUBDIR_included, test "x$kandy_SUBDIR_included" = xyes)
AM_CONDITIONAL(kaddressbook_SUBDIR_included, test "x$kaddressbook_SUBDIR_included" = xyes)
AM_CONDITIONAL(kpilot_SUBDIR_included, test "x$kpilot_SUBDIR_included" = xyes)
AM_CONDITIONAL(ksync_SUBDIR_included, test "x$ksync_SUBDIR_included" = xyes)
AM_CONDITIONAL(konsolekalendar_SUBDIR_included, test "x$konsolekalendar_SUBDIR_included" = xyes)
AM_CONDITIONAL(kitchensync_SUBDIR_included, test "x$kitchensync_SUBDIR_included" = xyes)
AM_CONDITIONAL(kalarmd_SUBDIR_included, test "x$kalarmd_SUBDIR_included" = xyes)
AM_CONDITIONAL(libkpimexchange_SUBDIR_included, test "x$libkpimexchange_SUBDIR_included" = xyes)
AM_CONDITIONAL(kalarm_SUBDIR_included, test "x$kalarm_SUBDIR_included" = xyes)
AM_CONDITIONAL(korganizer_SUBDIR_included, test "x$korganizer_SUBDIR_included" = xyes)
AM_CONDITIONAL(kaplan_SUBDIR_included, test "x$kaplan_SUBDIR_included" = xyes)
AC_CONFIG_FILES([ Makefile ])
AC_CONFIG_FILES([ calendarsystem/Makefile ])
AC_CONFIG_FILES([ doc/Makefile ])
AC_CONFIG_FILES([ doc/kaddressbook/Makefile ])
AC_CONFIG_FILES([ doc/kalarm/Makefile ])
AC_CONFIG_FILES([ doc/kandy/Makefile ])
AC_CONFIG_FILES([ doc/karm/Makefile ])
AC_CONFIG_FILES([ doc/kcontrol/Makefile ])
AC_CONFIG_FILES([ doc/kcontrol/kalarmd/Makefile ])
AC_CONFIG_FILES([ doc/knotes/Makefile ])
AC_CONFIG_FILES([ doc/korganizer/Makefile ])
AC_CONFIG_FILES([ doc/kpilot/Makefile ])
AC_CONFIG_FILES([ kabc/Makefile ])
AC_CONFIG_FILES([ kabc/frontend/Makefile ])
AC_CONFIG_FILES([ kabc/kabc2mutt/Makefile ])
AC_CONFIG_FILES([ kaddressbook/Makefile ])
AC_CONFIG_FILES([ kaddressbook/csv-templates/Makefile ])
AC_CONFIG_FILES([ kaddressbook/details/Makefile ])
AC_CONFIG_FILES([ kaddressbook/features/Makefile ])
AC_CONFIG_FILES([ kaddressbook/pics/Makefile ])
AC_CONFIG_FILES([ kaddressbook/printing/Makefile ])
AC_CONFIG_FILES([ kaddressbook/views/Makefile ])
AC_CONFIG_FILES([ kalarm/Makefile ])
AC_CONFIG_FILES([ kalarm/pixmaps/Makefile ])
AC_CONFIG_FILES([ kalarmd/Makefile ])
AC_CONFIG_FILES([ kalarmd/pixmaps/Makefile ])
AC_CONFIG_FILES([ kandy/Makefile ])
AC_CONFIG_FILES([ kandy/profiles/Makefile ])
AC_CONFIG_FILES([ kandy/src/Makefile ])
AC_CONFIG_FILES([ kaplan/Makefile ])
AC_CONFIG_FILES([ kaplan/interfaces/Makefile ])
AC_CONFIG_FILES([ kaplan/plugins/Makefile ])
AC_CONFIG_FILES([ kaplan/plugins/kaddressbook/Makefile ])
AC_CONFIG_FILES([ kaplan/plugins/kmail/Makefile ])
AC_CONFIG_FILES([ kaplan/plugins/knotes/Makefile ])
AC_CONFIG_FILES([ kaplan/plugins/korganizer/Makefile ])
AC_CONFIG_FILES([ kaplan/plugins/test/Makefile ])
AC_CONFIG_FILES([ kaplan/src/Makefile ])
AC_CONFIG_FILES([ karm/Makefile ])
AC_CONFIG_FILES([ karm/pics/Makefile ])
AC_CONFIG_FILES([ karm/support/Makefile ])
AC_CONFIG_FILES([ kfile-plugins/Makefile ])
AC_CONFIG_FILES([ kfile-plugins/vcf/Makefile ])
AC_CONFIG_FILES([ kgantt/Makefile ])
AC_CONFIG_FILES([ kgantt/kgantt/Makefile ])
AC_CONFIG_FILES([ kgantt/pixmaps/Makefile ])
AC_CONFIG_FILES([ kitchensync/Makefile ])
AC_CONFIG_FILES([ kitchensync/devicemimetypes/Makefile ])
AC_CONFIG_FILES([ kitchensync/kitchensync/Makefile ])
AC_CONFIG_FILES([ kitchensync/kitchensync/addressbook/Makefile ])
AC_CONFIG_FILES([ kitchensync/kitchensync/fileview/Makefile ])
AC_CONFIG_FILES([ kitchensync/kitchensync/lib/Makefile ])
AC_CONFIG_FILES([ kitchensync/kitchensync/organizer/Makefile ])
AC_CONFIG_FILES([ kitchensync/kitchensync/overview/Makefile ])
AC_CONFIG_FILES([ kitchensync/klockfile/Makefile ])
AC_CONFIG_FILES([ kitchensync/klockfile/test/Makefile ])
AC_CONFIG_FILES([ kitchensync/lib/Makefile ])
AC_CONFIG_FILES([ kitchensync/lib/test/Makefile ])
AC_CONFIG_FILES([ kitchensync/libkonnector/Makefile ])
AC_CONFIG_FILES([ kitchensync/libkonnector/plugins/Makefile ])
AC_CONFIG_FILES([ kitchensync/libkonnector/plugins/agendaVr3/Makefile ])
AC_CONFIG_FILES([ kitchensync/libkonnector/plugins/opie/Makefile ])
AC_CONFIG_FILES([ kitchensync/libkonnector/plugins/opie/tests/Makefile ])
AC_CONFIG_FILES([ kitchensync/libkonnector/plugins/phone/Makefile ])
AC_CONFIG_FILES([ kitchensync/libkonnector/plugins/pv/Makefile ])
AC_CONFIG_FILES([ kitchensync/libkonnector/plugins/pv/libpv/Makefile ])
AC_CONFIG_FILES([ kitchensync/libkonnector/plugins/pv/libpv/docs/Makefile ])
AC_CONFIG_FILES([ kitchensync/libkonnector/plugins/pv/libpv/docs/en/Makefile ])
AC_CONFIG_FILES([ kitchensync/libkonnector/plugins/qtopia/Makefile ])
AC_CONFIG_FILES([ kitchensync/libkonnector/plugins/qtopia/test/Makefile ])
AC_CONFIG_FILES([ kitchensync/libkonnector/test/Makefile ])
AC_CONFIG_FILES([ kitchensync/libksync/Makefile ])
AC_CONFIG_FILES([ kitchensync/libksync/plugins/Makefile ])
AC_CONFIG_FILES([ kitchensync/libksync/plugins/addressbook/Makefile ])
AC_CONFIG_FILES([ kitchensync/libksync/plugins/kalendar/Makefile ])
AC_CONFIG_FILES([ knotes/Makefile ])
AC_CONFIG_FILES([ konsolekalendar/Makefile ])
AC_CONFIG_FILES([ korganizer/Makefile ])
AC_CONFIG_FILES([ korganizer/interfaces/Makefile ])
AC_CONFIG_FILES([ korganizer/interfaces/calendar/Makefile ])
AC_CONFIG_FILES([ korganizer/interfaces/korganizer/Makefile ])
AC_CONFIG_FILES([ korganizer/knewstuff/Makefile ])
AC_CONFIG_FILES([ korganizer/pixmaps/Makefile ])
AC_CONFIG_FILES([ korganizer/plugins/Makefile ])
AC_CONFIG_FILES([ korganizer/plugins/birthdays/Makefile ])
AC_CONFIG_FILES([ korganizer/plugins/datenums/Makefile ])
AC_CONFIG_FILES([ korganizer/plugins/exchange/Makefile ])
AC_CONFIG_FILES([ korganizer/plugins/holidays/Makefile ])
AC_CONFIG_FILES([ korganizer/plugins/holidays/holidays/Makefile ])
AC_CONFIG_FILES([ korganizer/plugins/projectview/Makefile ])
AC_CONFIG_FILES([ korganizer/plugins/webexport/Makefile ])
AC_CONFIG_FILES([ korganizer/sounds/Makefile ])
AC_CONFIG_FILES([ kpilot/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/JPilotPluginProxy/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/JPilotPluginProxy/JPilotAPI/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/ProjectManagerConduits/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/ProjectManagerConduits/Bonsai/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/ProjectManagerConduits/BrainForest/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/ProjectManagerConduits/ListMaker/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/ProjectManagerConduits/Progect/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/ProjectManagerConduits/ShadowPlan/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/ProjectManagerConduits/lib/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/abbrowserconduit/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/expense/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/knotes/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/malconduit/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/null/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/popmail/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/timeconduit/Makefile ])
AC_CONFIG_FILES([ kpilot/conduits/vcalconduit/Makefile ])
AC_CONFIG_FILES([ kpilot/kpilot/Makefile ])
AC_CONFIG_FILES([ kpilot/kpilot/Icons/Makefile ])
AC_CONFIG_FILES([ kpilot/lib/Makefile ])
AC_CONFIG_FILES([ ksync/Makefile ])
AC_CONFIG_FILES([ ksync/lib/Makefile ])
AC_CONFIG_FILES([ ksync/src/Makefile ])
AC_CONFIG_FILES([ libkcal/Makefile ])
AC_CONFIG_FILES([ libkcal/tests/Makefile ])
AC_CONFIG_FILES([ libkcal/versit/Makefile ])
AC_CONFIG_FILES([ libkdepim/Makefile ])
AC_CONFIG_FILES([ libkdepim/resources/Makefile ])
AC_CONFIG_FILES([ libkpimexchange/Makefile ])
AC_CONFIG_FILES([ libkpimexchange/calendar/Makefile ])
AC_CONFIG_FILES([ libkpimexchange/calendar/tests/Makefile ])
AC_CONFIG_FILES([ libkpimexchange/core/Makefile ])
AC_CONFIG_FILES([ korganizer/ical2vcal ])
AC_CONFIG_FILES([ korganizer/korganizerIn ])
AC_OUTPUT
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
