From 1312aedbe0a346999581b243324594e1abe2cebf Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 4 Dec 2019 18:11:47 +0100 Subject: ubihealthd: Build only if sys/random.h is present The ubihealthd depends on sys/random.h , which is not present on some older systems. Build ubihealthd only if sys/random.h is present. Signed-off-by: Marek Vasut Signed-off-by: David Oberhollenzer --- Makefile.am | 4 ++++ configure.ac | 14 ++++++++++++++ ubi-utils/Makemodule.am | 9 +++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index aacf589..4fdcd70 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,6 +22,10 @@ if WITH_CRYPTO AM_CPPFLAGS += -DWITH_CRYPTO endif +if WITH_GETRANDOM +AM_CPPFLAGS += -DWITH_GETRANDOM +endif + sbin_PROGRAMS = sbin_SCRIPTS = check_PROGRAMS = diff --git a/configure.ac b/configure.ac index 1b97ff6..f09a726 100644 --- a/configure.ac +++ b/configure.ac @@ -71,6 +71,7 @@ need_xattr="no" need_cmocka="no" need_selinux="no" need_openssl="no" +need_getrandom="no" AM_COND_IF([UNIT_TESTS], [ need_cmocka="yes" @@ -141,6 +142,7 @@ AM_COND_IF([BUILD_UBIFS], [ need_lzo="yes" need_zstd="yes" need_openssl="yes" + need_getrandom="yes" ]) AM_COND_IF([BUILD_JFFSX], [ @@ -204,6 +206,7 @@ xattr_missing="no" cmocka_missing="no" selinux_missing="no" openssl_missing="no" +getrandom_missing="no" if test "x$need_zlib" = "xyes"; then PKG_CHECK_MODULES(ZLIB, [zlib], [], [zlib_missing="yes"]) @@ -255,6 +258,10 @@ if test "x$need_openssl" = "xyes"; then PKG_CHECK_MODULES(OPENSSL, [openssl], [], [openssl_missing="yes"]) fi +if test "x$need_getrandom" = "xyes"; then + AC_CHECK_HEADERS([sys/random.h], [], [getrandom_missing="yes"]) +fi + if test "x$need_cmocka" = "xyes"; then PKG_CHECK_MODULES(CMOCKA, [cmocka], [], [cmocka_missing="yes"]) fi @@ -323,6 +330,12 @@ if test "x$openssl_missing" = "xyes"; then need_openssl="no" fi +if test "x$getrandom_missing" = "xyes"; then + AC_MSG_WARN([cannot find headers for getrandom() function]) + AC_MSG_WARN([disabling UBIFS ubihealthd support]) + need_getrandom="no" +fi + if test "x$cmocka_missing" = "xyes"; then AC_MSG_WARN([cannot find CMocka library required for unit tests]) AC_MSG_NOTICE([unit tests can optionally be disabled]) @@ -340,6 +353,7 @@ AM_CONDITIONAL([WITHOUT_ZSTD], [test "x$need_zstd" != "xyes"]) AM_CONDITIONAL([WITHOUT_XATTR], [test "x$need_xattr" != "xyes"]) AM_CONDITIONAL([WITH_SELINUX], [test "x$need_selinux" == "xyes"]) AM_CONDITIONAL([WITH_CRYPTO], [test "x$need_openssl" == "xyes"]) +AM_CONDITIONAL([WITH_GETRANDOM], [test "x$need_getrandom" == "xyes"]) AC_CHECK_SIZEOF([off_t]) AC_CHECK_SIZEOF([loff_t]) diff --git a/ubi-utils/Makemodule.am b/ubi-utils/Makemodule.am index 984e2cd..2835702 100644 --- a/ubi-utils/Makemodule.am +++ b/ubi-utils/Makemodule.am @@ -37,13 +37,18 @@ ubirsvol_LDADD = libmtd.a libubi.a ubiblock_SOURCES = ubi-utils/ubiblock.c ubiblock_LDADD = libmtd.a libubi.a +if WITH_GETRANDOM ubihealthd_SOURCES = ubi-utils/ubihealthd.c ubihealthd_LDADD = libmtd.a libubi.a +endif UBI_BINS = \ ubiupdatevol ubimkvol ubirmvol ubicrc32 ubinfo ubiattach \ - ubidetach ubinize ubiformat ubirename mtdinfo ubirsvol ubiblock \ - ubihealthd + ubidetach ubinize ubiformat ubirename mtdinfo ubirsvol ubiblock + +if WITH_GETRANDOM +UBI_BINS += ubihealthd +endif UBI_MAN = \ ubi-utils/ubinize.8 -- cgit v1.2.3