[ltt-dev] [PATCH 2/4] lttv: Clean up library handling in the build system
Benjamin Poirier
benjamin.poirier at polymtl.ca
Fri Jul 31 17:08:00 EDT 2009
Take advantage of some more autoconf macros
Use LDADD instead of modifying LIBS through automake
Do not link each loadable module against lttvwindow ("Warning: Linking the
shared library [...] against the loadable module liblttvwindow.so is not
portable!")
Signed-off-by: Benjamin Poirier <benjamin.poirier at polymtl.ca>
---
configure.in | 18 ++++++++++--------
ltt/Makefile.am | 2 --
lttv/lttv/Makefile.am | 5 +----
lttv/lttv/lttv-gui.sh | 2 +-
lttv/modules/gui/common.am | 4 ----
lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am | 2 --
lttv/modules/gui/tracecontrol/Makefile.am | 2 +-
lttv/modules/text/Makefile.am | 2 --
runlttv | 12 +++++++++++-
9 files changed, 24 insertions(+), 25 deletions(-)
diff --git a/configure.in b/configure.in
index 89acdb3..926c014 100644
--- a/configure.in
+++ b/configure.in
@@ -42,12 +42,11 @@ AC_PROG_CC
AC_CHECK_LIB([popt], [poptGetNextOpt], POPT_LIBS="-lpopt",AC_MSG_ERROR([libpopt is required in order to compile LinuxTraceToolkit]) )
#AC_CHECK_LIB([m], [round], M_LIBS="-lm",AC_MSG_ERROR([Mathematical libraries are missing.]) )
-AC_CHECK_LIB([util], [forkpty], UTIL_LIBS="-lutil", AC_MSG_ERROR([libutil is
-required in order to compile LinuxTraceToolkit]))
+AC_CHECK_LIB([util], [forkpty], UTIL_LIBS="-lutil", AC_MSG_ERROR([libutil is required in order to compile LinuxTraceToolkit]))
# pthread for gdb with dlopen().
-AC_CHECK_LIB(pthread, pthread_join,[THREAD_LIBS="-lpthread"], AC_MSG_ERROR([LinuxThreads is required in order to make sure gdb works fine with lttv-gui]))
+AC_CHECK_LIB(pthread, pthread_join, [], AC_MSG_ERROR([LinuxThreads is required in order to make sure gdb works fine with lttv-gui]))
# Checks for header files.
AC_HEADER_STDC
@@ -59,9 +58,13 @@ AM_PROG_CC_STDC
AC_HEADER_STDC
pkg_modules="gtk+-2.0 >= 2.0.0"
-PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
+PKG_CHECK_MODULES(GTK, [$pkg_modules])
-PACKAGE_CFLAGS="$PACKAGE_CFLAGS -Wall -Wformat"
+pkg_modules="gobject-2.0 >= 2.0.0"
+PKG_CHECK_MODULES(GOBJECT, [$pkg_modules])
+
+LIBS="$LIBS $GTK_LIBS $GOBJECT_LIBS"
+PACKAGE_CFLAGS="$GTK_CFLAGS $GOBJECT_CFLAGS -Wall -Wformat"
MODULE_CFLAGS="$PACKAGE_CFLAGS -fvisibility=hidden"
MODULE_LDFLAGS="-module -avoid-version"
AC_SUBST([PACKAGE_CFLAGS])
@@ -98,9 +101,8 @@ lttvincludedir="${includedir}/lttv"
lttvwindowincludedir="${includedir}/lttvwindow"
lttctlincludedir="${includedir}/liblttctl"
-AC_SUBST(POPT_LIBS)
-AC_SUBST(UTIL_LIBS)
-AC_SUBST(THREAD_LIBS)
+AC_SUBST([POPT_LIBS])
+AC_SUBST([UTIL_LIBS])
AC_SUBST(lttvlibdir)
AC_SUBST(lttvplugindir)
#AC_SUBST(lttlibdir)
diff --git a/ltt/Makefile.am b/ltt/Makefile.am
index aab53f9..2850f4d 100644
--- a/ltt/Makefile.am
+++ b/ltt/Makefile.am
@@ -7,8 +7,6 @@
#libdir = ${lttlibdir}
AM_CFLAGS = $(PACKAGE_CFLAGS)
-LIBS += $(GLIB_LIBS)
-LIBS += $(THREAD_LIBS)
lib_LTLIBRARIES = liblttvtraceread.la
liblttvtraceread_la_SOURCES = tracefile.c marker.c event.c
diff --git a/lttv/lttv/Makefile.am b/lttv/lttv/Makefile.am
index 9094c4e..241c42c 100644
--- a/lttv/lttv/Makefile.am
+++ b/lttv/lttv/Makefile.am
@@ -1,8 +1,5 @@
AM_CFLAGS= $(PACKAGE_CFLAGS)
-
-LIBS += $(THREAD_LIBS)
-LIBS += $(POPT_LIBS) $(GLIB_LIBS) -lgobject-2.0 -L${top_builddir}/ltt\
- -llttvtraceread
+LDADD = $(POPT_LIBS) ${top_builddir}/ltt/liblttvtraceread.la
bin_PROGRAMS = lttv.real
diff --git a/lttv/lttv/lttv-gui.sh b/lttv/lttv/lttv-gui.sh
index 2de28de..717f15e 100644
--- a/lttv/lttv/lttv-gui.sh
+++ b/lttv/lttv/lttv-gui.sh
@@ -5,6 +5,6 @@
LTTV_CMD=`echo $0 | sed 's/-gui$//'`
-$LTTV_CMD.real -m guievents -m guifilter -m guicontrolflow -m resourceview \
+$LTTV_CMD.real -m lttvwindow -m guievents -m guifilter -m guicontrolflow -m resourceview \
-m guistatistics -m guitracecontrol $*
diff --git a/lttv/modules/gui/common.am b/lttv/modules/gui/common.am
index a0fda89..ce50113 100644
--- a/lttv/modules/gui/common.am
+++ b/lttv/modules/gui/common.am
@@ -17,11 +17,7 @@
# MA 02111-1307, USA.
AM_CFLAGS = $(MODULE_CFLAGS)
-AM_CFLAGS += $(GTK_CFLAGS)
AM_LDFLAGS = $(MODULE_LDFLAGS)
-LIBS += $(GLIB_LIBS)
-LIBS += $(THREAD_LIBS)
-LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
libdir = ${lttvplugindir}
diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am b/lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am
index ddccc4c..00e4177 100644
--- a/lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am
+++ b/lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am
@@ -39,5 +39,3 @@ lttvwindowinclude_HEADERS = \
lttv_plugin_tab.h \
lttv_plugin.h
-liblttvwindow_la_LIBADD = $(INTLLIBS)
-
diff --git a/lttv/modules/gui/tracecontrol/Makefile.am b/lttv/modules/gui/tracecontrol/Makefile.am
index 2865e69..27b1fde 100644
--- a/lttv/modules/gui/tracecontrol/Makefile.am
+++ b/lttv/modules/gui/tracecontrol/Makefile.am
@@ -7,10 +7,10 @@
include ../common.am
AM_CFLAGS += -DPACKAGE_DATA_DIR=\""$(datadir)"\" -DPACKAGE_BIN_DIR=\""$(bindir)"\"
-LIBS += $(UTIL_LIBS)
lib_LTLIBRARIES = libguitracecontrol.la
libguitracecontrol_la_SOURCES = tracecontrol.c
+libguitracecontrol_la_LIBADD = $(UTIL_LIBS)
EXTRA_DIST = \
hTraceControlInsert.xpm TraceControlStart.xpm TraceControlPause.xpm \
diff --git a/lttv/modules/text/Makefile.am b/lttv/modules/text/Makefile.am
index d81d0c9..140cf47 100644
--- a/lttv/modules/text/Makefile.am
+++ b/lttv/modules/text/Makefile.am
@@ -1,8 +1,6 @@
AM_CFLAGS = $(MODULE_CFLAGS)
AM_LDFLAGS = $(MODULE_LDFLAGS)
-LIBS += $(THREAD_LIBS)
-LIBS += $(GLIB_LIBS) -lgobject-2.0 -L${top_builddir}/ltt -llttvtraceread
libdir = ${lttvplugindir}
lib_LTLIBRARIES = libtextDump.la libbatchAnalysis.la libtextFilter.la libprecomputeState.la
diff --git a/runlttv b/runlttv
index 60fe83b..7cf75eb 100755
--- a/runlttv
+++ b/runlttv
@@ -18,7 +18,17 @@
RCFILE=".runlttvrc"
-ARGS="-L lttv/modules/gui/controlflow/.libs -m guicontrolflow -L lttv/modules/gui/lttvwindow/lttvwindow/.libs -m lttvwindow -L lttv/modules/gui/detailedevents/.libs -m guievents -L lttv/modules/gui/tracecontrol/.libs -m guitracecontrol -L lttv/modules/gui/statistics/.libs -m guistatistics -L lttv/modules/gui/resourceview/.libs -m resourceview -L lttv/modules/gui/filter/.libs -m guifilter -L lttv/modules/gui/interrupts/.libs -m interrupts -L lttv/modules/gui/histogram/.libs -m guihistogram"
+ARGS=\
+"-L lttv/modules/gui/lttvwindow/lttvwindow/.libs -m lttvwindow "\
+"-L lttv/modules/gui/controlflow/.libs -m guicontrolflow "\
+"-L lttv/modules/gui/detailedevents/.libs -m guievents "\
+"-L lttv/modules/gui/tracecontrol/.libs -m guitracecontrol "\
+"-L lttv/modules/gui/statistics/.libs -m guistatistics "\
+"-L lttv/modules/gui/resourceview/.libs -m resourceview "\
+"-L lttv/modules/gui/filter/.libs -m guifilter "\
+"-L lttv/modules/gui/interrupts/.libs -m interrupts "\
+"-L lttv/modules/gui/histogram/.libs -m guihistogram"
+
LTTV_EXEC="lttv/lttv/.libs/lttv.real"
if [ ! -e "$LTTV_EXEC" ]; then
--
1.6.3.3
More information about the lttng-dev
mailing list