chiark / gitweb /
Fix bug that program_invocation_name is NULL when backgrounding
[elogind.git] / configure.ac
index 66a5e3e9a160a78d85ec3a953c9e70a505f5c3a3..1c5e25f48b1526209137351e181bb2040c494499 100644 (file)
@@ -20,7 +20,7 @@
 AC_PREREQ([2.64])
 
 AC_INIT([elogind],
-        [226],
+        [226.2],
         [https://github.com/elogind/elogind/issues],
         [elogind],
         [https://github.com/elogind/elogind])
@@ -109,6 +109,23 @@ if test -z "$GPERF" ; then
         AC_MSG_ERROR([*** gperf not found])
 fi
 
+
+# ------------------------------------------------------------------------------
+# Find running cgroup controller
+with_cgroupctrl=
+AS_IF(  [test -f /proc/self/cgroup], [
+        # If the init system is a cgroup controler, it will be position 1.
+        # Secondary controllers, like cgmanager, do not work.
+        with_cgroupctrl=`grep "^1:name=" /proc/self/cgroup | cut -d ':' -f 2`
+        AS_IF(  [test -z "$with_cgroupctrl"], [
+                # Try to be our own cgroup controller
+                with_cgroupctrl="name=elogind"
+        ])
+])
+AS_IF(  [test -z "$with_cgroupctrl"],
+        AC_MSG_ERROR([No running cgroup controller found]))
+
+
 # ------------------------------------------------------------------------------
 address_sanitizer_cflags=
 address_sanitizer_cppflags=
@@ -233,7 +250,8 @@ AC_CHECK_SIZEOF(rlim_t,,[
 ])
 
 GPERF_TEST="$(echo foo,bar | ${GPERF} -L ANSI-C)"
-
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wno-error"
 AC_COMPILE_IFELSE(
         [AC_LANG_PROGRAM([
                 #include <string.h>
@@ -251,6 +269,7 @@ AC_COMPILE_IFELSE(
                 [AC_MSG_ERROR([** unable to determine gperf len type])]
         )]
 )
+CFLAGS="$save_CFLAGS"
 
 AC_DEFINE_UNQUOTED([GPERF_LEN_TYPE], [$GPERF_LEN_TYPE], [gperf len type])
 
@@ -286,9 +305,16 @@ AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers n
 AC_CHECK_HEADERS([linux/btrfs.h], [], [])
 AC_CHECK_HEADERS([linux/memfd.h], [], [])
 
+AC_CHECK_HEADERS([printf.h], [have_printf_h=yes], [have_printf_h=no])
+AS_IF([test x$have_printf_h = xyes], [
+        AC_DEFINE(HAVE_PRINTF_H, 1, [Define if printf.h was found])
+])
+
+
+
 # unconditionally pull-in librt with old glibc versions
-AC_SEARCH_LIBS([clock_gettime], [rt], [], [])
-AC_SEARCH_LIBS([mq_unlink], [rt], [], [])
+dnl AC_SEARCH_LIBS([clock_gettime], [rt], [], [])
+dnl AC_SEARCH_LIBS([mq_unlink], [rt], [], [])
 
 AC_ARG_WITH([libcap],
             AS_HELP_STRING([--with-libcap=DIR], [Prefix for libcap]),
@@ -654,14 +680,17 @@ AC_ARG_ENABLE(tests,
 AM_CONDITIONAL(ENABLE_TESTS, [test x$enable_tests = xyes])
 
 AC_ARG_ENABLE(debug,
-        [AC_HELP_STRING([--enable-debug@<:@=LIST@:>@], [enable extra debugging (hashmap,mmap-cache)])],
+        [AC_HELP_STRING([--enable-debug@<:@=LIST@:>@], [enable extra debugging (elogind,hashmap,mmap-cache)])],
         [if test "x$enableval" = "xyes"; then
-                enableval="hashmap,mmap-cache"
+                enableval="elogind,hashmap,mmap-cache"
         fi
         saved_ifs="$IFS"
         IFS="$IFS$PATH_SEPARATOR,"
         for name in $enableval; do
                 case $name in
+                elogind)
+                        enable_debug_elogind=yes
+                        ;;
                 hashmap)
                         enable_debug_hashmap=yes
                         ;;
@@ -673,6 +702,10 @@ AC_ARG_ENABLE(debug,
         IFS="$saved_ifs"],[])
 
 enable_debug=""
+AS_IF([test x$enable_debug_elogind = xyes], [
+        AC_DEFINE(ENABLE_DEBUG_ELOGIND, 1, [Define if elogind debugging is to be enabled])
+        enable_debug="elogind $enable_debug"
+])
 AS_IF([test x$enable_debug_hashmap = xyes], [
         AC_DEFINE(ENABLE_DEBUG_HASHMAP, 1, [Define if hashmap debugging is to be enabled])
         enable_debug="hashmap $enable_debug"
@@ -691,6 +724,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir])
 AC_SUBST([pamconfdir], [$with_pamconfdir])
 AC_SUBST([rootprefix], [$with_rootprefix])
 AC_SUBST([rootlibdir], [$with_rootlibdir])
+AC_SUBST([cgroup_controller], [$with_cgroupctrl])
 
 AC_CONFIG_FILES([
         Makefile
@@ -712,6 +746,7 @@ AC_MSG_RESULT([
         test coverage:           ${have_coverage}
         Split /usr:              ${enable_split_usr}
         extra debugging:         ${enable_debug}
+        cgroup controller:       ${with_cgroupctrl}
 
         prefix:                  ${prefix}
         rootprefix:              ${with_rootprefix}