File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,25 @@ project(
88 ' buildtype=debugoptimized' ,
99 ],
1010)
11- has_cc = add_languages (' c' , required : get_option (' python' ), native : false )
11+ fc_nested_functions = meson .get_compiler(' fortran' ).run(
12+ ' call a(); contains; subroutine a(); print "(a)", "Nested functions supported"; end; end' ,
13+ ).returncode() == 0
14+ if fc_nested_functions
15+ has_cc = add_languages (' c' , required : get_option (' python' ), native : false )
16+ else
17+ has_cc = false
18+ if get_option (' python' )
19+ error (' Cannot compile Python API, Fortran compiler does not support nested functions' )
20+ else
21+ warning (' Fortran compiler does not support nested functions, C API is disabled' )
22+ endif
23+ endif
1224
1325minpack_lib = library (
1426 meson .project_name(),
1527 sources : files (
1628 ' src/minpack.f90' ,
17- ' src/minpack_capi.f90' ,
29+ fc_nested_functions ? ' src/minpack_capi.f90' : ,
1830 ),
1931 install : true ,
2032)
@@ -38,9 +50,11 @@ install_data(
3850 install_dir : get_option (' datadir' )/ ' licenses' / meson .project_name()
3951)
4052
41- install_headers (
42- minpack_header,
43- )
53+ if fc_nested_functions
54+ install_headers (
55+ minpack_header,
56+ )
57+ endif
4458
4559module_id = meson .project_name()
4660meson .add_install_script(
You can’t perform that action at this time.
0 commit comments