From 55355fa5bb062aeb705e808642bf953d9de9b3ba Mon Sep 17 00:00:00 2001 From: Jan Blunck Date: Wed, 10 Jun 2009 20:07:15 +0200 Subject: [PATCH] Make buildsystem use pkg-config to search for kcompat and liburcu Signed-off-by: Jan Blunck --- configure.ac | 64 +++++++++++++++++---------------------- hello/Makefile.am | 10 +++--- libmallocwrap/Makefile.am | 8 ++--- libust/Makefile.am | 10 +++--- make_scripts/dummy | 1 - ust/Makefile.am | 4 +-- ustd/Makefile.am | 9 ++---- 7 files changed, 44 insertions(+), 62 deletions(-) delete mode 100644 make_scripts/dummy diff --git a/configure.ac b/configure.ac index 213e4a0..6f18d7a 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,8 @@ #AC_PREREQ([2.63]) AC_INIT([ust], [0.0], [pierre-marc dot fournier at polymtl dot ca]) -AC_CONFIG_AUX_DIR(make_scripts) +AC_CONFIG_AUX_DIR([config]) +AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([0.0 foreign]) AC_CONFIG_SRCDIR([ust/localerr.h]) AC_CONFIG_HEADERS([config.h]) @@ -49,46 +50,37 @@ AC_C_INLINE AC_FUNC_MALLOC AC_CHECK_FUNCS([gettimeofday munmap socket strerror strtol]) -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]) - ]) +AC_ARG_WITH(kcompat, [ --with-kcompat path Path to userspace kcompat source +], [ + AC_CHECK_FILE("$KCOMPAT_PATH/kcompat.h", [ + KCOMPAT_CFLAGS="-I$withval" + KCOMPAT_LIBS= + ], AC_MSG_ERROR([Cannot find kcompat.h in kcompat directory])) +], [ + PKG_CHECK_MODULES(KCOMPAT, [libkcompat], , [ + AC_MSG_ERROR([Must specify kcompat path.])]) ]) -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) +AC_SUBST(KCOMPAT_CFLAGS) +AC_SUBST(KCOMPAT_LIBS) -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" ], + 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.])]) ]) -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 -# libmarkers/Makefile -# libtracectl/Makefile -# libtracing/Makefile -# ust/Makefile -# ustd/Makefile]) +AC_SUBST(URCU_CFLAGS) +AC_SUBST(URCU_LIBS) -AC_CONFIG_FILES([Makefile libust/Makefile hello/Makefile libmallocwrap/Makefile ustd/Makefile ust/Makefile]) +AC_CONFIG_FILES([ + Makefile + libust/Makefile + hello/Makefile + libmallocwrap/Makefile + ustd/Makefile + ust/Makefile +]) AC_OUTPUT diff --git a/hello/Makefile.am b/hello/Makefile.am index 63e30b1..85b04b6 100644 --- a/hello/Makefile.am +++ b/hello/Makefile.am @@ -1,8 +1,6 @@ +INCLUDES = -I$(top_builddir)/share -I$(top_builddir)/libust \ + $(KCOMPAT_CFLAGS) $(URCU_CFLAGS) + noinst_PROGRAMS = hello hello_SOURCES = hello.c tp.c tp.h -hello_LDADD = $(top_builddir)/libust/libust.la @URCU_PATH@@URCU_LIB@ - -INCLUDES = -I$(top_builddir)/share -INCLUDES += -I@URCU_PATH@ -INCLUDES += -I@KCOMPAT_PATH@ -INCLUDES += -I$(top_builddir)/libust +hello_LDADD = $(top_builddir)/libust/libust.la $(URCU_LIBS) diff --git a/libmallocwrap/Makefile.am b/libmallocwrap/Makefile.am index 61e7e60..3d49dcb 100644 --- a/libmallocwrap/Makefile.am +++ b/libmallocwrap/Makefile.am @@ -1,9 +1,7 @@ +INCLUDES = -I$(top_builddir)/share -I$(top_builddir)/libust \ + $(KCOMPAT_CFLAGS) $(URCU_CFLAGS) + lib_LTLIBRARIES = libmallocwrap.la libmallocwrap_la_SOURCES = mallocwrap.c libmallocwrap_la_LIBADD = -ldl noinst_SCRIPTS = run - -INCLUDES = -I$(top_builddir)/share -INCLUDES += -I@URCU_PATH@ -INCLUDES += -I@KCOMPAT_PATH@ -INCLUDES += -I$(top_builddir)/libust diff --git a/libust/Makefile.am b/libust/Makefile.am index 60687a9..0faa8c0 100644 --- a/libust/Makefile.am +++ b/libust/Makefile.am @@ -1,9 +1,7 @@ +INCLUDES = -I$(top_builddir)/share -I$(top_builddir)/libustcomm \ + $(KCOMPAT_CFLAGS) $(URCU_CFLAGS) + 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_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 -INCLUDES += -I@URCU_PATH@ -INCLUDES += -I@KCOMPAT_PATH@ +libust_la_LIBADD = $(URCU_LIBS) -lpthread diff --git a/make_scripts/dummy b/make_scripts/dummy deleted file mode 100644 index 96f5cff..0000000 --- a/make_scripts/dummy +++ /dev/null @@ -1 +0,0 @@ -Dummy file so git adds this directory. diff --git a/ust/Makefile.am b/ust/Makefile.am index 9f5a94b..8f78cfd 100644 --- a/ust/Makefile.am +++ b/ust/Makefile.am @@ -2,7 +2,7 @@ bin_PROGRAMS = ust ust_SOURCES = ust.c $(top_builddir)/libustcomm/ustcomm.c $(top_builddir)/libustcomm/ustcomm.h #INCLUDES = -I$(top_builddir)/share -INCLUDES = -I@URCU_PATH@ -INCLUDES += -I@KCOMPAT_PATH@ +#INCLUDES += -I@URCU_PATH@ +INCLUDES = $(KCOMPAT_CFLAGS) #INCLUDES += -I$(top_builddir)/libust INCLUDES += -I$(top_builddir)/libustcomm diff --git a/ustd/Makefile.am b/ustd/Makefile.am index 723b9df..72f40a8 100644 --- a/ustd/Makefile.am +++ b/ustd/Makefile.am @@ -1,9 +1,6 @@ +INCLUDES = -I$(top_builddir)/share -I$(top_builddir)/libust \ + -I$(top_builddir)/libustcomm $(KCOMPAT_CFLAGS) + bin_PROGRAMS = ustd ustd_SOURCES = lowlevel.c localerr.h ustd.c ustd.h $(top_builddir)/libustcomm/ustcomm.c $(top_builddir)/libustcomm/ustcomm.h $(top_builddir)/share/kref.c ustd_LDFLAGS = -lpthread - -INCLUDES = -I$(top_builddir)/share -INCLUDES += -I@URCU_PATH@ -INCLUDES += -I@KCOMPAT_PATH@ -INCLUDES += -I$(top_builddir)/libust -INCLUDES += -I$(top_builddir)/libustcomm -- 2.34.1