[vlc-devel] [PATCH V3 3/7] configure: detect broken qsort_r

Thomas Guillem thomas at gllm.fr
Tue Jan 22 14:30:07 CET 2019


---
 configure.ac | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/configure.ac b/configure.ac
index 1b63a74736..c59e9cd3f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -747,6 +747,21 @@ AC_CHECK_LIB([m], [sincos], [
   AC_LIBOBJ([sincos])
 ])
 
+AC_MSG_CHECKING([broken qsort_r prototype])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <stdlib.h>
+
+_Static_assert(_Generic((qsort_r),
+    void (*)(void *, size_t, size_t, void *,
+             int (*)(void *, const void *, const void *)) : 1, default: 0),
+    "Bad prototype not matched");
+])], [
+  AC_MSG_RESULT([broken])
+  AC_DEFINE([HAVE_BROKEN_QSORT_R], 1, [Defined to 1 if the qsort_r() prototype contradicts the upcoming POSIX standard.])
+], [
+  AC_MSG_RESULT([no])
+])
+
+
 AC_MSG_CHECKING([_Thread_local support])
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([_Thread_local int foo = 0;
                    int main() {}])], [
-- 
2.20.1



More information about the vlc-devel mailing list