From 6bc3237477069c8ddc70deee6e0d7cbbbdf92a08 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Tue, 16 Jul 2019 15:34:16 -0400 Subject: [PATCH] LU-9897 build: use pkgconf for detecting libblkid Currently we have extra complexity to determine where packages are installed. This approach is also fragile if packages are not installed in the standard location. This can be handled in a much cleaner way with pkgconfig. Use pkgconf to discover libblkid. Test-Parameters: trivial Change-Id: I5241c2c38b1114d8f061ee5f2a4cb0c677ce2c71 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/35531 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Nathaniel Clark Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- lustre.spec.in | 7 ++++++- lustre/autoconf/lustre-core.m4 | 9 +++++++-- lustre/utils/Makefile.am | 9 +-------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lustre.spec.in b/lustre.spec.in index db3c0d40..64fdb9b 100644 --- a/lustre.spec.in +++ b/lustre.spec.in @@ -146,13 +146,18 @@ BuildRoot: %{_tmppath}/lustre-%{version}-root Requires: %{requires_kmod_name} = %{requires_kmod_version} zlib Requires: %{requires_yaml_name} BuildRequires: libtool libyaml-devel zlib-devel +%if %{_vendor}=="redhat" +BuildRequires: pkgconfig +%else +BuildRequires: pkg-config +%endif %if %{with servers} Requires: lustre-osd Requires: lustre-osd-mount Obsoletes: lustre-client < %{version} Provides: lustre-client = %{version}-%{release} %endif -# GSS requires this: BuildRequires: pkgconfig, libgssapi-devel >= 0.10 +# GSS requires this: BuildRequires: libgssapi-devel >= 0.10 %if %{_vendor}=="redhat" || %{_vendor}=="fedora" #suse don't support selinux BuildRequires: libselinux-devel diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 22ed68a..4bd7e78 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -3261,7 +3261,9 @@ AC_CHECK_HEADERS([netdb.h endian.h]) AC_CHECK_FUNCS([gethostbyname]) # lustre/utils/llverdev.c -AC_CHECK_HEADERS([blkid/blkid.h]) +AS_IF([test "x$enable_dist" = xno], [ + PKG_CHECK_MODULES(blkid, [blkid]) +]) # lustre/utils/llverfs.c AC_CHECK_HEADERS([ext2fs/ext2fs.h]) @@ -3278,6 +3280,10 @@ AS_IF([test "$enable_dist" = "no"], [ ]) SELINUX="" +AS_IF([test "x$enable_dist" = xno], [ + PKG_CHECK_MODULES(blkid, [blkid]) +]) + AC_CHECK_LIB([selinux], [is_selinux_enabled], [AC_CHECK_HEADERS([selinux/selinux.h], [SELINUX="-lselinux" @@ -3373,7 +3379,6 @@ AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests) AM_CONDITIONAL(CLIENT, test x$enable_client = xyes) AM_CONDITIONAL(SERVER, test x$enable_server = xyes) AM_CONDITIONAL(SPLIT, test x$enable_split = xyes) -AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes) AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes) AM_CONDITIONAL(GSS, test x$enable_gss = xyes) AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes) diff --git a/lustre/utils/Makefile.am b/lustre/utils/Makefile.am index 75e6018..44ae523 100644 --- a/lustre/utils/Makefile.am +++ b/lustre/utils/Makefile.am @@ -89,15 +89,8 @@ E2PLIB = EXT2FSLIB = endif -if BLKID -BLKIDLIB = -lblkid -luuid -else -BLKIDLIB = -endif - llverfs_LDADD := $(EXT2FSLIB) $(E2PLIB) - -llverdev_LDADD := $(EXT2FSLIB) $(BLKIDLIB) +llverdev_LDADD := $(EXT2FSLIB) $(blkid_LIBS) liblustreapi_la_SOURCES = liblustreapi.c liblustreapi_hsm.c \ liblustreapi_nodemap.c lustreapi_internal.h \ -- 1.8.3.1