From afa28e0364b5132f3473ff08d9bca2026e723b41 Mon Sep 17 00:00:00 2001 From: Jan Blunck Date: Wed, 10 Jun 2009 20:07:14 +0200 Subject: [PATCH] Modify buildsystem to be able to compile with installed libraries --- configure.ac | 35 ++++++++++++++++++++++++++++++----- hello/Makefile.am | 2 +- libust/Makefile.am | 4 ++-- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index a7f9a73..213e4a0 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/hello/Makefile.am b/hello/Makefile.am index f682130..63e30b1 100644 --- a/hello/Makefile.am +++ b/hello/Makefile.am @@ -1,6 +1,6 @@ noinst_PROGRAMS = hello hello_SOURCES = hello.c tp.c tp.h -hello_LDADD = $(top_builddir)/libust/libust.la @URCU_PATH@/liburcu.so +hello_LDADD = $(top_builddir)/libust/libust.la @URCU_PATH@@URCU_LIB@ INCLUDES = -I$(top_builddir)/share INCLUDES += -I@URCU_PATH@ diff --git a/libust/Makefile.am b/libust/Makefile.am index d2a8187..60687a9 100644 --- a/libust/Makefile.am +++ b/libust/Makefile.am @@ -1,7 +1,7 @@ lib_LTLIBRARIES = libust.la libust_la_SOURCES = marker.c marker.h tracepoint.c tracepoint.h immediate.h channels.c channels.h marker-control.c marker-control.h relay.c relay.h tracer.c tracer.h tracercore.c tracercore.h serialize.c tracectl.c $(top_builddir)/libustcomm/ustcomm.c $(top_builddir)/share/kref.c $(top_builddir)/share/usterr.c -libust_la_LIBADD = @URCU_PATH@/liburcu.so -libust_la_LDFLAGS = -lpthread +libust_la_LDFLAGS = -no-undefined -version-info 0:0:0 +libust_la_LIBADD = @URCU_PATH@@URCU_LIB@ -lpthread INCLUDES = -I$(top_builddir)/share INCLUDES += -I$(top_builddir)/libustcomm -- 2.34.1