summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cc0a0d4dc..de591e4e4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -58,15 +58,29 @@ add_feature_info(futimens GIT_USE_FUTIMENS "futimens support")
# qsort
+# old-style FreeBSD qsort_r() has the 'context' parameter as the first argument
+# of the comparison function:
check_prototype_definition(qsort_r
- "void qsort_r(void *base, size_t nmemb, size_t size, void *thunk, int (*compar)(void *, const void *, const void *))"
+ "void (qsort_r)(void *base, size_t nmemb, size_t size, void *context, int (*compar)(void *, const void *, const void *))"
"" "stdlib.h" GIT_QSORT_R_BSD)
+# GNU or POSIX qsort_r() has the 'context' parameter as the last argument of the
+# comparison function:
check_prototype_definition(qsort_r
- "void qsort_r(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *arg)"
+ "void (qsort_r)(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *context)"
"" "stdlib.h" GIT_QSORT_R_GNU)
-check_function_exists(qsort_s GIT_QSORT_S)
+# C11 qsort_s() has the 'context' parameter as the last argument of the
+# comparison function, and returns an error status:
+check_prototype_definition(qsort_s
+ "errno_t (qsort_s)(void *base, rsize_t nmemb, rsize_t size, int (*compar)(const void *, const void *, void *), void *context)"
+ "0" "stdlib.h" GIT_QSORT_S_C11)
+
+# MSC qsort_s() has the 'context' parameter as the first argument of the
+# comparison function, and as the last argument of qsort_s():
+check_prototype_definition(qsort_s
+ "void (qsort_s)(void *base, size_t num, size_t width, int (*compare )(void *, const void *, const void *), void *context)"
+ "" "stdlib.h" GIT_QSORT_S_MSC)
# random / entropy data