-AC_ARG_WITH(urcu, [ --with-urcu path Path to userspace RCU source], URCU_PATH="$withval", AC_MSG_ERROR([Must specify urcu path.]))
-AC_ARG_WITH(kcompat, [ --with-kcompat path Path to userspace kcompat source], KCOMPAT_PATH="$withval", AC_MSG_ERROR([Must specify kcompat path.]))
-AC_SUBST(URCU_PATH)
-AC_SUBST(KCOMPAT_PATH)
+AC_ARG_WITH(urcu, [ --with-urcu path Path to userspace RCU source], [
+ AC_CHECK_FILE(["$withval/urcu.h"], [
+ URCU_CFLAGS="-I$withval"
+ URCU_LIBS="-L$withval -lurcu" ],
+ AC_MSG_ERROR([Cannot find urcu.h in urcu directory]))
+], [
+ PKG_CHECK_MODULES(URCU, [liburcu], , [
+ AC_MSG_ERROR([Must specify urcu path.])])
+])
+AC_SUBST(URCU_CFLAGS)
+AC_SUBST(URCU_LIBS)