All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] fstests: GDBM detection cleanup
@ 2018-03-15 21:54 jeffm
  2018-03-15 21:54 ` [PATCH 1/4] build: remove dead AC_PACKAGE_WANT_NDBM macro jeffm
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jeffm @ 2018-03-15 21:54 UTC (permalink / raw)
  To: xfstests list; +Cc: Luis Rodriguez, Eryu Guan, Jeff Mahoney

From: Jeff Mahoney <jeffm@suse.com>

Commit 2353022 (build: update AC_PACKAGE_WANT_GDBM() and src/dbtest.c
to build) fixed building on newer SUSE systems but broke older ones.  Where
we used to skip building src/dbtest on SLES systems, now we'd fail
to build on SLES11.  The reason was that we were now detecting
ndbm.h but also including gdbm.h, which doesn't work on older systems due
to both defining the datum type.  It turns out that no system needs
gdbm.h at all.

This series cleans up the macros and fixes detection for all systems that
only have /usr/include/ndbm.h.

-Jeff

---

Jeff Mahoney (4):
  build: remove dead AC_PACKAGE_WANT_NDBM macro
  build: AC_PACKAGE_WANT_GDBM, fall back to compat if libgdbm detection
    fails
  build: clean up AC_PACKAGE_WANT_GDBM
  build: fix <ndbm.h> detection in AC_PACKAGE_WANT_GDBM

 m4/package_gdbmdev.m4 | 104 ++++++++++++++++++++++----------------------------
 src/dbtest.c          |   3 --
 2 files changed, 46 insertions(+), 61 deletions(-)

-- 
2.15.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] build: remove dead AC_PACKAGE_WANT_NDBM macro
  2018-03-15 21:54 [PATCH 0/4] fstests: GDBM detection cleanup jeffm
@ 2018-03-15 21:54 ` jeffm
  2018-03-15 21:54 ` [PATCH 2/4] build: AC_PACKAGE_WANT_GDBM, fall back to compat if libgdbm detection fails jeffm
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jeffm @ 2018-03-15 21:54 UTC (permalink / raw)
  To: xfstests list; +Cc: Luis Rodriguez, Eryu Guan, Jeff Mahoney

From: Jeff Mahoney <jeffm@suse.com>

Commit fb05a918085 build: remove IRIX-specific build logic) removed
the tests used on IRIX but missed AC_PACKAGE_WANT_NDBM.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 m4/package_gdbmdev.m4 | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/m4/package_gdbmdev.m4 b/m4/package_gdbmdev.m4
index e9634316..484b751a 100644
--- a/m4/package_gdbmdev.m4
+++ b/m4/package_gdbmdev.m4
@@ -1,23 +1,3 @@
-AC_DEFUN([AC_PACKAGE_WANT_NDBM],
-  [ AC_CHECK_HEADERS(ndbm.h, [ have_db=true ], [ have_db=false ])
-    found=false
-    libgdbm=""
-
-    if test $have_db = true; then
-      AC_CHECK_LIB(ndbm,dbm_open,found=true,found=false)
-      AC_CHECK_LIB(ndbm,dbm_fetch,,found=false)
-      AC_CHECK_LIB(ndbm,dbm_store,,found=false)
-      AC_CHECK_LIB(ndbm,dbm_close,,found=false)
-
-      if test $found = true; then
-        libgdbm="$ndbm"
-      fi
-    fi
-
-    AC_SUBST(libgdbm)
-    AC_SUBST(have_db)
-  ])
-
 AC_DEFUN([AC_PACKAGE_WANT_GDBM],
   [ AC_CHECK_HEADER(gdbm-ndbm.h, [ gdbm_ndbm=true; have_db=true ], [ gdbm_ndbm=false; have_db=false ])
 
-- 
2.15.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] build: AC_PACKAGE_WANT_GDBM, fall back to compat if libgdbm detection fails
  2018-03-15 21:54 [PATCH 0/4] fstests: GDBM detection cleanup jeffm
  2018-03-15 21:54 ` [PATCH 1/4] build: remove dead AC_PACKAGE_WANT_NDBM macro jeffm
@ 2018-03-15 21:54 ` jeffm
  2018-03-15 21:54 ` [PATCH 3/4] build: clean up AC_PACKAGE_WANT_GDBM jeffm
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jeffm @ 2018-03-15 21:54 UTC (permalink / raw)
  To: xfstests list; +Cc: Luis Rodriguez, Eryu Guan, Jeff Mahoney

From: Jeff Mahoney <jeffm@suse.com>

We currently check if libgdbm_compat contains the required symbols
even if libgdbm does.  Let's fall back only when necessary (which
is pretty much always anyway).

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 m4/package_gdbmdev.m4 | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/m4/package_gdbmdev.m4 b/m4/package_gdbmdev.m4
index 484b751a..3e5f33d0 100644
--- a/m4/package_gdbmdev.m4
+++ b/m4/package_gdbmdev.m4
@@ -30,16 +30,15 @@ AC_DEFUN([AC_PACKAGE_WANT_GDBM],
 
       if test $found = true; then
         libgdbm="${libgdbm} -lgdbm"
-      fi
-
-      found="no"
-      AC_CHECK_LIB(gdbm_compat,dbm_open,found=true,found=false,-lgdbm)
-      AC_CHECK_LIB(gdbm_compat,dbm_fetch,,found=false,-lgdbm)
-      AC_CHECK_LIB(gdbm_compat,dbm_store,,found=false,-lgdbm)
-      AC_CHECK_LIB(gdbm_compat,dbm_close,,found="no",-lgdbm)
-
-      if test $found = true ; then
-        libgdbm="${libgdbm} -lgdbm_compat -lgdbm"
+      else
+	AC_CHECK_LIB(gdbm_compat,dbm_open,found=true,found=false,-lgdbm)
+	AC_CHECK_LIB(gdbm_compat,dbm_fetch,,found=false,-lgdbm)
+	AC_CHECK_LIB(gdbm_compat,dbm_store,,found=false,-lgdbm)
+	AC_CHECK_LIB(gdbm_compat,dbm_close,,found="false",-lgdbm)
+
+	if test $found = true ; then
+	  libgdbm="${libgdbm} -lgdbm_compat -lgdbm"
+	fi
       fi
     fi
 
-- 
2.15.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] build: clean up AC_PACKAGE_WANT_GDBM
  2018-03-15 21:54 [PATCH 0/4] fstests: GDBM detection cleanup jeffm
  2018-03-15 21:54 ` [PATCH 1/4] build: remove dead AC_PACKAGE_WANT_NDBM macro jeffm
  2018-03-15 21:54 ` [PATCH 2/4] build: AC_PACKAGE_WANT_GDBM, fall back to compat if libgdbm detection fails jeffm
@ 2018-03-15 21:54 ` jeffm
  2018-03-15 21:54 ` [PATCH 4/4] build: fix <ndbm.h> detection in AC_PACKAGE_WANT_GDBM jeffm
  2018-03-23  3:30 ` [PATCH 0/4] fstests: GDBM detection cleanup Eryu Guan
  4 siblings, 0 replies; 6+ messages in thread
From: jeffm @ 2018-03-15 21:54 UTC (permalink / raw)
  To: xfstests list; +Cc: Luis Rodriguez, Eryu Guan, Jeff Mahoney

From: Jeff Mahoney <jeffm@suse.com>

The AC_PACKAGE_WANT_GDBM macro is not easily read.  It's not doing anything
particularly complex other than working through a set of alternatives
for headers and libraries.

This patch cleans it up to be more readable.  We also only attempt to
check in libgdbm_compat if the checks in libgdbm fail.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 m4/package_gdbmdev.m4 | 87 ++++++++++++++++++++++++++++++++-------------------
 1 file changed, 55 insertions(+), 32 deletions(-)

diff --git a/m4/package_gdbmdev.m4 b/m4/package_gdbmdev.m4
index 3e5f33d0..922cbcbc 100644
--- a/m4/package_gdbmdev.m4
+++ b/m4/package_gdbmdev.m4
@@ -1,43 +1,66 @@
 AC_DEFUN([AC_PACKAGE_WANT_GDBM],
-  [ AC_CHECK_HEADER(gdbm-ndbm.h, [ gdbm_ndbm=true; have_db=true ], [ gdbm_ndbm=false; have_db=false ])
+  [
+    have_db=
+    AC_CHECK_HEADER(gdbm-ndbm.h,
+      [
+	have_db=true
+        AC_DEFINE(HAVE_GDBM_NDBM_H, [1],
+		  [Define to 1 if you have the <gdbm-ndbm.h> header file.])
+      ])
 
-    if test $gdbm_ndbm = true; then
-        AC_DEFINE(HAVE_GDBM_NDBM_H, [1], [Define to 1 if you have the <gdbm-ndbm.h> header file.])
-    else
-        AS_UNSET([ac_cv_header_gdbm_ndbm_h])
-        AC_CHECK_HEADER(gdbm/ndbm.h, [ gdbm_ndbm_=true; have_db=true ], [ gdbm_ndbm_=false; have_db=false ])
-        if test $gdbm_ndbm_ = true; then
-            AC_DEFINE(HAVE_GDBM_NDBM_H_, [1], [Define to 1 if you have the <gdbm/ndbm.h> header file.])
-        else
-            AC_CHECK_HEADER(gdbm.h, [ gdbm_ndbm_=true; have_db=true ], [ gdbm_ndbm_=false; have_db=false ])
-            AC_CHECK_HEADER(ndbm.h, [ ndbm_=true ], [ ndbm_=false ])
-                if test $gdbm_ndbm_ = true; then
-                    if test $ndbm_ = true; then
-                        AC_DEFINE(HAVE_GDBM_H, [1], [Define to 1 if you have both <gdbm.h> and <ndbm.h> header files.])
-                    fi
-                fi
-        fi
+    if test -z "$have_db"; then
+      dnl gdbm-ndbm.h and gdbm/ndbm.h map to the same autoconf internal
+      dnl variable.  We need to clear it or this test will be skipped
+      dnl and the cached result from first test will be used.
+      AS_UNSET([ac_cv_header_gdbm_ndbm_h])
+      AC_CHECK_HEADER(gdbm/ndbm.h,
+	[
+	  have_db=true
+	  AC_DEFINE(HAVE_GDBM_NDBM_H_, [1],
+		    [Define to 1 if you have the <gdbm/ndbm.h> header file.])
+	])
     fi
 
-    found=false
-    libgdbm=""
+    if test -z "$have_db"; then
+      AC_CHECK_HEADER(gdbm.h,
+	[
+	  have_db=true
+	  gdbm_ndbm_=true
+	], [
+	  have_db=false
+	  gdbm_ndbm_=false
+	])
+      AC_CHECK_HEADER(ndbm.h,
+	[
+	  ndbm_=true
+	], [
+	  ndbm_=false
+	])
+	if test $gdbm_ndbm_ = true; then
+	  if test $ndbm_ = true; then
+	    AC_DEFINE(HAVE_GDBM_H, [1],
+		      [Define to 1 if you have both <gdbm.h> and <ndbm.h> header files.])
+	  fi
+	fi
+    fi
 
-    if test $have_db = true; then
-      AC_CHECK_LIB(gdbm,dbm_open,found=true,found=false)
-      AC_CHECK_LIB(gdbm,dbm_fetch,,found=false)
-      AC_CHECK_LIB(gdbm,dbm_store,,found=false)
-      AC_CHECK_LIB(gdbm,dbm_close,,found=false)
+    if test "$have_db" = true; then
+      found=false
+      AC_CHECK_LIB(gdbm, dbm_open, found=true, found=false)
+      AC_CHECK_LIB(gdbm, dbm_fetch,, found=false)
+      AC_CHECK_LIB(gdbm, dbm_store,, found=false)
+      AC_CHECK_LIB(gdbm, dbm_close,, found=false)
 
-      if test $found = true; then
-        libgdbm="${libgdbm} -lgdbm"
+      if test "$found" = true; then
+        libgdbm="-lgdbm"
       else
-	AC_CHECK_LIB(gdbm_compat,dbm_open,found=true,found=false,-lgdbm)
-	AC_CHECK_LIB(gdbm_compat,dbm_fetch,,found=false,-lgdbm)
-	AC_CHECK_LIB(gdbm_compat,dbm_store,,found=false,-lgdbm)
-	AC_CHECK_LIB(gdbm_compat,dbm_close,,found="false",-lgdbm)
+	AC_CHECK_LIB(gdbm_compat, dbm_open, found=true, found=false, -lgdbm)
+	AC_CHECK_LIB(gdbm_compat, dbm_fetch,, found=false, -lgdbm)
+	AC_CHECK_LIB(gdbm_compat, dbm_store,, found=false, -lgdbm)
+	AC_CHECK_LIB(gdbm_compat, dbm_close,, found="no", -lgdbm)
 
-	if test $found = true ; then
-	  libgdbm="${libgdbm} -lgdbm_compat -lgdbm"
+	if test "$found" = "true"; then
+	  libgdbm="-lgdbm_compat -lgdbm"
 	fi
       fi
     fi
-- 
2.15.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] build: fix <ndbm.h> detection in AC_PACKAGE_WANT_GDBM
  2018-03-15 21:54 [PATCH 0/4] fstests: GDBM detection cleanup jeffm
                   ` (2 preceding siblings ...)
  2018-03-15 21:54 ` [PATCH 3/4] build: clean up AC_PACKAGE_WANT_GDBM jeffm
@ 2018-03-15 21:54 ` jeffm
  2018-03-23  3:30 ` [PATCH 0/4] fstests: GDBM detection cleanup Eryu Guan
  4 siblings, 0 replies; 6+ messages in thread
From: jeffm @ 2018-03-15 21:54 UTC (permalink / raw)
  To: xfstests list; +Cc: Luis Rodriguez, Eryu Guan, Jeff Mahoney

From: Jeff Mahoney <jeffm@suse.com>

SUSE systems export the NDBM interface via /usr/include/ndbm.h

This means that dbtest wasn't built on SUSE systems until
commit 2353022 (build: update AC_PACKAGE_WANT_GDBM() and src/dbtest.c
to build).  That change was incompatible with older
SLES releases due to <ndbm.h> and <gdbm.h> both defining the datum
type, resulting in build failures.

Nothing has ever set HAVE_GDBM_H or checked for the <gdbm.h> header
prior to the above commit, and it's not required on SUSE systems
either, so just remove that entirely.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 m4/package_gdbmdev.m4 | 20 +++-----------------
 src/dbtest.c          |  3 ---
 2 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/m4/package_gdbmdev.m4 b/m4/package_gdbmdev.m4
index 922cbcbc..723900fc 100644
--- a/m4/package_gdbmdev.m4
+++ b/m4/package_gdbmdev.m4
@@ -22,26 +22,12 @@ AC_DEFUN([AC_PACKAGE_WANT_GDBM],
     fi
 
     if test -z "$have_db"; then
-      AC_CHECK_HEADER(gdbm.h,
-	[
-	  have_db=true
-	  gdbm_ndbm_=true
-	], [
-	  have_db=false
-	  gdbm_ndbm_=false
-	])
       AC_CHECK_HEADER(ndbm.h,
 	[
-	  ndbm_=true
-	], [
-	  ndbm_=false
+	  have_db=true
+	  AC_DEFINE(HAVE_NDBM_H, [1],
+		    [Define to 1 if you have the <ndbm.h> header file.])
 	])
-	if test $gdbm_ndbm_ = true; then
-	  if test $ndbm_ = true; then
-	    AC_DEFINE(HAVE_GDBM_H, [1],
-		      [Define to 1 if you have both <gdbm.h> and <ndbm.h> header files.])
-	  fi
-	fi
     fi
 
     if test "$have_db" = true; then
diff --git a/src/dbtest.c b/src/dbtest.c
index f45db4ac..4366dcdf 100644
--- a/src/dbtest.c
+++ b/src/dbtest.c
@@ -22,9 +22,6 @@
 #include <gdbm/ndbm.h>
 #elif HAVE_GDBM_NDBM_H
 #include <gdbm-ndbm.h>
-#elif HAVE_GDBM_H
-#include <gdbm.h>
-#include <ndbm.h>
 #elif HAVE_NDBM_H
 #include <ndbm.h>
 #else
-- 
2.15.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] fstests: GDBM detection cleanup
  2018-03-15 21:54 [PATCH 0/4] fstests: GDBM detection cleanup jeffm
                   ` (3 preceding siblings ...)
  2018-03-15 21:54 ` [PATCH 4/4] build: fix <ndbm.h> detection in AC_PACKAGE_WANT_GDBM jeffm
@ 2018-03-23  3:30 ` Eryu Guan
  4 siblings, 0 replies; 6+ messages in thread
From: Eryu Guan @ 2018-03-23  3:30 UTC (permalink / raw)
  To: jeffm; +Cc: xfstests list, Luis Rodriguez

On Thu, Mar 15, 2018 at 05:54:51PM -0400, jeffm@suse.com wrote:
> From: Jeff Mahoney <jeffm@suse.com>
> 
> Commit 2353022 (build: update AC_PACKAGE_WANT_GDBM() and src/dbtest.c
> to build) fixed building on newer SUSE systems but broke older ones.  Where
> we used to skip building src/dbtest on SLES systems, now we'd fail
> to build on SLES11.  The reason was that we were now detecting
> ndbm.h but also including gdbm.h, which doesn't work on older systems due
> to both defining the datum type.  It turns out that no system needs
> gdbm.h at all.
> 
> This series cleans up the macros and fixes detection for all systems that
> only have /usr/include/ndbm.h.

Thanks for the fixes and cleanups! I tested them on Fedora 27, RHEL7 and
Debian stretch, with/without gdbm devel package installed, all worked
fine. But I don't have SUSE systems by hand, I assume you've tested them
successfully.

Thanks,
Eryu

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-03-23  3:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-15 21:54 [PATCH 0/4] fstests: GDBM detection cleanup jeffm
2018-03-15 21:54 ` [PATCH 1/4] build: remove dead AC_PACKAGE_WANT_NDBM macro jeffm
2018-03-15 21:54 ` [PATCH 2/4] build: AC_PACKAGE_WANT_GDBM, fall back to compat if libgdbm detection fails jeffm
2018-03-15 21:54 ` [PATCH 3/4] build: clean up AC_PACKAGE_WANT_GDBM jeffm
2018-03-15 21:54 ` [PATCH 4/4] build: fix <ndbm.h> detection in AC_PACKAGE_WANT_GDBM jeffm
2018-03-23  3:30 ` [PATCH 0/4] fstests: GDBM detection cleanup Eryu Guan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.