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>
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])
* 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
else
return 0;
}
+
+#endif
* 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