summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-13 11:00:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-13 11:00:55 +0000
commitcff6bdfcba57995e1879c7a2003f9949aec29632 (patch)
tree017c290c13ca848e91e08ce17b50252fa2809449 /configure.ac
parent38122275f3d23226891a04108f69c8d14b7a6fe1 (diff)
Make qsort_r() flavor detecting work if qsort_r() is a macro
On FreeBSD we're going to switch to the GNU-ish version of qsort_r(). POSIX is also considering standardizing that one. To prevent faulty calls, we have a macro in place to throw a compiler error if a BSD-style qsort_r() call is performed on a patched system. Such an approach tends to be permitted by POSIX. The configure check we have in Ruby would fail if qsort_r() is a function macro. Add parentheses around it to prevent macro expansion and force the declaration of a prototype. [Fix GH-1954] From: Ed Schouten <ed@nuxi.nl> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac4
1 files changed, 2 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index f401fd5..14fe527 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1950,7 +1950,7 @@ AS_IF([test "$ac_cv_func_qsort_r" != no], [
AC_CACHE_CHECK(whether qsort_r is GNU version, rb_cv_gnu_qsort_r,
[AC_TRY_COMPILE([
@%:@include <stdlib.h>
-void qsort_r(void *base, size_t nmemb, size_t size,
+void (qsort_r)(void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *, void *),
void *arg);
],[ ],
@@ -1960,7 +1960,7 @@ void qsort_r(void *base, size_t nmemb, size_t size,
AC_CACHE_CHECK(whether qsort_r is BSD version, rb_cv_bsd_qsort_r,
[AC_TRY_COMPILE([
@%:@include <stdlib.h>
-void qsort_r(void *base, size_t nmemb, size_t size,
+void (qsort_r)(void *base, size_t nmemb, size_t size,
void *arg, int (*compar)(void *, const void *, const void *));
],[ ],
[rb_cv_bsd_qsort_r=yes],