xfs
[Top] [All Lists]

[PATCH 3/3] xfsqa: build dbtest on debian platforms

To: xfs@xxxxxxxxxxx
Subject: [PATCH 3/3] xfsqa: build dbtest on debian platforms
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 29 Apr 2010 10:16:26 +1000
In-reply-to: <1272500186-29393-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1272500186-29393-1-git-send-email-david@xxxxxxxxxxxxx>
Set up autoconf to find the correct headers and compat libraries for
debian squeeze, and massage the includes to ensure the right headers get
included. Also fix a compile warning that was emitted now that it is being
compiled.

Signed-off-by: Dave Chinner <david@xxxxxxxxxxxxx>
---
 m4/package_gdbmdev.m4 |    8 ++++++--
 src/dbtest.c          |   18 +++++++++---------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/m4/package_gdbmdev.m4 b/m4/package_gdbmdev.m4
index d826acd..6580fba 100644
--- a/m4/package_gdbmdev.m4
+++ b/m4/package_gdbmdev.m4
@@ -6,9 +6,13 @@ AC_DEFUN([AC_PACKAGE_WANT_NDBM],
   ])
 
 AC_DEFUN([AC_PACKAGE_WANT_GDBM],
-  [ AC_CHECK_HEADERS([gdbm/ndbm.h], [ have_db=true ], [ have_db=false ])
+  [ AC_CHECK_HEADERS([gdbm/ndbm.h, gdbm-ndbm.h], [ have_db=true ], [ 
have_db=false ])
+    libgdbm=""
+    if test $have_db = true -a -f 
${libexecdir}${libdirsuffix}/libgdbm_compat.a; then
+       libgdbm="${libexecdir}${libdirsuffix}/libgdbm_compat.a"
+    fi
     if test $have_db = true -a -f ${libexecdir}${libdirsuffix}/libgdbm.a; then
-       libgdbm="${libexecdir}${libdirsuffix}/libgdbm.a"
+       libgdbm="${libgdbm} ${libexecdir}${libdirsuffix}/libgdbm.a"
     fi
     AC_SUBST(libgdbm)
     AC_SUBST(have_db)
diff --git a/src/dbtest.c b/src/dbtest.c
index 48667b7..297540f 100644
--- a/src/dbtest.c
+++ b/src/dbtest.c
@@ -18,19 +18,17 @@
  
 #include "global.h"
 
-#ifdef HAVE_GDBM_NDBM_H
+#ifdef HAVE_GDBM_NDBM_H_
 #include <gdbm/ndbm.h>
-#else
-#ifdef HAVE_GDBM_H
+#elif HAVE_GDBM_NDBM_H
+#include <gdbm-ndbm.h>
+#elif HAVE_GDBM_H
 #include <gdbm.h>
-#else
-#ifdef HAVE_NDBM_H
+#elif HAVE_NDBM_H
 #include <ndbm.h>
 #else
 bozo!
 #endif
-#endif
-#endif
 
 
 /* #define WorkDir     "/xfs" */
@@ -144,7 +142,8 @@ int InitDbmLookup(int howmany)
                fflush(stdout);
        }
        dbm = dbm_open(filename, O_WRONLY|O_CREAT, 0644);
-       if(dbm == NULL) DoSysError("\ndbm_open", (int)dbm);
+       if(dbm == NULL)
+               DoSysError("\ndbm_open", -1);
 
        if ((KeyArray = (unsigned short *)calloc( howmany,
                                sizeof(unsigned short))) == NULL)
@@ -195,7 +194,8 @@ int InitDbmLookup(int howmany)
                fflush(stdout);
        }
        dbm = dbm_open(filename, O_RDONLY, 0);
-       if(dbm == NULL) DoSysError("\ndbm_open", (int)dbm);
+       if(dbm == NULL)
+               DoSysError("\ndbm_open", -1);
        return 0;
 }
 
-- 
1.5.6.5

<Prev in Thread] Current Thread [Next in Thread>