depot/third_party/nixpkgs/pkgs/applications/science/physics/crystfel/link-to-argp-standalone-if-needed.patch
Default email 5c370c0b2a Project import generated by Copybara.
GitOrigin-RevId: 33d1e753c82ffc557b4a585c77de43d4c922ebb5
2024-05-15 17:35:15 +02:00

26 lines
1.1 KiB
Diff

diff --git a/meson.build b/meson.build
index 4717bb2a..38d8693f 100644
--- a/meson.build
+++ b/meson.build
@@ -70,6 +70,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
+
if cc.has_function('sched_setaffinity',
prefix: '#include <sched.h>',
args: '-D_GNU_SOURCE')
@@ -186,7 +192,7 @@ endif
indexamajig = executable('indexamajig', indexamajig_sources,
dependencies: [mdep, libcrystfeldep, gsldep,
- pthreaddep, zmqdep, asapodep, asapoproddep],
+ pthreaddep, zmqdep, asapodep, asapoproddep, argpdep],
install: true,
install_rpath: crystfel_rpath)