Compiling in Red hat 6.2

Clint Adams schizo at debian.org
Wed Feb 19 20:07:29 CET 2003


> On RHL 6.2, you'll have to test for -ldb-3.1
> or make the following symlink:
> 
> ln -s /usr/lib/db-3.1.so /usr/lib/db-3.so

With this patch, configure should handle all original cases, RH6.2, 
and any installations using db-uniquename.

Index: acinclude.m4
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/acinclude.m4,v
retrieving revision 1.1
diff -u -r1.1 acinclude.m4
--- acinclude.m4	21 Jan 2003 11:42:36 -0000	1.1
+++ acinclude.m4	19 Feb 2003 19:03:27 -0000
@@ -103,3 +103,28 @@
   AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])
 fi
 ])# AC_HEADER_STDBOOL
+
+AC_DEFUN([AC_CHECK_DB],[
+for lib in $1
+do
+   AS_VAR_PUSHDEF([ac_tr_db], [ac_cv_db_lib_${lib}])dnl
+   bogo_saved_LIBS="$LIBS"
+   LIBS="$LIBS -l$lib"
+   AC_CACHE_CHECK([for db_create in -l${lib}], ac_tr_db,
+      [AC_TRY_LINK([#include <db.h>], [int foo=db_create((void *)0, (void *) 0, 0 )],
+                   [AS_VAR_SET(ac_tr_db, yes)],
+                   [AS_VAR_SET(ac_tr_db, no)])
+      ])
+   AS_IF([test AS_VAR_GET(ac_tr_db) = yes],
+         [$2
+          db=yes],
+         [LIBS="$bogo_saved_LIBS"
+          db=no])
+   AS_VAR_POPDEF([ac_tr_db])dnl
+test "$db" = "yes" && break
+done
+if test "$db" = "no"; then
+$3
+fi
+])# AC_CHECK_DB
+
Index: configure.ac
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/configure.ac,v
retrieving revision 1.27
diff -u -r1.27 configure.ac
--- configure.ac	19 Feb 2003 13:36:18 -0000	1.27
+++ configure.ac	19 Feb 2003 19:03:27 -0000
@@ -85,21 +85,10 @@
 You can download BerkeleyDB 4.0.x from http://www.sleepycat.com])
 )
 
-AC_CHECK_LIB(db-4, db_create, LIBS="$LIBS -ldb-4", 
-AC_CHECK_LIB(db4, db_create, LIBS="$LIBS -ldb4", 
-		AC_CHECK_LIB(db-3, db_create, LIBS="$LIBS -ldb-3", 
-		AC_CHECK_LIB(db3, db_create, LIBS="$LIBS -ldb3", 
-			AC_CHECK_LIB(db-2, db_create, LIBS="$LIBS -ldb-2",
-			AC_CHECK_LIB(db2, db_create, LIBS="$LIBS -ldb2",
-				AC_CHECK_LIB(db, db_create, LIBS="$LIBS -ldb", 
-					AC_MSG_ERROR([Can not locate a suitable BerkeleyDB libdb.so library.
-Use --with-db=PATH to specify the path to a v3+ install directory])
-					)))))))
-
-
-AC_MSG_CHECKING(BerkeleyDB)
-AC_TRY_LINK_FUNC(db_create,, AC_MSG_ERROR([BerkeleyDB v3+ package is not working properly. Specify a different one using --with-db=PATH]))
-AC_MSG_RESULT(BerkeleyDB)
+AC_CHECK_DB([db-4 db4 db-3.1 db-3 db3 db-2 db2 db],,
+		    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.




More information about the bogofilter-dev mailing list