pkgcfg_has_package Function

public function pkgcfg_has_package(name) result(success)

Check if pkgcfg has package

pkg-config –exists returns 0 only if the package exists

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: name

Package name

Return Value logical


Source Code

logical function pkgcfg_has_package(name) result(success)

    !> Package name
    character(*), intent(in) :: name
    
    integer :: exitcode
    logical :: cmdok
    type(string_t) :: log    
        
    call run_wrapper(wrapper=string_t('pkg-config'), &
                     args=[string_t(name),string_t('--exists')], &
                     exitcode=exitcode,cmd_success=cmdok,screen_output=log)    
    
    !> pkg-config --exists returns 0 only if the package exists
    success = cmdok .and. exitcode==0
            
end function pkgcfg_has_package