Skip to content

Commit

Permalink
use ax_check_openssl.m4 instead of a direct use of pkg-config.
Browse files Browse the repository at this point in the history
on some platforms, including NetBSD-6, openssl is available but
its pkg-config files (*.pc) are not.  according to Ed Maste,
this is the case for FreeBSD as well.

Signed-off-by: YAMAMOTO Takashi <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
yamt authored and blp committed Apr 22, 2013
1 parent 7042347 commit 0f31bef
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
38 changes: 19 additions & 19 deletions m4/ax_check_openssl.m4
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
# Look for OpenSSL in a number of default spots, or in a user-selected
# spot (via --with-openssl). Sets
#
# OPENSSL_INCLUDES to the include directives required
# OPENSSL_LIBS to the -l directives required
# OPENSSL_LDFLAGS to the -L or -R flags required
# SSL_INCLUDES to the include directives required
# SSL_LIBS to the -l directives required
# SSL_LDFLAGS to the -L or -R flags required
#
# and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
#
# This macro sets OPENSSL_INCLUDES such that source files should use the
# This macro sets SSL_INCLUDES such that source files should use the
# openssl/ directory in include directives:
#
# #include <openssl/hmac.h>
Expand Down Expand Up @@ -53,10 +53,10 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
# then use that information and don't search ssldirs
AC_PATH_PROG([PKG_CONFIG], [pkg-config])
if test x"$PKG_CONFIG" != x""; then
OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
SSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
if test $? = 0; then
OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
SSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
SSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
found=true
fi
fi
Expand All @@ -73,13 +73,13 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
# an 'openssl' subdirectory
if ! $found; then
OPENSSL_INCLUDES=
SSL_INCLUDES=
for ssldir in $ssldirs; do
AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
if test -f "$ssldir/include/openssl/ssl.h"; then
OPENSSL_INCLUDES="-I$ssldir/include"
OPENSSL_LDFLAGS="-L$ssldir/lib"
OPENSSL_LIBS="-lssl -lcrypto"
SSL_INCLUDES="-I$ssldir/include"
SSL_LDFLAGS="-L$ssldir/lib"
SSL_LIBS="-lssl -lcrypto"
found=true
AC_MSG_RESULT([yes])
break
Expand All @@ -96,15 +96,15 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
# being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \
"OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
echo "Trying link with SSL_LDFLAGS=$SSL_LDFLAGS;" \
"SSL_LIBS=$SSL_LIBS; SSL_INCLUDES=$SSL_INCLUDES" >&AS_MESSAGE_LOG_FD
save_LIBS="$LIBS"
save_LDFLAGS="$LDFLAGS"
save_CPPFLAGS="$CPPFLAGS"
LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
LIBS="$OPENSSL_LIBS $LIBS"
CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
LIBS="$SSL_LIBS $LIBS"
CPPFLAGS="$SSL_INCLUDES $CPPFLAGS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
[
Expand All @@ -118,7 +118,7 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
LDFLAGS="$save_LDFLAGS"
LIBS="$save_LIBS"
AC_SUBST([OPENSSL_INCLUDES])
AC_SUBST([OPENSSL_LIBS])
AC_SUBST([OPENSSL_LDFLAGS])
AC_SUBST([SSL_INCLUDES])
AC_SUBST([SSL_LIBS])
AC_SUBST([SSL_LDFLAGS])
])
3 changes: 1 addition & 2 deletions m4/openvswitch.m4
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ AC_DEFUN([OVS_CHECK_OPENSSL],
[ssl=check])
if test "$ssl" != false; then
m4_ifndef([PKG_CHECK_MODULES], [m4_fatal([Please install pkg-config.])])
PKG_CHECK_MODULES([SSL], [openssl],
AX_CHECK_OPENSSL(
[HAVE_OPENSSL=yes],
[HAVE_OPENSSL=no
if test "$ssl" = check; then
Expand Down

0 comments on commit 0f31bef

Please sign in to comment.