File tree 1 file changed +19
-5
lines changed
1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,25 @@ project(
8
8
' buildtype=debugoptimized' ,
9
9
],
10
10
)
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
12
24
13
25
minpack_lib = library (
14
26
meson .project_name(),
15
27
sources : files (
16
28
' src/minpack.f90' ,
17
- ' src/minpack_capi.f90' ,
29
+ fc_nested_functions ? ' src/minpack_capi.f90' : ,
18
30
),
19
31
install : true ,
20
32
)
@@ -38,9 +50,11 @@ install_data(
38
50
install_dir : get_option (' datadir' )/ ' licenses' / meson .project_name()
39
51
)
40
52
41
- install_headers (
42
- minpack_header,
43
- )
53
+ if fc_nested_functions
54
+ install_headers (
55
+ minpack_header,
56
+ )
57
+ endif
44
58
45
59
module_id = meson .project_name()
46
60
meson .add_install_script(
You can’t perform that action at this time.
0 commit comments