Joe Orton wrote:
On Fri, Aug 05, 2005 at 11:21:05AM -0400, Glenn Schrader wrote:

I'm attempting to build apr-util 1.1.2 on Solaris 2.8 with
--enable-static, --disable-shared, and --with-berkeley-db=<path>.
The configuration script indicates that it can't find a
good Berkeley DB. The problem isn't that its not pointing
to a good libdb since the log file says that the test
for the database is failing to link because fdatasync
is undefined. What I've found is that on linux, fdatasync
appears to be in both libc and librt but on Solaris 2.8
its only in librt. The attached patch modifies
apr-util/build/apu-hits.m4 to add -lrt to the list of
libraries to be linked in for Solaris2.


If a static BDB library can depend on -lrt then the correct way to fix this is to enhance the APU_CHECK_BERKELEY_DB macro (build/bdb.m4) to trying linking against -ldb -lrt if linking against -ldb fails.

joe


OK. That does sound cleaner (be gentle, this is the first patch that
i've submitted here). An updated patch is attached.

-glenn
--- apr-util-1.1.2_old/build/dbm.m4     2004-11-24 18:41:24.000000000 -0500
+++ apr-util-1.1.2/build/dbm.m4 2005-08-05 16:07:05.646753610 -0400
@@ -109,6 +109,7 @@
             AC_MSG_CHECKING([for -l$bdb_libname])
             dnl We can't use AC_CACHE_CHECK here, because that won't print out
             dnl the value of the computed cache variable properly.
+            apu_db_need_librt="0"
             AC_CACHE_VAL($cache_id,
               [
                 APU_TRY_BERKELEY_DB($1, $2, $3, $bdb_header, $bdb_libname)
@@ -116,6 +117,20 @@
               ])
             result="`eval echo '$'$cache_id`"
             AC_MSG_RESULT($result)
+            if test "$result" != "yes"; then
+              apu_db_need_librt="1" 
+              cache_id="${cache_id}_librt"
+              AC_MSG_CHECKING([if -l$bdb_libname needs -lrt ])
+              LIBS="$LIBS -lrt"
+              AC_CACHE_VAL($cache_id,
+                [
+                  APU_TRY_BERKELEY_DB($1, $2, $3, $bdb_header, $bdb_libname)
+                  eval "$cache_id=$apu_try_berkeley_db"
+                ])
+              LIBS="$apu_check_lib_save_libs"
+              result="`eval echo '$'$cache_id`"
+              AC_MSG_RESULT($result)
+            fi
           elif test "$1" = "1"; then
             AC_CHECK_LIB($bdb_libname,
               dbopen,
@@ -143,6 +158,7 @@
   done
 
   # Restore the original values of the flags we tweak.
+  LIBS="$apu_check_lib_save_libs"
   LDFLAGS="$apu_check_lib_save_ldflags"
   CPPFLAGS="$apu_check_lib_save_cppflags"
 
@@ -782,6 +798,10 @@
   if test "$apu_have_db" = "1"; then
     APR_ADDTO(APRUTIL_EXPORT_LIBS,[-l$apu_db_lib])
     APR_ADDTO(APRUTIL_LIBS,[-l$apu_db_lib])
+    if test "$apu_db_need_librt" = "1"; then
+      APR_ADDTO(APRUTIL_EXPORT_LIBS, [-lrt])
+      APR_ADDTO(APRUTIL_LIBS, [-lrt])
+    fi    
     if test -n "apu_db_xtra_libs"; then
       APR_ADDTO(APRUTIL_EXPORT_LIBS,[$apu_db_xtra_libs])
       APR_ADDTO(APRUTIL_LIBS,[$apu_db_xtra_libs])

Reply via email to