Added macro for iSER on RHEL7.6
[compat-rdma/compat.git] / config / rdma.m4
index 929256b..2b77c3c 100644 (file)
@@ -1,141 +1,3 @@
-dnl Checks for the in-box ib_core
-AC_DEFUN([RDMA_CONFIG_COMPAT],
-[
-       AC_MSG_CHECKING([if ib_verbs has ib_dma_map_single])
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/version.h>
-               #include <linux/pci.h>
-               #include <linux/gfp.h>
-               #include <rdma/ib_verbs.h>
-       ],[
-               ib_dma_map_single(NULL, NULL, 0, 0);
-               return 0;
-       ],[
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_INBOX_IB_DMA_MAP, 1,
-                         [ib_dma_map_single defined])
-       ],[
-               AC_MSG_RESULT(no)
-       ])
-
-       AC_MSG_CHECKING([if ib_create_cq wants comp_vector])
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/version.h>
-               #include <linux/pci.h>
-               #include <linux/gfp.h>
-               #include <rdma/ib_verbs.h>
-       ],[
-               ib_create_cq(NULL, NULL, NULL, NULL, 0, 0);
-               return 0;
-       ],[
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_INBOX_IB_COMP_VECTOR, 1,
-                         [has completion vector])
-       ],[
-               AC_MSG_RESULT(no)
-       ])
-
-       AC_MSG_CHECKING([if rdma_cm has RDMA_CM_EVENT_ADDR_CHANGE])
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/version.h>
-               #include <linux/pci.h>
-               #include <linux/gfp.h>
-               #include <rdma/rdma_cm.h>
-       ],[
-               return (RDMA_CM_EVENT_ADDR_CHANGE == 0);
-       ],[
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_INBOX_RDMA_CMEV_ADDRCHANGE, 1,
-                         [has completion vector])
-       ],[
-               AC_MSG_RESULT(no)
-       ])
-
-       AC_MSG_CHECKING([if rdma_cm has RDMA_CM_EVENT_TIMEWAIT_EXIT])
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/version.h>
-               #include <linux/pci.h>
-               #include <linux/gfp.h>
-               #include <rdma/rdma_cm.h>
-       ],[
-               return (RDMA_CM_EVENT_TIMEWAIT_EXIT == 0);
-       ],[
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_INBOX_RDMA_CMEV_TIMEWAIT_EXIT, 1,
-                         [has completion vector])
-       ],[
-               AC_MSG_RESULT(no)
-       ])
-
-       AC_MSG_CHECKING([if rdma_cm has rdma_set_reuseaddr])
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/version.h>
-               #include <linux/pci.h>
-               #include <linux/gfp.h>
-               #include <rdma/rdma_cm.h>
-       ],[
-               rdma_set_reuseaddr(NULL, 1);
-               return 0;
-       ],[
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_INBOX_RDMA_SET_REUSEADDR, 1,
-                         [rdma_set_reuse defined])
-       ],[
-               AC_MSG_RESULT(no)
-       ])
-
-       AC_MSG_CHECKING([if struct ib_wc has member named ts])
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/version.h>
-               #include <rdma/ib_verbs.h>
-       ],[
-        struct ib_wc wc;
-        wc->ts.timestamp = 0;
-
-               return 0;
-       ],[
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_INBOX_IB_WC_TS, 1,
-                         [ib_wc has member named ts])
-       ],[
-               AC_MSG_RESULT(no)
-       ])
-
-       AC_MSG_CHECKING([if struct ib_ah_attr has member named dmac])
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/version.h>
-               #include <rdma/ib_verbs.h>
-       ],[
-        struct ib_ah_attr *ah_attr;
-        memset(ah_attr->dmac, 0, 6);
-
-               return 0;
-       ],[
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_INBOX_IB_AH_ATTR_DMAC, 1,
-                         [ah_attr has member named dmac])
-       ],[
-               AC_MSG_RESULT(no)
-       ])
-
-       AC_MSG_CHECKING([if struct ib_ah_attr has member named vlan_id])
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/version.h>
-               #include <rdma/ib_verbs.h>
-       ],[
-        struct ib_ah_attr *ah_attr;
-        ah_attr->vlan_id = 0;
-
-               return 0;
-       ],[
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_INBOX_IB_AH_ATTR_VLAN_ID, 1,
-                         [ah_attr has member named vlan_id])
-       ],[
-               AC_MSG_RESULT(no)
-       ])
-])
-
 dnl Examine kernel functionality
 AC_DEFUN([LINUX_CONFIG_COMPAT],
 [
@@ -203,6 +65,22 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
                AC_MSG_RESULT(no)
        ])
 
+       AC_MSG_CHECKING([if kernel has ktime_get_boottime_ns])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/ktime.h>
+       ],[
+               unsigned long long ns;
+
+               ns = ktime_get_boottime_ns();
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_KTIME_GET_BOOTTIME_NS, 1,
+                         [ktime_get_boottime_ns defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
        AC_MSG_CHECKING([if timekeeping.h has ktime_get_real_ns])
        LB_LINUX_TRY_COMPILE([
                #include <linux/ktime.h>
@@ -414,6 +292,24 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
                AC_MSG_RESULT(no)
        ])
 
+       AC_MSG_CHECKING([if struct ethtool_ops has get/set_fec_param])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/ethtool.h>
+       ],[
+               const struct ethtool_ops en_ethtool_ops = {
+                       .get_fec_param = NULL,
+                       .set_fec_param = NULL,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_GET_SET_FEC, 1,
+                         [get/set_fec_param is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
        AC_MSG_CHECKING([if struct net_device has dev_port])
        LB_LINUX_TRY_COMPILE([
                #include <linux/netdevice.h>
@@ -2499,6 +2395,22 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
        ],[
                AC_MSG_RESULT(no)
        ])
+       
+       AC_MSG_CHECKING([if linux/dma-mapping.h has dma_map_page_attrs])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/dma-mapping.h>
+       ],[
+               dma_addr_t addr;
+               addr = dma_map_page_attrs(NULL, NULL, 0, 0, 0, 0);
+               return addr;
+
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_DMA_MAP_PAGE_ATTRS, 1,
+                         [dma_map_page_attrs is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
 
        AC_MSG_CHECKING([if pci.h has pcie_get_minimum_link])
        LB_LINUX_TRY_COMPILE([
@@ -3644,6 +3556,21 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
                AC_MSG_RESULT(no)
        ])
 
+       AC_MSG_CHECKING([if ethtool.h enum ethtool_link_mode_bit_indices has ETHTOOL_LINK_MODE_10000baseSR_Full_BIT])
+       LB_LINUX_TRY_COMPILE([
+               #include <uapi/linux/ethtool.h>
+       ],[
+               enum ethtool_link_mode_bit_indices x = ETHTOOL_LINK_MODE_10000baseSR_Full_BIT;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_ETHTOOL_LINK_MODE_10000baseSR_Full_BIT, 1,
+                         [ETHTOOL_LINK_MODE_10000baseSR_Full_BIT is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
        AC_MSG_CHECKING([if include/net/flow_dissector.h exists])
        LB_LINUX_TRY_COMPILE([
                #include <net/flow_dissector.h>
@@ -3877,6 +3804,22 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
                AC_MSG_RESULT(no)
        ])
 
+       AC_MSG_CHECKING([if struct tc_cls_common_offload exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/pkt_cls.h>
+       ],[
+               struct tc_cls_common_offload common;
+               common = common;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_TC_CLS_COMMON_OFFLOAD, 1,
+                         [tc_cls_common_offload is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
        AC_MSG_CHECKING([if if_vlan.h has vlan_features_check])
        LB_LINUX_TRY_COMPILE([
                #include <linux/if_vlan.h>
@@ -4015,6 +3958,23 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
                AC_MSG_RESULT(no)
        ])
 
+       AC_MSG_CHECKING([if scsi_host.h struct Scsi_Host has member virt_boundary_mask])
+       LB_LINUX_TRY_COMPILE([
+               #include <scsi/scsi_host.h>
+       ],[
+               struct Scsi_Host sh = {
+                       .virt_boundary_mask = 0,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_SCSI_HOST_VIRT_BOUNDARY_MASK, 1,
+                               [Scsi_Host has members virt_boundary_mask])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
        AC_MSG_CHECKING([if scsi_host.h struct scsi_host_template has member track_queue_depth])
        LB_LINUX_TRY_COMPILE([
                #include <scsi/scsi_host.h>
@@ -6460,6 +6420,21 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
                AC_MSG_RESULT(no)
        ])
 
+       AC_MSG_CHECKING([if linux/security.h has register_blocking_lsm_notifier])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/security.h>
+       ],[
+               register_blocking_lsm_notifier(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_REGISTER_BLOCKING_LSM_NOTIFIER, 1,
+                         [linux/security.h has register_blocking_lsm_notifier])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
        AC_MSG_CHECKING([if refcount.h exists])
        LB_LINUX_TRY_COMPILE([
                #include <linux/refcount.h>
@@ -6719,6 +6694,21 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
                AC_MSG_RESULT(no)
        ])
 
+       AC_MSG_CHECKING([if skbuff.h has skb_put_data])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/skbuff.h>
+       ],[
+               skb_put_data(NULL, NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_SKB_PUT_DATA, 1,
+                         [skb_put_data is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
        AC_MSG_CHECKING([if flow_dissector.h enum flow_dissector_key_keyid has FLOW_DISSECTOR_KEY_TCP])
        LB_LINUX_TRY_COMPILE([
                #include <net/flow_dissector.h>
@@ -6963,6 +6953,2713 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
        ],[
                AC_MSG_RESULT(no)
        ])
+
+       AC_MSG_CHECKING([if libiscsi.h has iscsi_eh_cmd_timed_out])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+               #include <scsi/libiscsi.h>
+       ],[
+               iscsi_eh_cmd_timed_out(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_ISCSI_EH_CMD_TIMED_OUT, 1,
+                       [iscsi_eh_cmd_timed_out is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+       AC_MSG_CHECKING([if struct bio has member bi_disk])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk_types.h>
+       ],[
+               struct bio b = {
+                       .bi_disk = NULL,
+               };
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BIO_BI_DISK, 1,
+                       [struct bio has member bi_disk])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if bio.h struct bio_integrity_payload has member bip_iter])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/bio.h>
+               #include <linux/bvec.h>
+       ],[
+               struct bvec_iter bip_it = {0};
+               struct bio_integrity_payload bip = {
+                       .bip_iter = bip_it,
+               };
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BIO_INTEGRITY_PYLD_BIP_ITER, 1,
+                       [bio_integrity_payload has members bip_iter])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blkdev.h blk_add_request_payload has 4 parameters])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               blk_add_request_payload(NULL, NULL, 0, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_ADD_REQUEST_PAYLOAD_HAS_4_PARAMS, 1,
+                       [blkdev.h blk_add_request_payload has 4 parameters])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blkdev.h has REQ_TYPE_DRV_PRIV])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               enum rq_cmd_type_bits rctb = REQ_TYPE_DRV_PRIV;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLKDEV_REQ_TYPE_DRV_PRIV, 1,
+                       [REQ_TYPE_DRV_PRIV is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h has blk_freeze_queue_start])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+       ],[
+               blk_freeze_queue_start(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_FREEZE_QUEUE_START, 1,
+                         [blk_freeze_queue_start is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blkdev.h has BLK_INTEGRITY_DEVICE_CAPABLE])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               enum  blk_integrity_flags bif = BLK_INTEGRITY_DEVICE_CAPABLE;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_INTEGRITY_DEVICE_CAPABLE, 1,
+                       [BLK_INTEGRITY_DEVICE_CAPABLE is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blkdev.h has BLK_MAX_WRITE_HINTS])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               int x = BLK_MAX_WRITE_HINTS;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MAX_WRITE_HINTS, 1,
+                       [BLK_MAX_WRITE_HINTS is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h blk_mq_alloc_request has 3 parameters])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+       ],[
+               blk_mq_alloc_request(NULL, 0, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_ALLOC_REQUEST_HAS_3_PARAMS, 1,
+                         [linux/blk-mq.h blk_mq_alloc_request has 3 parameters])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h blk_mq_complete_request has 2 parameters])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+       ],[
+               blk_mq_complete_request(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_COMPLETE_REQUEST_HAS_2_PARAMS, 1,
+                         [linux/blk-mq.h blk_mq_complete_request has 2 parameters])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blk_mq_end_request accepts blk_status_t as second parameter])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+               #include <linux/blk_types.h>
+       ],[
+               blk_status_t error = BLK_STS_OK;
+
+               blk_mq_end_request(NULL, error);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_END_REQUEST_TAKES_BLK_STATUS_T, 1,
+                         [blk_mq_end_request accepts blk_status_t as second parameter])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+
+       AC_MSG_CHECKING([if blkdev.h has blk_mq_quiesce_queue])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+               #include <linux/blk-mq.h>
+       ],[
+               blk_mq_quiesce_queue(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_QUIESCE_QUEUE, 1,
+                               [blk_mq_quiesce_queue exist])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h blk_mq_reinit_tagset takes 2 params])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+       ],[
+               blk_mq_reinit_tagset(NULL, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_REINIT_TAGSET_2_PARAM, 1,
+                         [blk_mq_reinit_tagset takes 2 params])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blk-mq.h blk_mq_requeue_request has 2 parameters])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+       ],[
+               blk_mq_requeue_request(NULL, false);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_REQUEUE_REQUEST_2_PARAMS, 1,
+                         [blk-mq.h blk_mq_requeue_request has 2 parameters])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h has blk_mq_tagset_iter])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+       ],[
+               blk_mq_tagset_iter(NULL, NULL, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_TAGSET_ITER, 1,
+                         [blk_mq_tagset_iter is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h has blk_mq_unquiesce_queue])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+       ],[
+               blk_mq_unquiesce_queue(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_UNQUIESCE_QUEUE, 1,
+                         [blk_mq_unquiesce_queue is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blkdev.h has blk_queue_max_write_zeroes_sectors])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               blk_queue_max_write_zeroes_sectors(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_QUEUE_MAX_WRITE_ZEROES_SECTORS, 1,
+                         [blk_queue_max_write_zeroes_sectors is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blkdev.h has blk_rq_nr_discard_segments])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               blk_rq_nr_discard_segments(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_RQ_NR_DISCARD_SEGMENTS, 1,
+                       [blk_rq_nr_discard_segments is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk_types.h has REQ_INTEGRITY])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk_types.h>
+       ],[
+               int x = REQ_INTEGRITY;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_TYPES_REQ_INTEGRITY, 1,
+                       [REQ_INTEGRITY is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk_types.h has REQ_OP_DISCARD])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk_types.h>
+       ],[
+               int x = REQ_OP_DISCARD;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_TYPES_REQ_OP_DISCARD, 1,
+                       [REQ_OP_DISCARD is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk_types.h has REQ_OP_DRV_OUT])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk_types.h>
+       ],[
+               enum req_opf xx = REQ_OP_DRV_OUT;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_TYPES_REQ_OP_DRV_OUT, 1,
+                         [REQ_OP_DRV_OUT is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk_types.h has REQ_OP_FLUSH])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk_types.h>
+       ],[
+               int x = REQ_OP_FLUSH;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_TYPES_REQ_OP_FLUSH, 1,
+                       [REQ_OP_FLUSH is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if cleanup_srcu_struct_quiesced exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/srcu.h>
+       ],[
+               cleanup_srcu_struct_quiesced(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_CLEANUP_SRCU_STRUCT_QUIESCED, 1,
+                         [linux/srcu.h cleanup_srcu_struct_quiesced is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if genhd.h has device_add_disk])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/genhd.h>
+       ],[
+               device_add_disk(NULL, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_DEVICE_ADD_DISK, 1,
+                       [genhd.h has device_add_disk])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if device.h has device_remove_file_self])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/device.h>
+       ],[
+               device_remove_file_self(NULL, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_DEVICE_REMOVE_FILE_SELF, 1,
+                       [device.h has device_remove_file_self])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if pm.h struct dev_pm_info has member set_latency_tolerance])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pm.h>
+               #include <asm/device.h>
+               #include <linux/types.h>
+
+               static void nvme_set_latency_tolerance(struct device *dev, s32 val)
+               {
+                       return;
+               }
+       ],[
+               struct dev_pm_info dpinfo = {
+                       .set_latency_tolerance = nvme_set_latency_tolerance,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_DEV_PM_INFO_SET_LATENCY_TOLERANCE, 1,
+                       [set_latency_tolerance is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/lightnvm.h exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/lightnvm.h>
+       ],[
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_LIGHTNVM_H, 1,
+                       [linux/lightnvm.h exists])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if lightnvm.h struct nvm_dev has member dev])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/lightnvm.h>
+       ],[
+               struct device devx = {0};
+               struct nvm_dev d = {
+                       .dev = devx,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_LIGHTNVM_NVM_DEV, 1,
+                         [nvm_dev dev is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/sed-opal.h exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/sed-opal.h>
+       ],[
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_LINUX_SED_OPAL_H, 1,
+                       [linux/sed-opal.h exists])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if uapi/linux/lightnvm.h has struct nvm_user_vio])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/genhd.h>
+               #include <uapi/linux/lightnvm.h>
+       ],[
+               struct nvm_user_vio vio;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NVM_USER_VIO, 1,
+                         [struct nvm_user_vio is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/pr.h exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/fs.h>
+               #include <linux/pr.h>
+       ],[
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PR_H, 1,
+                       [linux/pr.h exists])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blkdev.h struct request has rq_flags])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               struct request rq = { .rq_flags = 0 };
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_REQUEST_RQ_FLAGS, 1,
+                       [blkdev.h struct request has rq_flags])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/t10-pi.h exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/t10-pi.h>
+       ],[
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_T10_PI_H, 1,
+                       [linux/t10-pi.h exists])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/uuid.h has uuid_is_null])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/uuid.h>
+       ],[
+               uuid_t uuid;
+               uuid_is_null(&uuid);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_UUID_IS_NULL, 1,
+                       [uuid_is_null is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h has blk_mq_all_tag_busy_iter])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+
+               static void
+               nvme_cancel_request(struct request *req, void *data, bool reserved) {
+                       return;
+               }
+       ],[
+               blk_mq_all_tag_busy_iter(NULL, nvme_cancel_request, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_ALL_TAG_BUSY_ITER, 1,
+                         [blk_mq_all_tag_busy_iter is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h has blk_mq_freeze_queue_wait_timeout])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+       ],[
+               blk_mq_freeze_queue_wait_timeout(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_FREEZE_QUEUE_WAIT_TIMEOUT, 1,
+                         [blk_mq_freeze_queue_wait_timeout is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h has blk_mq_freeze_queue_wait_timeout])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+       ],[
+               blk_mq_freeze_queue_wait_timeout(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_FREEZE_QUEUE_WAIT_TIMEOUT, 1,
+                         [blk_mq_freeze_queue_wait_timeout is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if struct blk_mq_ops has map_queues])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+       ],[
+               struct blk_mq_ops ops = {
+                       .map_queues = NULL,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_OPS_MAP_QUEUES, 1,
+                         [struct blk_mq_ops has map_queues])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if include/linux/blk-mq-pci.h exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq-pci.h>
+       ],[
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_PCI_H, 1,
+                         [include/linux/blk-mq-pci.h exists])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if include/linux/blk-mq-pci.h has blk_mq_pci_map_queues])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq-pci.h>
+       ],[
+               blk_mq_pci_map_queues(NULL, NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_PCI_MAP_QUEUES_3_ARGS, 1,
+                       [blk_mq_pci_map_queues is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk_types.h has blk_mq_req_flags_t])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk_types.h>
+       ],[
+               blk_mq_req_flags_t x = 0;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_REQ_FLAGS_T, 1,
+                         [blk_mq_req_flags_t is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h has blk_mq_tagset_busy_iter])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+
+               static void
+               nvme_cancel_request(struct request *req, void *data, bool reserved) {
+                       return;
+               }
+       ],[
+               blk_mq_tagset_busy_iter(NULL, nvme_cancel_request, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_TAGSET_BUSY_ITER, 1,
+                         [blk_mq_tagset_busy_iter is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk_types.h has blk_path_error])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/errno.h>
+               #include <linux/blkdev.h>
+               #include <linux/blk_types.h>
+       ],[
+               blk_path_error(0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_PATH_ERROR, 1,
+                         [blk_path_error is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blkdev.h has blk_queue_flag_set])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               blk_queue_flag_set(0, NULL);
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_QUEUE_FLAG_SET, 1,
+                               [blk_queue_flag_set is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blkdev.h has blk_queue_write_cache])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               blk_queue_write_cache(NULL, 0, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE, 1,
+                       [blkdev.h has blk_queue_write_cache])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blkdev.h has blk_rq_is_passthrough])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               blk_rq_is_passthrough(NULL);
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_RQ_IS_PASSTHROUGH, 1,
+                               [blk_rq_is_passthrough is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk_types.h has blk_status_t])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk_types.h>
+       ],[
+               blk_status_t xx;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_STATUS_T, 1,
+                       [blk_status_t is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blkdev.h has QUEUE_FLAG_WC_FUA])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               int x = QUEUE_FLAG_WC;
+               int y = QUEUE_FLAG_FUA;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_QUEUE_FLAG_WC_FUA, 1,
+                       [QUEUE_FLAG_WC_FUA is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if struct request_queue has q_usage_counter])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               struct percpu_ref counter = {0};
+               struct request_queue rq = {
+                       .q_usage_counter = counter,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_REQUEST_QUEUE_Q_USAGE_COUNTER, 1,
+                         [struct request_queue has q_usage_counter])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h has blk_mq_freeze_queue_wait_timeout])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+       ],[
+               blk_mq_freeze_queue_wait_timeout(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_FREEZE_QUEUE_WAIT_TIMEOUT, 1,
+                         [blk_mq_freeze_queue_wait_timeout is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h has blk_mq_freeze_queue_wait])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+       ],[
+               blk_mq_freeze_queue_wait(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_FREEZE_QUEUE_WAIT, 1,
+                         [blk_mq_freeze_queue_wait is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/io-64-nonatomic-lo-hi.h exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/io-64-nonatomic-lo-hi.h>
+       ],[
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_IO_64_NONATOMIC_LO_HI_H, 1,
+                       [linux/io-64-nonatomic-lo-hi.h exists])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if slab.h has kmalloc_array])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/slab.h>
+       ],[
+               kmalloc_array(0, 0, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_KMALLOC_ARRAY, 1,
+                         [kmalloc_array is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if slab.h has kmalloc_array_node])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/slab.h>
+       ],[
+               kmalloc_array_node(0, 0, 0, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_KMALLOC_ARRAY_NODE, 1,
+                         [kmalloc_array_node is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if include/linux/once.h exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/once.h>
+       ],[
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_ONCE_H, 1,
+                         [include/linux/once.h exists])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blk-mq.h has BLK_MQ_F_NO_SCHED])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+       ],[
+               int x = BLK_MQ_F_NO_SCHED;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_F_NO_SCHED, 1,
+                               [BLK_MQ_F_NO_SCHED is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h blk_mq_ops init_request has 4 parameters])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+
+               int init_request(struct blk_mq_tag_set *set, struct request * req,
+                                unsigned int i, unsigned int k) {
+                       return 0;
+               }
+       ],[
+               struct blk_mq_ops ops = {
+                       .init_request = init_request,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_OPS_INIT_REQUEST_HAS_4_PARAMS, 1,
+                         [linux/blk-mq.h blk_mq_ops init_request has 4 parameters])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blkdev.h has blk_mq_poll])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               blk_mq_poll(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_POLL, 1,
+                       [blk_mq_poll exist])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h blk_mq_tag_set member ops is const])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+               static const struct blk_mq_ops xmq = {0};
+
+       ],[
+               struct blk_mq_tag_set x = {
+                       .ops = &xmq,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_TAG_SET_HAS_CONST_POS, 1,
+                         [ blk_mq_tag_set member ops is const])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h has blk_mq_update_nr_hw_queues])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+       ],[
+               blk_mq_update_nr_hw_queues(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_UPDATE_NR_HW_QUEUES, 1,
+                         [blk_mq_update_nr_hw_queues is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blkdev.h has blk_rq_payload_bytes])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               blk_rq_payload_bytes(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_RQ_NR_PAYLOAD_BYTES, 1,
+                       [blk_rq_payload_bytes exist])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blkdev.h has blk_rq_nr_phys_segments])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               blk_rq_nr_phys_segments(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_RQ_NR_PHYS_SEGMENTS, 1,
+                       [blk_rq_nr_phys_segments exist])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if dma-mapping.h has DMA_ATTR_NO_WARN])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/dma-mapping.h>
+       ],[
+               int x = DMA_ATTR_NO_WARN;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_DMA_ATTR_NO_WARN, 1,
+                         [DMA_ATTR_NO_WARN is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if dma-mapping.h has dma_alloc_attrs takes unsigned long attrs])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/dma-mapping.h>
+       ],[
+               dma_alloc_attrs(NULL, 0, NULL, GFP_KERNEL, DMA_ATTR_NO_KERNEL_MAPPING);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_DMA_SET_ATTR_TAKES_UNSIGNED_LONG_ATTRS, 1,
+                         [dma_alloc_attrs takes unsigned long attrs])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if interrupt.h has irq_calc_affinity_vectors with 3 args])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/interrupt.h>
+       ],[
+               int x = irq_calc_affinity_vectors(0, 0, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_IRQ_CALC_AFFINITY_VECTORS_3_ARGS, 1,
+                         [irq_calc_affinity_vectors is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+       AC_MSG_CHECKING([if pci.h pci_bus_addr_t])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+       ],[
+               pci_bus_addr_t x = 0;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_BUS_ADDR_T, 1,
+                         [pci_bus_addr_t is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if pci.h struct pci_error_handlers has reset_done])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+
+               void reset_done(struct pci_dev *dev) {
+                       return;
+               }
+       ],[
+               struct pci_error_handlers x = {
+                       .reset_done = reset_done,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_ERROR_HANDLERS_RESET_DONE, 1,
+               [pci.h struct pci_error_handlers has reset_done])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if pci.h struct pci_error_handlers has reset_notify])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+
+               void reset(struct pci_dev *dev, bool prepare) {
+                       return;
+               }
+       ],[
+               struct pci_error_handlers x = {
+                       .reset_notify = reset,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_ERROR_HANDLERS_RESET_NOTIFY, 1,
+                         [pci.h struct pci_error_handlers has reset_notify])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if pci.h struct pci_error_handlers has reset_prepare])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+
+               void reset_prepare(struct pci_dev *dev) {
+                       return;
+               }
+       ],[
+               struct pci_error_handlers x = {
+                       .reset_prepare = reset_prepare,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_ERROR_HANDLERS_RESET_PREPARE, 1,
+                       [pci.h struct pci_error_handlers has reset_prepare])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/pci.h has pci_free_irq])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+       ],[
+               pci_free_irq(NULL, 0, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_FREE_IRQ, 1,
+                         [linux/pci.h has pci_free_irq])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blkdev.h has req_op])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               struct request *req;
+               req_op(req);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_REQ_OP, 1,
+                       [req_op exist])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h has blk_mq_alloc_request_hctx])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+       ],[
+               blk_mq_alloc_request_hctx(NULL, 0, 0, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_ALLOC_REQUEST_HCTX, 1,
+                         [linux/blk-mq.h has blk_mq_alloc_request_hctx])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h has blk_mq_map_queues])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+       ],[
+               blk_mq_map_queues(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_MAP_QUEUES, 1,
+                         [blk_mq_map_queues is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h blk_mq_ops exit_request has 3 parameters])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+
+               void exit_request(struct blk_mq_tag_set *set, struct request * req,
+                                 unsigned int i) {
+                       return;
+               }
+       ],[
+               struct blk_mq_ops ops = {
+                       .exit_request = exit_request,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_OPS_EXIT_REQUEST_HAS_3_PARAMS, 1,
+                         [linux/blk-mq.h blk_mq_ops exit_request has 3 parameters])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if scsi.h has SCSI_MAX_SG_SEGMENTS])
+       LB_LINUX_TRY_COMPILE([
+               #include <scsi/scsi.h>
+       ],[
+               int x = SCSI_MAX_SG_SEGMENTS;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_SCSI_MAX_SG_SEGMENTS, 1,
+                         [SCSI_MAX_SG_SEGMENTS is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/scatterlist.h sg_alloc_table_chained has 4 parameters])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/scatterlist.h>
+       ],[
+               gfp_t gfp_mask;
+               sg_alloc_table_chained(NULL, 0, gfp_mask, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_SG_ALLOC_TABLE_CHAINED_4_PARAMS, 1,
+                       [sg_alloc_table_chained has 4 parameters])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/blk-mq.h struct blk_mq_ops has field reinit_request])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk-mq.h>
+
+               static int
+               nvme_fc_reinit_request(void *data, struct request *rq)
+               {
+                       return 0;
+               }
+       ],[
+               static struct blk_mq_ops nvme_fc_mq_ops = {
+                       .reinit_request = nvme_fc_reinit_request,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_MQ_OPS_REINIT_REQUEST, 1,
+                       [struct blk_mq_ops has field reinit_request])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/nvme-fc-driver.h exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/scatterlist.h>
+               #include <uapi/scsi/fc/fc_fs.h>
+               #include <linux/nvme-fc-driver.h>
+       ],[
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_LINUX_NVME_FC_DRIVER_H, 1,
+                       [linux/nvme-fc-driver.h exists])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if pci.h has pci_irq_get_affinity])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+       ],[
+               pci_irq_get_affinity(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_IRQ_GET_AFFINITY, 1,
+                         [pci_irq_get_affinity is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       LB_CHECK_SYMBOL_EXPORT([elfcorehdr_addr],
+               [kernel/crash_dump.c],
+               [AC_DEFINE(HAVE_ELFCOREHDR_ADDR_EXPORTED, 1,
+                       [elfcorehdr_addr is exported by the kernel])],
+       [])
+
+       LB_CHECK_SYMBOL_EXPORT([fib_lookup],
+               [net/ipv4/fib_rules.c],
+               [AC_DEFINE(HAVE_FIB_LOOKUP_EXPORTED, 1,
+                       [fib_lookup is exported by the kernel])],
+       [])
+
+       AC_MSG_CHECKING([if pci.h has pci_irq_get_node])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+       ],[
+               pci_irq_get_node(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_IRQ_GET_NODE, 1,
+                         [pci_irq_get_node is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if pci.h has pci_num_vf])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+       ],[
+               struct pci_dev x;
+               pci_num_vf(&x);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_NUM_VF, 1,
+                         [pci_num_vf is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if pci.h pci_physfn])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+       ],[
+               struct pci_dev x;
+               pci_physfn(&x);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_PHYSFN, 1,
+                         [pci_physfn is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if pci.h has pci_release_mem_regions])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+       ],[
+               pci_release_mem_regions(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_RELEASE_MEM_REGIONS, 1,
+                       [pci_release_mem_regions is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if pci.h has pci_request_mem_regions])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+       ],[
+               pci_request_mem_regions(NULL, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_REQUEST_MEM_REGIONS, 1,
+                       [pci_request_mem_regions is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if pci.h pci_sriov_get_totalvfs])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+       ],[
+               int x = pci_sriov_get_totalvfs(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_SRIOV_GET_TOTALVFS, 1,
+                       [pci_sriov_get_totalvfs is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if pci.h has pci_vfs_assigned])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+       ],[
+               struct pci_dev pdev;
+               pci_vfs_assigned(&pdev);
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_VFS_ASSIGNED, 1,
+                         [pci_vfs_assigned is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if include/linux/sizes.h exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/sizes.h>
+       ],[
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_SIZES_H, 1,
+                         [include/linux/sizes.h exists])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/uuid.h has uuid_be_to_bin])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/uuid.h>
+       ],[
+               uuid_be_to_bin(NULL, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_UUID_BE_TO_BIN, 1,
+                       [uuid_be_to_bin is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/uuid.h has uuid_equal])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/uuid.h>
+       ],[
+               uuid_equal(NULL, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_UUID_EQUAL, 1,
+                       [uuid_equal is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/uuid.h has uuid_gen])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/uuid.h>
+       ],[
+               uuid_t id;
+               uuid_gen(&id);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_UUID_GEN, 1,
+                       [uuid_gen is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if pm_qos.h has DEV_PM_QOS_LATENCY_TOLERANCE])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pm_qos.h>
+       ],[
+               enum dev_pm_qos_req_type type = DEV_PM_QOS_LATENCY_TOLERANCE;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_DEV_PM_QOS_LATENCY_TOLERANCE, 1,
+                         [DEV_PM_QOS_LATENCY_TOLERANCE is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if pm_qos.h has DEV_PM_QOS_RESUME_LATENCY])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pm_qos.h>
+       ],[
+               enum dev_pm_qos_req_type type = DEV_PM_QOS_RESUME_LATENCY;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_DEV_PM_QOS_RESUME_LATENCY, 1,
+                         [DEV_PM_QOS_RESUME_LATENCY is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if pm_qos.h has PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pm_qos.h>
+       ],[
+               int x = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT, 1,
+                         [PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if route.h has ip4_dst_hoplimit])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/route.h>
+       ],[
+               ip4_dst_hoplimit(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_IP4_DST_HOPLIMIT, 1,
+               [ip4_dst_hoplimit is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/kref.h has kref_read])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/kref.h>
+       ],[
+               kref_read(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_KREF_READ, 1,
+                         [kref_read is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/pci.h has pcie_relaxed_ordering_enabled])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+       ],[
+               pcie_relaxed_ordering_enabled(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCIE_RELAXED_ORDERING_ENABLED, 1,
+                       [pcie_relaxed_ordering_enabled is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       LB_CHECK_SYMBOL_EXPORT([irq_to_desc],
+               [kernel/irq/irqdesc.c],
+               [AC_DEFINE(HAVE_IRQ_TO_DESC_EXPORTED, 1,
+                       [irq_to_desc is exported by the kernel])],
+       [])
+
+       LB_CHECK_SYMBOL_EXPORT([dev_pm_qos_update_user_latency_tolerance],
+               [drivers/base/power/qos.c],
+               [AC_DEFINE(HAVE_PM_QOS_UPDATE_USER_LATENCY_TOLERANCE_EXPORTED, 1,
+                       [dev_pm_qos_update_user_latency_tolerance is exported by the kernel])],
+       [])
+
+       AC_MSG_CHECKING([if linux/bio.h bio_endio has 1 parameter])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/bio.h>
+       ],[
+               bio_endio(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BIO_ENDIO_1_PARAM, 1,
+                       [linux/bio.h bio_endio has 1 parameter])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if bio.h bio_init has 3 parameters])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/bio.h>
+       ],[
+               bio_init(NULL, NULL, false);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BIO_INIT_3_PARAMS, 1,
+                         [bio.h bio_init has 3 parameters])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blkdev.h has __blkdev_issue_discard])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               __blkdev_issue_discard(NULL, 0, 0, 0, 0, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE___BLKDEV_ISSUE_DISCARD, 1,
+                       [__blkdev_issue_discard is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blkdev.h has __blkdev_issue_zeroout])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               __blkdev_issue_zeroout(NULL, 0, 0, 0, NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLKDEV_ISSUE_ZEROOUT, 1,
+                       [__blkdev_issue_zeroout exist])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blkdev.h has blk_poll])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blkdev.h>
+       ],[
+               blk_poll(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_BLK_POLL, 1,
+                       [blk_poll exist])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/inet.h has inet_addr_is_any])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/inet.h>
+       ],[
+               inet_addr_is_any(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_INET_ADDR_IS_ANY, 1,
+                       [inet_addr_is_any is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if string.h has memchr_inv])
+       LB_LINUX_TRY_COMPILE([
+       #include <linux/string.h>
+       ],[
+               memchr_inv(NULL, 0, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_MEMCHR_INV, 1,
+               [memchr_inv is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if string.h has memcpy_and_pad])
+       LB_LINUX_TRY_COMPILE([
+       #include <linux/string.h>
+       ],
+       [
+               memcpy_and_pad(NULL, 0, NULL, 0, ' ');
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_MEMCPY_AND_PAD, 1,
+               [memcpy_and_pad is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if string.h has memdup_user_nul])
+       LB_LINUX_TRY_COMPILE([
+       #include <linux/string.h>
+       ],[
+               memdup_user_nul(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_MEMDUP_USER_NUL, 1,
+               [memdup_user_nul is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if blk_types.h has REQ_IDLE])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk_types.h>
+       ],[
+               int flags = REQ_IDLE;
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_REQ_IDLE, 1,
+                       [blk_types.h has REQ_IDLE])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/scatterlist.h sg_alloc_table_chained has 3 parameters])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/scatterlist.h>
+       ],[
+               sg_alloc_table_chained(NULL, 0, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_SG_ALLOC_TABLE_CHAINED_3_PARAMS, 1,
+                       [sg_alloc_table_chained has 3 parameters])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/scatterlist.h has sgl_alloc])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/scatterlist.h>
+       ],[
+               sgl_alloc(0, 0, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_SGL_ALLOC, 1,
+                       [sgl_alloc is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/scatterlist.h has sgl_free])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/scatterlist.h>
+       ],[
+               sgl_free(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_SGL_FREE, 1,
+                       [sgl_free is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/scatterlist.h has sg_zero_buffer])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/scatterlist.h>
+       ],[
+               sg_zero_buffer(NULL, 0, 0, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_SG_ZERO_BUFFER, 1,
+                       [sg_zero_buffer is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if string.h has strnicmp])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/string.h>
+       ],[
+               char a[10] = "aaa";
+               char b[10] = "bbb";
+               strnicmp(a, b, sizeof(a));
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_STRNICMP, 1,
+                         [strnicmp is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if struct bio has member bi_error])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk_types.h>
+       ],[
+               struct bio b = {
+                       .bi_error = 0,
+               };
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_STRUCT_BIO_BI_ERROR, 1,
+                       [struct bio has member bi_error])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if struct bio has member bi_iter])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk_types.h>
+       ],[
+               struct bio b = {
+                       .bi_iter = 0,
+               };
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_STRUCT_BIO_BI_ITER, 1,
+                       [struct bio has member bi_iter])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if struct bio has member bi_opf])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/blk_types.h>
+       ],[
+               struct bio b = {
+                       .bi_opf = 0,
+               };
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_STRUCT_BIO_BI_OPF, 1,
+                       [struct bio has member bi_opf])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/bio.h submit_bio has 1 parameter])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/bio.h>
+               #include <linux/fs.h>
+       ],[
+               submit_bio(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_SUBMIT_BIO_1_PARAM, 1,
+                       [linux/bio.h submit_bio has 1 parameter])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+
+       AC_MSG_CHECKING([if moduleparam.h has kernel_param_ops])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/moduleparam.h>
+       ],[
+               static struct kernel_param_ops ops = {0};
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_MODULEPARAM_KERNEL_PARAM_OPS, 1,
+                       [moduleparam.h has kernel_param_ops])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+       AC_MSG_CHECKING([if struct mm_struct has member atomic_pinned_vm])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/mm_types.h>
+       ],[
+               struct mm_struct x;
+                atomic64_t y;
+               x.pinned_vm = y;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_ATOMIC_PINNED_VM, 1,
+                         [atomic_pinned_vm is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if net/ipv6_stubs.h exists])
+       LB_LINUX_TRY_COMPILE([
+                #include <net/ipv6_stubs.h>
+       ],[
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_IPV6_STUBS, 1,
+                         [net/ipv6_stubs.h exists])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if netlink.h has nla_parse_deprecated ])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/netlink.h>
+       ],[
+               nla_parse_deprecated(NULL, 0, NULL, 0, NULL, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NLA_PARSE_DEPRECATED, 1,
+                         [nla_parse_deprecated exist])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if xarray is defined])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/xarray.h>
+       ],[
+                struct xa_limit x;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_XARRAY, 1,
+                         [xa_array is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if netdevice.h alloc_netdev_mq has 4 params])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/netdevice.h>
+       ],[
+               alloc_netdev_mq(0, NULL, NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_ALLOC_NETDEV_MQ_4_PARAMS, 1,
+                         [alloc_netdev_mq has 4 params])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if netdevice.h alloc_netdev_mqs has 5 params])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/netdevice.h>
+       ],[
+               alloc_netdev_mqs(0, NULL, NULL, 0, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_ALLOC_NETDEV_MQS_5_PARAMS, 1,
+                         [alloc_netdev_mqs has 5 params])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/pci-p2pdma.h exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci-p2pdma.h>
+       ],[
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_P2PDMA_H, 1,
+                         [linux/pci-p2pdma.h exists])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if idr.h has ida_alloc])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/idr.h>
+       ],[
+               ida_alloc(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_IDA_ALLOC, 1,
+                         [ida_alloc is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/overflow.h exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/overflow.h>
+       ],[
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_LINUX_OVERFLOW_H, 1,
+                         [linux/overflow.h is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if route.h struct rtable has member rt_gw_family])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/route.h>
+       ],[
+               struct rtable x = {
+                       .rt_gw_family = 0,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_RT_GW_FAMILY, 1,
+                         [rt_gw_family is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if route.h struct rtable has member rt_uses_gateway])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/route.h>
+       ],[
+               struct rtable x = {
+                       .rt_uses_gateway = 0,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_RT_USES_GATEWAY, 1,
+                         [rt_uses_gateway is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       LB_CHECK_SYMBOL_EXPORT([devlink_params_publish],
+               [net/core/devlink.c],
+               [AC_DEFINE(HAVE_DEVLINK_PARAMS_PUBLISHED, 1,
+                       [devlink_params_publish is exported by the kernel])],
+       [])
+       LB_CHECK_SYMBOL_EXPORT([split_page],
+               [mm/page_alloc.c],
+               [AC_DEFINE(HAVE_SPLIT_PAGE_EXPORTED, 1,
+                       [split_page is exported by the kernel])],
+       [])
+
+       LB_CHECK_SYMBOL_EXPORT([ip6_dst_hoplimit],
+                [net/ipv6/output_core.c],
+                [AC_DEFINE(HAVE_IP6_DST_HOPLIMIT, 1,
+                        [ip6_dst_hoplimit is exported by the kernel])],
+        [])
+
+       LB_CHECK_SYMBOL_EXPORT([udp4_hwcsum],
+               [net/ipv4/udp.c],
+               [AC_DEFINE(HAVE_UDP4_HWCSUM, 1,
+                       [udp4_hwcsum is exported by the kernel])],
+       [])
+
+       LB_CHECK_SYMBOL_EXPORT([__ip_dev_find],
+               [net/ipv4/devinet.c],
+               [AC_DEFINE(HAVE___IP_DEV_FIND, 1,
+                       [HAVE___IP_DEV_FIND is exported by the kernel])],
+       [])
+       LB_CHECK_SYMBOL_EXPORT([inet_confirm_addr],
+               [net/ipv4/devinet.c],
+               [AC_DEFINE(HAVE_INET_CONFIRM_ADDR_EXPORTED, 1,
+                       [inet_confirm_addr is exported by the kernel])],
+       [])
+
+       AC_MSG_CHECKING([if tracepoint.h supports trace_event_raw_ib_mad_send_template])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/dma-mapping.h>
+               #include <linux/slab.h>
+               #include <linux/module.h>
+               #include <linux/security.h>
+               #include <linux/xarray.h>
+               #include <rdma/ib_cache.h>
+
+               #include "mad_priv.h"
+               #include "core_priv.h"
+               #include "mad_rmpp.h"
+               #include "smi.h"
+               #include "opa_smi.h"
+               #include "agent.h"
+
+               #include <trace/events/ib_mad.h>
+       ],[
+               #ifdef CONFIG_TRACEPOINTS
+               static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr,
+                                        struct ib_mad_qp_info *qp_info,
+                                        struct trace_event_raw_ib_mad_send_template *entry)
+               {
+                      u16 pkey;
+                      struct ib_device *dev = qp_info->port_priv->device;
+                      u8 pnum = qp_info->port_priv->port_num;
+                      struct ib_ud_wr *wr = &mad_send_wr->send_wr;
+                      struct rdma_ah_attr attr = {};
+
+                      rdma_query_ah(wr->ah, &attr);
+
+                      /* These are common */
+                      entry->sl = attr.sl;
+                      ib_query_pkey(dev, pnum, wr->pkey_index, &pkey);
+                      entry->pkey = pkey;
+                      entry->rqpn = wr->remote_qpn;
+                      entry->rqkey = wr->remote_qkey;
+                      entry->dlid = rdma_ah_get_dlid(&attr);
+               }
+               #endif
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_TRACE_EVENT_RAW_IB_MAD_SEND_TEMPLATE, 1,
+                         [trace_event_raw_ib_mad_send_template is supported])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if netlink.h struct netlink_skb_parms has portid])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/netlink.h>
+       ],[
+               struct netlink_skb_parms xx = {
+                       .portid = 0,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NETLINK_SKB_PARMS_PORTID, 1,
+                         [struct netlink_skb_parms has portid])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if netlink.h has nla_nest_start_noflag])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/netlink.h>
+       ],[
+               nla_nest_start_noflag(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NLA_NEST_START_NOFLAG, 1,
+                         [nla_nest_start_noflag exist])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if netlink.h has nlmsg_parse_deprecated ])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/netlink.h>
+       ],[
+               nlmsg_parse_deprecated(NULL, 0, NULL, 0, NULL, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NLMSG_PARSE_DEPRECATED, 1,
+                         [nlmsg_parse_deprecated exist])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if idr.h has ida_alloc_max])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/idr.h>
+       ],[
+               ida_alloc_max(NULL, 0, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_IDA_ALLOC_MAX, 1,
+                         [ida_alloc_max is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if netlink.h has nlmsg_validate_deprecated ])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/netlink.h>
+       ],[
+               nlmsg_validate_deprecated(NULL, 0, 0, NULL, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NLMSG_VALIDATE_DEPRECATED, 1,
+                         [nlmsg_validate_deprecated exist])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if fs.h has stream_open])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/fs.h>
+       ],[
+               stream_open(NULL, NULL);
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_STREAM_OPEN, 1,
+                       [fs.h has stream_open])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+
+       AC_MSG_CHECKING([if mm.h has mmget])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/sched/mm.h>
+       ],[
+               mmget(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_MMGET, 1,
+                       [mmget is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if mm.h has mmget_not_zero])
+       LB_LINUX_TRY_COMPILE([
+                #include <linux/sched/mm.h>
+       ],[
+               mmget_not_zero(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_MMGET_NOT_ZERO, 1,
+                       [mmget_not_zero is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if mm.h has mmget_still_valid])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/sched/mm.h>
+       ],[
+               mmget_still_valid(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_MMGET_STILL_VALID, 1,
+                       [mmget_still_valid is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if mm.h has mmgrab])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/sched/mm.h>
+       ],[
+               mmgrab(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_MMGRAB, 1,
+                       [mmgrab is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/sched.h exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/sched.h>
+       ],[
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_SCHED_H, 1,
+                         [linux/sched.h exists])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if sched/mm.h has mmget_not_zero])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/sched/mm.h>
+       ],[
+               mmget_not_zero(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_SCHED_MMGET_NOT_ZERO, 1,
+                       [mmget_not_zero is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if vm_fault_t exist in mm_types.h])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/mm_types.h>
+       ],[
+               vm_fault_t a;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_VM_FAULT_T, 1,
+                         [vm_fault_t is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if uaccess.h access_ok has 3 parameters])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/uaccess.h>
+       ],[
+               access_ok(0, NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_ACCESS_OK_HAS_3_PARAMS, 1,
+                         [access_okhas 3 parameters])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/atomic.h has __atomic_add_unless])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/highmem.h>
+       ],[
+               atomic_t x;
+               __atomic_add_unless(&x, 1, 1);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE___ATOMIC_ADD_UNLESS, 1,
+                         [__atomic_add_unless is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/atomic.h has atomic_fetch_add_unless])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/highmem.h>
+       ],[
+               atomic_t x;
+               atomic_fetch_add_unless(&x, 1, 1);
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_ATOMIC_FETCH_ADD_UNLESS, 1,
+                         [atomic_fetch_add_unless is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if linux/cgroup_rdma.h exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/cgroup_rdma.h>
+       ],[
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_CGROUP_RDMA_H, 1,
+                         [linux/cgroup_rdma exists])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if idr.h has ida_simple_get])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/idr.h>
+       ],[
+               ida_simple_get(NULL, 0, 0, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_IDA_SIMPLE_GET, 1,
+                         [ida_simple_get is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if idr.h has idr_for_each_entry])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/idr.h>
+       ],[
+                int id;
+               void * entry;
+               struct idr * tmp_idr;
+               idr_for_each_entry(tmp_idr, entry, id);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_IDR_FOR_EACH_ENTRY, 1,
+                         [idr_for_each_entry is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if pci.h has pci_irq_get_affinity])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+       ],[
+               pci_irq_get_affinity(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_IRQ_GET_AFFINITY, 1,
+                         [pci_irq_get_affinity is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       LB_CHECK_SYMBOL_EXPORT([elfcorehdr_addr],
+               [kernel/crash_dump.c],
+               [AC_DEFINE(HAVE_ELFCOREHDR_ADDR_EXPORTED, 1,
+                       [elfcorehdr_addr is exported by the kernel])],
+       [])
+
+       LB_CHECK_SYMBOL_EXPORT([fib_lookup],
+               [net/ipv4/fib_rules.c],
+               [AC_DEFINE(HAVE_FIB_LOOKUP_EXPORTED, 1,
+                       [fib_lookup is exported by the kernel])],
+       [])
+
+       LB_CHECK_SYMBOL_EXPORT([idr_get_next_ul],
+               [lib/idr.c],
+               [AC_DEFINE(HAVE_IDR_GET_NEXT_UL_EXPORTED, 1,
+                       [idr_get_next_ul is exported by the kernel])],
+       [])
+
+       LB_CHECK_SYMBOL_EXPORT([idr_get_next],
+               [lib/idr.c],
+               [AC_DEFINE(HAVE_IDR_GET_NEXT_EXPORTED, 1,
+                       [idr_get_next is exported by the kernel])],
+       [])
+
+       AC_MSG_CHECKING([if pci.h has pci_irq_get_affinity])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+       ],[
+               pci_irq_get_affinity(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_IRQ_GET_AFFINITY, 1,
+                         [pci_irq_get_affinity is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       LB_CHECK_SYMBOL_EXPORT([elfcorehdr_addr],
+               [kernel/crash_dump.c],
+               [AC_DEFINE(HAVE_ELFCOREHDR_ADDR_EXPORTED, 1,
+                       [elfcorehdr_addr is exported by the kernel])],
+       [])
+
+       LB_CHECK_SYMBOL_EXPORT([fib_lookup],
+               [net/ipv4/fib_rules.c],
+               [AC_DEFINE(HAVE_FIB_LOOKUP_EXPORTED, 1,
+                       [fib_lookup is exported by the kernel])],
+       [])
+
+       LB_CHECK_SYMBOL_EXPORT([idr_get_next_ul],
+               [lib/idr.c],
+               [AC_DEFINE(HAVE_IDR_GET_NEXT_UL_EXPORTED, 1,
+                       [idr_get_next_ul is exported by the kernel])],
+       [])
+
+       LB_CHECK_SYMBOL_EXPORT([idr_get_next],
+               [lib/idr.c],
+               [AC_DEFINE(HAVE_IDR_GET_NEXT_EXPORTED, 1,
+                       [idr_get_next is exported by the kernel])],
+       [])
+
+       AC_MSG_CHECKING([if idr.h has idr_preload_end])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/idr.h>
+       ],[
+               idr_preload_end();
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_IDR_PRELOAD_END, 1,
+                         [idr_preload_end is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if smp_load_acquire is defined])
+       LB_LINUX_TRY_COMPILE([
+               #include <asm-generic/barrier.h>
+       ],[
+               u32 x;
+               smp_load_acquire(&x);
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_SMP_LOAD_ACQUIRE, 1,
+                         [smp_load_acquire is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       LB_CHECK_SYMBOL_EXPORT([idr_preload],
+               [lib/radix-tree.c],
+               [AC_DEFINE(HAVE_IDR_PRELOAD_EXPORTED, 1,
+                       [idr_preload is exported by the kernel])],
+       [])
+
+       LB_CHECK_SYMBOL_EXPORT([radix_tree_iter_delete],
+               [lib/radix-tree.c],
+               [AC_DEFINE(HAVE_RADIX_TREE_ITER_DELETE_EXPORTED, 1,
+                       [radix_tree_iter_delete is exported by the kernel])],
+       [])
+       LB_CHECK_SYMBOL_EXPORT([kobj_ns_grab_current],
+               [lib/kobject.c],
+               [AC_DEFINE(HAVE_KOBJ_NS_GRAB_CURRENT_EXPORTED, 1,
+                       [kobj_ns_grab_current is exported by the kernel])],
+       [])
+
+       AC_MSG_CHECKING([if mm.h struct vm_operations_struct has .fault])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/mm.h>
+               static vm_fault_t rdma_umap_fault(struct vm_fault *vmf) {
+                       return NULL;
+               }
+
+       ],[
+               struct vm_operations_struct rdma_umap_ops = {
+                       .fault = rdma_umap_fault,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_VM_OPERATIONS_STRUCT_HAS_FAULT, 1,
+                         [vm_operations_struct has .fault])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if radix-tree.h has radix_tree_iter_lookup])
+       LB_LINUX_TRY_COMPILE([
+       #include <linux/radix-tree.h>
+       ],[
+               radix_tree_iter_lookup(NULL, NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_RADIX_TREE_ITER_LOOKUP, 1,
+               [radix_tree_iter_lookup is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if device.h struct class has member class_groups])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/device.h>
+               #include <linux/sysfs.h>
+       ],[
+               static struct attribute *umad_class_attrs[] = {
+                       NULL,
+               };
+               ATTRIBUTE_GROUPS(umad_class);
+
+               struct class x = {
+                       .class_groups = umad_class_groups,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_CLASS_GROUPS, 1,
+                         [class_groups is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if mm.h has want_init_on_alloc])
+       LB_LINUX_TRY_COMPILE([
+       #include <linux/mm.h>
+       ],[
+               gfp_t flags = __GFP_ZERO;
+               want_init_on_alloc(flags);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_WANT_INIT_ON_ALLOC, 1,
+               [want_init_on_alloc is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if mm.h has FOLL_LONGTERM])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/mm.h>
+       ],[
+               int x = FOLL_LONGTERM;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_FOLL_LONGTERM, 1,
+                       [FOLL_LONGTERM is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if get_user_pages has 7 params])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/mm.h>
+       ],[
+               unsigned long start;
+               unsigned long nr_pages;
+               unsigned int gup_flags;
+               struct page **page_list;
+               struct vm_area_struct **vmas;
+               int ret;
+
+               ret = get_user_pages(NULL, NULL, start, nr_pages, gup_flags,
+                                       page_list, vmas);
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_GET_USER_PAGES_7_PARAMS, 1,
+                       [get_user_pages has 7 params])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if radix-tree.h has radix_tree_iter_delete])
+       LB_LINUX_TRY_COMPILE([
+       #include <linux/radix-tree.h>
+       ],[
+               radix_tree_iter_delete(NULL, NULL, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_RADIX_TREE_ITER_DELETE, 1,
+               [radix_tree_iter_delete is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if mm.h has put_user_page])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/mm.h>
+       ],[
+               struct page *page;
+
+               put_user_page(page);
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PUT_USER_PAGE, 1,
+                       [put_user_page is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if netdevice.h dev_change_flags has 3 parameters])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/netdevice.h>
+       ],[
+               dev_change_flags(NULL, 0, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_DEV_CHANGE_FLAGS_HAS_3_PARAMS, 1,
+                         [dev_change_flags has 3 parameters])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if struct net_device has close_list])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/netdevice.h>
+       ],[
+               struct net_device *dev = NULL;
+               struct list_head xlist;
+
+               dev->close_list = xlist;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NET_DEVICE_HAS_CLOSE_LIST, 1,
+                         [net_device close_list is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if struct net_device has needs_free_netdev])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/netdevice.h>
+       ],[
+               struct net_device *dev = NULL;
+
+               dev->needs_free_netdev = true;
+               dev->priv_destructor = NULL;
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NET_DEVICE_NEEDS_FREE_NETDEV, 1,
+                         [net_device needs_free_netdev is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if mm.h has kvcalloc])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/mm.h>
+       ],[
+               kvcalloc(0, 0, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_KVCALLOC, 1,
+                       [kvcalloc is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
 ])
 #
 # COMPAT_CONFIG_HEADERS