summaryrefslogtreecommitdiffstats
path: root/test cases/linuxlike/14 static dynamic linkage/meson.build
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/linuxlike/14 static dynamic linkage/meson.build
parentInitial commit. (diff)
downloadmeson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.tar.xz
meson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/linuxlike/14 static dynamic linkage/meson.build')
-rw-r--r--test cases/linuxlike/14 static dynamic linkage/meson.build36
1 files changed, 36 insertions, 0 deletions
diff --git a/test cases/linuxlike/14 static dynamic linkage/meson.build b/test cases/linuxlike/14 static dynamic linkage/meson.build
new file mode 100644
index 0000000..fb0e353
--- /dev/null
+++ b/test cases/linuxlike/14 static dynamic linkage/meson.build
@@ -0,0 +1,36 @@
+project('static dynamic', 'c')
+
+# Solaris does not ship static libraries
+if host_machine.system() == 'sunos'
+ has_static = false
+else
+ has_static = true
+endif
+
+cc = meson.get_compiler('c')
+
+z_default = cc.find_library('z')
+if has_static
+ z_static = cc.find_library('z', static: true)
+endif
+z_dynamic = cc.find_library('z', static: false)
+
+exe_default = executable('main_default', 'main.c', dependencies: [z_default])
+if has_static
+ exe_static = executable('main_static', 'main.c', dependencies: [z_static])
+endif
+exe_dynamic = executable('main_dynamic', 'main.c', dependencies: [z_dynamic])
+
+test('test default', exe_default)
+if has_static
+ test('test static', exe_static)
+endif
+test('test dynamic', exe_dynamic)
+
+if has_static
+ test('verify static linking', find_program('verify_static.py'),
+ args: ['--platform=' + host_machine.system(), exe_static.full_path()])
+endif
+test('verify dynamic linking', find_program('verify_static.py'),
+ args: ['--platform=' + host_machine.system(), exe_dynamic.full_path()],
+ should_fail: true)