Scenario 1: I'm trying to install IBM
GPFS
driver onto RHEL6 with a vanilla kernel 3.10 (actually, kernel-lt
from Elrepo). The GPL part won't compile due to:
- Too many/too few arguments passed to function
- struct x has no such member
- type mismatch
Their code compiles fine on stock RHEL/Suse kernels older or newer than mine, but fails here.
Scenario 2:
I'm trying to compile the opensource softiwarp
driver on RHEL6
with stock kernel, but it fails with same errors as in scenario 1. However, it compiles fine on a vanilla kernel.
This all is because their feature-check headers look like this:
#if LINUX_KERNEL_VERSION >= 2061300
#define FOO <newer variant>
#else
#define FOO <older variant>
#endif
But RHEL and Suse have many backports and bugfixes, so their 3.10.101
is not the same as vanilla 3.10.101
.
How to write code that will check features, not version number? In a user-space program I would use autoconf macros AC_CHECK_MEMBER
/AC_CHECK_FUNC