Better portability patch for systems that don't define SYS_NMLN.
This commit is contained in:
@@ -32,6 +32,10 @@
|
|||||||
|
|
||||||
#undef HD44780_DRV
|
#undef HD44780_DRV
|
||||||
|
|
||||||
|
#undef HAVE_SYS_NMLN
|
||||||
|
|
||||||
|
#undef HAVE__SYS_NAMELEN
|
||||||
|
|
||||||
#undef IRMANIN_DRV
|
#undef IRMANIN_DRV
|
||||||
|
|
||||||
#undef JOY_DRV
|
#undef JOY_DRV
|
||||||
|
|||||||
@@ -32,8 +32,19 @@
|
|||||||
int TwentyFourHour = 1;
|
int TwentyFourHour = 1;
|
||||||
int uptime_fd = 0;
|
int uptime_fd = 0;
|
||||||
|
|
||||||
static char kver[SYS_NMLN];
|
#ifdef HAVE_SYS_NMLN
|
||||||
static char sysname[SYS_NMLN];
|
static char kver[SYS_NMLN];
|
||||||
|
static char sysname[SYS_NMLN];
|
||||||
|
#else
|
||||||
|
# ifdef HAVE__SYS_NAMELEN
|
||||||
|
static char kver[_SYS_NAMELEN];
|
||||||
|
static char sysname[_SYS_NAMELEN];
|
||||||
|
# else
|
||||||
|
// Last hope! May segfault!
|
||||||
|
static char *kver;
|
||||||
|
static char *sysname;
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
static double get_uptime (double *up, double *idle);
|
static double get_uptime (double *up, double *idle);
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,42 @@ AC_HEADER_STDC
|
|||||||
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h)
|
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h)
|
||||||
AC_CHECK_HEADERS(curses.h ncurses.h)
|
AC_CHECK_HEADERS(curses.h ncurses.h)
|
||||||
|
|
||||||
|
dnl Check for particular preprocessor macros
|
||||||
|
|
||||||
|
dnl Checking if sys/utsname.h is present and defines SYS_NMLN or _SYS_NAMELEN
|
||||||
|
AC_CHECK_HEADER(sys/utsname.h,
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(if sys/utsname.h defines SYS_NMLN)
|
||||||
|
AC_TRY_RUN([[
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
int main() {
|
||||||
|
char kver[SYS_NMLN];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
]], [
|
||||||
|
dnl then
|
||||||
|
AC_DEFINE(HAVE_SYS_NMLN)
|
||||||
|
AC_MSG_RESULT(yes) ], [
|
||||||
|
dnl else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
AC_MSG_CHECKING(if sys/utsname.h defines _SYS_NAMELEN)
|
||||||
|
AC_TRY_RUN([[
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
int main() {
|
||||||
|
char kver[_SYS_NAMELEN];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
]], [
|
||||||
|
dnl then
|
||||||
|
AC_DEFINE(HAVE__SYS_NAMELEN)
|
||||||
|
AC_MSG_RESULT(yes) ], [
|
||||||
|
dnl else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
AC_MSG_WARN([sys/utsname.h does not define SYS_NMLN or _SYS_NAMELEN])],[:])
|
||||||
|
],[:])
|
||||||
|
|
||||||
|
, [AC_MSG_WARN([LCDproc client requires sys/utsname.h.])])
|
||||||
|
|
||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
AC_C_INLINE
|
AC_C_INLINE
|
||||||
|
|||||||
Reference in New Issue
Block a user