[vlc-commits] configure: fix gcrypt test
Rémi Denis-Courmont
git at videolan.org
Sat Aug 6 10:08:49 CEST 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Aug 6 11:06:23 2016 +0300| [f94ac7241f33b6896a8e12ae4e3e43d9fd7fb6cc] | committer: Rémi Denis-Courmont
configure: fix gcrypt test
* Mark GCRYPT_CFLAGS and GCRYPT_LIBS as precious.
* Actually use GCRYPT_CFLAGS during compilation test.
* Use newer AC_COMPILE_IFELSE.
* Use caching.
* Provide sane default for GCRYPT_LIBS.
* Do not invoke broken NIH libgcrypt-config script.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f94ac7241f33b6896a8e12ae4e3e43d9fd7fb6cc
---
configure.ac | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/configure.ac b/configure.ac
index 72da07c..8d10cc6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4042,28 +4042,42 @@ dnl libgcrypt
dnl
AC_ARG_ENABLE(libgcrypt,
[ --disable-libgcrypt gcrypt support (default enabled)])
+AC_ARG_VAR([GCRYPT_CFLAGS], [C compiler flags for gcrypt])
+AC_ARG_VAR([GCRYPT_LIBS], [linker flags flags for gcrypt])
+
# require libgcrypt >= 1.6.0
AS_IF([test "${enable_libgcrypt}" != "no"], [
- AC_TRY_COMPILE([
-#include <gcrypt.h>
+ AC_CACHE_CHECK([for gcrypt 1.6.0 or later], [ac_cv_lib_gcrypt], [
+ VLC_SAVE_FLAGS
+ CFLAGS="${CFLAGS} ${GCRYPT_CFLAGS}"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
+[#include <gcrypt.h>
#if GCRYPT_VERSION_NUMBER < 0x010600
#error
-#endif],
- [], [
- have_libgcrypt="yes"
+#endif]])], [
+ ac_cv_lib_gcrypt=yes
+ ], [
+ ac_cv_lib_gcrypt=no
+ ])
+ VLC_RESTORE_FLAGS
+ ])
+
+ AS_IF([test "${ac_cv_lib_gcrypt}" = "yes"], [
AC_DEFINE([HAVE_GCRYPT], 1, [Defined if having gcrypt])
- GCRYPT_CFLAGS="`libgcrypt-config --cflags`"
- GCRYPT_LIBS="`libgcrypt-config --libs`"
], [
- AS_IF([test "${enable_libgcrypt}" == "yes"], [
+ AS_IF([test "${enable_libgcrypt}" = "yes"], [
AC_MSG_ERROR([libgcrypt version 1.6.0 or higher not found. Install libgcrypt or pass --disable-libgcrypt.])
])
])
])
+AS_IF([test -z "$GCRYPT_LIBS"], [
+ GCRYPT_LIBS="-lgcrypt -lgpg-error"
+])
+
AC_SUBST(GCRYPT_CFLAGS)
AC_SUBST(GCRYPT_LIBS)
-AM_CONDITIONAL([HAVE_GCRYPT], [test "${have_libgcrypt}" = "yes"])
+AM_CONDITIONAL([HAVE_GCRYPT], [test "${ac_cv_lib_gcrypt}" = "yes"])
dnl
dnl TLS/SSL
More information about the vlc-commits
mailing list