diff --git a/configure.ac b/configure.ac index b48a24a5e..f36b18c3c 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ]) +AC_CHECK_DECL([SOCK_CLOEXEC], + [have_sock_cloexec=yes], [have_sock_cloexec=no], + [#include + #include ]) +AC_CHECK_DECL([SOCK_NONBLOCK], + [have_sock_nonblock=yes], [have_sock_nonblock=no], + [#include + #include ]) +AC_CHECK_DECL([SO_PASSCRED], + [have_so_passcred=yes], [have_so_passcred=no], + [#include + #include ]) + 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] diff --git a/lib/Makemodule.am b/lib/Makemodule.am index b2172db13..704a16e20 100644 --- a/lib/Makemodule.am +++ b/lib/Makemodule.am @@ -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 diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c index 8d6e65229..1f4e468f8 100644 --- a/login-utils/sulogin.c +++ b/login-utils/sulogin.c @@ -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) { diff --git a/term-utils/agetty.c b/term-utils/agetty.c index ab82fdbc8..d12a3f1c7 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -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 #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);