]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
meson: never require a libm
authorEli Schwartz <eschwartz@archlinux.org>
Mon, 31 Jan 2022 02:02:44 +0000 (21:02 -0500)
committerEli Schwartz <eschwartz@archlinux.org>
Mon, 31 Jan 2022 02:50:42 +0000 (21:50 -0500)
libm is not guaranteed to exist. POSIX requires the math functions to
exist, but doesn't require to have it be a standalone library.

On platforms where libm exists as a standalone library, it will always
be found by meson -- it is shipped with libc.

If it is not found, then we can safely assume the linker will make the
math functions available by default.

See https://mesonbuild.com/howtox.html#add-math-library-lm-portably

Fixes building with bin_tests=true on Windows.

build/meson/meson.build

index 0c29a7621b91114d8a3d31c022166067cea67d4c..e0ea3dff9cec4c1fa1ea30a317e538bb79fd4c6f 100644 (file)
@@ -92,7 +92,7 @@ feature_lz4 = get_option('lz4')
 # Dependencies
 # =============================================================================
 
-libm_dep = cc.find_library('m', required: bin_tests)
+libm_dep = cc.find_library('m', required: false)
 thread_dep = dependency('threads', required: feature_multi_thread)
 use_multi_thread = thread_dep.found()
 # Arguments in dependency should be equivalent to those passed to pkg-config