Patchwork [10/21] xinetd: add support to use RPC support from libtirpc

login
register
mail settings
Submitter Thomas Petazzoni
Date Nov. 4, 2012, 5:34 p.m.
Message ID <94b700ff4570051f6408d4264efcbff74ae014cd.1352050008.git.thomas.petazzoni@free-electrons.com>
Download mbox | patch
Permalink /patch/197069/
State Accepted
Headers show

Comments

Thomas Petazzoni - Nov. 4, 2012, 5:34 p.m.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/xinetd/xinetd.mk |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
Peter Korsgaard - Nov. 5, 2012, 8:50 a.m.
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

 Thomas> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

It unfortunately fails here:

confparse.o: In function `cnf_get':
confparse.c:(.text+0x1174): undefined reference to `getrpcbyname'
collect2: ld returned 1 exit status
make[2]: Leaving directory `/home/peko/source/buildroot/output/build/xinetd-2.3.15/xinetd'

getrpcbyname() apparently seems to be behind a 'GQ' define in libtirpc.

Care to look into that?

Also notice that we recently added conntrack-tools, which should also
get libtirpc support.

Patch

diff --git a/package/xinetd/xinetd.mk b/package/xinetd/xinetd.mk
index a420425..cb48145 100644
--- a/package/xinetd/xinetd.mk
+++ b/package/xinetd/xinetd.mk
@@ -9,10 +9,25 @@  XINETD_SITE          = http://www.xinetd.org
 XINETD_LICENSE       = xinetd license
 XINETD_LICENSE_FILES = COPYRIGHT
 
-ifneq ($(BR2_TOOLCHAIN_HAS_NATIVE_RPC),y)
-XINETD_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -DNO_RPC"
+XINETD_CFLAGS = $(TARGET_CFLAGS)
+
+# Three cases here:
+#  1. We have libtirpc, use it by passing special flags
+#  2. We have native RPC support, use it, no need to pass special
+#     flags (so this case 2 is implicit and not visible below)
+#  3. We don't have RPC support, pass -DNO_RPC to disable it
+ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
+XINETD_DEPENDENCIES += libtirpc
+XINETD_CFLAGS += -I$(STAGING_DIR)/usr/include/tirpc/
+XINETD_LIBS += -ltirpc
+else ifeq ($(BR2_TOOLCHAIN_HAS_NATIVE_RPC),)
+XINETD_CFLAGS += -DNO_RPC
 endif
 
+XINETD_CONF_ENV += \
+	CFLAGS="$(XINETD_CFLAGS)" \
+	LIBS="$(XINETD_LIBS)"
+
 XINETD_MAKE_OPT = AR="$(TARGET_AR)"
 
 $(eval $(autotools-package))