From d29305ee15fb4477835f84c06e84686560dcbfa2 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 21 Apr 2022 15:18:10 -0700 Subject: [PATCH] configure.ac: Enable cross-compilation commit c48335416a09b881d2309b8f88c9b3d1441f4a9c category: bugfix issue: #I6VAS0 CVE: NA Signed-off-by: DongSenhao --------------------------------------- Stop using PKG_CHECK_MODULES() since that macro is not compatible with cross-compilation. Signed-off-by: Bart Van Assche Signed-off-by: Jaegeuk Kim Signed-off-by: dongsenhao --- README.md | 1 - configure.ac | 45 +++++++++++++++++------------------------ mkfs/f2fs_format.c | 2 +- mkfs/f2fs_format_main.c | 4 ++-- tools/f2fscrypt.c | 2 +- 5 files changed, 23 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index d8541ca..b858a2f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ Before compilation You should install the following packages. - libuuid-devel or uuid-dev - - pkg-config - autoconf - libtool - libselinux1-dev diff --git a/configure.ac b/configure.ac index 0d7872a..4a3afa4 100644 --- a/configure.ac +++ b/configure.ac @@ -53,6 +53,12 @@ AC_PATH_PROG([LDCONFIG], [ldconfig], [$PATH:/sbin]) # Checks for libraries. +AC_CHECK_LIB([blkid], [blkid_probe_all], + [AC_SUBST([libblkid_LIBS], ["-lblkid"]) + AC_DEFINE([HAVE_LIBBLKID], [1], + [Define if you have libblkid]) + ], [], []) + AC_CHECK_LIB([lzo2], [main], [AC_SUBST([liblzo2_LIBS], ["-llzo2"]) AC_DEFINE([HAVE_LIBLZO2], [1], @@ -65,37 +71,22 @@ AC_CHECK_LIB([lz4], [main], [Define if you have liblz4]) ], [], []) -PKG_CHECK_MODULES([libuuid], [uuid]) +AC_CHECK_LIB([selinux], [getcon], + [AC_SUBST([libselinux_LIBS], ["-lselinux"]) + AC_DEFINE([HAVE_LIBSELINUX], [1], + [Define if you have libselinux]) + ], [], []) -AS_IF([test "x$with_selinux" != "xno"], - [PKG_CHECK_MODULES([libselinux], [libselinux], - [have_selinux=yes], [have_selinux=no])], - [have_selinux=no] -) - -AS_IF([test "x$have_selinux" = "xyes"], - [AC_DEFINE([HAVE_LIBSELINUX], [1], [Use libselinux])], - [AS_IF([test "x$with_selinux" = "xyes"], - [AC_MSG_ERROR([selinux support requested but libselinux not found])] - )] -) - -AS_IF([test "x$with_blkid" != "xno"], - [PKG_CHECK_MODULES([libblkid], [blkid], - [have_blkid=yes], [have_blkid=no])], - [have_blkid=no] -) - -AS_IF([test "x$have_blkid" = "xyes"], - [AC_DEFINE([HAVE_LIBBLKID], [1], [Use blkid])], - [AS_IF([test "x$with_blkid" = "xyes"], - [AC_MSG_ERROR([blkid support requested but libblkid not found])] - )] -) +AC_CHECK_LIB([uuid], [uuid_clear], + [AC_SUBST([libuuid_LIBS], ["-luuid"]) + AC_DEFINE([HAVE_LIBUUID], [1], + [Define if you have libuuid]) + ], [], []) # Checks for header files. AC_CHECK_HEADERS(m4_flatten([ attr/xattr.h + blkid/blkid.h byteswap.h fcntl.h linux/blkzoned.h @@ -110,6 +101,7 @@ AC_CHECK_HEADERS(m4_flatten([ mach/mach_time.h mntent.h scsi/sg.h + selinux/selinux.h stdlib.h string.h sys/acl.h @@ -120,6 +112,7 @@ AC_CHECK_HEADERS(m4_flatten([ sys/utsname.h sys/xattr.h unistd.h + uuid/uuid.h ])) # Checks for typedefs, structures, and compiler characteristics. diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c index 079869b..58ac32c 100644 --- a/mkfs/f2fs_format.c +++ b/mkfs/f2fs_format.c @@ -20,7 +20,7 @@ #include #endif #include -#include +#include #include "f2fs_fs.h" #include "quota.h" diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c index 0c35fd3..7b2f695 100644 --- a/mkfs/f2fs_format_main.c +++ b/mkfs/f2fs_format_main.c @@ -21,13 +21,13 @@ #include #endif #include -#include +#include #include #include #include "config.h" #ifdef HAVE_LIBBLKID -#include +#include #endif #include "f2fs_fs.h" diff --git a/tools/f2fscrypt.c b/tools/f2fscrypt.c index d5bc3c5..fe3e0ff 100644 --- a/tools/f2fscrypt.c +++ b/tools/f2fscrypt.c @@ -43,7 +43,7 @@ #ifdef __KERNEL__ #include #endif -#include +#include #if !defined(HAVE_ADD_KEY) || !defined(HAVE_KEYCTL) #include