summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--auto_tests/Makefile.inc6
-rw-r--r--configure.ac194
-rw-r--r--other/Makefile.inc5
-rw-r--r--other/bootstrap_serverdaemon/Makefile.inc5
-rw-r--r--testing/DHT_test.c4
-rw-r--r--testing/Lossless_UDP_testclient.c4
-rw-r--r--testing/Lossless_UDP_testserver.c4
-rw-r--r--testing/Makefile.inc28
-rw-r--r--testing/Messenger_test.c4
-rw-r--r--testing/crypto_speed_test.c4
-rw-r--r--testing/misc_tools.c4
-rw-r--r--toxcore/DHT.c4
-rw-r--r--toxcore/LAN_discovery.c4
-rw-r--r--toxcore/Lossless_UDP.c4
-rw-r--r--toxcore/Makefile.inc7
-rw-r--r--toxcore/Messenger.c4
-rw-r--r--toxcore/friend_requests.c4
-rw-r--r--toxcore/net_crypto.c4
-rw-r--r--toxcore/network.c4
-rw-r--r--toxcore/network.h2
-rw-r--r--toxcore/ping.c4
-rw-r--r--toxcore/tox.c4
-rw-r--r--toxcore/util.c4
23 files changed, 252 insertions, 59 deletions
diff --git a/auto_tests/Makefile.inc b/auto_tests/Makefile.inc
index 199b61e9..4930a798 100644
--- a/auto_tests/Makefile.inc
+++ b/auto_tests/Makefile.inc
@@ -9,23 +9,29 @@ messenger_autotest_SOURCES = \
9 9
10messenger_autotest_CFLAGS = \ 10messenger_autotest_CFLAGS = \
11 $(LIBSODIUM_CFLAGS) \ 11 $(LIBSODIUM_CFLAGS) \
12 $(NACL_CFLAGS) \
12 $(CHECK_CFLAGS) 13 $(CHECK_CFLAGS)
13 14
14messenger_autotest_LDADD = \ 15messenger_autotest_LDADD = \
15 $(LIBSODIUM_LDFLAGS) \ 16 $(LIBSODIUM_LDFLAGS) \
17 $(NACL_LDFLAGS) \
16 libtoxcore.la \ 18 libtoxcore.la \
17 $(LIBSODIUM_LIBS) \ 19 $(LIBSODIUM_LIBS) \
20 $(NACL_LIBS) \
18 $(CHECK_LIBS) 21 $(CHECK_LIBS)
19 22
20 23
21crypto_test_SOURCES = ../auto_tests/crypto_test.c 24crypto_test_SOURCES = ../auto_tests/crypto_test.c
22 25
23crypto_test_CFLAGS = $(LIBSODIUM_CFLAGS) \ 26crypto_test_CFLAGS = $(LIBSODIUM_CFLAGS) \
27 $(NACL_CFLAGS) \
24 $(CHECK_CFLAGS) 28 $(CHECK_CFLAGS)
25 29
26crypto_test_LDADD = $(LIBSODIUM_LDFLAGS) \ 30crypto_test_LDADD = $(LIBSODIUM_LDFLAGS) \
31 $(NACL_LDFLAGS) \
27 libtoxcore.la \ 32 libtoxcore.la \
28 $(LIBSODIUM_LIBS) \ 33 $(LIBSODIUM_LIBS) \
34 $(NACL_LIBS) \
29 $(CHECK_LIBS) 35 $(CHECK_LIBS)
30 36
31endif 37endif
diff --git a/configure.ac b/configure.ac
index e82fe1f0..762736df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,18 @@ BUILD_TESTS="yes"
32NCURSES_FOUND="no" 32NCURSES_FOUND="no"
33LIBCONFIG_FOUND="no" 33LIBCONFIG_FOUND="no"
34LIBCHECK_FOUND="no" 34LIBCHECK_FOUND="no"
35WANT_NACL="no"
36
37AC_ARG_ENABLE([nacl],
38 [AC_HELP_STRING([--enable-tests], [use nacl instead of libsodium (default: disabled)]) ],
39 [
40 if test "x$enableval" = "xno"; then
41 WANT_NACL="no"
42 elif test "x$enableval" = "xyes"; then
43 WANT_NACL="yes"
44 fi
45 ]
46)
35 47
36AC_ARG_ENABLE([tests], 48AC_ARG_ENABLE([tests],
37 [AC_HELP_STRING([--disable-tests], [build unit tests (default: auto)]) ], 49 [AC_HELP_STRING([--disable-tests], [build unit tests (default: auto)]) ],
@@ -69,6 +81,8 @@ AC_ARG_ENABLE([dht-bootstrap-daemon],
69DEPSEARCH= 81DEPSEARCH=
70LIBSODIUM_SEARCH_HEADERS= 82LIBSODIUM_SEARCH_HEADERS=
71LIBSODIUM_SEARCH_LIBS= 83LIBSODIUM_SEARCH_LIBS=
84NACL_SEARCH_HEADERS=
85NACL_SEARCH_LIBS=
72 86
73AC_ARG_WITH(dependency-search, 87AC_ARG_WITH(dependency-search,
74 AC_HELP_STRING([--with-dependency-search=DIR], 88 AC_HELP_STRING([--with-dependency-search=DIR],
@@ -86,6 +100,24 @@ if test -n "$DEPSEARCH"; then
86 export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$DEPSEARCH/lib/pkgconfig 100 export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$DEPSEARCH/lib/pkgconfig
87fi 101fi
88 102
103AC_ARG_WITH(nacl-headers,
104 AC_HELP_STRING([--with-nacl-headers=DIR],
105 [search for nacl<F2> header files in DIR]),
106 [
107 NACL_SEARCH_HEADERS="$withval"
108 AC_MSG_NOTICE([will search for nacl header files in $withval])
109 ]
110)
111
112AC_ARG_WITH(nacl-libs,
113 AC_HELP_STRING([--with-nacl-libs=DIR],
114 [search for nacl libraries in DIR]),
115 [
116 NACL_SEARCH_LIBS="$withval"
117 AC_MSG_NOTICE([will search for nacl libraries in $withval])
118 ]
119)
120
89AC_ARG_WITH(libsodium-headers, 121AC_ARG_WITH(libsodium-headers,
90 AC_HELP_STRING([--with-libsodium-headers=DIR], 122 AC_HELP_STRING([--with-libsodium-headers=DIR],
91 [search for libsodium header files in DIR]), 123 [search for libsodium header files in DIR]),
@@ -132,61 +164,128 @@ AM_CONDITIONAL(WIN32, test "x$WIN32" = "xyes")
132AC_SUBST(EXTRA_LT_LDFLAGS) 164AC_SUBST(EXTRA_LT_LDFLAGS)
133 165
134# Checks for libraries. 166# Checks for libraries.
135LIBSODIUM_LIBS= 167
136LIBSODIUM_LDFLAGS= 168if test "x$WANT_NACL" = "xyes"; then
137LDFLAGS_SAVE="$LDFLAGS" 169 NACL_LIBS=
138if test -n "$LIBSODIUM_SEARCH_LIBS"; then 170 NACL_LDFLAGS=
139 LDFLAGS="-L$LIBSODIUM_SEARCH_LIBS $LDFLAGS" 171 LDFLAGS_SAVE="$LDFLAGS"
140 AC_CHECK_LIB(sodium, randombytes_random, 172 if test -n "$NACL_SEARCH_LIBS"; then
141 [ 173 LDFLAGS="-L$NACL_SEARCH_LIBS $LDFLAGS"
142 LIBSODIUM_LDFLAGS="-L$LIBSODIUM_SEARCH_LIBS" 174 AC_CHECK_LIB(nacl, random,
143 LIBSODIUM_LIBS="-lsodium" 175 [
144 ], 176 NACL_LDFLAGS="-L$NACL_SEARCH_LIBS"
145 [ 177 NACL_LIBS="-lnacl"
146 AC_MSG_ERROR([required library libsodium was not found in requested location $LIBSODIUM_SEARCH_LIBS]) 178 ],
147 ] 179 [
148 ) 180 AC_MSG_ERROR([library nacl was not found in requested location $NACL_SEARCH_LIBS])
181 ]
182 )
183 else
184 AC_CHECK_LIB(nacl, random,
185 [],
186 [
187 AC_MSG_ERROR([you enabled nacl support, but library nacl was not found on your system])
188 ]
189 )
190 fi
191
192 if (test -f "$NACL_SEARCH_LIBS/cpucycles.o") &&
193 (test -f "$NACL_SEARCH_LIBS/randombytes.o"); then
194 NACL_LIBS="$NACL_LIBS $NACL_SEARCH_LIBS/cpucycles.o $NACL_SEARCH_LIBS/randombytes.o"
195 else
196 AC_MSG_ERROR([nacl weirdness: required object files cpucycles.o randombytes.o not found])
197 fi
198
199 LDFLAGS="$LDFLAGS_SAVE"
200 AC_SUBST(NACL_LIBS)
201 AC_SUBST(NACL_LDFLAGS)
149else 202else
150 AC_CHECK_LIB(sodium, randombytes_random, 203 LIBSODIUM_LIBS=
151 [], 204 LIBSODIUM_LDFLAGS=
152 [ 205 LDFLAGS_SAVE="$LDFLAGS"
153 AC_MSG_ERROR([required library libsodium was not found on your system, please check http://download.libsodium.org/libsodium/releases/]) 206 if test -n "$LIBSODIUM_SEARCH_LIBS"; then
154 ] 207 LDFLAGS="-L$LIBSODIUM_SEARCH_LIBS $LDFLAGS"
155 ) 208 AC_CHECK_LIB(sodium, randombytes_random,
156fi 209 [
210 LIBSODIUM_LDFLAGS="-L$LIBSODIUM_SEARCH_LIBS"
211 LIBSODIUM_LIBS="-lsodium"
212 ],
213 [
214 AC_MSG_ERROR([required library libsodium was not found in requested location $LIBSODIUM_SEARCH_LIBS])
215 ]
216 )
217 else
218 AC_CHECK_LIB(sodium, randombytes_random,
219 [],
220 [
221 AC_MSG_ERROR([required library libsodium was not found on your system, please check http://download.libsodium.org/libsodium/releases/])
222 ]
223 )
224 fi
157 225
158LDFLAGS="$LDFLAGS_SAVE" 226 LDFLAGS="$LDFLAGS_SAVE"
159AC_SUBST(LIBSODIUM_LIBS) 227 AC_SUBST(LIBSODIUM_LIBS)
160AC_SUBST(LIBSODIUM_LDFLAGS) 228 AC_SUBST(LIBSODIUM_LDFLAGS)
229fi
161 230
162# Checks for header files. 231# Checks for header files.
163AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h]) 232AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
164 233
165LIBSODIUM_CFLAGS= 234
166CFLAGS_SAVE="$CFLAGS" 235if test "x$WANT_NACL" = "xyes"; then
167CPPFLAGS_SAVE="$CPPFLAGS" 236 NACL_CFLAGS=
168if test -n "$LIBSODIUM_SEARCH_HEADERS"; then 237 CFLAGS_SAVE="$CFLAGS"
169 CFLAGS="-I$LIBSODIUM_SEARCH_HEADERS $CFLAGS" 238 CPPFLAGS_SAVE="$CPPFLAGS"
170 CPPFLAGS="-I$LIBSODIUM_SEARCH_HEADERS $CPPFLAGS" 239 if test -n "$NACL_SEARCH_HEADERS"; then
171 AC_CHECK_HEADER(sodium.h, 240 CFLAGS="-I$NACL_SEARCH_HEADERS $CFLAGS"
172 [ 241 CPPFLAGS="-I$NACL_SEARCH_HEADERS $CPPFLAGS"
173 LIBSODIUM_CFLAGS="-I$LIBSODIUM_SEARCH_HEADERS" 242 AC_CHECK_HEADER(crypto_box.h,
174 ], 243 [
175 [ 244 NACL_CFLAGS="-I$NACL_SEARCH_HEADERS"
176 AC_MSG_ERROR([header files for required library libsodium was not found in requested location $LIBSODIUM_SEARCH_HEADERS]) 245 ],
177 ] 246 [
178 ) 247 AC_MSG_ERROR([header files for library nacl were not found in requested location $NACL_SEARCH_HEADERS])
248 ]
249 )
250 else
251 AC_CHECK_HEADER(crypto_box.h,
252 [],
253 [
254 AC_MSG_ERROR([you enabled nacl support, but nacl header files were not found on your system])
255 ]
256 )
257 fi
258 CFLAGS="$CFLAGS_SAVE"
259 CPPFLAGS="$CPPFLAGS_SAVE"
260 AC_SUBST(NACL_CFLAGS)
261 AC_DEFINE([VANILLA_NACL], [1], [use nacl instead of libsodium])
179else 262else
180 AC_CHECK_HEADER(sodium.h, 263 LIBSODIUM_CFLAGS=
181 [], 264 CFLAGS_SAVE="$CFLAGS"
182 [ 265 CPPFLAGS_SAVE="$CPPFLAGS"
183 AC_MSG_ERROR([header files for required library libsodium was not found on your system, please check http://download.libsodium.org/libsodium/releases/]) 266 if test -n "$LIBSODIUM_SEARCH_HEADERS"; then
184 ] 267 CFLAGS="-I$LIBSODIUM_SEARCH_HEADERS $CFLAGS"
185 ) 268 CPPFLAGS="-I$LIBSODIUM_SEARCH_HEADERS $CPPFLAGS"
269 AC_CHECK_HEADER(sodium.h,
270 [
271 LIBSODIUM_CFLAGS="-I$LIBSODIUM_SEARCH_HEADERS"
272 ],
273 [
274 AC_MSG_ERROR([header files for required library libsodium were not found in requested location $LIBSODIUM_SEARCH_HEADERS])
275 ]
276 )
277 else
278 AC_CHECK_HEADER(sodium.h,
279 [],
280 [
281 AC_MSG_ERROR([header files for required library libsodium was not found on your system, please check http://download.libsodium.org/libsodium/releases/])
282 ]
283 )
284 fi
285 CFLAGS="$CFLAGS_SAVE"
286 CPPFLAGS="$CPPFLAGS_SAVE"
287 AC_SUBST(LIBSODIUM_CFLAGS)
186fi 288fi
187CFLAGS="$CFLAGS_SAVE"
188CPPFLAGS="$CPPFLAGS_SAVE"
189AC_SUBST(LIBSODIUM_CFLAGS)
190 289
191# Checks for typedefs, structures, and compiler characteristics. 290# Checks for typedefs, structures, and compiler characteristics.
192AC_HEADER_STDBOOL 291AC_HEADER_STDBOOL
@@ -201,7 +300,6 @@ AC_TYPE_UINT8_T
201 300
202# Checks for library functions. 301# Checks for library functions.
203AC_FUNC_FORK 302AC_FUNC_FORK
204AC_FUNC_REALLOC
205AC_CHECK_FUNCS([gettimeofday memset socket strchr malloc]) 303AC_CHECK_FUNCS([gettimeofday memset socket strchr malloc])
206 304
207# pkg-config based tests 305# pkg-config based tests
diff --git a/other/Makefile.inc b/other/Makefile.inc
index 2703f26a..736678fd 100644
--- a/other/Makefile.inc
+++ b/other/Makefile.inc
@@ -5,11 +5,14 @@ DHT_bootstrap_SOURCES = ../other/DHT_bootstrap.c \
5 ../toxcore/friend_requests.h 5 ../toxcore/friend_requests.h
6 6
7DHT_bootstrap_CFLAGS = -I$(top_srcdir)/other \ 7DHT_bootstrap_CFLAGS = -I$(top_srcdir)/other \
8 $(LIBSODIUM_CFLAGS) 8 $(LIBSODIUM_CFLAGS) \
9 $(NACL_CFLAGS)
9 10
10DHT_bootstrap_LDADD = $(LIBSODIUM_LDFLAGS) \ 11DHT_bootstrap_LDADD = $(LIBSODIUM_LDFLAGS) \
12 $(NACL_LDFLAGS) \
11 libtoxcore.la \ 13 libtoxcore.la \
12 $(LIBSODIUM_LIBS) \ 14 $(LIBSODIUM_LIBS) \
15 $(NACL_LIBS) \
13 $(WINSOCK2_LIBS) 16 $(WINSOCK2_LIBS)
14 17
15EXTRA_DIST += $(top_srcdir)/other/DHTservers \ 18EXTRA_DIST += $(top_srcdir)/other/DHTservers \
diff --git a/other/bootstrap_serverdaemon/Makefile.inc b/other/bootstrap_serverdaemon/Makefile.inc
index 2eaf7b9c..73b078c3 100644
--- a/other/bootstrap_serverdaemon/Makefile.inc
+++ b/other/bootstrap_serverdaemon/Makefile.inc
@@ -8,13 +8,16 @@ DHT_bootstrap_daemon_SOURCES = \
8DHT_bootstrap_daemon_CFLAGS = \ 8DHT_bootstrap_daemon_CFLAGS = \
9 -I$(top_srcdir)/other/bootstrap_serverdaemon \ 9 -I$(top_srcdir)/other/bootstrap_serverdaemon \
10 $(LIBSODIUM_CFLAGS) \ 10 $(LIBSODIUM_CFLAGS) \
11 $(NACL_CFLAGS) \
11 $(LIBCONFIG_CFLAGS) 12 $(LIBCONFIG_CFLAGS)
12 13
13DHT_bootstrap_daemon_LDADD = \ 14DHT_bootstrap_daemon_LDADD = \
14 $(LIBSODIUM_LDFLAGS) \ 15 $(LIBSODIUM_LDFLAGS) \
16 $(NACL_LDFLAGS) \
15 libtoxcore.la \ 17 libtoxcore.la \
16 $(LIBCONFIG_LIBS) \ 18 $(LIBCONFIG_LIBS) \
17 $(LIBSODIUM_LIBS) 19 $(LIBSODIUM_LIBS) \
20 $(NACL_LIBS)
18 21
19endif 22endif
20 23
diff --git a/testing/DHT_test.c b/testing/DHT_test.c
index 58879134..fce9c257 100644
--- a/testing/DHT_test.c
+++ b/testing/DHT_test.c
@@ -27,6 +27,10 @@
27 * 27 *
28 */ 28 */
29 29
30#ifdef HAVE_CONFIG_H
31#include "config.h"
32#endif
33
30//#include "../core/network.h" 34//#include "../core/network.h"
31#include "../toxcore/DHT.h" 35#include "../toxcore/DHT.h"
32#include "../toxcore/friend_requests.h" 36#include "../toxcore/friend_requests.h"
diff --git a/testing/Lossless_UDP_testclient.c b/testing/Lossless_UDP_testclient.c
index 5777f9e7..d5fb1544 100644
--- a/testing/Lossless_UDP_testclient.c
+++ b/testing/Lossless_UDP_testclient.c
@@ -28,6 +28,10 @@
28 * 28 *
29 */ 29 */
30 30
31#ifdef HAVE_CONFIG_H
32#include "config.h"
33#endif
34
31#include "../toxcore/network.h" 35#include "../toxcore/network.h"
32#include "../toxcore/Lossless_UDP.h" 36#include "../toxcore/Lossless_UDP.h"
33 37
diff --git a/testing/Lossless_UDP_testserver.c b/testing/Lossless_UDP_testserver.c
index c450c91a..eb506b3d 100644
--- a/testing/Lossless_UDP_testserver.c
+++ b/testing/Lossless_UDP_testserver.c
@@ -28,6 +28,10 @@
28 * 28 *
29 */ 29 */
30 30
31#ifdef HAVE_CONFIG_H
32#include "config.h"
33#endif
34
31#include "../toxcore/network.h" 35#include "../toxcore/network.h"
32#include "../toxcore/Lossless_UDP.h" 36#include "../toxcore/Lossless_UDP.h"
33 37
diff --git a/testing/Makefile.inc b/testing/Makefile.inc
index b63e715a..ee68e289 100644
--- a/testing/Makefile.inc
+++ b/testing/Makefile.inc
@@ -6,11 +6,14 @@ nTox_SOURCES = ../testing/nTox.h \
6 ../testing/nTox.c 6 ../testing/nTox.c
7 7
8nTox_CFLAGS = $(LIBSODIUM_CFLAGS) \ 8nTox_CFLAGS = $(LIBSODIUM_CFLAGS) \
9 $(NACL_CFLAGS) \
9 $(NCURSES_CFLAGS) 10 $(NCURSES_CFLAGS)
10 11
11nTox_LDADD = $(LIBSODIUM_LDFLAGS) \ 12nTox_LDADD = $(LIBSODIUM_LDFLAGS) \
13 $(NAC_LDFLAGS) \
12 libtoxcore.la \ 14 libtoxcore.la \
13 $(LIBSODIUM_LIBS) \ 15 $(LIBSODIUM_LIBS) \
16 $(NACL_LIBS) \
14 $(NCURSES_LIBS) \ 17 $(NCURSES_LIBS) \
15 $(WINSOCK2_LIBS) 18 $(WINSOCK2_LIBS)
16endif 19endif
@@ -24,11 +27,14 @@ noinst_PROGRAMS += DHT_test \
24 27
25DHT_test_SOURCES = ../testing/DHT_test.c 28DHT_test_SOURCES = ../testing/DHT_test.c
26 29
27DHT_test_CFLAGS = $(LIBSODIUM_CFLAGS) 30DHT_test_CFLAGS = $(LIBSODIUM_CFLAGS) \
31 $(NACL_CFLAGS)
28 32
29DHT_test_LDADD = $(LIBSODIUM_LDFLAGS) \ 33DHT_test_LDADD = $(LIBSODIUM_LDFLAGS) \
34 $(NACL_LDFLAGS) \
30 libtoxcore.la \ 35 libtoxcore.la \
31 $(LIBSODIUM_LIBS) \ 36 $(LIBSODIUM_LIBS) \
37 $(NACL_LIBS) \
32 $(WINSOCK2_LIBS) 38 $(WINSOCK2_LIBS)
33 39
34 40
@@ -36,12 +42,15 @@ Lossless_UDP_testclient_SOURCES = \
36 ../testing/Lossless_UDP_testclient.c 42 ../testing/Lossless_UDP_testclient.c
37 43
38Lossless_UDP_testclient_CFLAGS = \ 44Lossless_UDP_testclient_CFLAGS = \
39 $(LIBSODIUM_CFLAGS) 45 $(LIBSODIUM_CFLAGS) \
46 $(NACL_CFLAGS)
40 47
41Lossless_UDP_testclient_LDADD = \ 48Lossless_UDP_testclient_LDADD = \
42 $(LIBSODIUM_LDFLAGS) \ 49 $(LIBSODIUM_LDFLAGS) \
50 $(NACL_LDFLAGS) \
43 libtoxcore.la \ 51 libtoxcore.la \
44 $(LIBSODIUM_LIBS) \ 52 $(LIBSODIUM_LIBS) \
53 $(NACL_LIBS) \
45 $(WINSOCK2_LIBS) 54 $(WINSOCK2_LIBS)
46 55
47 56
@@ -49,23 +58,29 @@ Lossless_UDP_testserver_SOURCES = \
49 ../testing/Lossless_UDP_testserver.c 58 ../testing/Lossless_UDP_testserver.c
50 59
51Lossless_UDP_testserver_CFLAGS = \ 60Lossless_UDP_testserver_CFLAGS = \
52 $(LIBSODIUM_CFLAGS) 61 $(LIBSODIUM_CFLAGS) \
62 $(NACL_CFLAGS)
53 63
54Lossless_UDP_testserver_LDADD = \ 64Lossless_UDP_testserver_LDADD = \
55 $(LIBSODIUM_LDFLAGS) \ 65 $(LIBSODIUM_LDFLAGS) \
66 $(NACL_LDFLAGS) \
56 libtoxcore.la \ 67 libtoxcore.la \
57 $(LIBSODIUM_LIBS) \ 68 $(LIBSODIUM_LIBS) \
69 $(NACL_LIBS) \
58 $(WINSOCK2_LIBS) 70 $(WINSOCK2_LIBS)
59 71
60 72
61Messenger_test_SOURCES = \ 73Messenger_test_SOURCES = \
62 ../testing/Messenger_test.c 74 ../testing/Messenger_test.c
63 75
64Messenger_test_CFLAGS = $(LIBSODIUM_CFLAGS) 76Messenger_test_CFLAGS = $(LIBSODIUM_CFLAGS) \
77 $(NACL_CFLAGS)
65 78
66Messenger_test_LDADD = $(LIBSODIUM_LDFLAGS) \ 79Messenger_test_LDADD = $(LIBSODIUM_LDFLAGS) \
80 $(NACL_LDFLAGS) \
67 libtoxcore.la \ 81 libtoxcore.la \
68 $(LIBSODIUM_LIBS) \ 82 $(LIBSODIUM_LIBS) \
83 $(NACL_LIBS) \
69 $(WINSOCK2_LIBS) 84 $(WINSOCK2_LIBS)
70 85
71 86
@@ -73,12 +88,15 @@ crypto_speed_test_SOURCES = \
73 ../testing/crypto_speed_test.c 88 ../testing/crypto_speed_test.c
74 89
75crypto_speed_test_CFLAGS = \ 90crypto_speed_test_CFLAGS = \
76 $(LIBSODIUM_CFLAGS) 91 $(LIBSODIUM_CFLAGS) \
92 $(NACL_CFLAGS)
77 93
78crypto_speed_test_LDADD = \ 94crypto_speed_test_LDADD = \
79 $(LIBSODIUM_LDFLAGS) \ 95 $(LIBSODIUM_LDFLAGS) \
96 $(NACL_LDFLAGS) \
80 libtoxcore.la \ 97 libtoxcore.la \
81 $(LIBSODIUM_LIBS) \ 98 $(LIBSODIUM_LIBS) \
99 $(NACL_LIBS) \
82 $(WINSOCK2_LIBS) 100 $(WINSOCK2_LIBS)
83 101
84EXTRA_DIST += $(top_srcdir)/testing/misc_tools.c 102EXTRA_DIST += $(top_srcdir)/testing/misc_tools.c
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c
index ff34cd4c..e85a85a2 100644
--- a/testing/Messenger_test.c
+++ b/testing/Messenger_test.c
@@ -37,6 +37,10 @@
37 * 37 *
38 */ 38 */
39 39
40#ifdef HAVE_CONFIG_H
41#include "config.h"
42#endif
43
40#include "../toxcore/Messenger.h" 44#include "../toxcore/Messenger.h"
41#include "misc_tools.c" 45#include "misc_tools.c"
42 46
diff --git a/testing/crypto_speed_test.c b/testing/crypto_speed_test.c
index b06c25e1..05f4aaf2 100644
--- a/testing/crypto_speed_test.c
+++ b/testing/crypto_speed_test.c
@@ -1,3 +1,7 @@
1#ifdef HAVE_CONFIG_H
2#include "config.h"
3#endif
4
1// Hi-resolution timer 5// Hi-resolution timer
2#ifdef WIN32 6#ifdef WIN32
3#ifndef WINVER 7#ifndef WINVER
diff --git a/testing/misc_tools.c b/testing/misc_tools.c
index 6e775867..c4dce1bb 100644
--- a/testing/misc_tools.c
+++ b/testing/misc_tools.c
@@ -21,6 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#ifdef HAVE_CONFIG_H
25#include "config.h"
26#endif
27
24#include <string.h> 28#include <string.h>
25#include <stdlib.h> 29#include <stdlib.h>
26#include <stdio.h> 30#include <stdio.h>
diff --git a/toxcore/DHT.c b/toxcore/DHT.c
index 4807c369..e2d91256 100644
--- a/toxcore/DHT.c
+++ b/toxcore/DHT.c
@@ -23,6 +23,10 @@
23 23
24/*----------------------------------------------------------------------------------*/ 24/*----------------------------------------------------------------------------------*/
25 25
26#ifdef HAVE_CONFIG_H
27#include "config.h"
28#endif
29
26#include "DHT.h" 30#include "DHT.h"
27#include "ping.h" 31#include "ping.h"
28#include "misc_tools.h" 32#include "misc_tools.h"
diff --git a/toxcore/LAN_discovery.c b/toxcore/LAN_discovery.c
index 06e5a677..1980cd93 100644
--- a/toxcore/LAN_discovery.c
+++ b/toxcore/LAN_discovery.c
@@ -21,6 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#ifdef HAVE_CONFIG_H
25#include "config.h"
26#endif
27
24#include "LAN_discovery.h" 28#include "LAN_discovery.h"
25 29
26#define MAX_INTERFACES 16 30#define MAX_INTERFACES 16
diff --git a/toxcore/Lossless_UDP.c b/toxcore/Lossless_UDP.c
index 3858716d..fbb473e7 100644
--- a/toxcore/Lossless_UDP.c
+++ b/toxcore/Lossless_UDP.c
@@ -26,6 +26,10 @@
26 * There are a couple of useless variables to get rid of. 26 * There are a couple of useless variables to get rid of.
27 */ 27 */
28 28
29#ifdef HAVE_CONFIG_H
30#include "config.h"
31#endif
32
29#include "Lossless_UDP.h" 33#include "Lossless_UDP.h"
30 34
31 35
diff --git a/toxcore/Makefile.inc b/toxcore/Makefile.inc
index 23584953..5a9002ef 100644
--- a/toxcore/Makefile.inc
+++ b/toxcore/Makefile.inc
@@ -29,10 +29,13 @@ libtoxcore_la_SOURCES = ../toxcore/DHT.h \
29 29
30libtoxcore_la_CFLAGS = -I$(top_srcdir) \ 30libtoxcore_la_CFLAGS = -I$(top_srcdir) \
31 -I$(top_srcdir)/toxcore \ 31 -I$(top_srcdir)/toxcore \
32 $(LIBSODIUM_CFLAGS) 32 $(LIBSODIUM_CFLAGS) \
33 $(NACL_CFLAGS)
33 34
34libtoxcore_la_LDFLAGS = $(EXTRA_LT_LDFLAGS) \ 35libtoxcore_la_LDFLAGS = $(EXTRA_LT_LDFLAGS) \
35 $(LIBSODIUM_LDFLAGS) \ 36 $(LIBSODIUM_LDFLAGS) \
37 $(NACL_LDFLAGS) \
36 $(WINSOCK2_LIBS) 38 $(WINSOCK2_LIBS)
37 39
38libtoxcore_la_LIBS = $(LIBSODIUM_LIBS) 40libtoxcore_la_LIBS = $(LIBSODIUM_LIBS) \
41 $(NAC_LIBS)
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index 846bed6d..6550b540 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -21,6 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#ifdef HAVE_CONFIG_H
25#include "config.h"
26#endif
27
24#include "Messenger.h" 28#include "Messenger.h"
25 29
26#define MIN(a,b) (((a)<(b))?(a):(b)) 30#define MIN(a,b) (((a)<(b))?(a):(b))
diff --git a/toxcore/friend_requests.c b/toxcore/friend_requests.c
index 6e98f18b..b01015c4 100644
--- a/toxcore/friend_requests.c
+++ b/toxcore/friend_requests.c
@@ -21,6 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#ifdef HAVE_CONFIG_H
25#include "config.h"
26#endif
27
24#include "friend_requests.h" 28#include "friend_requests.h"
25 29
26/* Try to send a friend request to peer with public_key. 30/* Try to send a friend request to peer with public_key.
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c
index b20917cf..a182bb53 100644
--- a/toxcore/net_crypto.c
+++ b/toxcore/net_crypto.c
@@ -24,6 +24,10 @@
24 * 24 *
25 */ 25 */
26 26
27#ifdef HAVE_CONFIG_H
28#include "config.h"
29#endif
30
27#include "net_crypto.h" 31#include "net_crypto.h"
28 32
29#define CONN_NO_CONNECTION 0 33#define CONN_NO_CONNECTION 0
diff --git a/toxcore/network.c b/toxcore/network.c
index 9e329949..ed3dff8a 100644
--- a/toxcore/network.c
+++ b/toxcore/network.c
@@ -21,6 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#ifdef HAVE_CONFIG_H
25#include "config.h"
26#endif
27
24#include "network.h" 28#include "network.h"
25 29
26/* return current UNIX time in microseconds (us). */ 30/* return current UNIX time in microseconds (us). */
diff --git a/toxcore/network.h b/toxcore/network.h
index ca79a81b..2d08e88d 100644
--- a/toxcore/network.h
+++ b/toxcore/network.h
@@ -39,8 +39,6 @@
39#include <windows.h> 39#include <windows.h>
40#include <ws2tcpip.h> 40#include <ws2tcpip.h>
41 41
42#undef VANILLA_NACL /* Make sure on Windows we use libsodium. */
43
44#else // Linux includes 42#else // Linux includes
45 43
46#include <fcntl.h> 44#include <fcntl.h>
diff --git a/toxcore/ping.c b/toxcore/ping.c
index db7333d3..3b39d911 100644
--- a/toxcore/ping.c
+++ b/toxcore/ping.c
@@ -5,6 +5,10 @@
5 * Copyright 2013 plutooo 5 * Copyright 2013 plutooo
6 */ 6 */
7 7
8#ifdef HAVE_CONFIG_H
9#include "config.h"
10#endif
11
8#include <stdbool.h> 12#include <stdbool.h>
9#include <stdint.h> 13#include <stdint.h>
10 14
diff --git a/toxcore/tox.c b/toxcore/tox.c
index e55f51ca..0af07ede 100644
--- a/toxcore/tox.c
+++ b/toxcore/tox.c
@@ -21,6 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#ifdef HAVE_CONFIG_H
25#include "config.h"
26#endif
27
24#include "Messenger.h" 28#include "Messenger.h"
25/* 29/*
26 * returns a FRIEND_ADDRESS_SIZE byte address to give to others. 30 * returns a FRIEND_ADDRESS_SIZE byte address to give to others.
diff --git a/toxcore/util.c b/toxcore/util.c
index 59609340..1728ea21 100644
--- a/toxcore/util.c
+++ b/toxcore/util.c
@@ -5,6 +5,10 @@
5 * Copyright 2013 plutooo 5 * Copyright 2013 plutooo
6 */ 6 */
7 7
8#ifdef HAVE_CONFIG_H
9#include "config.h"
10#endif
11
8#include <time.h> 12#include <time.h>
9#include <stdint.h> 13#include <stdint.h>
10#include <stdbool.h> 14#include <stdbool.h>