--- src/CMakeLists.txt.orig 2017-10-15 22:35:17.000000000 +0200 +++ src/CMakeLists.txt 2017-10-20 09:13:13.740336950 +0200 @@ -118,6 +118,19 @@ message(FATAL_ERROR "pkg-config required but not found") endif (PKG_CONFIG_FOUND) +include (CheckFunctionExists) +check_function_exists(random_r HAVE_RANDOM_R) + +# musl systems don’t have random_r() and also need argp-standalone +if (NOT HAVE_RANDOM_R) + find_library (ARGP_LIB argp REQUIRED) + if (ARGP_LIB) + message(STATUS "Found argp") + else() + message(FATAL_ERROR "argp required but not found") + endif() +endif() + # libz set (CMAKE_REQUIRED_LIBRARIES z) check_c_source_compiles ( @@ -497,6 +510,10 @@ target_link_libraries (yoshimi ${ExternLibraries}) +if (NOT HAVE_RANDOM_R) + target_link_libraries (yoshimi ${ARGP_LIB}) +endif() + install (TARGETS yoshimi RUNTIME DESTINATION bin) install (DIRECTORY ../banks DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/yoshimi