Linux: Use our own signalfd wrapper, rather than libstddjb
selfpipe already does a fine job of interfacing to signalfd. But Debian and
Ubuntu want us to depend on the skalibs-dev package rather than build libstddjb
ourselves. That would be fine except that skalibs-dev has static libraries
only, and they aren't built with -fPIC. This interferes with building
mosh-{client,server} as position-independent executables, which is a desirable
security measure.
So we have our own wrapper, which invokes either signalfd or selfpipe. And we
build it ourselves with our own flags, because it's part of the Mosh project
proper.
(closes #108)
This commit is contained in:
committed by
Keith Winstein
parent
93325d3ef0
commit
0eec0b60f0
+20
-6
@@ -176,13 +176,32 @@ AC_ARG_WITH([skalibs-libdir],
|
||||
[specify exact library dir for skalibs libraries])],
|
||||
[SKALIBS_LDFLAGS="-L$withval"])
|
||||
|
||||
AM_CONDITIONAL([COND_THIRD_LIBSTDDJB], [test x"$with_skalibs" = xno])
|
||||
STDDJB_CPPFLAGS=""
|
||||
STDDJB_LDFLAGS=""
|
||||
AS_IF([test x"$with_skalibs" != xno],
|
||||
[AX_CHECK_LIBRARY([SKALIBS], [selfpipe.h], [stddjb], [],
|
||||
[AC_MSG_ERROR([Unable to find skalibs.])])
|
||||
AC_SUBST([STDDJB_CPPFLAGS], ["$SKALIBS_CPPFLAGS"])
|
||||
AC_SUBST([STDDJB_LDFLAGS], ["$SKALIBS_LDFLAGS -lstddjb"])])
|
||||
|
||||
have_signalfd="no"
|
||||
AC_CHECK_DECL([signalfd],
|
||||
[have_signalfd="yes"
|
||||
AC_DEFINE([HAVE_SIGNALFD], [1],
|
||||
[Define if signalfd is available.])],
|
||||
, [[#include <sys/signalfd.h>]])
|
||||
|
||||
AS_IF([test x"$have_signalfd" = xno],
|
||||
[AC_DEFINE([USE_LIBSTDDJB], [1],
|
||||
[Define if we should call functions from libstddjb (part of skalibs)])])
|
||||
AM_CONDITIONAL([USE_LIBSTDDJB],
|
||||
[test x"$have_signalfd" = xno])
|
||||
|
||||
# Build the bundled libstddjb only if we'll use it and we don't have a
|
||||
# path for skalibs.
|
||||
AM_CONDITIONAL([COND_THIRD_LIBSTDDJB],
|
||||
[test x"$have_signalfd" = xno && test x"$with_skalibs" = xno])
|
||||
|
||||
# Checks for header files.
|
||||
AC_CHECK_HEADERS([arpa/inet.h fcntl.h langinfo.h limits.h locale.h netinet/in.h stddef.h stdint.h inttypes.h stdlib.h string.h sys/ioctl.h sys/resource.h sys/socket.h sys/time.h term.h termios.h unistd.h wchar.h wctype.h], [], [AC_MSG_ERROR([Missing required header file.])])
|
||||
|
||||
@@ -239,11 +258,6 @@ AC_CHECK_DECL([pipe2],
|
||||
, [[#define _GNU_SOURCE
|
||||
#include <unistd.h>]])
|
||||
|
||||
AC_CHECK_DECL([signalfd],
|
||||
[AC_DEFINE([HAVE_SIGNALFD], [1],
|
||||
[Define if signalfd is available.])],
|
||||
, [[#include <sys/signalfd.h>]])
|
||||
|
||||
AC_CHECK_DECL([forkpty],
|
||||
[AC_DEFINE([FORKPTY_IN_LIBUTIL], [1],
|
||||
[Define if libutil.h necessary for forkpty().])],
|
||||
|
||||
Reference in New Issue
Block a user