After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 651920 - Improve qsort_r detection
Improve qsort_r detection
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.29.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-06-05 12:20 UTC by Kalev Lember
Modified: 2011-06-14 11:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH 1/2] configure.ac: Print qsort_r result only once (1003 bytes, patch)
2011-06-05 12:21 UTC, Kalev Lember
committed Details | Review
[PATCH 2/2] configure.ac: Check for qsort_r function before running the test program (2.57 KB, patch)
2011-06-05 12:21 UTC, Kalev Lember
committed Details | Review
fix regression introduced by PATCH 2/2 (1.35 KB, patch)
2011-06-09 11:40 UTC, Christophe Fergeau
committed Details | Review

Description Kalev Lember 2011-06-05 12:20:04 UTC
qsort_r() detection currently uses AC_RUN_IFELSE to check if qsort_r() argument order matches what we expect. However, when cross compiling, the test program cannot be run and everyone has has to populate the cache manually with glib_cv_have_qsort_r.

To make it easier to cross compile for platforms without qsort_r, it would be better to first check if qsort_r exists. That way we can avoid running the test program when qsort_r is unavailable, removing the need to manually populate the cache.
Comment 1 Kalev Lember 2011-06-05 12:21:05 UTC
Created attachment 189264 [details] [review]
[PATCH 1/2] configure.ac: Print qsort_r result only once

AC_CACHE_CHECK that was introduced in 70a19815 prints the result, so the
following AC_MSG_RESULT is no longer needed.
Comment 2 Kalev Lember 2011-06-05 12:21:53 UTC
Created attachment 189265 [details] [review]
[PATCH 2/2] configure.ac: Check for qsort_r function before running the test program

When cross compiling, test programs cannot be run. In order to make it
easier to cross compile for targets that do not have qsort_r(), check
for the function before trying to run the test program.

This avoid having to populate cache with glib_cv_have_qsort_r=no with
e.g. mingw cross compiler.
Comment 3 Matthias Clasen 2011-06-05 15:09:58 UTC
Review of attachment 189264 [details] [review]:

Thanks, looks good
Comment 4 Matthias Clasen 2011-06-05 15:11:08 UTC
Review of attachment 189265 [details] [review]:

Good idea.
Comment 5 Kalev Lember 2011-06-05 16:53:02 UTC
Review of attachment 189264 [details] [review]:

Pushed as 886a349
Comment 6 Kalev Lember 2011-06-05 16:53:35 UTC
Review of attachment 189265 [details] [review]:

Pushed as 03441e4
Comment 7 Christophe Fergeau 2011-06-09 11:40:00 UTC
Created attachment 189538 [details] [review]
fix regression introduced by PATCH 2/2

PATCH 2/2 causes a regression since AC_CHECK_FUNCS will automatically define HAVE_QSORT_R if it can be found. However, we don't want to have it defined before doing additionnal checks since on BSD we can't use HAVE_QSORT_R, so defining it really need to be done after AC_RUN_IFELSE has been done. This breaks glib/gtk on OSX (and I guess on all BSDs), the attached patch uses AC_CHECK_FUNC instead which doesn't define HAVE_QSORT_R automatically.
Comment 8 Matthias Clasen 2011-06-09 14:29:12 UTC
Review of attachment 189538 [details] [review]:

Please reopen the bug in cases like this.
Thanks for catching that, though !
Comment 9 Christophe Fergeau 2011-06-10 13:20:36 UTC
Comment on attachment 189538 [details] [review]
fix regression introduced by PATCH 2/2

Committed, I thought I had reopened the bug, I'll .e more careful next time.