165b390aaSDag-Erling Smørgrav# dnscrypt.m4 265b390aaSDag-Erling Smørgrav 365b390aaSDag-Erling Smørgrav# dnsc_DNSCRYPT([action-if-true], [action-if-false]) 465b390aaSDag-Erling Smørgrav# -------------------------------------------------------------------------- 565b390aaSDag-Erling Smørgrav# Check for required dnscrypt libraries and add dnscrypt configure args. 665b390aaSDag-Erling SmørgravAC_DEFUN([dnsc_DNSCRYPT], 765b390aaSDag-Erling Smørgrav[ 865b390aaSDag-Erling Smørgrav AC_ARG_ENABLE([dnscrypt], 965b390aaSDag-Erling Smørgrav AS_HELP_STRING([--enable-dnscrypt], 1065b390aaSDag-Erling Smørgrav [Enable dnscrypt support (requires libsodium)]), 1165b390aaSDag-Erling Smørgrav [opt_dnscrypt=$enableval], [opt_dnscrypt=no]) 1265b390aaSDag-Erling Smørgrav 1365b390aaSDag-Erling Smørgrav if test "x$opt_dnscrypt" != "xno"; then 14*f44e67d1SCy Schubert AC_ARG_WITH([libsodium], AS_HELP_STRING([--with-libsodium=path], 1565b390aaSDag-Erling Smørgrav [Path where libsodium is installed, for dnscrypt]), [ 1665b390aaSDag-Erling Smørgrav CFLAGS="$CFLAGS -I$withval/include" 1765b390aaSDag-Erling Smørgrav LDFLAGS="$LDFLAGS -L$withval/lib" 1865b390aaSDag-Erling Smørgrav ]) 1965b390aaSDag-Erling Smørgrav AC_SEARCH_LIBS([sodium_init], [sodium], [], 2065b390aaSDag-Erling Smørgrav AC_MSG_ERROR([The sodium library was not found. Please install sodium!])) 21c7f4d7adSDag-Erling Smørgrav AC_SEARCH_LIBS([crypto_box_curve25519xchacha20poly1305_beforenm], [sodium], 22c7f4d7adSDag-Erling Smørgrav [ 23c7f4d7adSDag-Erling Smørgrav AC_SUBST([ENABLE_DNSCRYPT_XCHACHA20], [1]) 24c7f4d7adSDag-Erling Smørgrav AC_DEFINE( 25c7f4d7adSDag-Erling Smørgrav [USE_DNSCRYPT_XCHACHA20], [1], 26c7f4d7adSDag-Erling Smørgrav [Define to 1 to enable dnscrypt with xchacha20 support]) 27c7f4d7adSDag-Erling Smørgrav ], 28c7f4d7adSDag-Erling Smørgrav [ 29c7f4d7adSDag-Erling Smørgrav AC_SUBST([ENABLE_DNSCRYPT_XCHACHA20], [0]) 30c7f4d7adSDag-Erling Smørgrav ]) 3157bddd21SDag-Erling Smørgrav AC_SEARCH_LIBS([sodium_set_misuse_handler], [sodium], 3257bddd21SDag-Erling Smørgrav [ 3357bddd21SDag-Erling Smørgrav AC_DEFINE( 3457bddd21SDag-Erling Smørgrav [SODIUM_MISUSE_HANDLER], [1], 3557bddd21SDag-Erling Smørgrav [Define to 1 if libsodium supports sodium_set_misuse_handler]) 3657bddd21SDag-Erling Smørgrav ], 3757bddd21SDag-Erling Smørgrav [ 3857bddd21SDag-Erling Smørgrav ]) 3965b390aaSDag-Erling Smørgrav $1 4065b390aaSDag-Erling Smørgrav else 41c7f4d7adSDag-Erling Smørgrav AC_SUBST([ENABLE_DNSCRYPT_XCHACHA20], [0]) 4265b390aaSDag-Erling Smørgrav $2 4365b390aaSDag-Erling Smørgrav fi 4465b390aaSDag-Erling Smørgrav]) 45