Issue #361: enable builds with MUSL libc

* Added configure option "--disable-utmp" which must be used when
  building with MUSL libc. This option disables login records which
  are stubed out in MUSL anyway.
* Added missing include "sys/ttydefaults.h".
This commit is contained in:
Luka Krajger 2016-10-11 13:22:38 +02:00
parent d0d8c58882
commit 05b2d3630c
2 changed files with 24 additions and 10 deletions

View file

@ -32,7 +32,7 @@ AC_SUBST(AR_FLAGS, [cr])
dnl Check for header files that do not exist on all platforms dnl Check for header files that do not exist on all platforms
AC_CHECK_HEADERS([libutil.h pthread.h pty.h strings.h syslog.h sys/prctl.h \ AC_CHECK_HEADERS([libutil.h pthread.h pty.h strings.h syslog.h sys/prctl.h \
sys/uio.h util.h utmp.h utmpx.h]) sys/uio.h util.h])
dnl Most systems require linking against libutil.so in order to get login_tty() dnl Most systems require linking against libutil.so in order to get login_tty()
AC_CHECK_FUNCS(login_tty, [], AC_CHECK_FUNCS(login_tty, [],
@ -75,15 +75,6 @@ AC_TRY_LINK([#include <math.h>],
[AC_DEFINE(HAVE_ISNAN, 1, [AC_DEFINE(HAVE_ISNAN, 1,
Define to 1 if you have support for isnan)]) Define to 1 if you have support for isnan)])
dnl Even if utmpx.h exists, not all systems have support for updwtmpx()
AC_TRY_LINK([#include <utmp.h>],
[updwtmp(0, 0);],
[AC_DEFINE(HAVE_UPDWTMP, 1,
Define to 1 if you have support for updwtmp)])
AC_TRY_LINK([#include <utmpx.h>],
[updwtmpx(0, 0);],
[AC_DEFINE(HAVE_UPDWTMPX, 1,
Define to 1 if you have support for updwtmpx)])
dnl Check if the compiler supports aliasing of symbols dnl Check if the compiler supports aliasing of symbols
AC_TRY_LINK([void x(void) { }; AC_TRY_LINK([void x(void) { };
@ -147,6 +138,28 @@ AC_ARG_ENABLE(runtime-loading,
these libraries into the binary, thus making them a these libraries into the binary, thus making them a
hard dependency, then disable runtime-loading.]) hard dependency, then disable runtime-loading.])
dnl This is feature is not suported in some standard C libs. So users can use
dnl this switch to avoid compile and runtime problems. Note that utmp must
dnl disabled on systems with musl libc.
AC_ARG_ENABLE(utmp,
[ --disable-utmp Disable support for login records. Note
that for systems with musl libc utmp must
be disabled.])
if test "x$enable_utmp" != xno; then
AC_CHECK_HEADERS([utmp.h utmpx.h])
dnl Even if utmpx.h exists, not all systems have support for updwtmpx()
AC_TRY_LINK([#include <utmp.h>],
[updwtmp(0, 0);],
[AC_DEFINE(HAVE_UPDWTMP, 1,
Define to 1 if you have support for updwtmp)])
AC_TRY_LINK([#include <utmpx.h>],
[updwtmpx(0, 0);],
[AC_DEFINE(HAVE_UPDWTMPX, 1,
Define to 1 if you have support for updwtmpx)])
fi
dnl Only test for OpenSSL headers, if not explicitly disabled dnl Only test for OpenSSL headers, if not explicitly disabled
if test "x$enable_ssl" != xno; then if test "x$enable_ssl" != xno; then
AC_CHECK_HEADERS([openssl/bio.h openssl/err.h openssl/ssl.h]) AC_CHECK_HEADERS([openssl/bio.h openssl/err.h openssl/ssl.h])

View file

@ -63,6 +63,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/ttydefaults.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/utsname.h> #include <sys/utsname.h>