Skip to content
  • Arkadiusz Hiler's avatar
    man/build: Fix dependency handling · fdad47c9
    Arkadiusz Hiler authored
    
    
    build_man is a 'feature' option, which means that we get an opaque
    object, so comparing it to 'yes' is always false.
    
    It should have been 'if build_man.enabled()'.
    
    But going even further we can prune the whole check, as rst2man is
    defined as follows:
    
    rst2man = find_program('rst2man-3', 'rst2man', required : build_man)
    
    >From the patch overhauling those options:
    
        get_option() on a feature returns opaque object that can be passed as
        a 'required' argument of a dependency. Auto is equivalent to 'required
        : false', enabled is equivalent to 'required : true' and disabled
        introduces new behavior forcing the dependency to be considered not
        found.
    
    This would cause the build to fail if build_man is enabled (aka
    'required') and rst2man is not found. So...
    
    if rst2man.found()
      # rst2man found
      # buildu buildu
    else
      # rst2man not found, but considered optional because
      # we haven't erred out on find_program
      if build_man.enabled() # cannot be, it's optional!
        error('...')
      endif
    endif
    
    We can get rid of the whole else block here.
    
    Cc: Antonio Argenziano <antonio.argenziano@intel.com>
    Cc: Petri Latvala <petri.latvala@intel.com>
    Signed-off-by: default avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
    Reviewed-by: default avatarSimon Ser <simon.ser@intel.com>
    fdad47c9