build-sys: add --disable-plymouth-support

The plymouth support depends on Linux specific SOCK_* flags and all
the feature is probably unnecessary in some cases (non-plymouth
distros, etc.)

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2016-05-26 15:05:14 +02:00
parent 924c93d9df
commit 1eb16fd780
4 changed files with 45 additions and 7 deletions

View File

@ -351,6 +351,22 @@ AC_CHECK_DECL([strsignal],
[Define to 1 if have strsignal function prototype])],
)
AC_CHECK_DECL([TIOCGLCKTRMIOS],
[have_tiocglcktrmios=yes], [have_tiocglcktrmios=no],
[#include <sys/ioctl.h>])
AC_CHECK_DECL([SOCK_CLOEXEC],
[have_sock_cloexec=yes], [have_sock_cloexec=no],
[#include <sys/types.h>
#include <sys/socket.h>])
AC_CHECK_DECL([SOCK_NONBLOCK],
[have_sock_nonblock=yes], [have_sock_nonblock=no],
[#include <sys/types.h>
#include <sys/socket.h>])
AC_CHECK_DECL([SO_PASSCRED],
[have_so_passcred=yes], [have_so_passcred=no],
[#include <sys/types.h>
#include <sys/socket.h>])
AC_CHECK_FUNCS([ \
__fpending \
secure_getenv \
@ -1237,6 +1253,21 @@ AS_IF([test "x$have_futimens" = xyes -a "x$have_inotify_init1" = xyes ], [
])
AC_ARG_ENABLE([plymouth_support],
AS_HELP_STRING([--disable-plymouth_support], [don not care about plymouth in sylogin(8) and agetty(8)]),
[], [UL_DEFAULT_ENABLE([plymouth_support], [check])]
)
UL_BUILD_INIT([plymouth_support])
UL_REQUIRES_HAVE([plymouth_support], [tiocglcktrmios], [TIOCGLCKTRMIOS flag])
UL_REQUIRES_HAVE([plymouth_support], [sock_cloexec], [SOCK_CLOEXEC flag])
UL_REQUIRES_HAVE([plymouth_support], [sock_nonblock], [SOCK_NONBLOCK flag])
UL_REQUIRES_HAVE([plymouth_support], [so_passcred], [SO_PASSCRED flag])
AM_CONDITIONAL([USE_PLYMOUTH_SUPPORT], [test "x$build_plymouth_support" = xyes])
AS_IF([test "x$build_plymouth_support" = xyes ], [
AC_DEFINE([USE_PLYMOUTH_SUPPORT], [1], [Enable plymouth support feature for sulogin and aggety])
])
AC_ARG_WITH([libz],
AS_HELP_STRING([--without-libz], [compile without libz]),
[], [with_libz=auto]

View File

@ -16,7 +16,6 @@ libcommon_la_SOURCES = \
lib/md5.c \
lib/pager.c \
lib/path.c \
lib/plymouth-ctrl.c \
lib/randutils.c \
lib/setproctitle.c \
lib/strutils.c \
@ -31,6 +30,10 @@ libcommon_la_SOURCES += \
lib/loopdev.c
endif
if USE_PLYMOUTH_SUPPORT
libcommon_la_SOURCES += lib/plymouth-ctrl.c
endif
if !HAVE_LANGINFO
libcommon_la_SOURCES += lib/langinfo.c
endif

View File

@ -58,7 +58,9 @@
#include "closestream.h"
#include "nls.h"
#include "pathnames.h"
#include "plymouth-ctrl.h"
#ifdef USE_PLYMOUTH_SUPPORT
# include "plymouth-ctrl.h"
#endif
#include "strutils.h"
#include "ttyutils.h"
#include "sulogin-consoles.h"
@ -100,9 +102,9 @@ static void tcinit(struct console *con)
{
int mode = 0, flags = 0;
struct termios *tio = &con->tio;
struct termios lock;
int fd = con->fd;
#ifdef TIOCGLCKTRMIOS
#ifdef USE_PLYMOUTH_SUPPORT
struct termios lock;
int i = (plymouth_command(MAGIC_PING)) ? PLYMOUTH_TERMIOS_FLAGS_DELAY : 0;
if (i)
plymouth_command(MAGIC_QUIT);
@ -121,7 +123,6 @@ static void tcinit(struct console *con)
memset(&lock, 0, sizeof(struct termios));
ioctl(fd, TIOCSLCKTRMIOS, &lock);
#endif
errno = 0;
if (tcgetattr(fd, tio) < 0) {

View File

@ -41,12 +41,15 @@
#include "all-io.h"
#include "nls.h"
#include "pathnames.h"
#include "plymouth-ctrl.h"
#include "c.h"
#include "widechar.h"
#include "ttyutils.h"
#include "color-names.h"
#ifdef USE_PLYMOUTH_SUPPORT
# include "plymouth-ctrl.h"
#endif
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
@ -1175,8 +1178,8 @@ static void termio_init(struct options *op, struct termios *tp)
{
speed_t ispeed, ospeed;
struct winsize ws;
#ifdef USE_PLYMOUTH_SUPPORT
struct termios lock;
#ifdef TIOCGLCKTRMIOS
int i = (plymouth_command(MAGIC_PING) == 0) ? PLYMOUTH_TERMIOS_FLAGS_DELAY : 0;
if (i)
plymouth_command(MAGIC_QUIT);