configure.ac: Enable cross-compilation

commit c48335416a09b881d2309b8f88c9b3d1441f4a9c
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Stop using PKG_CHECK_MODULES() since that macro is not compatible with
cross-compilation.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
This commit is contained in:
Bart Van Assche 2022-04-21 15:18:10 -07:00 committed by dongsenhao
parent d1669289cd
commit d29305ee15
5 changed files with 23 additions and 31 deletions

View File

@ -9,7 +9,6 @@ Before compilation
You should install the following packages.
- libuuid-devel or uuid-dev
- pkg-config
- autoconf
- libtool
- libselinux1-dev

View File

@ -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.

View File

@ -20,7 +20,7 @@
#include <sys/mount.h>
#endif
#include <time.h>
#include <uuid.h>
#include <uuid/uuid.h>
#include "f2fs_fs.h"
#include "quota.h"

View File

@ -21,13 +21,13 @@
#include <sys/mount.h>
#endif
#include <time.h>
#include <uuid.h>
#include <uuid/uuid.h>
#include <errno.h>
#include <getopt.h>
#include "config.h"
#ifdef HAVE_LIBBLKID
#include <blkid.h>
#include <blkid/blkid.h>
#endif
#include "f2fs_fs.h"

View File

@ -43,7 +43,7 @@
#ifdef __KERNEL__
#include <linux/fs.h>
#endif
#include <uuid.h>
#include <uuid/uuid.h>
#if !defined(HAVE_ADD_KEY) || !defined(HAVE_KEYCTL)
#include <sys/syscall.h>