[vlc-devel] [PATCH] configure: Support systems with popcount(3) and popcountll(3)

Kamil Rytarowski n54 at gmx.com
Fri Feb 23 22:21:28 CET 2018


NetBSD ships with the popcount(3) family out-of-the-box.
Add an autotools check for the existance of them in libc.
---
 configure.ac         | 2 +-
 include/vlc_common.h | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 225bcae987..f275a11489 100644
--- a/configure.ac
+++ b/configure.ac
@@ -590,7 +590,7 @@ dnl Check for system libs needed
 need_libc=false
 
 dnl Check for usual libc functions
-AC_CHECK_FUNCS([accept4 daemon fcntl flock fstatvfs fork getenv getpwuid_r isatty lstat memalign mkostemp mmap newlocale open_memstream openat pipe2 pread posix_fadvise posix_madvise posix_memalign setlocale stricmp strnicmp strptime uselocale])
+AC_CHECK_FUNCS([accept4 daemon fcntl flock fstatvfs fork getenv getpwuid_r isatty lstat memalign mkostemp mmap newlocale open_memstream openat pipe2 pread popcount popcountll posix_fadvise posix_madvise posix_memalign setlocale stricmp strnicmp strptime uselocale])
 AC_REPLACE_FUNCS([aligned_alloc atof atoll dirfd fdopendir ffsll flockfile fsync getdelim getpid lldiv memrchr nrand48 poll recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tdestroy tfind timegm timespec_get strverscmp pathconf])
 AC_REPLACE_FUNCS([gettimeofday])
 AC_CHECK_FUNC(fdatasync,,
diff --git a/include/vlc_common.h b/include/vlc_common.h
index 936df33bb6..3badb17753 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -556,6 +556,8 @@ static inline unsigned (ctz)(unsigned x)
 #endif
 }
 
+
+#ifndef HAVE_POPCOUNT
 /** Bit weight */
 VLC_USED
 static inline unsigned (popcount)(unsigned x)
@@ -572,7 +574,9 @@ static inline unsigned (popcount)(unsigned x)
     return count;
 #endif
 }
+#endif
 
+#ifndef HAVE_POPCOUNTLL
 /** Bit weight of long long */
 VLC_USED
 static inline int (popcountll)(unsigned long long x)
@@ -589,6 +593,7 @@ static inline int (popcountll)(unsigned long long x)
     return count;
 #endif
 }
+#endif
 
 VLC_USED
 static inline unsigned (parity)(unsigned x)
-- 
2.16.1



More information about the vlc-devel mailing list