From 5121281b9af535df77176c8fcdf3c62f4bb20f58 Mon Sep 17 00:00:00 2001 From: Jan Tulak Date: Tue, 18 Aug 2015 17:53:18 +1000 Subject: [PATCH] build: Add fls check into autoconf Signed-off-by: Jan Tulak Reviewed-by: Christoph Hellwig Signed-off-by: Dave Chinner --- configure.ac | 1 + include/bitops.h | 2 ++ include/builddefs.in | 4 ++++ m4/package_libcdev.m4 | 12 ++++++++++++ 4 files changed, 19 insertions(+) diff --git a/configure.ac b/configure.ac index 0aba90c36..abb790453 100644 --- a/configure.ac +++ b/configure.ac @@ -116,6 +116,7 @@ AC_HAVE_FIEMAP AC_HAVE_PREADV AC_HAVE_SYNC_FILE_RANGE AC_HAVE_MNTENT +AC_HAVE_FLS AC_HAVE_BLKID_TOPO AC_HAVE_READDIR diff --git a/include/bitops.h b/include/bitops.h index 930f64a32..44599a784 100644 --- a/include/bitops.h +++ b/include/bitops.h @@ -5,6 +5,7 @@ * fls: find last bit set. */ +#ifndef HAVE_FLS static inline int fls(int x) { int r = 32; @@ -32,6 +33,7 @@ static inline int fls(int x) } return r; } +#endif /* HAVE_FLS */ static inline int fls64(__u64 x) { diff --git a/include/builddefs.in b/include/builddefs.in index e522243aa..885195642 100644 --- a/include/builddefs.in +++ b/include/builddefs.in @@ -104,6 +104,7 @@ HAVE_PREADV = @have_preadv@ HAVE_SYNC_FILE_RANGE = @have_sync_file_range@ HAVE_READDIR = @have_readdir@ HAVE_MNTENT = @have_mntent@ +HAVE_FLS = @have_fls@ GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall # -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-decl @@ -131,6 +132,9 @@ PLDLIBS = -L/usr/local/lib -lintl PCFLAGS = -I/usr/local/include $(GCCFLAGS) DEPENDFLAGS = -D__FreeBSD__ endif +ifeq ($(HAVE_FLS),yes) +LCFLAGS+= -DHAVE_FLS +endif ifeq ($(HAVE_MNTENT),yes) PCFLAGS+= -DHAVE_MNTENT endif diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4 index 75aa61ee8..4a963745c 100644 --- a/m4/package_libcdev.m4 +++ b/m4/package_libcdev.m4 @@ -202,6 +202,18 @@ AC_DEFUN([AC_HAVE_READDIR], AC_SUBST(have_readdir) ]) +# +# Check if we have a flc call (Mac OS X) +# +AC_DEFUN([AC_HAVE_FLS], + [ AC_CHECK_DECL([fls], + have_fls=yes, + [], + [#include ] + ) + AC_SUBST(have_fls) + ]) + # # Check if there is mntent.h # -- 2.47.2