Please check this configure.ac patch out.
Matthias Andree
matthias.andree at gmx.de
Wed Feb 26 03:00:59 CET 2003
Clint Adams <schizo at debian.org> writes:
> You could chain a bunch of AC_SEARCH_LIBS together, I suppose.
> For example, search for db_create_4001, then db_create_4000,
> then db_create.
>
> I'm not sure that's cleaner than using the include file.
How about this patch instead?
Index: configure.ac
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/configure.ac,v
retrieving revision 1.29
diff -u -b -B -w -r1.29 configure.ac
--- configure.ac 20 Feb 2003 02:05:38 -0000 1.29
+++ configure.ac 26 Feb 2003 01:59:59 -0000
@@ -2,6 +2,7 @@
AC_INIT(bogofilter, 0.10.3.1.cvs)
AC_PREREQ(2.53)
AC_CONFIG_SRCDIR([src])
+AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(src/config.h:config.in)
AC_PROG_CC
@@ -48,11 +49,15 @@
AC_CHECK_LIB([m], [cos])
AH_TEMPLATE([HAVE_DB_H], [Have suitable db.h header])
-
+need_dash_r=
+case $target_os in
+ solaris*) need_dash_r=yes ;;
+esac
WITH_DB=
+dnl old test, going to be phased out
AC_ARG_WITH(db,
- [ --with-db=PATH Specify path to BerkelyDB install directory ],
+ [ --with-db=PATH Specify path to BerkeleyDB install directory ],
[
if test "x$withval" != "xno" ; then
WITH_DB=$withval
@@ -67,10 +72,14 @@
fi
LDFLAGS="-L${withval} ${LDFLAGS}"
fi
- if test -d "$withval/include"; then
+ if test -f "$withval/include/db.h"; then
CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
else
+ if test -f "$withval/db.h";then
CPPFLAGS="-I${withval} ${CPPFLAGS}"
+ else
+ AC_MSG_ERROR(Not a BerkeleyDB path. Use LDFLAGS and CPPFLAGS to specify the path.)
+ fi
fi
fi
]
@@ -79,16 +89,15 @@
DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-db=$WITH_DB"
fi
-AC_EGREP_HEADER(db_create, [db.h], AC_DEFINE(HAVE_DB_H),
- AC_MSG_ERROR([Can not locate a suitable BerkeleyDB db.h header file.
+AC_CHECK_DECLS(db_create,,
+ AC_MSG_ERROR([[Can not locate a suitable BerkeleyDB db.h header file.
Use --with-db=PATH to specify the path to a v3+ install directory.
-You can download BerkeleyDB 4.0.x from http://www.sleepycat.com])
+You can download BerkeleyDB 4.0.x from http://www.sleepycat.com/]]),
+[[#include <db.h>]]
)
-AC_CHECK_DB([db db-4.1 db-4 db4 db-3.1 db-3 db3 db-2 db2],,
- AC_MSG_ERROR([Can not locate a suitable Berkeley DB
- library. Use --with-db=PATH to specify
- the path to a v3+ install directory]))
+AC_CHECK_DB([db db-4.1 db-4 db4 db-3.3 db-3.2 db-3.1 db-3 db3],,
+ AC_MSG_ERROR([[Can not locate a suitable Berkeley DB library. Use --with-db=PATH to specify the path to a v3+ install directory]]))
# Allow the user to specify a header name to use to indicate whether a given
# message is SPAM or not.
@@ -207,6 +216,26 @@
AC_CHECK_FUNCS(strerror flock lockf fcntl strchr strrchr memcpy)
AC_CHECK_FUNCS(munmap pow sqrt strcasecmp strcspn strspn strstr)
AC_REPLACE_FUNCS(strlcpy strlcat)
+
+AC_CACHE_SAVE
+
+dnl check if header and library of DB library match
+dnl ignore if cross compiling
+AC_MSG_CHECKING(if db header and library versions match)
+AC_RUN_IFELSE(
+ AC_LANG_PROGRAM([[
+ #include <stdlib.h>
+ #include <db.h>
+ ]], [[
+ int maj, min;
+ (void)db_version(&maj, &min, (void *)0);
+ 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)
if test "$sysconfdir" = "\${prefix}/etc" \
&& { test "$prefix" = "NONE" || test "$prefix" = "/usr" \
--
Matthias Andree
More information about the bogofilter-dev
mailing list