[~5@sdZddlZddlZddlZddlmZddlmZddlm Z m Z m Z ddl m Z mZmZmZddlmZejdkrddlZnGd d d e ZdS) a9distutils.unixccompiler Contains the UnixCCompiler class, a subclass of CCompiler that handles the "typical" Unix-style command-line C compiler: * macros defined with -Dname[=value] * macros undefined with -Uname * include search directories specified with -Idir * libraries specified with -lllib * library search directories specified with -Ldir * compile handled by 'cc' (or similar) executable with -c option: compiles .c to .o * link static library handled by 'ar' command (possibly with 'ranlib') * link shared library handled by 'cc -shared' N) sysconfig)newer) CCompilergen_preprocess_optionsgen_lib_options)DistutilsExecError CompileErrorLibError LinkError)logdarwinc @seZdZdZidd6dgd6dgd6dgd6ddgd 6dgd 6d d gd 6dd6Zejdddkrdgeds z&UnixCCompiler.link..cs"g|]}|kr|qSr'r')r:r;)r<r'r(r=s z%'output_dir' must be a string or Nonez-oz-grzc++env=r zskipping %s (up-to-date)) r2Z _fix_lib_argsrget_config_varrr isinstancestrtype TypeErrorrrjoinr4r5rrrZ EXECUTABLErrrbasenamer*r+r,r-rrr r r6)rZ target_descr5r8r1Z librariesZ library_dirsZruntime_library_dirsZexport_symbolsr6r!r"Z build_tempr7r#Z multiarchZlib_optsZld_argsZlinkerir&r')r<r(linksT     "zUnixCCompiler.linkcCsd|S)Nz-Lr')rr;r'r'r(library_dir_optionsz UnixCCompiler.library_dir_optioncCsd|kpd|kS)NZgcczg++r')rZ compiler_namer'r'r(_is_gccszUnixCCompiler._is_gcccCstjjtjd}tjdddkr<d|Stjdddkr|j|rrdd|gSdd|gStjdd d kstjddd krd |gS|j|rtjd dkrd|Sd|Snd|SdS)NZCCrr z-Lzhp-uxz-Wl,+sz+sZirix646Zosf1V5z-rpathZGNULDZyesz-Wl,--enable-new-dtags,-Rz-Wl,-Rz-R)rrrGrrAr*r+rK)rr;rr'r'r(runtime_library_dir_options2  z(UnixCCompiler.runtime_library_dir_optioncCsd|S)Nz-lr')rlibr'r'r(library_optionszUnixCCompiler.library_optioncCs|j|dd}|j|dd}|j|dd}tjdkrtjd}tjd|}|dkrd} q|jd } nx5|D]-} tj j | |} tj j | |} tj j | |} tjdkr| j d s| j d r| j d  rtj j | | d d|} tj j | | d d|} tj j | | d d|} ntj j | r| Stj j | r| Stj j | r| SqWdS) NZlib_typeshareddylibstaticr ZCFLAGSz-isysroot\s+(\S+)/r?z/System/z/usr/z /usr/local/) r3r*r+rrAresearchgrouprrrF startswithexists)rdirsrOr6Zshared_fZdylib_fZstatic_fZcflagsmZsysrootr;rQrRrSr'r'r(find_library_file s4   ""%zUnixCCompiler.find_library_file)__name__ __module__ __qualname__Z compiler_typeZ executablesr*r+Zsrc_extensionsZ obj_extensionZstatic_lib_extensionZshared_lib_extensionZdylib_lib_extensionZstatic_lib_formatZshared_lib_formatZdylib_lib_formatZ exe_extensionr)r0r9rIrJrKrNrPr\r'r'r'r(r -s@            A   * r )__doc__rr*rUZ distutilsrZdistutils.dep_utilrZdistutils.ccompilerrrrZdistutils.errorsrrr r r r+r,r r'r'r'r(s$"