aboutsummaryrefslogtreecommitdiff
path: root/package/lldpd/0001-build-ability-to-disable-libbsd-with-without-libbsd.patch
blob: 7301ac636bde33028ed117812596b672d6ae4b81 (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
From ff3dcc4ad71c1105bd8ea11afe7e07efd48c038d Mon Sep 17 00:00:00 2001
From: Vincent Bernat <vincent@bernat.ch>
Date: Tue, 25 Sep 2018 10:57:49 +0200
Subject: [PATCH] build: ability to disable libbsd with --without-libbsd

This is useful when user wants to ensure reproducibility of the build
whatever libbsd is present or not.

Signed-off-by: Trent Piepho <tpiepho@impinj.com>
---
 configure.ac  | 59 +++++++++++++++++++++++++++++++++++++++--------------------
 src/marshal.h |  1 +
 2 files changed, 40 insertions(+), 20 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9b40473..589cd96 100644
--- a/configure.ac
+++ b/configure.ac
@@ -173,26 +173,44 @@ AC_FUNC_REALLOC
 AC_FUNC_FORK
 
 # Some functions can be in libbsd
-PKG_CHECK_MODULES([libbsd], [libbsd-overlay], [
-  _save_CFLAGS="$CFLAGS"
-  _save_LIBS="$LIBS"
-  CFLAGS="$CFLAGS $libbsd_CFLAGS"
-  LIBS="$LIBS $libbsd_LIBS"
-  AC_MSG_CHECKING([if libbsd can be linked correctly])
-  AC_TRY_LINK([
-@%:@include <sys/time.h>
-@%:@include <sys/types.h>
-],[],
-    [
-      AC_MSG_RESULT(yes)
-      LLDP_CFLAGS="$LLDP_CFLAGS $libbsd_CFLAGS"
-      LLDP_LDFLAGS="$LLDP_LDFLAGS $libbsd_LIBS"
-    ],[
-      AC_MSG_RESULT(no)
-      CFLAGS="$_save_CFLAGS"
-      LIBS="$_save_LIBS"
-    ])
-], [:])
+AC_ARG_WITH([libbsd],
+  AS_HELP_STRING(
+    [--with-libbsd],
+    [Use libbsd @<:@default=auto@:>@]),
+  [],
+  [with_libbsd=auto])
+if test x"$with_libbsd" != x"no"; then
+  PKG_CHECK_MODULES([libbsd], [libbsd-overlay], [
+    _save_CFLAGS="$CFLAGS"
+    _save_LIBS="$LIBS"
+    CFLAGS="$CFLAGS $libbsd_CFLAGS"
+    LIBS="$LIBS $libbsd_LIBS"
+    AC_MSG_CHECKING([if libbsd can be linked correctly])
+    AC_TRY_LINK([
+  @%:@include <sys/time.h>
+  @%:@include <sys/types.h>
+  ],[],
+      [
+        AC_MSG_RESULT(yes)
+        LLDP_CFLAGS="$LLDP_CFLAGS $libbsd_CFLAGS"
+        LLDP_LDFLAGS="$LLDP_LDFLAGS $libbsd_LIBS"
+        with_libbsd=yes
+      ],[
+        AC_MSG_RESULT(no)
+        CFLAGS="$_save_CFLAGS"
+        LIBS="$_save_LIBS"
+        if test x"$with_libbsd" = x"yes"; then
+           AC_MSG_FAILURE([*** no libbsd support found])
+        fi
+        with_libbsd=no
+      ])
+  ], [
+    if test x"$with_libbsd" = x"yes"; then
+       AC_MSG_FAILURE([*** no libbsd support found])
+    fi
+    with_libbsd=no
+  ])
+fi
 
 # setproctitle may have an _init function
 AC_REPLACE_FUNCS([setproctitle])
@@ -412,6 +430,7 @@ cat <<EOF
   XML output.....: ${with_xml-no}
   Oldies support.: $enable_oldies
   seccomp........: ${with_seccomp-no}
+  libbsd.........: ${with_libbsd-no}
 
  Privilege separation:
   Enabled........: $enable_privsep
diff --git a/src/marshal.h b/src/marshal.h
index b0e8032..0a782d5 100644
--- a/src/marshal.h
+++ b/src/marshal.h
@@ -19,6 +19,7 @@
 #define _MARSHAL_H
 
 #include <stddef.h>
+#include <stdint.h>
 #include <sys/types.h>
 
 struct marshal_info;
-- 
2.14.4