mktime: don’t consult daylight
[gnulib.git] / m4 / qsort_r.m4
blob505359e3d5ac43c6816e42d7095d24c9a1460b27
1 # qsort_r.m4
2 # serial 1
3 dnl Copyright 2014-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7 dnl This file is offered as-is, without any warranty.
9 dnl Reentrant sort function.
11 dnl Written by Paul Eggert.
13 AC_DEFUN([gl_FUNC_QSORT_R],
15   dnl Persuade glibc to declare qsort_r.
16   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
18   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
20   AC_CHECK_FUNCS_ONCE([qsort_r])
21   if test $ac_cv_func_qsort_r = yes; then
22     AC_CACHE_CHECK([for qsort_r signature], [gl_cv_qsort_r_signature],
23       [AC_LINK_IFELSE(
24          [AC_LANG_PROGRAM([[#include <stdlib.h>
25                             void qsort_r (void *, size_t, size_t,
26                                           int (*) (void const *, void const *,
27                                                    void *),
28                                           void *);
29                             void (*p) (void *, size_t, size_t,
30                                        int (*) (void const *, void const *,
31                                                 void *),
32                                        void *) = qsort_r;
33                           ]])],
34          [gl_cv_qsort_r_signature=GNU],
35          [AC_LINK_IFELSE(
36             [AC_LANG_PROGRAM([[#include <stdlib.h>
37                                void qsort_r (void *, size_t, size_t, void *,
38                                              int (*) (void *,
39                                                       void const *,
40                                                       void const *));
41                                void (*p) (void *, size_t, size_t, void *,
42                                           int (*) (void *, void const *,
43                                                    void const *)) = qsort_r;
44                              ]])],
45             [gl_cv_qsort_r_signature=BSD],
46             [gl_cv_qsort_r_signature=unknown])])])
47     case $gl_cv_qsort_r_signature in
48       GNU)     ;;
49       BSD)     REPLACE_QSORT_R=1 ;;
50       unknown) HAVE_QSORT_R=0 REPLACE_QSORT_R=1 ;;
51     esac
52   else
53     HAVE_QSORT_R=0
54   fi