From ab17f88506a2dde32c50ff72b03743cd9c384ecc Mon Sep 17 00:00:00 2001
From: Julien Cristau <jcristau@debian.org>
Date: Mon, 22 Sep 2008 01:59:31 +0200
Subject: [PATCH] Don't use our version of ffs() if the system has one

---
 configure.ac            | 2 +-
 dix/ffs.c               | 4 ++++
 include/dix-config.h.in | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 95fa73af1c..60cdc144aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -180,7 +180,7 @@ dnl Checks for library functions.
 AC_FUNC_VPRINTF
 AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
 		strtol getopt getopt_long vsnprintf walkcontext backtrace \
-		getisax getzoneid shmctl64 strcasestr])
+		getisax getzoneid shmctl64 strcasestr ffs])
 AC_FUNC_ALLOCA
 dnl Old HAS_* names used in os/*.c.
 AC_CHECK_FUNC([getdtablesize],
diff --git a/dix/ffs.c b/dix/ffs.c
index b75657d295..d0bd3e507e 100644
--- a/dix/ffs.c
+++ b/dix/ffs.c
@@ -30,6 +30,8 @@ The Open Group.
 #include <dix-config.h>
 #endif
 
+#ifndef HAVE_FFS
+
 #include "dix.h"
 
 int
@@ -42,3 +44,5 @@ ffs(int i)
 	i >>= 1;
     return j;
 }
+
+#endif
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 21d8d9c10c..06138c5db6 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -433,4 +433,7 @@
 /* Need the strcasestr function. */
 #undef NEED_STRCASESTR
 
+/* Define to 1 if you have the `ffs' function. */
+#undef HAVE_FFS
+
 #endif /* _DIX_CONFIG_H_ */
-- 
GitLab