aboutsummaryrefslogtreecommitdiffstats
path: root/main/dhcpcd-ui/strverscmp.patch
blob: 0542a05706a97c101292bc5b07a059d6de6d5101 (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
Index: configure
==================================================================
--- a/configure
+++ b/configure
@@ -296,10 +296,32 @@
 if [ "$STRLCPY" = no ]; then
 	echo "#define strlcpy(dst, src, n) " \
 	    "((size_t)snprintf(dst, n, \"%s\", src))" \
 	    >>$CONFIG_H
 fi
+
+if [ -z "$STRVERSCMP" ]; then
+	printf "Testing for strverscmp ... "
+	cat <<EOF >_strverscmp.c
+#define _GNU_SOURCE
+#include <string.h>
+int main(void) {
+	strverscmp(NULL, NULL);
+	return 0;
+}
+EOF
+	if $XCC _strverscmp.c -o _strverscmp 2>/dev/null; then
+		STRVERSCMP=yes
+	else
+		STRVERSCMP=no
+	fi
+	echo "$STRVERSCMP"
+	rm -f _strverscmp.c _strverscmp
+fi
+if [ "$STRVERSCMP" = yes ]; then
+	echo "#define HAVE_STRVERSCMP" >>$CONFIG_H
+fi
 
 if [ -z "$LIBDIR" ]; then
 	printf "lib directory name ... "
 	case `readlink /lib` in
 		"") LIBNAME="lib";;

Index: src/libdhcpcd/dhcpcd.c
==================================================================
--- a/src/libdhcpcd/dhcpcd.c
+++ b/src/libdhcpcd/dhcpcd.c
@@ -607,11 +607,11 @@
 
 	assert(con);
 	return con->progname;
 }
 
-#ifndef __GLIBC__
+#ifndef HAVE_STRVERSCMP
 /* Good enough for our needs */
 static int
 strverscmp(const char *s1, const char *s2)
 {
 	int s1maj, s1min, s1part;