summaryrefslogtreecommitdiff
blob: b87ca8a306323d1bdfc1f867591d5a7b05691f8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
sent upstream:
https://lists.alioth.debian.org/pipermail/sane-devel/2015-July/033602.html

From 1dcfb42608a27fbdebdaa721b4e48354850a7dcc Mon Sep 17 00:00:00 2001
From: Christopher Brannon <teiresias@gentoo.org>
Date: Wed, 8 Jul 2015 06:38:50 -0400
Subject: [PATCH] use pkg-config to look up systemd paths

Since systemd has always shipped pkg-config files, we should use them.
This also fixes cross-compiling by not relying on hardcoded host paths.
---
 configure.in | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/configure.in b/configure.in
index b539cda..5e703a8 100644
--- a/configure.in
+++ b/configure.in
@@ -346,21 +346,18 @@ dnl fi
 AC_ARG_WITH(systemd,
 	AC_HELP_STRING([--with-systemd], [enable systemd support @<:@default=yes@:>@]))
 if test "x$with_systemd" != xno ; then
-    dnl added by llagendijk 12/7/2012 to detect systemd for saned
-    $as_echo_n "Checking for systemd..."
-    if test -e /usr/include/systemd/sd-daemon.h ; then
-	AC_DEFINE(HAVE_SYSTEMD, 1, [Is /usr/include/systemd/sd-daemon.h available?])
-	have_systemd="yes"
-	SYSTEMD_LIBS=" -lsystemd-daemon"
-	AC_SUBST(SYSTEMD_LIBS)
-	$as_echo "yes"
-    else
-	have_systemd="no"
-	$as_echo "no"
-	if test "x$with_systemd" = xyes; then
-	    AC_MSG_ERROR([Systemd support was requested but systemd was not found])
-	fi
+  PKG_CHECK_MODULES(SYSTEMD, [libsystemd], have_systemd=yes, have_systemd=no)
+  if test "x$have_systemd" = xno; then
+    PKG_CHECK_MODULES(SYSTEMD, [libsystemd-daemon], have_systemd=yes, have_systemd=no)
+  fi
+  if test "x$have_systemd" = xyes; then
+    AC_DEFINE(HAVE_SYSTEMD, 1, [Is /usr/include/systemd/sd-daemon.h available?])
+    AC_SUBST(SYSTEMD_LIBS)
+  else
+    if test "x$with_systemd" = xyes; then
+      AC_MSG_ERROR([Systemd support was requested but systemd was not found])
     fi
+  fi
 fi
 
 dnl ***********
-- 
2.4.4