Modify buildsystem to be able to compile with installed libraries
[ust.git] / configure.ac
index a7f9a7398c7d18eb27d6d0dcb89c46f265b0b78b..213e4a0c5eeaa34d0825c98668e4186d7ee5dcd7 100644 (file)
@@ -49,13 +49,38 @@ AC_C_INLINE
 AC_FUNC_MALLOC
 AC_CHECK_FUNCS([gettimeofday munmap socket strerror strtol])
 
-AC_ARG_WITH(urcu, [  --with-urcu=path  Path to userspace RCU library source], URCU_PATH="$withval", AC_MSG_ERROR([Must specify liburcu path.]))
-AC_CHECK_FILE("$URCU_PATH/urcu.h", , AC_MSG_ERROR([Cannot find urcu.h in liburcu directory]))
-AC_ARG_WITH(kcompat, [  --with-kcompat=path    Path to libkcompat source], KCOMPAT_PATH="$withval", AC_MSG_ERROR([Must specify libkcompat path.]))
-AC_CHECK_FILE("$KCOMPAT_PATH/kcompat.h", , AC_MSG_ERROR([Cannot find kcompat.h in libkcompat directory]))
-AC_SUBST(URCU_PATH)
+KCOMPAT_PATH=
+AC_ARG_WITH(kcompat, [  --with-kcompat path    Path to userspace kcompat source], [
+       AC_CHECK_FILE(["$withval/kcompat.h"], KCOMPAT_PATH="$withval", [
+               AC_MSG_ERROR([Cannot find kcompat.h in kcompat directory])
+       ])
+])
+if test -n "${KCOMPAT_PATH}" ; then
+   CPPFLAGS="-I$KCOMPAT_PATH/ $CPPFLAGS"
+   AC_SUBST(CPPFLAGS)
+fi
+AC_CHECK_HEADER([kcompat.h], , AC_MSG_ERROR([Must specify kcompat path.]))
 AC_SUBST(KCOMPAT_PATH)
 
+URCU_LIB=
+AC_CHECK_HEADER([urcu.h], [
+       AC_CHECK_LIB(urcu, synchronize_rcu, [
+               URCU_PATH=
+               URCU_LIB="-lurcu"
+       ])
+])
+AC_ARG_WITH(urcu, [  --with-urcu path  Path to userspace RCU source], [
+       AC_CHECK_FILE(["$withval/urcu.h"], [
+               URCU_PATH="$withval"
+               URCU_LIB="/liburcu.la" ],
+               AC_MSG_ERROR([Cannot find urcu.h in urcu directory]))
+])
+if test -z "${URCU_LIB}" ; then
+   AC_MSG_ERROR([Must specify urcu path.])
+fi
+AC_SUBST(URCU_PATH)
+AC_SUBST(URCU_LIB)
+
 #AC_CONFIG_FILES([Makefile
 #                 hello/Makefile
 #                 libmallocwrap/Makefile
This page took 0.023156 seconds and 4 git commands to generate.