@@ -1440,14 +1440,16 @@ end function compiler_name
1440
1440
1441
1441
! > Run a single-source Fortran program using the current compiler
1442
1442
! > Compile a Fortran object
1443
- logical function check_fortran_source_runs (self , input ) result(success)
1443
+ logical function check_fortran_source_runs (self , input , compile_flags , link_flags ) result(success)
1444
1444
! > Instance of the compiler object
1445
1445
class(compiler_t), intent (in ) :: self
1446
1446
! > Program Source
1447
1447
character (len=* ), intent (in ) :: input
1448
+ ! > Optional build and link flags
1449
+ character (len=* ), optional , intent (in ) :: compile_flags, link_flags
1448
1450
1449
1451
integer :: stat,unit
1450
- character (:), allocatable :: source,object,logf,exe
1452
+ character (:), allocatable :: source,object,logf,exe,flags,ldflags
1451
1453
1452
1454
success = .false.
1453
1455
@@ -1463,10 +1465,17 @@ logical function check_fortran_source_runs(self, input) result(success)
1463
1465
write (unit,* ) input
1464
1466
close (unit)
1465
1467
1468
+ ! > Get flags
1469
+ flags = self% get_default_flags(release= .false. )
1470
+ ldflags = self% get_default_flags(release= .false. )
1471
+
1472
+ if (present (compile_flags)) flags = flags// " " // compile_flags
1473
+ if (present (link_flags)) ldflags = ldflags// " " // link_flags
1474
+
1466
1475
! > Compile and link program
1467
- call self% compile_fortran(source, object, self % get_default_flags(release = .false. ) , logf, stat)
1476
+ call self% compile_fortran(source, object, flags , logf, stat)
1468
1477
if (stat== 0 ) &
1469
- call self% link(exe, self % get_default_flags(release = .false. ) // " " // object, logf, stat)
1478
+ call self% link(exe, ldflags // " " // object, logf, stat)
1470
1479
1471
1480
! > Run and retrieve exit code
1472
1481
if (stat== 0 ) &
0 commit comments