summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorchristos <christos@pkgsrc.org>2006-01-04 23:33:23 +0000
committerchristos <christos@pkgsrc.org>2006-01-04 23:33:23 +0000
commitc6761ed17e9777054908c7b706ce79ae385b5ac0 (patch)
treecf77d4af9d78c16c3ed8812b5291327b64976c5d /pkgtools
parentb36634437fe0d43d0d7387ae49255952175c5250 (diff)
downloadpkgsrc-c6761ed17e9777054908c7b706ce79ae385b5ac0.tar.gz
Handle newer versions of Berkeley DB. Our algorithm is:
- if you have > db1 the probably you have db_185.h which means that dbopen is really __db185_open, and we'll prefer that. - else if you have db1, then you have db1/db.h and dbopen - else if you have db.h, then this is either the one from db1 and it will work with -ldb having dbopen, or it will not. Note that the compatibility option on __db185_open() will actually not create or update db1.85/1.86 files, but it will use the current format of the db library. This compatibility layer is source code only.
Diffstat (limited to 'pkgtools')
-rwxr-xr-xpkgtools/pkg_install/files/configure161
-rw-r--r--pkgtools/pkg_install/files/configure.ac6
-rw-r--r--pkgtools/pkg_install/files/lib/config.h.in10
-rw-r--r--pkgtools/pkg_install/files/lib/pkgdb.c21
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
5 files changed, 172 insertions, 30 deletions
diff --git a/pkgtools/pkg_install/files/configure b/pkgtools/pkg_install/files/configure
index ce2bbc85c2f..f7d8d22f6c5 100755
--- a/pkgtools/pkg_install/files/configure
+++ b/pkgtools/pkg_install/files/configure
@@ -3129,14 +3129,13 @@ fi;
-
-echo "$as_me:$LINENO: checking for dbopen in -ldb1" >&5
-echo $ECHO_N "checking for dbopen in -ldb1... $ECHO_C" >&6
-if test "${ac_cv_lib_db1_dbopen+set}" = set; then
+echo "$as_me:$LINENO: checking for __db185_open in -ldb" >&5
+echo $ECHO_N "checking for __db185_open in -ldb... $ECHO_C" >&6
+if test "${ac_cv_lib_db___db185_open+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldb1 $LIBS"
+LIBS="-ldb $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -3150,11 +3149,11 @@ extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char dbopen ();
+char __db185_open ();
int
main ()
{
-dbopen ();
+__db185_open ();
;
return 0;
}
@@ -3181,25 +3180,153 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_lib_db1_dbopen=yes
+ ac_cv_lib_db___db185_open=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_db1_dbopen=no
+ac_cv_lib_db___db185_open=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_db1_dbopen" >&5
-echo "${ECHO_T}$ac_cv_lib_db1_dbopen" >&6
-if test $ac_cv_lib_db1_dbopen = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_db___db185_open" >&5
+echo "${ECHO_T}$ac_cv_lib_db___db185_open" >&6
+if test $ac_cv_lib_db___db185_open = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDB1 1
+#define HAVE_LIBDB 1
_ACEOF
- LIBS="-ldb1 $LIBS"
+ LIBS="-ldb $LIBS"
+
+else
+ echo "$as_me:$LINENO: checking for library containing dbopen" >&5
+echo $ECHO_N "checking for library containing dbopen... $ECHO_C" >&6
+if test "${ac_cv_search_dbopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+ac_cv_search_dbopen=no
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dbopen ();
+int
+main ()
+{
+dbopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 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); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_dbopen="none required"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_dbopen" = no; then
+ for ac_lib in db db1; do
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dbopen ();
+int
+main ()
+{
+dbopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 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); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_dbopen="-l$ac_lib"
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_dbopen" >&5
+echo "${ECHO_T}$ac_cv_search_dbopen" >&6
+if test "$ac_cv_search_dbopen" != no; then
+ test "$ac_cv_search_dbopen" = "none required" || LIBS="$ac_cv_search_dbopen $LIBS"
+
+fi
fi
@@ -3995,7 +4122,8 @@ done
-for ac_header in db1/db.h db.h
+
+for ac_header in db1/db.h db_185.h db.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -4318,7 +4446,8 @@ done
-for ac_func in chflags dbopen tgetent vfork
+
+for ac_func in chflags dbopen __db185_open tgetent vfork
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
diff --git a/pkgtools/pkg_install/files/configure.ac b/pkgtools/pkg_install/files/configure.ac
index d3df5a34aa1..d3f14e09cb4 100644
--- a/pkgtools/pkg_install/files/configure.ac
+++ b/pkgtools/pkg_install/files/configure.ac
@@ -68,7 +68,7 @@ AC_ARG_WITH(mtree,
AC_SUBST(mtree)
dnl Checks for libraries.
-AC_CHECK_LIB(db1, dbopen)
+AC_CHECK_LIB(db, __db185_open, , AC_SEARCH_LIBS(dbopen, [db db1]))
AC_SEARCH_LIBS(tgetent, [termcap termlib curses ncurses])
dnl Checks for header files.
@@ -76,14 +76,14 @@ AC_HEADER_STDC
AC_CHECK_HEADERS([assert.h ctype.h dirent.h err.h errno.h fnctl.h fnmatch.h \
glob.h inttypes.h limits.h md5.h netdb.h pwd.h regex.h signal.h stdarg.h \
stdio.h stdlib.h string.h termcap.h termios.h time.h unistd.h vis.h])
-AC_CHECK_HEADERS([db1/db.h db.h])
+AC_CHECK_HEADERS([db1/db.h db_185.h db.h])
AC_CHECK_HEADERS([sys/cdefs.h sys/file.h sys/ioctl.h sys/mount.h sys/param.h \
sys/poll.h sys/queue.h sys/resource.h sys/signal.h sys/stat.h \
sys/statvfs.h sys/time.h sys/types.h sys/utsname.h sys/vfs.h \
sys/wait.h])
# Checks for library functions.
-AC_CHECK_FUNCS([chflags dbopen tgetent vfork])
+AC_CHECK_FUNCS([chflags dbopen __db185_open tgetent vfork])
AC_CHECK_FUNCS([getrlimit setrlimit])
need_priu64=no
diff --git a/pkgtools/pkg_install/files/lib/config.h.in b/pkgtools/pkg_install/files/lib/config.h.in
index c9c07405e32..3a189f0c850 100644
--- a/pkgtools/pkg_install/files/lib/config.h.in
+++ b/pkgtools/pkg_install/files/lib/config.h.in
@@ -15,6 +15,9 @@
/* Define to 1 if you have the `dbopen' function. */
#undef HAVE_DBOPEN
+/* Define to 1 if you have the <db_185.h> header file. */
+#undef HAVE_DB_185_H
+
/* Define to 1 if you have the <db.h> header file. */
#undef HAVE_DB_H
@@ -42,8 +45,8 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
-/* Define to 1 if you have the `db1' library (-ldb1). */
-#undef HAVE_LIBDB1
+/* Define to 1 if you have the `db' library (-ldb). */
+#undef HAVE_LIBDB
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
@@ -156,6 +159,9 @@
/* Define to 1 if you have the <vis.h> header file. */
#undef HAVE_VIS_H
+/* Define to 1 if you have the `__db185_open' function. */
+#undef HAVE___DB185_OPEN
+
/* Defined when PRIu64 is missing or broken */
#undef NEED_PRI_MACRO
diff --git a/pkgtools/pkg_install/files/lib/pkgdb.c b/pkgtools/pkg_install/files/lib/pkgdb.c
index f8017780770..96b959dea62 100644
--- a/pkgtools/pkg_install/files/lib/pkgdb.c
+++ b/pkgtools/pkg_install/files/lib/pkgdb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pkgdb.c,v 1.24 2005/02/05 00:28:58 jlam Exp $ */
+/* $NetBSD: pkgdb.c,v 1.25 2006/01/04 23:33:23 christos Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#endif
#ifndef lint
-__RCSID("$NetBSD: pkgdb.c,v 1.24 2005/02/05 00:28:58 jlam Exp $");
+__RCSID("$NetBSD: pkgdb.c,v 1.25 2006/01/04 23:33:23 christos Exp $");
#endif
/*
@@ -41,7 +41,9 @@ __RCSID("$NetBSD: pkgdb.c,v 1.24 2005/02/05 00:28:58 jlam Exp $");
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if HAVE_DB1_DB_H
+#if HAVE_DB_185_H
+#include <db_185.h>
+#elif HAVE_DB1_DB_H
#include <db1/db.h>
#elif HAVE_DB_H
#include <db.h>
@@ -64,6 +66,11 @@ __RCSID("$NetBSD: pkgdb.c,v 1.24 2005/02/05 00:28:58 jlam Exp $");
#if HAVE_STRING_H
#include <string.h>
#endif
+#if defined(HAVE_DBOPEN) || (defined(HAVE___DB185_OPEN) && defined(HAVE_DB_185_H))
+#define HAVE_DBLIB 1
+#else
+#define HAVE_DBLIB 0
+#endif
#include "lib.h"
@@ -79,13 +86,13 @@ __RCSID("$NetBSD: pkgdb.c,v 1.24 2005/02/05 00:28:58 jlam Exp $");
/* just in case we change the environment variable name */
#define PKG_DBDIR "PKG_DBDIR"
-#if HAVE_DBOPEN
+#if HAVE_DBLIB
static DB *pkgdbp;
#endif
static char *pkgdb_dir = NULL;
static char pkgdb_cache[MaxPathSize];
-#if HAVE_DBOPEN
+#if HAVE_DBLIB
/*
* Open the pkg-database
* Return value:
@@ -265,7 +272,7 @@ pkgdb_remove_pkg(const char *pkg)
return ret;
}
-#else /* !HAVE_DBOPEN */
+#else /* !HAVE_DBLIB */
int pkgdb_open(int mode) { return 1; }
void pkgdb_close(void) {}
@@ -275,7 +282,7 @@ void pkgdb_dump(void) {}
int pkgdb_remove(const char *key) { return 0; }
int pkgdb_remove_pkg(const char *pkg) { return 1; }
-#endif /* HAVE_DBOPEN */
+#endif /* HAVE_DBLIB */
/*
* Return the location of the package reference counts database directory.
diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index 87486a82a6c..9e3f767f671 100644
--- a/pkgtools/pkg_install/files/lib/version.h
+++ b/pkgtools/pkg_install/files/lib/version.h
@@ -1,4 +1,4 @@
-/* $NetBSD: version.h,v 1.52 2005/11/22 15:44:59 ben Exp $ */
+/* $NetBSD: version.h,v 1.53 2006/01/04 23:33:23 christos Exp $ */
/*
* Copyright (c) 2001 Thomas Klausner. All rights reserved.
@@ -33,6 +33,6 @@
#ifndef _INST_LIB_VERSION_H_
#define _INST_LIB_VERSION_H_
-#define PKGTOOLS_VERSION "20051122"
+#define PKGTOOLS_VERSION "20060104"
#endif /* _INST_LIB_VERSION_H_ */