[systemd-devel] [PATCH 1/1] configure.ac: make libgcrypt dependency optional

Djalal Harouni tixxdz at opendz.org
Fri Nov 1 18:11:49 PDT 2013


Currently systemd will fail to build if libgcrypt headers are not
installed:

autoge.sh output:
...
libtoolize: linking file `m4/lt~obsolete.m4'
configure.ac:547: warning: macro 'AM_PATH_LIBGCRYPT' not found in library
configure.ac:47: error: possibly undefined macro: AC_MSG_ERROR
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:547: error: possibly undefined macro: AM_PATH_LIBGCRYPT
autoreconf: /usr/bin/autoconf failed with exit status: 1

configure output:
...
checking for fsetxattr in -lattr... yes
./configure: line 17100: syntax error near unexpected token `newline'
./configure: line 17100: `        AM_PATH_LIBGCRYPT('

The macro AM_PATH_LIBGCRYPT is used to check if libgcrypt support is
present, but if libgcrypt headers are missing then this macro is
undefined and the build process will fail.

Fix this by removing the AM_PATH_LIBGCRYPT macro and convert the
libgcrypt headers check to be consistent with other systemd library
checks.

This will remove the libgcrypt version check from configure.ac and
delay it to be done during runtime, precisely during libgcrypt
intialization by the gcry_check_version() function. The manuals of
libgcrypt suggest this which is already done by systemd.

All the calls to this function are followed by an assert() check to
make sure that we are using the required version.
---
 configure.ac | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7e41d57..ade172d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -544,13 +544,21 @@ AC_ARG_ENABLE([gcrypt],
                 [have_gcrypt=auto])
 
 if test "x${have_gcrypt}" != xno ; then
-        AM_PATH_LIBGCRYPT(
-                [1.4.5],
+        AC_CHECK_HEADER(
+                [gcrypt.h],
                 [have_gcrypt=yes],
                 [if test "x$have_gcrypt" = xyes ; then
                         AC_MSG_ERROR([*** GCRYPT headers not found.])
                 fi])
 
+        AC_CHECK_LIB(
+                [gcrypt],
+                [gcry_check_version],
+                [have_gcrypt=yes],
+                [if test "x$have_gcrypt" = xyes ; then
+                        AC_MSG_ERROR([*** libgcrypt not found.])
+                fi])
+
         if test "x$have_gcrypt" = xyes ; then
                 GCRYPT_LIBS="$LIBGCRYPT_LIBS"
                 GCRYPT_CFLAGS="$LIBGCRYPT_CFLAGS"
-- 
1.7.11.7



More information about the systemd-devel mailing list