summary refs log tree commit diff
path: root/pkgs/applications/science/physics/crystfel/link-to-argp-standalone-if-needed.patch
blob: 8314be29ac006389c84e6ff6dce784077e95854f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
diff --git a/meson.build b/meson.build
index 59bbcfb7..dd75d4e2 100644
--- a/meson.build
+++ b/meson.build
@@ -80,6 +80,12 @@ if cc.has_function('clock_gettime', prefix: '#include <time.h>')
   conf_data.set10('HAVE_CLOCK_GETTIME', true)
 endif
 
+if build_machine.system() == 'darwin' or build_machine.system() == 'freebsd' or not cc.links('#include <argp.h>\nstatic error_t parse_opt (int key, char *arg, struct argp_state *state) { argp_usage(state); return 0; }; void main() {}')
+    argpdep = cc.find_library('argp')
+else
+    argpdep = dependency('', required : false)
+endif
+
 # ************************ libcrystfel (subdir) ************************
 
 subdir('libcrystfel')
@@ -180,7 +186,7 @@ endif
 
 indexamajig = executable('indexamajig', indexamajig_sources,
                          dependencies: [mdep, libcrystfeldep, gsldep,
-                                        pthreaddep, zmqdep, asapodep],
+                                        pthreaddep, zmqdep, asapodep, argpdep],
                          install: true,
                          install_rpath: '$ORIGIN/../lib64/:$ORIGIN/../lib')