From a2504ef5899d13ccc8436794444d03c1e8e070c5 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Fri, 7 Nov 2014 15:40:37 +0100 Subject: [PATCH] build: fix out-of-tree build When building collectd out of tree, `srcdir` and `builddir` are different. We ask to search path in `$(top_srcdir)/src` since this is needed to find `liboconfig/config.h`. Also fix search path for libcollectdclient where only one header is in `builddir` while the remaining are in `srcdir`. --- src/Makefile.am | 6 +++--- src/daemon/Makefile.am | 3 ++- src/libcollectdclient/Makefile.am | 5 ++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 4e62675f..8fc351bc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -30,7 +30,7 @@ collectdmon_SOURCES = collectdmon.c collectdmon_CPPFLAGS = $(AM_CPPFLAGS) collectd_nagios_SOURCES = collectd-nagios.c -collectd_nagios_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/src/libcollectdclient/collectd +collectd_nagios_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/libcollectdclient/collectd -I$(top_builddir)/src/libcollectdclient/collectd collectd_nagios_LDADD = if BUILD_WITH_LIBSOCKET collectd_nagios_LDADD += -lsocket @@ -44,7 +44,7 @@ collectd_nagios_DEPENDENCIES = libcollectdclient/libcollectdclient.la collectdctl_SOURCES = collectdctl.c -collectdctl_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/src/libcollectdclient/collectd +collectdctl_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/libcollectdclient/collectd -I$(top_builddir)/src/libcollectdclient/collectd collectdctl_LDADD = if BUILD_WITH_LIBSOCKET collectdctl_LDADD += -lsocket @@ -57,7 +57,7 @@ collectdctl_DEPENDENCIES = libcollectdclient/libcollectdclient.la collectd_tg_SOURCES = collectd-tg.c \ daemon/utils_heap.c daemon/utils_heap.h -collectd_tg_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/src/libcollectdclient/collectd +collectd_tg_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/libcollectdclient/collectd -I$(top_builddir)/src/libcollectdclient/collectd collectd_tg_LDADD = if BUILD_WITH_LIBSOCKET collectd_tg_LDADD += -lsocket diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am index d6067d7b..fc815543 100644 --- a/src/daemon/Makefile.am +++ b/src/daemon/Makefile.am @@ -2,7 +2,8 @@ if COMPILER_IS_GCC AM_CFLAGS = -Wall -Werror endif -AM_CPPFLAGS = -DPREFIX='"${prefix}"' +AM_CPPFLAGS = -I$(top_srcdir)/src +AM_CPPFLAGS += -DPREFIX='"${prefix}"' AM_CPPFLAGS += -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"' AM_CPPFLAGS += -DLOCALSTATEDIR='"${localstatedir}"' AM_CPPFLAGS += -DPKGLOCALSTATEDIR='"${localstatedir}/lib/${PACKAGE_NAME}"' diff --git a/src/libcollectdclient/Makefile.am b/src/libcollectdclient/Makefile.am index 2fc3152d..5abee2f1 100644 --- a/src/libcollectdclient/Makefile.am +++ b/src/libcollectdclient/Makefile.am @@ -11,7 +11,10 @@ nodist_pkgconfig_DATA = libcollectdclient.pc BUILT_SOURCES = collectd/lcc_features.h libcollectdclient_la_SOURCES = client.c network.c network_buffer.c -libcollectdclient_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/src/libcollectdclient/collectd -I$(top_srcdir)/src/daemon +libcollectdclient_la_CPPFLAGS = $(AM_CPPFLAGS) \ + -I$(top_srcdir)/src/libcollectdclient/collectd \ + -I$(top_builddir)/src/libcollectdclient/collectd \ + -I$(top_srcdir)/src/daemon libcollectdclient_la_LDFLAGS = -version-info 1:0:0 libcollectdclient_la_LIBADD = if BUILD_WITH_LIBGCRYPT -- 2.11.0