I am new to autoconf so I would ask you how could I check if a struct member is declared with a particular type.
For example I should check if struct posix_acl.a_refcount is declared as refcount_t and not atomic_t.
I know AC functions as ac_fn_c_check_decl and ac_fn_c_check_member, but none that accomplish this task.
Thank you!
Disclaimer: As there are no other answers at the time this answer is being written, this represents my best attempt to provide a solution, but you may need to adjust things to make it work for you. Caveat emptor.
You would need to use the
AC_COMPILE_IFELSEmacro with code that usesatomic_t, and if the compilation succeeds, then you're usingatomic_t. As future-proofing, you might also add a test forrefcount_tif theatomic_ttest fails.Example:
The tests assume that you already have a variable containing the kernel source directory, and the kernel source's
includedirectory is specified inCPPFLAGSorCFLAGSprior to attempting the tests. You can add more tests at the position indicated, and if the resultingposix_acl_refcount_typeshell variable is still not defined after all those tests, then the finalAS_VAR_SET_IFinvocation will invokeAC_MSG_FAILUREto stopconfigurewith the specified error message.Note that I used
<uapi/../linux/posix_acl.h>to specifically target the kernel'slinux/posix_acl.hheader rather than the userspace APIuapi/linux/posix_acl.hheader installed in a system's include directory with theuapi/stripped off, which may result in the compile tests above failing due to the missingstruct posix_aclin the userspace API. This may not work the way I'd expect and may need modification.