From 8d7404149eb0ca695a54b4659c11e9ae4d63922c Mon Sep 17 00:00:00 2001 From: Serj Kalichev Date: Mon, 26 Mar 2012 10:19:00 -0400 Subject: [PATCH] irqbalance: Misc build enhancements - Remove AC_CANONICAL_TARGET macro from configure to allow easier cross compilation - Add private implementation of called glib2 functions so that irqbalance can be built on systems not supporting a sufficiently recent version of glib2 - Add --without-glib2 configure option to support explicit selection of internal glib2 function definitions, overriding automatic selection. Signed-off-by: Serj Kalichev Signed-off-by: Neil Horman --- .gitignore | 6 ++++++ Makefile.am | 4 +++- configure.ac | 34 +++++++++++++++++++++++++++++++--- irqbalance.c | 1 + irqbalance.h | 1 + 5 files changed, 42 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 2eb3414..c87f0c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ +*.a *.o *~ +.deps + *.diff *.patch *.orig @@ -9,6 +12,8 @@ /INSTALL /Makefile /Makefile.in +*/Makefile +*/Makefile.in /aclocal.m4 /autom4te.cache /compile @@ -25,6 +30,7 @@ /m4 /missing /stamp-h1 +/depcomp /irqbalance irqbalance-*.tar.* diff --git a/Makefile.am b/Makefile.am index 9847232..2142e5b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,7 +25,7 @@ ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = README INSTALL COPYING autogen.sh m4/cap-ng.m4 misc/irqbalance.service INCLUDES = -I${top_srcdir} -LIBS = $(CAPNG_LDADD) $(GLIB_LIBS) @LIBS@ +LIBS = $(CAPNG_LDADD) @LIBS@ AM_CFLAGS = $(GLIB_CFLAGS) AM_CPPFLAGS = -W -Wall -Wshadow -Wformat -Wundef -D_GNU_SOURCE noinst_HEADERS = bitmap.h constants.h cpumask.h irqbalance.h non-atomic.h \ @@ -33,6 +33,7 @@ noinst_HEADERS = bitmap.h constants.h cpumask.h irqbalance.h non-atomic.h \ sbin_PROGRAMS = irqbalance irqbalance_SOURCES = activate.c bitmap.c classify.c cputree.c irqbalance.c \ irqlist.c numa.c placement.c powermode.c procinterrupts.c +irqbalance_LDADD = $(CAPNG_LDADD) $(GLIB_LIBS) dist_man_MANS = irqbalance.1 CONFIG_CLEAN_FILES = debug*.list config/* @@ -40,3 +41,4 @@ clean-generic: rm -rf autom4te*.cache rm -f *.rej *.orig *~ +SUBDIRS = $(GLIB_SUBDIR) diff --git a/configure.ac b/configure.ac index eed55ba..861582d 100644 --- a/configure.ac +++ b/configure.ac @@ -36,7 +36,6 @@ AM_CONFIG_HEADER(config.h) echo Configuring irqbalance $VERSION AC_CONFIG_MACRO_DIR([m4]) -AC_CANONICAL_TARGET AM_INIT_AUTOMAKE AM_PROG_LIBTOOL AC_SUBST(LIBTOOL_DEPS) @@ -70,10 +69,39 @@ AC_C_CONST AC_C_INLINE AM_PROG_CC_C_O -PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.28]) +AC_ARG_WITH([glib2], + [AS_HELP_STRING([--without-glib2], + [Don't use system glib2 library. Use local implementation instead.])], + [], + [with_glib2=check]) + +local_glib2= +AS_IF( + [test "x$with_glib2" = xyes], + [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.28])], + + [test "x$with_glib2" = xno], + [local_glib2="yes"], + + [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.28], [], [local_glib2="yes"])] +) + +AS_IF( + [test "x$local_glib2" = xyes], + [ + GLIB_CFLAGS=-I./glib-local + GLIB_LIBS=glib-local/libglib.a + GLIB_SUBDIR=glib-local + AC_SUBST(GLIB_CFLAGS) + AC_SUBST(GLIB_LIBS) + AC_SUBST(GLIB_SUBDIR) + AC_MSG_WARN(Using locale implementation of GList functions) + ] +) + LIBCAP_NG_PATH -AC_OUTPUT(Makefile) +AC_OUTPUT(Makefile glib-local/Makefile) AC_MSG_NOTICE() AC_MSG_NOTICE([irqbalance Version: $VERSION]) diff --git a/irqbalance.c b/irqbalance.c index 35bfd22..9a11217 100644 --- a/irqbalance.c +++ b/irqbalance.c @@ -27,6 +27,7 @@ #include #include #include +#include #ifdef HAVE_GETOPT_LONG #include #endif diff --git a/irqbalance.h b/irqbalance.h index 956aa8c..f4e50f0 100644 --- a/irqbalance.h +++ b/irqbalance.h @@ -9,6 +9,7 @@ #include #include #include +#include #include "types.h" #ifdef HAVE_NUMA_H