]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Make utmpx.h optional
authorStéphane Graber <stgraber@ubuntu.com>
Thu, 3 Jan 2013 17:24:15 +0000 (12:24 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Wed, 9 Jan 2013 15:13:59 +0000 (10:13 -0500)
This adds code detecting the presence of utmpx.h and in its absence, turns the
utmp related functions into no-ops.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
configure.ac
src/lxc/utmp.c
src/lxc/utmp.h

index d6ecc909b46cb180f1e9cb303e6d11466d678b14..c65c67cca84b7336d80fccdc7b858b473cdab8f0 100644 (file)
@@ -221,7 +221,7 @@ AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
 AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
 
 # Check for some headers
-AC_CHECK_HEADERS([sys/signalfd.h pty.h sys/capability.h sys/personality.h])
+AC_CHECK_HEADERS([sys/signalfd.h pty.h sys/capability.h sys/personality.h utmpx.h])
 
 # Check for some syscalls functions
 AC_CHECK_FUNCS([setns pivot_root sethostname unshare])
index a7b9b525de05a876947fc9bf7fb320f3a8512183..f32ed632dbe0d50f248549f09d65f10fe32a3816 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
+#include "config.h"
+
+#ifdef HAVE_UTMPX_H
+
 #include <stdio.h>
 #include <unistd.h>
 #include <errno.h>
 #include "mainloop.h"
 #include "lxc.h"
 #include "log.h"
+
+#ifndef __USE_GNU
 #define __USE_GNU
+#endif
 #include <utmpx.h>
 #undef __USE_GNU
 
@@ -410,3 +417,5 @@ int lxc_utmp_del_timer(struct lxc_epoll_descr *descr,
        else
                return 0;
 }
+
+#endif
index ac3eee427b45232cb2bafbe2b80b19c8793bf860..1bd7c23dbed02f983d18fd050556302fdec00bd7 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
+#include "config.h"
+
 struct lxc_handler;
 struct lxc_epoll_descr;
 
+#ifdef HAVE_UTMPX_H
 int lxc_utmp_mainloop_add(struct lxc_epoll_descr *descr,
                          struct lxc_handler *handler);
+#else
+static inline int lxc_utmp_mainloop_add(struct lxc_epoll_descr *descr,
+                         struct lxc_handler *handler) {
+               return -1;
+}
+#endif