1dnl XIPH_PATH_OPENSSL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) 2dnl Karl Heyes <karl@xiph.org> 3dnl Test for openssl, and define OPENSSL_CFLAGS and OPENSSL_LIBS 4dnl 5AC_DEFUN([XIPH_PATH_OPENSSL], 6[dnl 7dnl Get the cflags and libraries 8dnl 9AC_ARG_WITH(openssl, 10 AC_HELP_STRING([--with-openssl=PFX],[Prefix where openssl is installed (optional)]), 11 openssl_prefix="$withval", openssl_prefix="") 12 13if test "x$openssl_prefix" != "x" -a "x$openssl_prefix" != "xyes"; then 14 OPENSSL_LIBS="-L$openssl_prefix/lib -lssl" 15 OPENSSL_CFLAGS="-I$openssl_prefix/include" 16else 17 AC_PATH_PROG([PKGCONFIG], [pkg-config], [no]) 18 if test "$PKGCONFIG" != "no" && `$PKGCONFIG --exists openssl`; then 19 OPENSSL_CFLAGS=`$PKGCONFIG --cflags openssl` 20 OPENSSL_LIBS=`$PKGCONFIG --libs openssl` 21 else 22 if test "x$prefix" = "xNONE"; then 23 openssl_prefix="/usr/local" 24 else 25 openssl_prefix="$prefix" 26 fi 27 OPENSSL_LIBS="-L$openssl_prefix/lib -lssl" 28 OPENSSL_CFLAGS="-I$openssl_prefix/include" 29 fi 30fi 31 32# Now try linking to openssl 33xt_save_CFLAGS="$CFLAGS" 34xt_save_LIBS="$LIBS" 35CFLAGS="$CFLAGS $OPENSSL_CFLAGS" 36LIBS="$OPENSSL_LIBS $LIBS" 37AC_TRY_LINK([#include <openssl/ssl.h>], [void *a = SSL_new], [openssl_ok='yes']) 38CFLAGS="$xt_save_CFLAGS" 39LIBS="$xt_save_LIBS" 40 41if test "$openssl_ok" = "yes"; then 42 AC_DEFINE(HAVE_OPENSSL, 1, [Define if you have libopenssl.]) 43 ifelse([$1], , :, [$1]) 44else 45 OPENSSL_LIBS="" 46 OPENSSL_CFLAGS="" 47 ifelse([$2], , :, [$2]) 48fi 49]) 50