GNOME Bugzilla – Bug 651920
Improve qsort_r detection
Last modified: 2011-06-14 11:14:27 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.
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.
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.
Review of attachment 189264 [details] [review]: Thanks, looks good
Review of attachment 189265 [details] [review]: Good idea.
Review of attachment 189264 [details] [review]: Pushed as 886a349
Review of attachment 189265 [details] [review]: Pushed as 03441e4
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.
Review of attachment 189538 [details] [review]: Please reopen the bug in cases like this. Thanks for catching that, though !
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.