mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-04 07:27:26 +01:00
Merge pull request #1782 from minrk/configure-with-tweetnacl
fallback on tweetnacl if libsodium is not found and not explicitly requested
This commit is contained in:
commit
c59670dbc2
@ -274,6 +274,15 @@ src_libzmq_la_CPPFLAGS += ${sodium_CFLAGS}
|
||||
src_libzmq_la_LIBADD += ${sodium_LIBS}
|
||||
endif
|
||||
|
||||
if USE_TWEETNACL
|
||||
src_libzmq_la_SOURCES += \
|
||||
tweetnacl/src/tweetnacl.c \
|
||||
tweetnacl/contrib/randombytes/devurandom.c
|
||||
src_libzmq_la_CXXFLAGS += \
|
||||
-I$(top_builddir)/tweetnacl/contrib/randombytes \
|
||||
-I$(top_builddir)/tweetnacl/src
|
||||
endif
|
||||
|
||||
if HAVE_PGM
|
||||
src_libzmq_la_CPPFLAGS += ${pgm_CFLAGS}
|
||||
src_libzmq_la_LIBADD += ${pgm_LIBS}
|
||||
|
32
configure.ac
32
configure.ac
@ -427,13 +427,34 @@ fi
|
||||
have_sodium_library="no"
|
||||
|
||||
AC_ARG_WITH([libsodium], [AS_HELP_STRING([--with-libsodium],
|
||||
[require libzmq build with libsodium crypto library. Requires pkg-config [default=yes]])],
|
||||
[require libzmq build with libsodium crypto library. Requires pkg-config [default=check]])],
|
||||
[require_libsodium_ext=$withval],
|
||||
[require_libsodium_ext=yes])
|
||||
[require_libsodium_ext=check])
|
||||
|
||||
AC_ARG_WITH([tweetnacl], [AS_HELP_STRING([--with-tweetnacl],
|
||||
[build libzmq with bundled tweetnacl crypto library [default=no]])],
|
||||
[require_libsodium_ext=no
|
||||
with_tweetnacl=yes
|
||||
AC_MSG_CHECKING(for sodium)
|
||||
AC_MSG_RESULT(tweetnacl)],
|
||||
[with_tweetnacl=check])
|
||||
|
||||
# conditionally require libsodium package
|
||||
if test "x$require_libsodium_ext" != "xno"; then
|
||||
PKG_CHECK_MODULES([sodium], [libsodium], [have_sodium_library="yes"])
|
||||
PKG_CHECK_MODULES([sodium], [libsodium],
|
||||
[
|
||||
have_sodium_library=yes
|
||||
with_tweetnacl=no
|
||||
],
|
||||
[
|
||||
if test "x$require_libsodium_ext" == "xyes"; then
|
||||
AC_MSG_ERROR(libsodium has been requested but not found)
|
||||
else
|
||||
AC_MSG_RESULT([ libsodium not found, using tweetnacl])
|
||||
have_sodium_library=no
|
||||
with_tweetnacl=yes
|
||||
fi
|
||||
])
|
||||
fi
|
||||
|
||||
if test "x$have_sodium_library" != "xno"; then
|
||||
@ -446,10 +467,13 @@ if test "x$have_sodium_library" != "xno"; then
|
||||
CPPFLAGS="$CPPFLAGS -Wno-long-long"
|
||||
;;
|
||||
esac
|
||||
elif test "x$with_tweetnacl" != "xno"; then
|
||||
AC_DEFINE(HAVE_LIBSODIUM, 1, [Sodium is provided by tweetnacl.])
|
||||
AC_DEFINE(HAVE_TWEETNACL, 1, [Using tweetnacl.])
|
||||
fi
|
||||
|
||||
|
||||
AM_CONDITIONAL(HAVE_SODIUM, test "x$have_sodium_library" != "xno")
|
||||
AM_CONDITIONAL(USE_TWEETNACL, test "x$with_tweetnacl" != "xno")
|
||||
|
||||
# build using pgm
|
||||
have_pgm_library="no"
|
||||
|
Loading…
x
Reference in New Issue
Block a user