chiark / gitweb /
journal: make libgcrypt dependency optional
[elogind.git] / configure.ac
index c5fbec5738436d481a2a040829913caf412ad653..3df43b91fd21d517b56d162b6ade361fd2cafced 100644 (file)
@@ -20,7 +20,7 @@
 AC_PREREQ([2.64])
 
 AC_INIT([systemd],
-        [186],
+        [188],
         [http://bugs.freedesktop.org/enter_bug.cgi?product=systemd],
         [systemd],
         [http://www.freedesktop.org/wiki/Software/systemd])
@@ -79,13 +79,15 @@ if test -z "$GPERF" ; then
         AC_MSG_ERROR([*** gperf not found])
 fi
 
+# we use python only to build the man page index
+AM_PATH_PYTHON(,, [:])
+AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
+
 CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
         -pipe \
         -Wall \
-        -W \
         -Wextra \
         -Wno-inline \
-        -Wvla \
         -Wundef \
         -Wformat=2 \
         -Wlogical-op \
@@ -114,20 +116,27 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
         -Wno-missing-field-initializers \
         -Wno-unused-result \
         -Werror=overflow \
-        -Wp,-D_FORTIFY_SOURCE=2 \
         -ffast-math \
         -fno-common \
         -fdiagnostics-show-option \
         -fno-strict-aliasing \
         -fvisibility=hidden \
         -ffunction-sections \
-        -fdata-sections])
-AC_SUBST([WARNINGFLAGS], $with_cflags)
+        -fdata-sections \
+        -fstack-protector \
+        --param=ssp-buffer-size=4])
+AC_SUBST([OUR_CFLAGS], $with_cflags)
+
+CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
+        -Wp,-D_FORTIFY_SOURCE=2])
+AC_SUBST([OUR_CPPFLAGS], $with_cppflags)
 
 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
         -Wl,--as-needed \
-        -Wl,--gc-sections])
-AC_SUBST([GCLDFLAGS], $with_ldflags)
+        -Wl,--gc-sections \
+        -Wl,-z,relro \
+        -Wl,-z,now])
+AC_SUBST([OUR_LDFLAGS], $with_ldflags)
 
 AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
 AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])
@@ -292,6 +301,39 @@ fi
 AC_SUBST(ACL_LIBS)
 AM_CONDITIONAL([HAVE_ACL], [test "x$have_acl" != xno])
 
+# ------------------------------------------------------------------------------
+AC_ARG_ENABLE([gcrypt],
+        AS_HELP_STRING([--disable-gcrypt],[Disable optional GCRYPT support]),
+                [case "${enableval}" in
+                        yes) have_gcrypt=yes ;;
+                        no) have_gcrypt=no ;;
+                        *) AC_MSG_ERROR(bad value ${enableval} for --disable-gcrypt) ;;
+                esac],
+                [have_gcrypt=auto])
+
+if test "x${have_gcrypt}" != xno ; then
+        AM_PATH_LIBGCRYPT(
+                [1.4.5],
+                [have_gcrypt=yes],
+                [if test "x$have_gcrypt" = xyes ; then
+                        AC_MSG_ERROR([*** GCRYPT headers not found.])
+                fi])
+
+        if test "x$have_gcrypt" = xyes ; then
+                GCRYPT_LIBS="$LIBGCRYPT_LIBS"
+                GCRYPT_CFLAGS="$LIBGCRYPT_CFLAGS"
+                AC_DEFINE(HAVE_GCRYPT, 1, [GCRYPT available])
+        else
+                have_gcrypt=no
+        fi
+else
+        GCRYPT_LIBS=
+        GCRYPT_CFLAGS=
+fi
+AC_SUBST(GCRYPT_LIBS)
+AC_SUBST(GCRYPT_CFLAGS)
+AM_CONDITIONAL([HAVE_GCRYPT], [test "x$have_gcrypt" != xno])
+
 # ------------------------------------------------------------------------------
 AC_ARG_ENABLE([audit],
         AS_HELP_STRING([--disable-audit],[Disable optional AUDIT support]),
@@ -505,7 +547,7 @@ if test "z$with_distro" = "z"; then
         if test "$cross_compiling" = yes; then
                 AC_MSG_WARN([Target distribution cannot be reliably detected when cross-compiling. You should specify it with --with-distro (see $0 --help for recognized distros)])
         else
-                with_distro=$($GREP '^ID=' /etc/os-release | $SED 's/ID=//');
+                with_distro=$($GREP '^ID=' /etc/os-release 2>/dev/null | $SED 's/ID=//');
         fi
         if test "z$with_distro" = "z"; then
                 with_distro=other
@@ -717,6 +759,7 @@ AC_MSG_RESULT([
         SELinux:                 ${have_selinux}
         XZ:                      ${have_xz}
         ACL:                     ${have_acl}
+        GCRYPT:                  ${have_gcrypt}
         binfmt:                  ${have_binfmt}
         vconsole:                ${have_vconsole}
         readahead:               ${have_readahead}
@@ -750,7 +793,7 @@ AC_MSG_RESULT([
         Split /usr:              ${enable_split_usr}
         man pages:               ${have_manpages}
 
-        CFLAGS:                  ${CFLAGS}
-        CPPLAGS:                 ${CPPFLAGS}
-        LDFLAGS:                 ${LDFLAGS}
+        CFLAGS:                  ${OUR_CFLAGS} ${CFLAGS}
+        CPPLAGS:                 ${OUR_CPPFLAGS} ${CPPFLAGS}
+        LDFLAGS:                 ${OUR_LDFLAGS} ${LDFLAGS}
 ])