+AC_DEFUN([LN_CONFIG_GNILND], [
+AC_MSG_CHECKING([whether to enable GNI lnd])
+AC_ARG_ENABLE([gni],
+ AC_HELP_STRING([--enable-gni],
+ [enable GNI lnd]),
+ [], [enable_gni="no"])
+AC_MSG_RESULT([$enable_gni])
+
+AS_IF([test "x$enable_gni" = xyes], [
+ # GNICPPFLAGS was set in spec file
+ EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
+ EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
+ LB_CHECK_COMPILE([if GNI kernel headers are present],
+ GNI_header, [
+ #include <linux/types.h>
+ #include <gni_pub.h>
+ ],[
+ gni_cdm_handle_t kgni_domain;
+ gni_return_t rc;
+ int rrc;
+ rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
+ rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
+ return rrc;
+ ],[
+ GNILND="gnilnd"
+ ],[
+ AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
+ ])
+ # at this point, we have gnilnd basic support,
+ # now check for extra features
+ LB_CHECK_COMPILE([to use RCA in gnilnd],
+ RCA_gnilnd, [
+ #include <linux/types.h>
+ #include <gni_pub.h>
+ #include <krca_lib.h>
+ ],[
+ gni_cdm_handle_t kgni_domain;
+ gni_return_t rc;
+ krca_ticket_t ticket = KRCA_NULL_TICKET;
+ int rrc;
+ __u32 nid = 0, nic_addr;
+ rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
+ rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
+ rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
+ rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
+ return rrc;
+ ],[
+ GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
+ GNILNDRCA="gnilndrca"
+ ])
+ EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"