bus: Build syslog logger depending on syslog() availability
authorMartin Willi <martin@revosec.ch>
Wed, 8 Jan 2014 10:28:49 +0000 (11:28 +0100)
committerMartin Willi <martin@revosec.ch>
Wed, 4 Jun 2014 13:53:05 +0000 (15:53 +0200)
configure.ac
src/libcharon/Makefile.am

index 633e611..ca5c636 100644 (file)
@@ -569,7 +569,13 @@ AC_CHECK_FUNC(
 )
 
 AC_CHECK_FUNCS(prctl mallinfo getpass closefrom getpwnam_r getgrnam_r getpwuid_r)
-AC_CHECK_FUNCS(fmemopen funopen mmap memrchr syslog setlinebuf)
+AC_CHECK_FUNCS(fmemopen funopen mmap memrchr setlinebuf)
+
+AC_CHECK_FUNC([syslog], [
+       AC_DEFINE([HAVE_SYSLOG], [], [have syslog(3) and friends])
+       syslog=true
+])
+AM_CONDITIONAL(USE_SYSLOG, [test "x$syslog" = xtrue])
 
 AC_CHECK_HEADERS(sys/sockio.h glob.h net/if_tun.h linux/fib_rules.h)
 AC_CHECK_HEADERS(net/pfkeyv2.h netipsec/ipsec.h netinet6/ipsec.h linux/udp.h)
index a4f1ebb..8513af8 100644 (file)
@@ -124,6 +124,10 @@ processing/jobs/dpd_timeout_job.c processing/jobs/dpd_timeout_job.h \
 processing/jobs/adopt_children_job.c processing/jobs/adopt_children_job.h
 endif
 
+if USE_SYSLOG
+  libcharon_la_SOURCES += \
+    bus/listeners/sys_logger.c bus/listeners/sys_logger.h
+endif
 
 daemon.lo :            $(top_builddir)/config.status
 
@@ -145,9 +149,6 @@ libcharon_la_LIBADD = \
 
 if USE_WINDOWS
   libcharon_la_LIBADD += -lws2_32
-else
-  libcharon_la_SOURCES += \
-    bus/listeners/sys_logger.c bus/listeners/sys_logger.h
 endif
 
 EXTRA_DIST = Android.mk