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. You should install the following packages.
- libuuid-devel or uuid-dev - libuuid-devel or uuid-dev
- pkg-config
- autoconf - autoconf
- libtool - libtool
- libselinux1-dev - libselinux1-dev

View File

@ -53,6 +53,12 @@ AC_PATH_PROG([LDCONFIG], [ldconfig],
[$PATH:/sbin]) [$PATH:/sbin])
# Checks for libraries. # 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_CHECK_LIB([lzo2], [main],
[AC_SUBST([liblzo2_LIBS], ["-llzo2"]) [AC_SUBST([liblzo2_LIBS], ["-llzo2"])
AC_DEFINE([HAVE_LIBLZO2], [1], AC_DEFINE([HAVE_LIBLZO2], [1],
@ -65,37 +71,22 @@ AC_CHECK_LIB([lz4], [main],
[Define if you have liblz4]) [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"], AC_CHECK_LIB([uuid], [uuid_clear],
[PKG_CHECK_MODULES([libselinux], [libselinux], [AC_SUBST([libuuid_LIBS], ["-luuid"])
[have_selinux=yes], [have_selinux=no])], AC_DEFINE([HAVE_LIBUUID], [1],
[have_selinux=no] [Define if you have libuuid])
) ], [], [])
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])]
)]
)
# Checks for header files. # Checks for header files.
AC_CHECK_HEADERS(m4_flatten([ AC_CHECK_HEADERS(m4_flatten([
attr/xattr.h attr/xattr.h
blkid/blkid.h
byteswap.h byteswap.h
fcntl.h fcntl.h
linux/blkzoned.h linux/blkzoned.h
@ -110,6 +101,7 @@ AC_CHECK_HEADERS(m4_flatten([
mach/mach_time.h mach/mach_time.h
mntent.h mntent.h
scsi/sg.h scsi/sg.h
selinux/selinux.h
stdlib.h stdlib.h
string.h string.h
sys/acl.h sys/acl.h
@ -120,6 +112,7 @@ AC_CHECK_HEADERS(m4_flatten([
sys/utsname.h sys/utsname.h
sys/xattr.h sys/xattr.h
unistd.h unistd.h
uuid/uuid.h
])) ]))
# Checks for typedefs, structures, and compiler characteristics. # Checks for typedefs, structures, and compiler characteristics.

View File

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

View File

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

View File

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