Detect the presence of malloc_trim to fix the build with musl
malloc_trim is indeed a GNU extension, but an extension of glibc. Relying on GNUC unfortunately doesn't help with that. Check for the actual presence of malloc_trim with cmake's check_function_exists instead. This fixes the build with musl libc, which doesn't come with malloc_trim.
Co-authored-by: Ahmad Samir a.samirh78@gmail.com
Edited by Heiko Becker