AC_MSG_ERROR([Failed to compile the test program to check the Sword version! Please have a look at config.log! Report this to the BibleTime developers!]);
cat conftest.$ac_ext >&AC_FD_CC
fi
rm -f conftest*
CXXFLAGS="$ac_cxxflags_safe"
LDFLAGS="$ac_ldflags_safe"
LIBS="$ac_libs_safe"
LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
export LD_LIBRARY_PATH
LIBRARY_PATH="$ac_LIBRARY_PATH"
export LIBRARY_PATH
AC_LANG_RESTORE
])
AC_MSG_RESULT([$ac_cv_installed_sword_version])
dnl *** Now check if the installed version is recent enough
AC_MSG_CHECKING([whether your Sword installation is recent enough])
AC_CACHE_VAL(ac_cv_sword_recent_version,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
ac_LIBRARY_PATH="$LIBRARY_PATH"
ac_cxxflags_safe="$CXXFLAGS"
ac_ldflags_safe="$LDFLAGS"
ac_libs_safe="$LIBS"
CXXFLAGS="$CXXFLAGS -I$"
LDFLAGS="$LDFLAGS -L$ac_cv_sword_libdir"
LIBS="$LIB_SWORD -lz"
LD_LIBRARY_PATH="$ac_cv_sword_libdir"
export LD_LIBRARY_PATH
LIBRARY_PATH=
export LIBRARY_PATH
cat > conftest.$ac_ext <<EOF
#include <iostream>
#include <swversion.h>
#ifdef SWORD_NAMESPACE_START
using namespace sword;
#endif
int main(int argc, char* argv[[]]) {
if (argc == 2) { //compare required with installed Sword version
AC_MSG_ERROR([Failed to compile the test program to check the Sword version! Please have a look at config.log! Report this to the BibleTime developers!]);
cat conftest.$ac_ext >&AC_FD_CC
fi;
rm -f conftest*
CXXFLAGS="$ac_cxxflags_safe"
LDFLAGS="$ac_ldflags_safe"
LIBS="$ac_libs_safe"
LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
export LD_LIBRARY_PATH
LIBRARY_PATH="$ac_LIBRARY_PATH"
export LIBRARY_PATH
AC_LANG_RESTORE
])
if test "x$ac_cv_sword_recent_version" = "xok"; then
AC_MSG_RESULT([yes]);
elif test "x$ac_cv_sword_recent_version" = "xnot-ok"; then
AC_MSG_RESULT([no]);
AC_MSG_ERROR([Your Sword installation is not recent enought! Please upgrade to version $1! Get the Sword library at www.crosswire.org.]);
else
AC_MSG_ERROR([Invalid return code of the internal Sword version test program. Please submit a bugreport!]);