Use PKG_CONFIG_PATH along with PKG_CHECK_MODULES in openssl.m4 and libz.m4.

Replaced LIBZ_LIB and LIBZ_CPPFLAGS with ZLIB_LIB and ZLIB_CFLAGS
respectively.
pull/1/head
Tatsuhiro Tsujikawa 2011-02-18 21:51:23 +09:00
parent 3f125dce21
commit 5b62fa9ab1
3 changed files with 30 additions and 33 deletions

View File

@ -144,8 +144,8 @@ fi
if test "x$with_libz" = "xyes"; then
AM_PATH_LIBZ
if test "x$have_libz" = "xyes"; then
LIBS="$LIBZ_LIBS $LIBS"
CPPFLAGS="$LIBZ_CPPFLAGS $CPPFLAGS"
LIBS="$ZLIB_LIBS $LIBS"
CPPFLAGS="$ZLIB_CFLAGS $CPPFLAGS"
elif test "x$with_libz_requested" = "xyes"; then
ARIA2_DEP_NOT_MET([libz])
fi

View File

@ -9,25 +9,32 @@ if test "x$libz_prefix" = "x"; then
libz_prefix="/usr"
fi
libz_prefix_lib=$libz_prefix/lib
libz_prefix_include=$libz_prefix/include
LIBS_save=$LIBS
CPPFLAGS_save=$CPPFLAGS
PKG_CONFIG_PATH_save=$PKG_CONFIG_PATH
LIBS="-L$libz_prefix_lib $LIBS"
CPPFLAGS="-I$libz_prefix_include $CPPFLAGS"
PKG_CONFIG_PATH="$libz_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3], [have_libz=yes], [have_libz=no])
if test "x$have_libz" != "xyes"; then
libz_prefix_lib=$libz_prefix/lib
libz_prefix_include=$libz_prefix/include
LIBS="-L$libz_prefix_lib $LIBS"
CPPFLAGS="-I$libz_prefix_include $CPPFLAGS"
AC_CHECK_LIB([z], [zlibVersion], [have_libz=yes])
if test "x$have_libz" = "xyes"; then
ZLIB_LIBS="-L$libz_prefix_lib -lz"
ZLIB_CFLAGS="-I$libz_prefix_include"
fi
fi
AC_CHECK_LIB([z], [zlibVersion], [have_libz=yes])
if test "x$have_libz" = "xyes"; then
AC_DEFINE([HAVE_LIBZ], [1], [Define to 1 if you have libz.])
LIBZ_LIBS="-L$libz_prefix_lib -lz"
LIBZ_CPPFLAGS="-I$libz_prefix_include"
AC_SUBST(LIBZ_LIBS)
AC_SUBST(LIBZ_CPPFLAGS)
AC_DEFINE([HAVE_LIBZ], [1], [Define to 1 if you have libz.])
fi
LIBS=$LIBS_save
CPPFLAGS=$CPPFLAGS_save
PKG_CONFIG_PATH=$PKG_CONFIG_PATH_save
])

View File

@ -11,24 +11,12 @@ fi
LIBS_save=$LIBS
CPPFLAGS_save=$CPPFLAGS
PKG_CONFIG_PATH_save=$PKG_CONFIG_PATH
PKG_CONFIG="$openssl_prefix/bin/pkg-config"
if test -x $PKG_CONFIG; then
AC_MSG_CHECKING([checking availability of openssl using pkg-config])
$PKG_CONFIG --exists openssl
if test "$?" = "0"; then
# Use pkg-config to detect LIBS and CFLAGS
OPENSSL_LIBS=`$PKG_CONFIG --libs openssl`
OPENSSL_CFLAGS=`$PKG_CONFIG --cflags openssl`
PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
PKG_CHECK_MODULES([OPENSSL], [openssl >= 0.9.8],
[have_openssl=yes], [have_openssl=no])
LIBS="$OPENSSL_LIBS $LIBS"
CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
have_openssl=yes
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
if test "x$have_openssl" != "xyes"; then
openssl_prefix_lib=$openssl_prefix/lib
openssl_prefix_include=$openssl_prefix/include
@ -40,7 +28,8 @@ if test "x$have_openssl" != "xyes"; then
AC_CHECK_LIB([crypto], [main], [have_openssl=yes; LIBS="-lcrypto $LIBS"])
if test "x$have_openssl" = "xyes"; then
have_openssl=no
AC_CHECK_LIB([ssl], [SSL_library_init], [have_openssl=yes LIBS="-lssl $LIBS"])
AC_CHECK_LIB([ssl], [SSL_library_init],
[have_openssl=yes LIBS="-lssl $LIBS"])
if test "x$have_openssl" = "xyes"; then
OPENSSL_LIBS="-L$openssl_prefix_lib -lssl -lcrypto"
OPENSSL_CFLAGS="-I$openssl_prefix_include"
@ -50,13 +39,13 @@ fi
if test "x$have_openssl" = "xyes"; then
AC_DEFINE([HAVE_LIBSSL], [1], [Define to 1 if you have openssl.])
LIBS="$OPENSSL_LIBS $LIBS"
CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
# check whether EVP_DigestInit_ex exists. Old openssl doesn't have it.
AC_CHECK_FUNCS([EVP_DigestInit_ex], [have_digestinit_ex=yes])
if test "x$have_digestinit_ex" = "x"; then
AC_DEFINE([HAVE_OLD_LIBSSL], [1], [Define to 1 if you have old openssl.])
fi
AC_SUBST(OPENSSL_LIBS)
AC_SUBST(OPENSSL_CFLAGS)
# search for sha224 support
AC_CHECK_FUNCS([EVP_sha224])
# search for sha256 support
@ -69,4 +58,5 @@ fi
LIBS=$LIBS_save
CPPFLAGS=$CPPFLAGS_save
PKG_CONFIG_PATH=$PKG_CONFIG_PATH_save
])