summaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
authorKarel Zak2016-06-03 13:37:15 +0200
committerKarel Zak2016-06-03 13:37:15 +0200
commit2bd0b84f18c935e9d66be545049686ab7646cb9a (patch)
tree5747c66321c00eaf66b516e5191cfc994b8fb17e /m4
parentcfdisk: use libsmartcols ASCII for non-widechar environment (diff)
downloadkernel-qcow2-util-linux-2bd0b84f18c935e9d66be545049686ab7646cb9a.tar.gz
kernel-qcow2-util-linux-2bd0b84f18c935e9d66be545049686ab7646cb9a.tar.xz
kernel-qcow2-util-linux-2bd0b84f18c935e9d66be545049686ab7646cb9a.zip
build-sys: add UL_REQUIRES_COMPILE macro
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'm4')
-rw-r--r--m4/ul.m437
1 files changed, 37 insertions, 0 deletions
diff --git a/m4/ul.m4 b/m4/ul.m4
index dd932e31f..6c439511d 100644
--- a/m4/ul.m4
+++ b/m4/ul.m4
@@ -248,6 +248,43 @@ AC_DEFUN([UL_REQUIRES_HAVE], [
fi
])
+dnl UL_REQUIRES_HAVE(NAME, PROGRAM_PROLOGUE, PROGRAM_BODY, DESC, [VARSUFFIX=$1])
+dnl
+dnl Modifies $build_<name> variable according to $enable_<name> and
+dnl ability compile AC_LANG_PROGRAM(<program_prologue>, <program_body>).
+dnl
+dnl The <desc> is description used for warning/error dnl message (e.g. "foo support").
+dnl
+dnl The default <name> for $build_ and $enable_ could be overwrited by option $5.
+
+AC_DEFUN([UL_REQUIRES_COMPILE], [
+ m4_define([suffix], m4_default([$5],$1))
+
+ if test "x$[build_]suffix" != xno; then
+
+ AC_MSG_CHECKING([$4])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$2], [$3])],
+ [AC_MSG_RESULT([yes])
+ [ul_haveprogram_]suffix=yes],
+ [AC_MSG_RESULT([no])
+ [ul_haveprogram_]suffix=no])
+
+ case $[enable_]suffix:$[ul_haveprogram_]suffix in #(
+ no:*)
+ [build_]suffix=no ;;
+ yes:yes)
+ [build_]suffix=yes ;;
+ yes:*)
+ AC_MSG_ERROR([$1 selected, but required $4 not available]);;
+ check:yes)
+ [build_]suffix=yes ;;
+ check:*)
+ AC_MSG_WARN([$4 not found; not building $1])
+ [build_]suffix=no ;;
+ esac
+ fi
+])
+
dnl
dnl UL_CONFLICTS_BUILD(NAME, ANOTHER, ANOTHERDESC, [VARSUFFIX=$1])
dnl