Build didn't work if libsodium wasn't installed

This commit is contained in:
Pieter Hintjens 2013-09-13 09:47:23 +02:00
parent 3298e5a206
commit 0db2bbe29d

View File

@ -27,11 +27,16 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
#include <sodium.h> #include "../src/platform.hpp"
#include "z85_codec.h"
#ifdef HAVE_LIBSODIUM
# include <sodium.h>
# include "z85_codec.h"
#endif
int main (void) int main (void)
{ {
#ifdef HAVE_LIBSODIUM
# if crypto_box_PUBLICKEYBYTES != 32 \ # if crypto_box_PUBLICKEYBYTES != 32 \
|| crypto_box_SECRETKEYBYTES != 32 || crypto_box_SECRETKEYBYTES != 32
# error "libsodium not built correctly" # error "libsodium not built correctly"
@ -59,5 +64,8 @@ int main (void)
puts ("\n== CURVE SECRET KEY =="); puts ("\n== CURVE SECRET KEY ==");
puts (encoded); puts (encoded);
#else
puts ("To build curve_keygen, please install libsodium and then rebuild libzmq.");
#endif
exit (0); exit (0);
} }