$Id$
--- bogofilter-1.1.3.orig/configure	2006-12-03 05:17:15.000000000 +0100
+++ bogofilter-1.1.3/configure	2007-03-29 19:27:35.000000000 +0200
@@ -13464,238 +13464,55 @@ echo "${ECHO_T}$LIBDB" >&6; }
 
 		saveLIBS="$LIBS"
 	LIBS="$LIBS $LIBDB"
-	{ echo "$as_me:$LINENO: checking if a program can be linked against Berkeley DB and run" >&5
-echo $ECHO_N "checking if a program can be linked against Berkeley DB and run... $ECHO_C" >&6; }
-	if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
+#	AC_MSG_CHECKING(if a program can be linked against Berkeley DB and run)
+#	AC_RUN_IFELSE(
+#	AC_LANG_PROGRAM([[
 #ifdef HAVE_INTTYPES_H
 #include <inttypes.h>
 #endif
 #include <db.h>
+#		   ]], [[
+#return 0;
+#		   ]]),,
+#		   [AC_MSG_RESULT(no)
+#	AC_MSG_ERROR([Cannot run a program linked against libdb.
+#Did you adjust your library search path to include your libdb?])],)
+#	AC_MSG_RESULT(yes)
 
-int
-main ()
-{
-
-return 0;
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-{ echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-	{ { echo "$as_me:$LINENO: error: Cannot run a program linked against libdb.
-Did you adjust your library search path to include your libdb?" >&5
-echo "$as_me: error: Cannot run a program linked against libdb.
-Did you adjust your library search path to include your libdb?" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-	{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-
-			{ echo "$as_me:$LINENO: checking if Berkeley DB header and library versions match" >&5
-echo $ECHO_N "checking if Berkeley DB header and library versions match... $ECHO_C" >&6; }
-	rm -r -f bfadtestdir
-	mkdir bfadtestdir
-	if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-		   #include <stdlib.h>
-		   #include <stdio.h>
+#	dnl check if header and library of DB library match
+#	dnl ignore if cross compiling
+#	AC_MSG_CHECKING(if Berkeley DB header and library versions match)
+#	rm -r -f bfadtestdir
+#	mkdir bfadtestdir
+#	AC_RUN_IFELSE(
+#	AC_LANG_PROGRAM([[
+#		   #include <stdlib.h>
+#		   #include <stdio.h>
 #ifdef HAVE_INTTYPES_H
 #include <inttypes.h>
 #endif
-		   #include <db.h>
-
-int
-main ()
-{
-
-			int maj, min;
-			(void)db_version(&maj, &min, 0);
-			(void)fprintf(stderr, "headers: %d.%d, library: %d.%d\n",
-				DB_VERSION_MAJOR, DB_VERSION_MINOR, maj, min);
-			if (maj != DB_VERSION_MAJOR) exit(1);
-			if (min != DB_VERSION_MINOR) exit(1);
-			exit(0);
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-{ echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-		   { { echo "$as_me:$LINENO: error: db.h header file and db library version do not match." >&5
-echo "$as_me: error: db.h header file and db library version do not match." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-	{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-	{ echo "$as_me:$LINENO: checking whether db_create is declared" >&5
-echo $ECHO_N "checking whether db_create is declared... $ECHO_C" >&6; }
-if test "${ac_cv_have_decl_db_create+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef HAVE_INTTYPES_H
+#		   #include <db.h>
+#		   ]], [[
+#			int maj, min;
+#			(void)db_version(&maj, &min, 0);
+#			(void)fprintf(stderr, "headers: %d.%d, library: %d.%d\n",
+#				DB_VERSION_MAJOR, DB_VERSION_MINOR, maj, min);
+#			if (maj != DB_VERSION_MAJOR) exit(1);
+#			if (min != DB_VERSION_MINOR) exit(1);
+#			exit(0);
+#		   ]]),,
+#		   [AC_MSG_RESULT(no)
+#		   AC_MSG_ERROR(db.h header file and db library version do not match.)],)
+#	AC_MSG_RESULT(yes)
+#	AC_CHECK_DECLS(db_create,,
+#	       AC_MSG_ERROR([[Can not locate a suitable Berkeley DB db.h header file.
+#Use --with-libdb-prefix=PATH to specify the path to a v3+ install directory.
+#You can download Berkeley DB 4.3.x from http://www.sleepycat.com/]]),
+#	[[#ifdef HAVE_INTTYPES_H
 #include <inttypes.h>
 #endif
-#include <db.h>
-
-
-int
-main ()
-{
-#ifndef db_create
-  (void) db_create;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_have_decl_db_create=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_have_decl_db_create=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_db_create" >&5
-echo "${ECHO_T}$ac_cv_have_decl_db_create" >&6; }
-if test $ac_cv_have_decl_db_create = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_DB_CREATE 1
-_ACEOF
-
-
-else
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_DB_CREATE 0
-_ACEOF
-
-{ { echo "$as_me:$LINENO: error: Can not locate a suitable Berkeley DB db.h header file.
-Use --with-libdb-prefix=PATH to specify the path to a v3+ install directory.
-You can download Berkeley DB 4.3.x from http://www.sleepycat.com/" >&5
-echo "$as_me: error: Can not locate a suitable Berkeley DB db.h header file.
-Use --with-libdb-prefix=PATH to specify the path to a v3+ install directory.
-You can download Berkeley DB 4.3.x from http://www.sleepycat.com/" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-
+#include <db.h>]]
+#	)
 	{ echo "$as_me:$LINENO: checking if Berkeley DB supports shared environments" >&5
 echo $ECHO_N "checking if Berkeley DB supports shared environments... $ECHO_C" >&6; }
 	if test "x$enable_dbshared_test" != xno && test "x$USE_TRANSACTIONS" != xNO ; then
