Rather than check for specific glibc version on PLATFORM_LINUX, check
the existance of qsort_r.
This fixes the following compile error with musl libc:
CC src/main.o
In file included from src/main.c:39:0:
src/tvheadend.h:608:20: error: missing binary operator before token "("
#if !__GLIBC_PREREQ(2,8)
^
return ok;
}' -lpthread
+check_cc_snippet qsort_r '
+#include <stdlib.h>
+#define TEST test
+int test(void)
+{
+ qsort_r(NULL, 0, 0, NULL, NULL);
+ return 0;
+}
+'
#
# Python
#
char *regexp_escape ( const char *str );
-#ifdef PLATFORM_LINUX
/* glibc wrapper */
-#if !__GLIBC_PREREQ(2,8)
+#if ! ENABLE_QSORT_R
void
qsort_r(void *base, size_t nmemb, size_t size,
int (*cmp)(const void *, const void *, void *), void *aux);
-#endif
-#endif /* PLATFORM_LINUX */
+#endif /* ENABLE_QSORT_R */
/* printing */
# if __WORDSIZE == 64
return r;
}
-#ifdef PLATFORM_LINUX
+#if ! ENABLE_QSORT_R
/*
* qsort_r wrapper for pre GLIBC 2.8
*/
-#if !__GLIBC_PREREQ(2,8)
static __thread struct {
int (*cmp) ( const void *a, const void *b, void *p );
void *aux;
qsort_r_data.aux = aux;
qsort(base, nmemb, size, qsort_r_wrap);
}
-#endif /* GLIBC < 2.8 */
-#endif /* PLATFORM_LINUX */
+#endif /* ENABLE_QSORT_R */