build: check for qsort_r independent of platform

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)
                    ^
This commit is contained in:
Natanael Copa 2014-03-04 11:49:34 +00:00
parent b5112daee8
commit 215789651c
3 changed files with 13 additions and 8 deletions

9
configure vendored
View file

@ -103,6 +103,15 @@ int test ( void )
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
#

View file

@ -603,14 +603,12 @@ int rmtree ( const char *path );
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

View file

@ -135,12 +135,11 @@ tvhthread_create0
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;
@ -160,5 +159,4 @@ qsort_r(void *base, size_t nmemb, size_t size,
qsort_r_data.aux = aux;
qsort(base, nmemb, size, qsort_r_wrap);
}
#endif /* GLIBC < 2.8 */
#endif /* PLATFORM_LINUX */
#endif /* ENABLE_QSORT_R */