--- CMakeLists.txt.orig 2022-07-29 16:11:55 UTC +++ CMakeLists.txt @@ -58,29 +58,25 @@ else(WIN32) else(WIN32) -try_run(RUN_RESULT_2 COMPILE_SUCCESS_2 ${CMAKE_CURRENT_BINARY_DIR} ${config_SRCS} COMPILE_DEFINITIONS -DTEST_DECLARE_QSORT_R=ON) -if(COMPILE_SUCCESS_2 AND (RUN_RESULT_2 EQUAL 0)) - SET(VAR_2 0) +try_run(RUN_RESULT_BSD_QSORT_R COMPILE_SUCCESS_BSD_QSORT_R ${CMAKE_CURRENT_BINARY_DIR} ${config_SRCS} COMPILE_DEFINITIONS -DTEST_BSD_QSORT_R=ON) +try_run(RUN_RESULT_GNU_QSORT_R COMPILE_SUCCESS_GNU_QSORT_R ${CMAKE_CURRENT_BINARY_DIR} ${config_SRCS} COMPILE_DEFINITIONS -DTEST_GNU_QSORT_R=ON) +if(COMPILE_SUCCESS_GNU_QSORT_R AND (RUN_RESULT_GNU_QSORT_R EQUAL 0)) + SET(WANT_DECLARE_QSORT_R 0) + SET(WANT_BUNDLED_QSORT_R 0) + SET(WANT_SWAP_QSORT_R 1) else() - SET(VAR_2 1) + SET(WANT_SWAP_QSORT_R 0) + if(COMPILE_SUCCESS_BSD_QSORT_R AND (RUN_RESULT_BSD_QSORT_R EQUAL 0)) + SET(WANT_DECLARE_QSORT_R 0) + SET(WANT_BUNDLED_QSORT_R 0) + else() + SET(WANT_DECLARE_QSORT_R 1) + SET(WANT_BUNDLED_QSORT_R 1) + endif() endif() -file(APPEND "${config_FN}" "#define NEED_DECLARE_QSORT_R ${VAR_2}\n") - -try_run(RUN_RESULT_3 COMPILE_SUCCESS_3 ${CMAKE_CURRENT_BINARY_DIR} ${config_SRCS} COMPILE_DEFINITIONS -DTEST_QSORT_R=ON) -if(COMPILE_SUCCESS_3 AND (RUN_RESULT_3 EQUAL 0)) - SET(VAR_3 1) -else() - SET(VAR_3 0) -endif() -file(APPEND "${config_FN}" "#define NEED_QSORT_R ${VAR_3}\n") - -try_run(RUN_RESULT_4 COMPILE_SUCCESS_4 ${CMAKE_CURRENT_BINARY_DIR} ${config_SRCS} COMPILE_DEFINITIONS -DTEST_SWAP_QSORT_R=ON) -if(COMPILE_SUCCESS_4 AND (RUN_RESULT_4 EQUAL 0)) - SET(VAR_4 1) -else() - SET(VAR_4 0) -endif() -file(APPEND "${config_FN}" "#define NEED_SWAP_QSORT_R ${VAR_4}\n") +file(APPEND "${config_FN}" "#define NEED_DECLARE_QSORT_R ${WANT_DECLARE_QSORT_R}\n") +file(APPEND "${config_FN}" "#define NEED_SWAP_QSORT_R ${WANT_SWAP_QSORT_R}\n") +file(APPEND "${config_FN}" "#define NEED_QSORT_R ${WANT_BUNDLED_QSORT_R}\n") endif(WIN32)