summaryrefslogtreecommitdiff
blob: 14206d3bdeeb701da36350f7bab76fe89a75e718 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
From 7c7a97f8a4cc9a3efba630dc31ca9c35592bb1b9 Mon Sep 17 00:00:00 2001
From: "Jory A. Pratt" <anarchy@gentoo.org>
Date: Tue, 23 May 2017 14:15:43 -0500
Subject: [PATCH] Support musl libc

Signed-off-by: Jory A. Pratt <anarchy@gentoo.org>
---
 configure.ac                        | 1 +
 libnm-core/nm-utils.h               | 4 ++++
 src/platform/wifi/wifi-utils.h      | 4 ++++
 src/systemd/src/basic/socket-util.h | 5 +++++
 src/systemd/src/basic/stdio-util.h  | 2 ++
 src/systemd/src/basic/util.h        | 5 +++++
 6 files changed, 21 insertions(+)

diff --git a/configure.ac b/configure.ac
index 6f190c0..ddc25f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -278,6 +278,7 @@ dnl
 dnl Checks for libdl - on certain platforms its part of libc
 dnl
 AC_SEARCH_LIBS([dlopen], [dl dld], [], [ac_cv_search_dlopen=])
+AS_IF([test "$ac_cv_search_dlopen" = "none required"],[ac_cv_search_dlopen=""])
 AC_SUBST([DL_LIBS], "$ac_cv_search_dlopen")
 
 PKG_CHECK_MODULES(GLIB, [gio-unix-2.0 >= 2.37.6 gmodule-2.0],
diff --git a/libnm-core/nm-utils.h b/libnm-core/nm-utils.h
index 77fe18a..dcc776f 100644
--- a/libnm-core/nm-utils.h
+++ b/libnm-core/nm-utils.h
@@ -30,7 +30,11 @@
 #include <netinet/in.h>
 
 /* For ETH_ALEN and INFINIBAND_ALEN */
+#if defined(__GLIBC__)
 #include <linux/if_ether.h>
+#else
+#define ETH_ALEN	6		/* Octets in one ethernet addr	 */
+#endif
 #include <linux/if_infiniband.h>
 
 #include "nm-core-enum-types.h"
diff --git a/src/platform/wifi/wifi-utils.h b/src/platform/wifi/wifi-utils.h
index 705717b..da3edc4 100644
--- a/src/platform/wifi/wifi-utils.h
+++ b/src/platform/wifi/wifi-utils.h
@@ -22,7 +22,11 @@
 #ifndef __WIFI_UTILS_H__
 #define __WIFI_UTILS_H__
 
+#if defined(__GLIBC__)
 #include <net/ethernet.h>
+#else /* musl libc */
+#define ETH_ALEN	6		/* Octets in one ethernet addr	 */
+#endif
 
 #include "nm-dbus-interface.h"
 
diff --git a/src/systemd/src/basic/socket-util.h b/src/systemd/src/basic/socket-util.h
index 19a9ddb..337b20e 100644
--- a/src/systemd/src/basic/socket-util.h
+++ b/src/systemd/src/basic/socket-util.h
@@ -28,6 +28,11 @@
 #include <sys/un.h>
 #include <linux/netlink.h>
 #include <linux/if_packet.h>
+#if !defined(__GLIBC__)
+/* SIOCGSTAMPNS from linux/asm-generic.h 
+ * for src/systemd/src/libsystemd-network/sd-lldp.c */
+#include <linux/sockios.h>
+#endif
 
 #include "macro.h"
 #include "missing.h"
diff --git a/src/systemd/src/basic/stdio-util.h b/src/systemd/src/basic/stdio-util.h
index bd1144b..9eafacb 100644
--- a/src/systemd/src/basic/stdio-util.h
+++ b/src/systemd/src/basic/stdio-util.h
@@ -19,7 +19,9 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#if defined(__GLIBC__)
 #include <printf.h>
+#endif
 #include <stdarg.h>
 #include <stdio.h>
 #include <sys/types.h>
diff --git a/src/systemd/src/basic/util.h b/src/systemd/src/basic/util.h
index c7da6c3..d19e1b2 100644
--- a/src/systemd/src/basic/util.h
+++ b/src/systemd/src/basic/util.h
@@ -46,6 +46,11 @@
 #include "missing.h"
 #include "time-util.h"
 
+#if !defined(__GLIBC__)
+typedef int (*__compar_fn_t) (const void*, const void*);
+typedef __compar_fn_t comparison_fn_t;
+#endif
+
 size_t page_size(void) _pure_;
 #define PAGE_ALIGN(l) ALIGN_TO((l), page_size())
 
-- 
2.13.0