From: Marc Dionne Date: Mon, 6 Jul 2015 15:00:10 +0000 (-0300) Subject: Linux: Add AC_CHECK_LINUX_OPERATION configure macro X-Git-Tag: openafs-stable-1_8_0pre1~308 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=c2c0b6bc86c6d67814d0f7fe14fa8eefc445b4a4 Linux: Add AC_CHECK_LINUX_OPERATION configure macro Add a new macro to check the signature of a particular operation against a provided typed argument list. One of the arguments is an arbitrary label that is used to construct the pre-processor define name. This will allow for testing of different forms for the same operation. This can be used to replace many of the remaining odd checks in src/cf/linux_test4.m4. Change-Id: Ic619ace54f81aa8e1eb744e2d11f541a303b9587 Reviewed-on: http://gerrit.openafs.org/11927 Tested-by: BuildBot Reviewed-by: Jeffrey Altman --- diff --git a/src/cf/linux-test1.m4 b/src/cf/linux-test1.m4 index 4e799e2..95e4af0 100644 --- a/src/cf/linux-test1.m4 +++ b/src/cf/linux-test1.m4 @@ -150,3 +150,18 @@ AC_DEFUN([AC_CHECK_LINUX_TYPED_STRUCT], [Define if kernel $1 has the $2 element]) ]) +dnl AC_CHECK_LINUX_OPERATION([structure], [operation], [label], [includes], [return_type], [args]) +AC_DEFUN([AC_CHECK_LINUX_OPERATION], + [AS_VAR_PUSHDEF([ac_linux_operation], [ac_cv_linux_operation_$1_$2_$3]) + AC_CACHE_CHECK([operation $2 in $1], [ac_linux_operation], + [save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -Werror" + AC_TRY_KBUILD([$4], [struct $1 ops; $5 op($6) { return ($5)0; }; ops.$2 = op;], + AS_VAR_SET([ac_linux_operation], [yes]), + AS_VAR_SET([ac_linux_operation], [no])) + CPPFLAGS="$save_CPPFLAGS" + ]) + AS_IF([test AS_VAR_GET([ac_linux_operation]) = yes], + [AC_DEFINE(AS_TR_CPP(HAVE_LINUX_$1_$2_$3), 1, + [Define if $1 has $2 operation of form $6])]) + ])