[radvd-devel-l] [PATCH] Use libdaemon for daemonization

Petr Pisar ppisar at redhat.com
Wed Apr 11 08:13:15 EDT 2012


On Tue, Apr 10, 2012 at 09:32:19PM -0700, Reuben Hawkins wrote:
> On Tue, Apr 10, 2012 at 12:14 AM, Petr Pisar <ppisar at redhat.com> wrote:
> >
> > libdaemon provides pkg-config file to provide proper CFLAGS and LDFLAGS.
> > I did not use it not to drag pkg-config into radvd configure-time
> > dependencies.  However using pkg-config would be more clean solution.
> >
> > I think the libdaemon dependency should be documented somewhere in the
> > README. I did not do that.
> >
> > I replaced the daemon() call with the libdaemon code. It could be made
> > optional.
> >
> > The libdaemon functions can do some low-level logging which I did not
> > harness because I do not know if it's possible to patch them properly to
> > radvd logging mechanism.
> 
> I applied your patch.  The TODO things you mentioned in the last email I'm
> going to leave them as TODO items, but as of now I think the only one really
> worth looking into is the pkg-config configure time checking to libdaemon.
> 
Thank you. I've reworked the libdaemon detection to use pkg-config and also
I've documented the pkg-config and libdaemon dependency in README. The changes
are attached.

-- Petr
-------------- next part --------------
From 93a552a9b52b01f1d89b8c0a946252e33689d87e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
Date: Wed, 11 Apr 2012 13:52:24 +0200
Subject: [PATCH] Use pkg-config to discover libdaemon

---
 Makefile.am  |    5 ++++-
 README       |    2 ++
 configure.ac |    6 +-----
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 4b76a97..c6f4418 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -59,8 +59,11 @@ EXTRA_radvd_SOURCES = \
 	netlink.h \
 	privsep-linux.c
 
+radvd_CPPFLAGS = \
+	@DAEMON_CFLAGS@
+
 radvd_LDADD = \
-	@CONDITIONAL_SOURCES@
+	@CONDITIONAL_SOURCES@ @DAEMON_LIBS@
 
 radvd_DEPENDENCIES = \
 	@CONDITIONAL_SOURCES@
diff --git a/README b/README
index 5192c52..efa3154 100644
--- a/README
+++ b/README
@@ -2,6 +2,8 @@
 Installation:
 =============
 
+Install 'pkg-config' and 'libdaemon'.
+
 Run configure, e.g.
 
 ./configure --prefix=/usr/local --sysconfdir=/etc --mandir=/usr/share/man
diff --git a/configure.ac b/configure.ac
index 2e001bf..c796472 100644
--- a/configure.ac
+++ b/configure.ac
@@ -137,15 +137,11 @@ AC_CHECK_LIB(c, inet_ntop,,
 # prevent caching
 unset ac_cv_lib_inet6_inet_ntop
 
-AC_CHECK_LIB([daemon], [daemon_fork], ,
- AC_MSG_ERROR([Could not use libdaemon library])
-)
+PKG_CHECK_MODULES([DAEMON], libdaemon)
 
 dnl Checks for header files.
 AC_HEADER_STDC
 AC_CHECK_HEADERS( \
-	libdaemon/dfork.h \
-	libdaemon/dpid.h \
 	getopt.h \
 	ifaddrs.h \
 	machine/limits.h \
-- 
1.7.7.6

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 230 bytes
Desc: not available
URL: <http://lists.litech.org/pipermail/radvd-devel-l/attachments/20120411/17af6872/attachment.pgp>


More information about the radvd-devel-l mailing list