[GEDI] [PATCH 2/6] configure: Link test before auto-enabling glusterfs libraries

Philippe Mathieu-Daudé philmd at redhat.com
Fri Jun 14 07:24:28 UTC 2019


Similarly to commit a73e82ef912, test the libraries link correctly
before considering them as usable.

This fixes using ./configure --static on Ubuntu 18.04:

  $ make subdir-aarch64-softmmu
  [...]
    LINK    aarch64-softmmu/qemu-system-aarch64
  /usr/bin/ld: cannot find -lgfapi
  /usr/bin/ld: cannot find -lglusterfs
  /usr/bin/ld: cannot find -lgfrpc
  /usr/bin/ld: cannot find -lgfxdr
  collect2: error: ld returned 1 exit status
  Makefile:204: recipe for target 'qemu-system-aarch64' failed
  make[1]: *** [qemu-system-aarch64] Error 1

  $ fgrep gf config-host.mak
  GLUSTERFS_LIBS=-lacl -lgfapi -lglusterfs -lgfrpc -lgfxdr -luuid

  $ lsb_release -cri
  Distributor ID: Ubuntu
  Release:        18.04
  Codename:       bionic

Signed-off-by: Philippe Mathieu-Daudé <philmd at redhat.com>
---
 configure | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 13fd4a1166..3428adb75b 100755
--- a/configure
+++ b/configure
@@ -4179,9 +4179,23 @@ fi
 # glusterfs probe
 if test "$glusterfs" != "no" ; then
   if $pkg_config --atleast-version=3 glusterfs-api; then
-    glusterfs="yes"
     glusterfs_cflags=$($pkg_config --cflags glusterfs-api)
-    glusterfs_libs=$($pkg_config --libs glusterfs-api)
+    if test "$static" = "yes"; then
+        glusterfs_libs=$($pkg_config --libs --static glusterfs-api)
+    else
+        glusterfs_libs=$($pkg_config --libs glusterfs-api)
+    fi
+    # Packaging for the static libraries is not always correct.
+    # At least ubuntu 18.04 ships only shared libraries.
+    write_c_skeleton
+    if ! compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
+        if test "$glusterfs" = "yes" ; then
+          error_exit "glusterfs check failed."
+        fi
+        glusterfs="no"
+    else
+        glusterfs="yes"
+    fi
     if $pkg_config --atleast-version=4 glusterfs-api; then
       glusterfs_xlator_opt="yes"
     fi
-- 
2.20.1



More information about the integration mailing list