summaryrefslogtreecommitdiff
path: root/dev-lang/erlang/files/17.0-systemd.patch
blob: 2dba8c897fe69e389cc94d937e9278305a019a02 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
--- erts/configure.in	2014-05-08 10:07:18.691087332 +0200
+++ erts/configure.in	2014-05-08 10:12:56.579375822 +0200
@@ -366,6 +366,11 @@
 		   $with_assumed_cache_line_size,
 		   [Assumed cache-line size (in bytes)])
 
+AC_ARG_ENABLE(systemd,
+AS_HELP_STRING([--enable-systemd], [enable systemd support in epmd]),
+[],
+[enable_systemd=no])
+
 dnl Magic test for clearcase.
 OTP_RELEASE=
 if test "${ERLANG_COMMERCIAL_BUILD}" != ""; then
@@ -1042,8 +1047,6 @@
 AC_CHECK_LIB(inet, main)
 AC_CHECK_LIB(util, openpty)
 
-AC_CHECK_LIB(systemd-daemon, sd_listen_fds)
-
 dnl Try to find a thread library.
 dnl
 dnl ETHR_LIB_NAME, ETHR_LIBS, ETHR_X_LIBS, ETHR_THR_LIB_BASE and ETHR_DEFS
@@ -1679,7 +1682,29 @@
 	 #endif
 	])
 
-AC_CHECK_HEADERS(systemd/sd-daemon.h)
+dnl ----------------------------------------------------------------------
+dnl  Check the availability of systemd
+dnl ----------------------------------------------------------------------
+if test x"$enable_systemd" != x"no"; then
+
+systemd_daemon_save_LIBS=$LIBS
+LIBS=
+AC_SEARCH_LIBS(sd_listen_fds,[systemd systemd-daemon],
+  [have_sd_listen_fds=yes],[have_sd_listen_fds=no],$systemd_daemon_save_LIBS)
+AC_CHECK_HEADERS(systemd/sd-daemon.h,
+  [have_systemd_sd_daemon_h=yes],[have_systemd_sd_daemon_h=no])
+
+if test x"$have_sd_listen_fds" = x"yes" && \
+   test x"$have_systemd_sd_daemon_h" = x"yes"; then
+  AC_DEFINE([HAVE_SYSTEMD_DAEMON],[1],[Define if you have systemd daemon])
+  SYSTEMD_DAEMON_LIBS=$LIBS
+elif test x"$enable_systemd" = x"yes"; then
+  AC_MSG_FAILURE([--enable-systemd was given, but test for systemd failed])
+fi
+LIBS=$systemd_daemon_save_LIBS
+fi
+AC_SUBST(SYSTEMD_DAEMON_LIBS)
+
 
 dnl ----------------------------------------------------------------------
 dnl Check the availability for libdlpi
--- erts/epmd/src/Makefile.in	2014-05-08 10:07:58.344182314 +0200
+++ erts/epmd/src/Makefile.in	2014-05-08 10:12:56.580375784 +0200
@@ -84,7 +84,7 @@
 ifeq ($(findstring ose,$(TARGET)),ose)
 LIBS    = $(ERTS_INTERNAL_LIBS) @LIBS@
 else
-LIBS    = @LIBS@ $(ERTS_INTERNAL_LIBS)
+LIBS    = @LIBS@ @SYSTEMD_DAEMON_LIBS@ $(ERTS_INTERNAL_LIBS)
 endif
 LDFLAGS = @LDFLAGS@
 
--- erts/epmd/src/epmd_srv.c	2014-05-08 10:07:49.137392770 +0200
+++ erts/epmd/src/epmd_srv.c	2014-05-08 10:12:39.777759407 +0200
@@ -213,7 +213,7 @@
   node_init(g);
   g->conn = conn_init(g);
 
-#ifdef HAVE_SYSTEMD_SD_DAEMON_H
+#ifdef HAVE_SYSTEMD_DAEMON
   if (g->is_systemd)
     {
       int n;
@@ -310,7 +310,7 @@
       SET_ADDR(iserv_addr[0],EPMD_ADDR_ANY,sport);
       num_sockets = 1;
     }
-#ifdef HAVE_SYSTEMD_SD_DAEMON_H
+#ifdef HAVE_SYSTEMD_DAEMON
     }
 #endif