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
|
--- a/configure.ac
+++ b/configure.ac
@@ -61,6 +61,8 @@ AC_ARG_ENABLE([profiling],
AS_HELP_STRING([--enable-profiling], [Enable iperf3 profiling binary]))
AM_CONDITIONAL([ENABLE_PROFILING], [test x$enable_profiling = xyes])
+PKG_CHECK_MODULES([libcjson], [libcjson >= 1.7.15])
+
# Check for the math library (needed by cjson on some platforms)
AC_SEARCH_LIBS(floor, [m], [], [
echo "floor()"
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -10,8 +10,6 @@ include_HEADERS = iperf_api.h # Define
# Specify the source files and flags for the iperf library
libiperf_la_SOURCES = \
- cjson.c \
- cjson.h \
flowlabel.h \
iperf.h \
iperf_api.c \
@@ -46,10 +44,13 @@ libiperf_la_SOURCES = \
units.c \
units.h \
version.h
+libiperf_la_CPPFLAGS = $(CPPFLAGS) @libcjson_CFLAGS@
+libiperf_la_LIBADD = @libcjson_LIBS@
# Specify the sources and various flags for the iperf binary
iperf3_SOURCES = main.c
-iperf3_LDADD = libiperf.la
+iperf3_CPPFLAGS = $(CPPFLAGS) @libcjson_CFLAGS@
+iperf3_LDADD = libiperf.la @libcjson_LIBS@
if ENABLE_PROFILING
# If the iperf-profiled-binary is enabled
--- a/src/iperf.h
+++ b/src/iperf.h
@@ -52,7 +52,7 @@
#include "timer.h"
#include "queue.h"
-#include "cjson.h"
+#include <cjson/cJSON.h>
#include "iperf_time.h"
#include "portable_endian.h"
--- a/src/iperf_api.c
+++ b/src/iperf_api.c
@@ -79,7 +79,7 @@
#endif /* HAVE_SCTP_H */
#include "timer.h"
-#include "cjson.h"
+#include <cjson/cJSON.h>
#include "units.h"
#include "iperf_util.h"
#include "iperf_locale.h"
--- a/src/iperf_tcp.c
+++ b/src/iperf_tcp.c
@@ -43,7 +43,7 @@
#include "iperf_tcp.h"
#include "iperf_util.h"
#include "net.h"
-#include "cjson.h"
+#include <cjson/cJSON.h>
#if defined(HAVE_FLOWLABEL)
#include "flowlabel.h"
--- a/src/iperf_udp.c
+++ b/src/iperf_udp.c
@@ -45,7 +45,7 @@
#include "iperf_udp.h"
#include "timer.h"
#include "net.h"
-#include "cjson.h"
+#include <cjson/cJSON.h>
/* iperf_udp_recv
*
--- a/src/iperf_util.c
+++ b/src/iperf_util.c
@@ -46,7 +46,7 @@
#include <errno.h>
#include <fcntl.h>
-#include "cjson.h"
+#include <cjson/cJSON.h>
#include "iperf.h"
#include "iperf_api.h"
--- a/src/iperf_util.h
+++ b/src/iperf_util.h
@@ -28,7 +28,7 @@
#define __IPERF_UTIL_H
#include "iperf_config.h"
-#include "cjson.h"
+#include <cjson/cJSON.h>
#include <sys/select.h>
#include <stddef.h>
|