build: fix libm detection in meson
[dpdk.git] / config / meson.build
index 3ffb73a..28a57f5 100644 (file)
@@ -19,10 +19,20 @@ endforeach
 pver = meson.project_version().split('.')
 major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
 abi_version = run_command(find_program('cat', 'more'),
-       files('../ABI_VERSION')).stdout().strip()
-# experimental libraries are versioned as 0.majorminor versions, e.g. 0.201
-ever = abi_version.split('.')
-experimental_abi_version = '0.@0@@1@'.format(ever.get(0), ever.get(1))
+       abi_version_file).stdout().strip()
+
+# Regular libraries have the abi_version as the filename extension
+# and have the soname be all but the final part of the abi_version.
+# Experimental libraries have soname with '0.major'
+# and the filename suffix as 0.majorminor versions,
+# e.g. v20.1 => librte_stable.so.20.1, librte_experimental.so.0.201
+#    sonames => librte_stable.so.20, librte_experimental.so.0.20
+# e.g. v20.0.1 => librte_stable.so.20.0.1, librte_experimental.so.0.2001
+#      sonames => librte_stable.so.20.0, librte_experimental.so.0.200
+abi_va = abi_version.split('.')
+stable_so_version = abi_va.length() == 2 ? abi_va[0] : abi_va[0] + '.' + abi_va[1]
+experimental_abi_version = '0.' + ''.join(abi_va)
+experimental_so_version = '0.' + ''.join(stable_so_version.split('.'))
 
 # extract all version information into the build configuration
 dpdk_conf.set('RTE_VER_YEAR', pver.get(0).to_int())
@@ -105,7 +115,7 @@ add_project_link_arguments('-pthread', language: 'c')
 dpdk_extra_ldflags += '-pthread'
 
 # on some OS, maths functions are in a separate library
-if cc.find_library('libm', required : false).found()
+if cc.find_library('m', required : false).found()
        # some libs depend on maths lib
        add_project_link_arguments('-lm', language: 'c')
        dpdk_extra_ldflags += '-lm'