]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: add --disable-plymouth-support
authorKarel Zak <kzak@redhat.com>
Thu, 26 May 2016 13:05:14 +0000 (15:05 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 26 May 2016 13:08:53 +0000 (15:08 +0200)
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>
configure.ac
lib/Makemodule.am
login-utils/sulogin.c
term-utils/agetty.c

index b48a24a5e9ab85ffa2dfa55bc32dccc5c6e80f3d..f36b18c3cd4146de50f2c566e0e5ff9040e7c30c 100644 (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]
index b2172db13eb600c21097343865fe89ff85d7f460..704a16e20d0ad5a9989e5e7c718e25820fe71476 100644 (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
index 8d6e65229fff65c42eed6e8e6f31ece21f38e62e..1f4e468f8a32e4e31be9ceed47d3ddd0c1a24b3b 100644 (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) {
index ab82fdbc8dee6036a42acac290b25fee4f042e79..d12a3f1c791e580da2b4866493be9439d9b97585 100644 (file)
 #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);