From: Stéphane Graber Date: Thu, 3 Jan 2013 17:24:15 +0000 (-0500) Subject: Make utmpx.h optional X-Git-Tag: lxc-0.9.0.alpha3~1^2~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffbf58150c7a12ea2a133507f5f400ff3c839c12;p=thirdparty%2Flxc.git Make utmpx.h optional 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 Acked-by: Serge E. Hallyn --- diff --git a/configure.ac b/configure.ac index d6ecc909b..c65c67cca 100644 --- a/configure.ac +++ b/configure.ac @@ -221,7 +221,7 @@ AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"]) AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include ]) # 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]) diff --git a/src/lxc/utmp.c b/src/lxc/utmp.c index a7b9b525d..f32ed632d 100644 --- a/src/lxc/utmp.c +++ b/src/lxc/utmp.c @@ -21,6 +21,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + +#ifdef HAVE_UTMPX_H + #include #include #include @@ -37,7 +41,10 @@ #include "mainloop.h" #include "lxc.h" #include "log.h" + +#ifndef __USE_GNU #define __USE_GNU +#endif #include #undef __USE_GNU @@ -410,3 +417,5 @@ int lxc_utmp_del_timer(struct lxc_epoll_descr *descr, else return 0; } + +#endif diff --git a/src/lxc/utmp.h b/src/lxc/utmp.h index ac3eee427..1bd7c23db 100644 --- a/src/lxc/utmp.h +++ b/src/lxc/utmp.h @@ -21,8 +21,17 @@ * 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