ó
(•^c           @   s:   d  Z  d d l j Z d „  Z d 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=[<bool>|<dir>].
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   sp  | j  ƒ  } | j ƒ  } | d  k r- | } n  t |  j d | d  ƒ }	 t |  j d | d  ƒ }
 t |  j d | d  ƒ } t |  j d | d  ƒ } | r» |	 r× |	 j  ƒ  d% k s¸ t ‚ q× n |	 r× |	 j  ƒ  d& k r× d  St |	 |
 | | g ƒ s|	 r‹|	 j  ƒ  d' k r‹|  j d | ƒ d } | r2| d 7} n  |  j d | d | d | d | ƒ d | |  j	 k rw|  j
 d ƒ qu|  j
 d ƒ d  Snê | 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  | ru| rO|	 rOt j |	 d ƒ } n  | rut |  j	 d | | g ƒ qun  | r||  j d | f ƒ x0 | D]( } |  j d | d | d | d | ƒ q–W|  j
 t t |  j	 d | d  ƒ ƒ ƒ |  j d | ƒ |  j
 t t |  j	 d | ƒ ƒ ƒ t } x3 | D]+ } | t |  j	 d | ƒ k r)t } q)q)W| r||  j d | d d  ƒ q|n  | rï|  j d! | ƒ x0 | D]( } |  j d" | d | d | d | ƒ qšW|  j
 t t |  j	 d | d  ƒ ƒ ƒ n  | rl|  j d# | ƒ t ƒ  } xD | D]< } |  j | d$ | j ƒ  d | ƒ| |  j	 | j ƒ  7} qW|  j
 t | ƒ ƒ n  d  S((   Nt   with_s   with_%s_includes   with_%s_libs   with_%s_bint   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_t   bint   PATH_s   Location for %s libst   uses   Libs for %st   LIB_t   _LIBi   s   Location for %s headerst   header_names   Bins for %st   var(   s   noR   s   false(   s   noR   s   false(   s   yess   ons   true(   R   t   upperR   t   getattrt   optionst   AssertionErrort   anyt	   start_msgt	   check_cfgt   envt   end_msgt   ospt   joint   setattrt	   check_cxxt   strt   Truet   Falset   definet   listt   find_program(   t   ctxR	   t   incst   libst   binst   pcnameR   R   t   UPPERt   instdirt   incdirt   libdirt   bindirR   t   trylt   all_lib_existt   tryht
   found_binst   tryb(    (    s   waftools/generic.pyt
   _configure2   s„    	1   &#)	(    (    (    (   t   __doc__t   os.patht   pathR-   R
   R   R2   RF   (    (    (    s   waftools/generic.pyt   <module>$   s   	