1test for __compar_fn_t and if not defined by libc then define it 2help make directfb compile with musl 3 4Upstream-Status: Pending 5Signed-off-by: Khem Raj <raj.khem@gmail.com> 6 7Index: DirectFB-1.7.7/configure.in 8=================================================================== 9--- DirectFB-1.7.7.orig/configure.in 10+++ DirectFB-1.7.7/configure.in 11@@ -112,6 +112,17 @@ AC_CHECK_SIZEOF(long) 12 AC_CHECK_SIZEOF(long long) 13 AC_CHECK_FUNCS(fork) 14 15+AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [ 16+ AC_TRY_COMPILE( 17+ [#include <stdlib.h>], 18+ [void test_fn(void) { qsort(NULL, 0, 0, (__compar_fn_t)NULL); }], 19+ ccache_cv_COMPAR_FN_T=yes, 20+ ccache_cv_COMPAR_FN_T=no)]) 21+if test x"$ccache_cv_COMPAR_FN_T" = x"yes"; then 22+ AC_DEFINE(HAVE_COMPAR_FN_T, 1, 23+ Define to 1 if you have the `__compar_fn_t' typedef.) 24+fi 25+ 26 AC_PATH_PROGS(PERL, perl5 perl) 27 28 AC_PATH_PROG(MAN2HTML, man2html, no) 29Index: DirectFB-1.7.7/inputdrivers/lirc/lirc.c 30=================================================================== 31--- DirectFB-1.7.7.orig/inputdrivers/lirc/lirc.c 32+++ DirectFB-1.7.7/inputdrivers/lirc/lirc.c 33@@ -59,6 +59,11 @@ 34 35 #include <core/input_driver.h> 36 37+#if HAVE_COMPAR_FN_T 38+#define COMPAR_FN_T __compar_fn_t 39+#else 40+typedef int (*COMPAR_FN_T)(const void *, const void *); 41+#endif 42 43 DFB_INPUT_DRIVER( lirc ) 44 45@@ -97,7 +102,7 @@ static DFBInputDeviceKeySymbol lirc_pars 46 qsort ( keynames, 47 D_ARRAY_SIZE( keynames ), 48 sizeof(keynames[0]), 49- (__compar_fn_t) keynames_sort_compare ); 50+ (COMPAR_FN_T) keynames_sort_compare ); 51 keynames_sorted = true; 52 } 53 54@@ -124,7 +129,7 @@ static DFBInputDeviceKeySymbol lirc_pars 55 symbol_name = bsearch( name, keynames, 56 D_ARRAY_SIZE( keynames ), 57 sizeof(keynames[0]), 58- (__compar_fn_t) keynames_compare ); 59+ (COMPAR_FN_T) keynames_compare ); 60 if (symbol_name) 61 return symbol_name->symbol; 62 break; 63