pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files Handle newer versions of Be...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4a5220049f6d
branches:  trunk
changeset: 505575:4a5220049f6d
user:      christos <christos%pkgsrc.org@localhost>
date:      Wed Jan 04 23:33:23 2006 +0000

description:
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:

 pkgtools/pkg_install/files/configure       |  167 +++++++++++++++++++++++++---
 pkgtools/pkg_install/files/configure.ac    |    6 +-
 pkgtools/pkg_install/files/lib/config.h.in |   10 +-
 pkgtools/pkg_install/files/lib/pkgdb.c     |   21 ++-
 pkgtools/pkg_install/files/lib/version.h   |    4 +-
 5 files changed, 175 insertions(+), 33 deletions(-)

diffs (truncated from 363 to 300 lines):

diff -r 254c8cf7b682 -r 4a5220049f6d pkgtools/pkg_install/files/configure
--- a/pkgtools/pkg_install/files/configure      Wed Jan 04 23:18:08 2006 +0000
+++ b/pkgtools/pkg_install/files/configure      Wed Jan 04 23:33:23 2006 +0000
@@ -3129,14 +3129,86 @@
 
 
 
-
-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
+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 __db185_open ();
+int
+main ()
+{
+__db185_open ();
+  ;
+  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_lib_db___db185_open=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+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_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_LIBDB 1
+_ACEOF
+
+  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
@@ -3181,25 +3253,80 @@
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_db1_dbopen=yes
+  ac_cv_search_dbopen="none required"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_db1_dbopen=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
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDB1 1
-_ACEOF
-
-  LIBS="-ldb1 $LIBS"
+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 @@
 
 
 
-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 @@
 
 
 
-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 -r 254c8cf7b682 -r 4a5220049f6d pkgtools/pkg_install/files/configure.ac
--- a/pkgtools/pkg_install/files/configure.ac   Wed Jan 04 23:18:08 2006 +0000
+++ b/pkgtools/pkg_install/files/configure.ac   Wed Jan 04 23:33:23 2006 +0000
@@ -68,7 +68,7 @@
 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_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 -r 254c8cf7b682 -r 4a5220049f6d pkgtools/pkg_install/files/lib/config.h.in
--- a/pkgtools/pkg_install/files/lib/config.h.in        Wed Jan 04 23:18:08 2006 +0000
+++ b/pkgtools/pkg_install/files/lib/config.h.in        Wed Jan 04 23:33:23 2006 +0000
@@ -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 -r 254c8cf7b682 -r 4a5220049f6d pkgtools/pkg_install/files/lib/pkgdb.c
--- a/pkgtools/pkg_install/files/lib/pkgdb.c    Wed Jan 04 23:18:08 2006 +0000
+++ b/pkgtools/pkg_install/files/lib/pkgdb.c    Wed Jan 04 23:33:23 2006 +0000
@@ -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 @@
  * 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>



Home | Main Index | Thread Index | Old Index