Skip to content

Commit

Permalink
update configure file
Browse files Browse the repository at this point in the history
  • Loading branch information
madeye committed Dec 13, 2014
1 parent a0d773c commit c4e5512
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,68 @@ AC_DISABLE_STATIC
AC_DISABLE_SHARED
LT_INIT([dlopen])

dnl Checks for libsodium
LIBSODIUM_SEARCH_HEADERS=
LIBSODIUM_SEARCH_LIBS=
AC_ARG_WITH(libsodium-headers,
AC_HELP_STRING([--with-libsodium-headers=DIR],
[search for libsodium header files in DIR]),
[
LIBSODIUM_SEARCH_HEADERS="$withval"
AC_MSG_NOTICE([will search for libsodium header files in $withval])
]
)

AC_ARG_WITH(libsodium-libs,
AC_HELP_STRING([--with-libsodium-libs=DIR],
[search for libsodium libraries in DIR]),
[
LIBSODIUM_SEARCH_LIBS="$withval"
AC_MSG_NOTICE([will search for libsodium libraries in $withval])
]
)

LIBSODIUM_LIBS=
LIBSODIUM_LDFLAGS=
LDFLAGS_SAVE="$LDFLAGS"
if test -n "$LIBSODIUM_SEARCH_LIBS"; then
LDFLAGS="-L$LIBSODIUM_SEARCH_LIBS $LDFLAGS"
AC_CHECK_LIB(sodium, crypto_stream_salsa20_xor_ic,
[
LIBSODIUM_LDFLAGS="-L$LIBSODIUM_SEARCH_LIBS"
LIBSODIUM_LIBS="-lsodium"
],
[
AC_MSG_ERROR([required library libsodium was not found in requested location $LIBSODIUM_SEARCH_LIBS or library version is too old])
]
)
else
AC_CHECK_LIB(sodium, crypto_stream_salsa20_xor_ic)
fi

LIBSODIUM_CFLAGS=
CFLAGS_SAVE="$CFLAGS"
if test -n "$LIBSODIUM_SEARCH_HEADERS"; then
CFLAGS="-I$LIBSODIUM_SEARCH_HEADERS $CFLAGS"
AC_CHECK_HEADER(sodium.h,
[
LIBSODIUM_CFLAGS="-I$LIBSODIUM_SEARCH_HEADERS"
],
[
AC_MSG_ERROR([header files for required library libsodium were not found in requested location $LIBSODIUM_SEARCH_HEADERS])
]
)
else
AC_CHECK_HEADERS([sodium.h])
fi

CFLAGS="$CFLAGS_SAVE"
AC_SUBST(LIBSODIUM_CFLAGS)

LDFLAGS="$LDFLAGS_SAVE"
AC_SUBST(LIBSODIUM_LIBS)
AC_SUBST(LIBSODIUM_LDFLAGS)

dnl Checks for crypto library
AC_ARG_WITH(
[crypto-library],
Expand Down

0 comments on commit c4e5512

Please sign in to comment.