Skip to content

Commit

Permalink
build: use libgcrypt-config if pkg-config is not available for libcrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaian committed Jul 10, 2024
1 parent dad1033 commit 9fac985
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,30 @@ AS_IF([test "x$WITH_GNUTLS" = "xyes"], [
])
])
AC_PATH_PROG([LIBGCRYPT_CONFIG],[libgcrypt-config],[no])
if test "x${LIBGCRYPT_CONFIG}" = "xno"; then
AC_MSG_FAILURE([libgcrypt-config not found in PATH])
fi
AC_CHECK_LIB(
[gcrypt],
[gcry_md_map_name],
[LIBGCRYPT_CFLAGS="`${LIBGCRYPT_CONFIG} --cflags`"
LIBGCRYPT_LIBS="`${LIBGCRYPT_CONFIG} --libs`"
],
[AC_MSG_ERROR([ You need to have libgcrypt installed to compile sngrep])],
[`${LIBGCRYPT_CONFIG} --libs --cflags`]
)
AC_DEFINE([WITH_GNUTLS],[],[Compile With GnuTLS compatibility])
AC_SUBST(LIBGCRYPT_CFLAGS)
AC_SUBST(LIBGCRYPT_LIBS)
m4_ifdef([PKG_CHECK_MODULES], [
PKG_CHECK_MODULES([LIBGCRYPT], [libgcrypt])
], [
AC_PATH_PROG([LIBGCRYPT_CONFIG],[libgcrypt-config],[no])
if test "x${LIBGCRYPT_CONFIG}" = "xno"; then
AC_MSG_FAILURE([libgcrypt-config not found in PATH])
else
AC_CHECK_LIB(
[gcrypt],
[gcry_md_map_name],
[
LIBGCRYPT_CFLAGS="`${LIBGCRYPT_CONFIG} --cflags`"
LIBGCRYPT_LIBS="`${LIBGCRYPT_CONFIG} --libs`"
], [
AC_MSG_ERROR([ You need to have libgcrypt installed to compile sngrep])
],[
`${LIBGCRYPT_CONFIG} --libs --cflags`
]
)
fi
])
AC_DEFINE([WITH_GNUTLS],[],[Compile With GnuTLS compatibility])
AC_SUBST(LIBGCRYPT_CFLAGS)
AC_SUBST(LIBGCRYPT_LIBS)
], [])

####
Expand Down

0 comments on commit 9fac985

Please sign in to comment.