find_feature Subroutine

public subroutine find_feature(features, feature_name, current_platform, found, chosen_feature)

Find matching feature configuration (similar to find_profile)

Arguments

Type IntentOptional Attributes Name
type(feature_config_t), intent(in), allocatable :: features(:)
character(len=*), intent(in) :: feature_name
type(platform_config_t), intent(in) :: current_platform
logical, intent(out) :: found
type(feature_config_t), intent(out) :: chosen_feature

Source Code

    subroutine find_feature(features, feature_name, current_platform, found, chosen_feature)
        type(feature_config_t), allocatable, intent(in) :: features(:)
        character(*), intent(in) :: feature_name
        type(platform_config_t), intent(in) :: current_platform
        logical, intent(out) :: found
        type(feature_config_t), intent(out) :: chosen_feature
        
        integer :: i
        
        found = .false.
        if (size(features) < 1) return
        
        ! Try to find exact match (feature + compiler + OS)
        do i = 1, size(features)
            if (features(i)%name == feature_name .and. &
                features(i)%platform%matches(current_platform)) then
                chosen_feature = features(i)
                found = .true.
                return
            end if
        end do
        
        ! Try to find compiler match with OS_ALL
        do i = 1, size(features) 
            if (features(i)%name == feature_name .and. &
                features(i)%platform%matches(current_platform)) then
                chosen_feature = features(i)
                found = .true.
                return
            end if
        end do
        
        ! Try to find COMPILER_ALL match
        do i = 1, size(features)
            if (features(i)%name == feature_name .and. &
                features(i)%platform%matches(current_platform)) then
                chosen_feature = features(i) 
                found = .true.
                return
            end if
        end do
    end subroutine find_feature