chiark / gitweb /
Fix lookup_errno by adding a gperf length parameter detection.
[elogind.git] / configure.ac
index c8a4aff8ff0a1ec81312176d6ae42edaec0f49bf..24f4d0dd69963610d5c018a8a346dd28d3cc1584 100644 (file)
@@ -20,7 +20,7 @@
 AC_PREREQ([2.64])
 
 AC_INIT([elogind],
-        [221],
+        [226],
         [https://github.com/elogind/elogind/issues],
         [elogind],
         [https://github.com/elogind/elogind])
@@ -38,6 +38,16 @@ AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-di
 AM_SILENT_RULES([yes])
 AC_CANONICAL_HOST
 AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.])
+
+AC_PROG_CC_C99
+
+AX_COMPILER_VENDOR
+AS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [
+      AC_CHECK_TOOLS([AR], [gcc-ar ar], [:])
+      AC_CHECK_TOOLS([NM], [gcc-nm nm], [:])
+      AC_CHECK_TOOLS([RANLIB], [gcc-ranlib ranlib], [:])
+])
+
 LT_PREREQ(2.2)
 LT_INIT([disable-static])
 
@@ -82,8 +92,6 @@ AC_PROG_SED
 AC_PROG_GREP
 AC_PROG_AWK
 
-AC_PROG_CC_C99
-
 AC_PATH_PROG([M4], [m4])
 AC_PATH_PROG([XSLTPROC], [xsltproc])
 
@@ -95,16 +103,7 @@ AS_IF([! ln --relative --help > /dev/null 2>&1], [AC_MSG_ERROR([*** ln doesn't s
 
 M4_DEFINES=
 
-# gtkdocize greps for '^GTK_DOC_CHECK', so it needs to be on its own line
-m4_ifdef([GTK_DOC_CHECK], [
-GTK_DOC_CHECK([1.18],[--flavour no-tmpl])],
-         [AM_CONDITIONAL([ENABLE_GTK_DOC], [false])
-          enable_gtk_doc=no])
-
-AS_IF([test "x$enable_gtk_doc" = "xyes" -a "x$XSLTPROC" = x], [
-        AC_MSG_ERROR([*** GTK doc requested but xsltproc not found])
-])
-
+AC_CHECK_TOOL(OBJCOPY, objcopy)
 AC_CHECK_TOOL(GPERF, gperf)
 if test -z "$GPERF" ; then
         AC_MSG_ERROR([*** gperf not found])
@@ -192,9 +191,9 @@ AS_CASE([$CC], [*clang*],
 
 dnl AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
 dnl         [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-dnl                -flto -ffat-lto-objects])],
+dnl                -flto])],
 dnl         [AC_MSG_RESULT([skipping -flto, optimization not enabled])])
-AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
+dnl AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
 
 AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
         [CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
@@ -233,6 +232,54 @@ AC_CHECK_SIZEOF(rlim_t,,[
        #include <sys/resource.h>
 ])
 
+GPERF_TEST="$(echo foo,bar | ${GPERF} -L ANSI-C)"
+
+AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([
+                #include <string.h>
+                const char * in_word_set(const char *, size_t);
+                $GPERF_TEST]
+        )],
+        [GPERF_LEN_TYPE=size_t],
+        [AC_COMPILE_IFELSE(
+                [AC_LANG_PROGRAM([
+                        #include <string.h>
+                        const char * in_word_set(const char *, unsigned);
+                        $GPERF_TEST]
+                )],
+                [GPERF_LEN_TYPE=unsigned],
+                [AC_MSG_ERROR([** unable to determine gperf len type])]
+        )]
+)
+
+AC_DEFINE_UNQUOTED([GPERF_LEN_TYPE], [$GPERF_LEN_TYPE], [gperf len type])
+
+# ------------------------------------------------------------------------------
+# we use python to build the man page index
+have_python=no
+AC_ARG_WITH([python],
+        [AS_HELP_STRING([--without-python], [Disable building the man page index (default: test)])])
+
+have_lxml=no
+AS_IF([test "x$with_python" != "xno"], [
+        AM_PATH_PYTHON(,, [:])
+        AS_IF([test "x$PYTHON" != "x:"], [
+                AC_MSG_CHECKING([for python lxml module])
+                AS_IF(["$PYTHON" -c 'import lxml' 2>/dev/null], [have_lxml=yes])
+                AC_MSG_RESULT([$have_lxml])
+                AS_IF([test "x$have_lxml" = "xyes"], [have_python=yes],
+                      [AC_MSG_WARN([*** python support requires python-lxml module installed])])
+        ])
+])
+AS_IF([test "$have_python" != "yes"], [
+      AS_IF([test "$with_python" = "yes"],
+            [AC_MSG_ERROR([*** python support requested but python support not found])])
+      AS_IF([test "$with_python" != "no"],
+            [AC_MSG_WARN([*** python support not found, some documentation cannot be built])])
+])
+
+AM_CONDITIONAL([HAVE_PYTHON], [test "x$have_python" = "xyes"])
+
 # ------------------------------------------------------------------------------
 
 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
@@ -280,9 +327,10 @@ AC_CHECK_DECLS([IFLA_INET6_ADDR_GEN_MODE,
                 IFLA_VLAN_PROTOCOL,
                 IFLA_VXLAN_REMCSUM_NOPARTIAL,
                 IFLA_VXLAN_LOCAL6,
-                IFLA_IPTUN_6RD_RELAY_PREFIXLEN,
+                IFLA_IPTUN_ENCAP_DPORT,
+                IFLA_GRE_ENCAP_DPORT,
                 IFLA_BRIDGE_VLAN_INFO,
-                IFLA_BRPORT_UNICAST_FLOOD,
+                IFLA_BRPORT_LEARNING_SYNC,
                 NDA_IFINDEX,
                 IFA_FLAGS],
 [], [], [[
@@ -501,8 +549,14 @@ fi
 
 AC_ARG_WITH(smack-run-label,
 AS_HELP_STRING([--with-smack-run-label=STRING],
-        [run elogind --system with a specific SMACK label]),
-        [AC_DEFINE_UNQUOTED(SMACK_RUN_LABEL, ["$withval"], [Run with a smack label])],
+        [run elogind --system itself with a specific SMACK label]),
+        [AC_DEFINE_UNQUOTED(SMACK_RUN_LABEL, ["$withval"], [Run elogind itself with SMACK label])],
+        [])
+
+AC_ARG_WITH(smack-default-process-label,
+AS_HELP_STRING([--with-smack-default-process-label=STRING],
+        [default SMACK label for executed processes]),
+        [AC_DEFINE_UNQUOTED(SMACK_DEFAULT_PROCESS_LABEL, ["$withval"], [Default SMACK label for executed processes])],
         [])
 
 if test "x${have_smack}" = xyes ; then
@@ -511,6 +565,15 @@ fi
 
 AM_CONDITIONAL([HAVE_SMACK], [test "x$have_smack" = "xyes"])
 
+# ------------------------------------------------------------------------------
+have_logind=yes
+#AC_ARG_ENABLE(logind, AS_HELP_STRING([--disable-logind], [disable login daemon]))
+#if test "x$enable_logind" != "xno"; then
+#        have_logind=yes
+#fi
+AM_CONDITIONAL(ENABLE_LOGIND, [test "$have_logind" = "yes"])
+AS_IF([test "$have_logind" = "yes"], [ AC_DEFINE(HAVE_LOGIND, [1], [Logind support available]) ])
+
 # ------------------------------------------------------------------------------
 AC_ARG_WITH(system-uid-max,
         AS_HELP_STRING([--with-system-uid-max=UID]
@@ -587,11 +650,13 @@ AC_ARG_WITH([bashcompletiondir],
         ] , [
                 with_bashcompletiondir=${datadir}/bash-completion/completions
         ])])
+AM_CONDITIONAL(ENABLE_BASH_COMPLETION, [test "$with_bashcompletiondir" != "no"])
 AX_NORMALIZE_PATH([with_bashcompletiondir])
 
 AC_ARG_WITH([zshcompletiondir],
         AS_HELP_STRING([--with-zshcompletiondir=DIR], [Zsh completions directory]),
         [], [with_zshcompletiondir=${datadir}/zsh/site-functions])
+AM_CONDITIONAL(ENABLE_ZSH_COMPLETION, [test "$with_zshcompletiondir" != "no"])
 AX_NORMALIZE_PATH([with_zshcompletiondir])
 
 AC_ARG_WITH([rootprefix],
@@ -706,6 +771,7 @@ AC_MSG_RESULT([
         blkid:                   ${have_blkid}
         dbus:                    ${have_dbus}
         kdbus:                   ${have_kdbus}
+        Python:                  ${have_python}
         man pages:               ${have_manpages}
         test coverage:           ${have_coverage}
         Split /usr:              ${enable_split_usr}