ó
úq7]c           @   s7   d  Z  d d l j Z d „  Z d d d e d „ Z d S(   sÔ  
This is NOT a waf tool but generic functions to be called from a waf
tool, in particular by wcb.py.

There's probably a wafier way to do this.

The interpretation of options are very specific so don't change them
unless you really know all the use cases.  The rules are:

If package is optional:

    - omitting all --with-NAME* options will omit use the package

    - explicitly using --with-NAME=false (or "no" or "off") will omit
      use of the package.

If package is mandatory:

    - omitting all --with-NAME* options will use pkg-config to find
      the package.

    - explicitly using --with-NAME=false (or "no" or "off") will
      assert.

In either case:

    - explicitly using --with-NAME=true (or "yes" or "on") will use
      pkg-config to find the package.

    - using --with-NAME* with a path will attempt to locate the
      package without using pkg-config

Note, actually, pgk-config fails often to do its job.  Best to always
use explicit --with-NAME.
iÿÿÿÿNc      	   C   sŒ   | j  ƒ  } |  j d | ƒ }  |  j d | d d d d  d d | ƒ|  j d | d d d d	 | ƒ|  j d
 | d d d d | ƒd  S(   Ns
   %s Optionss	   --with-%st   typet   stringt   defaultt   helps   give %s installation locations   --with-%s-includes%   give %s include installation locations   --with-%s-libs!   give %s lib installation location(   t   lowert   add_option_groupt
   add_optiont   None(   t   optt   nameR   (    (    s   waftools/generic.pyt   _options'   s    c      
   C   s>  | j  ƒ  } | j ƒ  } | d  k r- | } n  t |  j d | d  ƒ } t |  j d | d  ƒ }	 t |  j d | d  ƒ }
 | r¢ | r× | j  ƒ  d k sŸ t ‚ q× n5 t | |	 |
 g ƒ s» d  S| r× | j  ƒ  d k r× d  St | |	 |
 g ƒ s| r„| j  ƒ  d  k r„|  j d
 | ƒ d } | r/| d 7} n  |  j d | d | d | d | ƒ d | |  j	 k rt|  j
 d ƒ q |  j
 d ƒ nœ | rÒ|	 r¬| r¬t j | d ƒ }	 n  |	 rÒt |  j	 d | |	 g ƒ qÒn  | r |
 rú| rút j | d ƒ }
 n  |
 r t |  j	 d | |
 g ƒ q n  | r“|  j d | ƒ x0 | D]( } |  j d | d | d | d | ƒ q>W|  j
 t t |  j	 d | d  ƒ ƒ ƒ n  | r:|  j d | ƒ x0 | D]( } |  j d | d | d | d | ƒ q±W|  j
 t t |  j	 d | d  ƒ ƒ ƒ |  j d | ƒ |  j
 t t |  j	 d | ƒ ƒ ƒ n  d  S(!   Nt   with_s   with_%s_includes   with_%s_libt   not   offt   falset   yest   ont   trues"   Checking for %s in PKG_CONFIG_PATHs   --cflagss    --libst   packaget   uselib_storet   argst	   mandatoryt   HAVE_t   foundt   failedt   includet	   INCLUDES_t   libt   LIBPATH_s   Location for %s headerst   header_namet   uses   Location for %s libss   Libs for %st   LIB_(   R   R   R   (   R   R   R   (   R   R   R   (   R   t   upperR   t   getattrt   optionst   AssertionErrort   anyt	   start_msgt	   check_cfgt   envt   end_msgt   ospt   joint   setattrt	   check_cxxt   str(   t   ctxR	   t   incst   libst   pcnameR   R   t   UPPERt   instt   incR   R   t   tryht   tryl(    (    s   waftools/generic.pyt
   _configure2   s`    	.  )&(    (    (   t   __doc__t   os.patht   pathR)   R
   R   t   TrueR7   (    (    (    s   waftools/generic.pyt   <module>$   s   	