From 44d9468edbbbb19d73c488345ceef1073d1df3a7 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 27 Aug 2007 15:56:14 -0700 Subject: Use autoconf to check for usleep before falling into twisty #ifdef maze --- configure.ac | 3 +++ xset.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 3c91865..a43b200 100644 --- a/configure.ac +++ b/configure.ac @@ -30,6 +30,9 @@ AM_CONFIG_HEADER(config.h) AC_PROG_CC AC_PROG_INSTALL +# Checks for system functions +AC_CHECK_FUNCS([usleep]) + # Checks for pkg-config packages PKG_CHECK_MODULES(XSET, xmuu) diff --git a/xset.c b/xset.c index a77d977..c2676e0 100644 --- a/xset.c +++ b/xset.c @@ -87,8 +87,10 @@ in this Software without prior written authorization from The Open Group. #endif #undef BOOL #endif -#if defined(SVR4) && defined(sun) -#include +#ifndef HAVE_USLEEP +# if defined(SVR4) && defined(sun) +# include +# endif #endif #endif /* DPMSExtension */ @@ -575,6 +577,9 @@ for (i = 1; i < argc; ) { * * On OS/2, use _sleep2() */ +#ifdef HAVE_USLEEP +# define Usleep(us) usleep((us)) +#else #ifdef SVR4 # ifdef sun /* Anything to avoid linking with -lposix4 */ @@ -610,6 +615,7 @@ for (i = 1; i < argc; ) { # define Usleep(us) usleep((us)) # endif #endif +#endif /* HAVE_USLEEP */ if (strcmp(arg, "on") == 0) { DPMSEnable(dpy); -- cgit v1.2.3