From 4823838f77ab03cccd07860fdf8002bc577e0f04 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Thu, 9 Apr 2009 14:55:03 -0700 Subject: luit: Convert platform #ifdefs to configure tests for functions & headers Also check for __SVR4 in remaining SVR4 check to match Solaris compiler default definition. Signed-off-by: Alan Coopersmith --- configure.ac | 3 +++ luit.c | 8 ++++++-- sys.c | 35 +++++++++++------------------------ 3 files changed, 20 insertions(+), 26 deletions(-) diff --git a/configure.ac b/configure.ac index 0b3bc27..a05c0f0 100644 --- a/configure.ac +++ b/configure.ac @@ -38,6 +38,9 @@ AC_CANONICAL_HOST XORG_CWARNFLAGS +AC_CHECK_HEADERS([poll.h pty.h stropts.h sys/param.h sys/select.h]) +AC_CHECK_FUNCS([poll select grantpt]) + AC_CHECK_LIB(z, gzopen,, AC_MSG_ERROR([zlib not found])) AC_ARG_WITH(localealiasfile, diff --git a/luit.c b/luit.c index dd07653..7fa7acf 100644 --- a/luit.c +++ b/luit.c @@ -34,8 +34,12 @@ THE SOFTWARE. #include #include -#ifdef SVR4 -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_STROPTS_H +# include #endif #include diff --git a/sys.c b/sys.c index da97028..ba60fbf 100644 --- a/sys.c +++ b/sys.c @@ -34,14 +34,8 @@ THE SOFTWARE. #include #include -#ifdef SVR4 -#define HAVE_POLL -#endif - -#ifndef HAVE_POLL -#ifndef _MINIX -#define HAVE_SELECT -#endif +#ifdef HAVE_CONFIG_H +# include "config.h" #endif #ifdef HAVE_POLL @@ -49,27 +43,20 @@ THE SOFTWARE. #undef HAVE_SELECT #endif -#ifdef __QNX__ -#include -#endif - - -#if (defined(__GLIBC__) && \ - (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1))) || \ - defined(SVR4) || defined(__APPLE__) -#define HAVE_GRANTPT +#ifdef HAVE_SYS_SELECT_H +# include #endif -#ifdef __GLIBC__ -#include +#ifdef HAVE_PTY_H +# include #endif -#ifdef SVR4 -#include +#ifdef HAVE_STROPTS_H +# include #endif -#if (defined(__unix__) || defined(unix)) && !defined(USG) -#include +#ifdef HAVE_SYS_PARAM_H +# include #endif #include "sys.h" @@ -433,7 +420,7 @@ openTty(char *line) } #endif -#ifdef SVR4 +#if defined(SVR4) || defined(__SVR4) rc = ioctl(tty, I_PUSH, "ptem"); if(rc < 0) goto bail; -- cgit v1.2.3