From 8f5292aad3a0dcbc219d76d63ea915f49d403bbc Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 28 Sep 2009 23:48:38 -0700 Subject: Replace platform #ifdefs with autoconf tests Signed-off-by: Alan Coopersmith --- audio.c | 2 +- common.c | 8 +------- configure.ac | 3 +++ decode11.c | 5 ----- fd.c | 18 +++++++----------- scope.c | 7 +------ scope.h | 6 ++++-- server.c | 5 ----- 8 files changed, 17 insertions(+), 37 deletions(-) diff --git a/audio.c b/audio.c index 4452a34..aaef19e 100644 --- a/audio.c +++ b/audio.c @@ -27,7 +27,7 @@ #include /* for struct iovec, used by socket.h */ #include /* for AF_INET, SOCK_STREAM, ... */ #include /* for FIONCLEX, FIONBIO, ... */ -#ifdef SVR4 +#if !defined(FIOCLEX) && defined(HAVE_SYS_FILIO_H) #include #endif #include diff --git a/common.c b/common.c index 8229e5f..8f9b291 100644 --- a/common.c +++ b/common.c @@ -55,12 +55,6 @@ #include "scope.h" #include - -#ifdef SYSV -#define bzero(s,l) memset(s, 0, l) -#define bcopy(s,d,l) memmove(d,s,l) -#endif - #include /* ********************************************** */ @@ -209,7 +203,7 @@ static int ListenTransCount; #include /* for AF_INET, SOCK_STREAM, ... */ #include /* for FIONCLEX, FIONBIO, ... */ #include /* for FIONCLEX, FIONBIO, ... */ -#ifdef SVR4 +#if !defined(FIOCLEX) && defined(HAVE_SYS_FILIO_H) #include #endif diff --git a/configure.ac b/configure.ac index f4739a9..8560d22 100644 --- a/configure.ac +++ b/configure.ac @@ -64,6 +64,9 @@ XSCOPE_CFLAGS="$XSCOPE_CFLAGS -DUSE_XTRANS" AC_SUBST(XSCOPE_CFLAGS) AC_SUBST(XSCOPE_LIBS) +AC_CHECK_FUNCS([getdtablesize]) +AC_CHECK_HEADERS([sys/filio.h]) + dnl Allow checking code with lint, sparse, etc. XORG_WITH_LINT diff --git a/decode11.c b/decode11.c index 0c43108..5f24f34 100644 --- a/decode11.c +++ b/decode11.c @@ -58,11 +58,6 @@ #include "extensions.h" #include "lbxscope.h" -#ifdef SYSV -#define bzero(s,l) memset(s, 0, l) -#define bcopy(s,d,l) memmove(d,s,l) -#endif - /* There are 4 types of things in X11: requests, replies, errors, and events. diff --git a/fd.c b/fd.c index 69a00ee..3ed013b 100644 --- a/fd.c +++ b/fd.c @@ -58,17 +58,11 @@ #include "scope.h" -#ifdef SYSV #include -#define getdtablesize() sysconf(_SC_OPEN_MAX) -#define bzero(s,l) memset(s, 0, l) -#define bcopy(s,d,l) memmove(d,s,l) -#endif - #include /* for struct iovec, used by socket.h */ #include /* for AF_INET, SOCK_STREAM, ... */ #include /* for FIONCLEX, FIONBIO, ... */ -#ifdef SVR4 +#if !defined(FIOCLEX) && defined(HAVE_SYS_FILIO_H) #include #endif #include @@ -100,14 +94,16 @@ InitializeFD(void) enterprocedure("InitializeFD"); /* get the number of file descriptors the system will let us use */ -#if defined(hpux) || defined(SVR4) - MaxFD = _NFILE - 1; -#else +#ifdef _SC_OPEN_MAX + MaxFD = sysconf(_SC_OPEN_MAX); +#elif defined(HAVE_GETDTABLESIZE) MaxFD = getdtablesize(); +#else + MaxFD = _NFILE - 1; +#endif if (MaxFD > FD_SETSIZE) { MaxFD = FD_SETSIZE; } -#endif if (MaxFD > StaticMaxFD) { fprintf(stderr, "Recompile with larger StaticMaxFD value %d\n", MaxFD); diff --git a/scope.c b/scope.c index 4a46ff4..dd7b717 100644 --- a/scope.c +++ b/scope.c @@ -59,16 +59,11 @@ #include #include -#ifdef SYSV -#define bzero(s,l) memset(s, 0, l) -#define bcopy(s,d,l) memmove(d,s,l) -#endif - #include /* needed by sys/socket.h and netinet/in.h */ #include /* for struct iovec, used by socket.h */ #include /* for AF_INET, SOCK_STREAM, ... */ #include /* for FIONCLEX, FIONBIO, ... */ -#ifdef SVR4 +#if !defined(FIOCLEX) && defined(HAVE_SYS_FILIO_H) #include #endif #include diff --git a/scope.h b/scope.h index 3fa3dd0..8954b68 100644 --- a/scope.h +++ b/scope.h @@ -56,6 +56,8 @@ #ifndef XSCOPE_SCOPE_H #define XSCOPE_SCOPE_H +#include "config.h" + #include #include #include @@ -63,9 +65,9 @@ #include #include #include -#ifdef SVR4 +#if !defined(FIOCLEX) && defined(HAVE_SYS_FILIO_H) #include -#endif /* SVR4 */ +#endif #define Boolean short #define true 1 diff --git a/server.c b/server.c index 629ade2..610a0b3 100644 --- a/server.c +++ b/server.c @@ -56,11 +56,6 @@ #include "scope.h" #include "x11.h" -#ifdef SYSV -#define bzero(s,l) memset(s, 0, l) -#define bcopy(s,d,l) memmove(d,s,l) -#endif - struct TypeDef TD[MaxTypes]; unsigned char RBf[2]; unsigned char SBf[4]; -- cgit v1.2.1