
    d:                         d Z ddlZddlZddlZddlmZ ddlmZ ddlm	Z	m
Z
mZ ddlmZmZmZmZ ddlmZ ej        dk    rddlZ G d	 d
e	          ZdS )a9  distutils.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)	CCompilergen_preprocess_optionsgen_lib_options)DistutilsExecErrorCompileErrorLibError	LinkError)logdarwinc            	           e Zd ZdZddgdgdgddgdgddgddZej        dd         d	k    rd
ged
<   g dZdZdZ	dZ
dZdZdxZxZZeZej        dk    rdZ	 	 ddZd Z	 ddZ	 	 	 	 d dZd Zd Zd Zd Zd!dZdS )"UnixCCompilerunixNccz-sharedarz-cr)preprocessorcompilercompiler_socompiler_cxx	linker_so
linker_exearchiverranlib   r   r   )z.cz.Cz.ccz.cxxz.cppz.mz.oz.az.soz.dylibz.tbdzlib%s%scygwinz.exec                    |                      d ||          }|\  }}}t          ||          }	| j        |	z   }
|r|
                    d|g           |r||
d d<   |r|
                    |           |
                    |           | j        s|t          ||          rm|r2|                     t          j	        
                    |                     	 |                     |
           d S # t          $ r}t          |          d }~ww xY wd S )N-or   )_fix_compile_argsr   r   extendappendforcer   mkpathospathdirnamespawnr   r	   )selfsourceoutput_filemacrosinclude_dirsextra_preargsextra_postargs
fixed_argsignorepp_optspp_argsmsgs               )  /croot/python-split_1694437901252/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/lib/python3.11/distutils/unixccompiler.py
preprocesszUnixCCompiler.preprocessU   s;   ++D&,GG
'1$(>>#g- 	0NND+./// 	('GBQBK 	+NN>***v : 	(,fk0J0J, :BGOOK88999(

7#####% ( ( ("3'''( -,s   C+ +
D	5DD	c                     | j         }t          j        dk    rt          j        |||z             }	 |                     ||z   |d|gz   |z              d S # t          $ r}t          |          d }~ww xY w)Nr   r   )r   sysplatform_osx_supportcompiler_fixupr'   r   r	   )	r(   objsrcextcc_argsr.   r1   r   r3   s	            r4   _compilezUnixCCompiler._compileo   s    &<8##&5k4;n4LN NK	$JJ{W,T3/??%& ' ' ' ' '! 	$ 	$ 	$s###	$s   !A 
A2A--A2r   c                    |                      ||          \  }}|                     ||          }|                     ||          r|                     t          j                            |                     |                     | j        |gz   |z   | j	        z              | j
        rB	 |                     | j
        |gz              d S # t          $ r}t          |          d }~ww xY wd S t          j        d|           d S )N)
output_dirskipping %s (up-to-date))_fix_object_argslibrary_filename
_need_linkr#   r$   r%   r&   r'   r   objectsr   r   r
   r   debug)r(   rF   output_libnamerA   rG   target_langoutput_filenamer3   s           r4   create_static_libzUnixCCompiler.create_static_libz   s,   "33GZHH !!.Z!HH 	 ??7O44 	CKK88999JJt}'()!%. / / / { ((JJt{o->>?????) ( ( ("3--'(( ( I0/BBBBBs   *C
 

C(C##C(c                    |                      ||          \  }}|                     |||          }|\  }}}t          | |||          }t          |t          t          d           f          st          d          | t          j        	                    ||          }| 
                    ||          r|| j        z   |z   d|gz   }|	rdg|d d<   |
r|
|d d<   |r|                    |           |                     t          j                            |                     	 |t          j        k    r| j        d d          }n| j        d d          }|dk    r| j        rd}t          j                            |d                   dk    rd}d||         v r|dz  }d||         v t          j                            ||                   d	k    rd}nd}| j        |         |||z   <   t*          j        d
k    rt/          j        ||          }|                     ||z              d S # t4          $ r}t7          |          d }~ww xY wt9          j        d|           d S )Nz%'output_dir' must be a string or Noner   z-gr   zc++env   =	ld_so_aixr   rB   )rC   _fix_lib_argsr   
isinstancestrtype	TypeErrorr$   r%   joinrE   rF   r    r#   r&   r   
EXECUTABLEr   r   r   basenamer7   r8   r9   r:   r'   r   r   r   rG   )r(   target_descrF   rJ   rA   	librarieslibrary_dirsruntime_library_dirsexport_symbolsrG   r-   r.   
build_temprI   r/   lib_optsld_argslinkerioffsetr3   s                        r4   linkzUnixCCompiler.link   s   
 #33GZHH''	<(<> >
8B5	<!5"47K#,. .*sDJJ&788 	ECDDD! gll:GGO??7O44 +	C- #'"9:G %#f ,+ /~...KK88999%)"666!_QQQ/FF!^AAA.F%''D,=' Aw''q	22e;;!VAY..FA "VAY.. w''q	22kAA "#!"'+'8';F1V8$<8++)8IIF

6G+,,,,,% % % %nn$% I0/BBBBBs   $D H& &
I0H??Ic                     d|z   S )N-L )r(   dirs     r4   library_dir_optionz UnixCCompiler.library_dir_option       cz    c                 :    t          fddD                       S )Nc              3       K   | ]}|v V  	d S )Nrg   ).0namecompiler_names     r4   	<genexpr>z(UnixCCompiler._is_gcc.<locals>.<genexpr>   s(      MMT4=(MMMMMMrk   )gcczg++clang)any)r(   rp   s    `r4   _is_gcczUnixCCompiler._is_gcc   s'    MMMM5LMMMMMMrk   c                     dd l }t          j                            |                    t          j        d                    d                   }t          j        d d         dk    rd|z   S t          j        d d         dk    rd|z   S t          j        d d	         d
k    r#| 	                    |          rdd|z   gS dd|z   gS | 	                    |          r"t          j        d          dk    rd|z   S d|z   S d|z   S )Nr   CCr   r   rf      freebsdz-Wl,-rpath=   zhp-uxz-Wl,+sz+sGNULDyesz-Wl,--enable-new-dtags,-Rz-Wl,-Rz-R)
shlexr$   r%   rX   splitr   get_config_varr7   r8   ru   )r(   rh   r}   r   s       r4   runtime_library_dir_optionz(UnixCCompiler.runtime_library_dir_option   s    	7##EKK	0H0N0N$O$OPQ$RSS<x''#:\"1"** 3&&\"1"((||H%% . $*--$*%%||H%% "
 +G44== 7<<#c>)
 cz!rk   c                     d|z   S )Nz-lrg   )r(   libs     r4   library_optionzUnixCCompiler.library_option  rj   rk   c                    |                      |d          }|                      |d          }|                      |d          }|                      |d          }t          j        dk    rgt          j        d          }t          j        d|          }	|	't          j        t          j        d	                    }
n|		                    d
          }
|D ]}t          j                            ||          }t          j                            ||          }t          j                            ||          }t          j                            ||          }t          j        dk    r|                    d          s*|                    d          r|                    d          st          j                            |
|d
d          |          }t          j                            |
|d
d          |          }t          j                            |
|d
d          |          }t          j                            |
|d
d          |          }t          j                            |          r|c S t          j                            |          r|c S t          j                            |          r|c S t          j                            |          r|c S d S )Nshared)lib_typedylib
xcode_stubstaticr   CFLAGSz-isysroot\s*(\S+)rw   rN   z/System/z/usr/z/usr/local/)rD   r7   r8   r   r   researchr9   _default_sysrootgroupr$   r%   rV   
startswithexists)r(   dirsr   rG   shared_fdylib_fxcode_stub_fstatic_fcflagsmsysrootrh   r   r   r   r   s                   r4   find_library_filezUnixCCompiler.find_library_file  s~   ((x(@@''g'>>,,S<,HH((x(@@<8##& -h77F	.77Ay&7	8PQU8V8VWW''!**  	 	CW\\#x00FGLLg..EW\\#x00Fc<88J|x''z** (w'' (03}0M0M ( gs122wAAWc!""gw??gs122wAAW\\'3qrr7LII
 w~~e$$ 
++ !!!!'' ''  trk   )NNNNN)Nr   N)
NNNNNr   NNNN)r   )__name__
__module____qualname__compiler_typeexecutablesr7   r8   src_extensionsobj_extensionstatic_lib_extensionshared_lib_extensiondylib_lib_extensionxcode_stub_lib_extensionstatic_lib_formatshared_lib_formatdylib_lib_formatxcode_stub_lib_formatexe_extensionr5   r?   rK   rd   ri   ru   r   r   r   rg   rk   r4   r   r   -   s       M %)%)F%)F%)F%)9$5%)F%)5M$( K |BQB8##!)
H :99NM "%?HHH),<,
|x:>IM( ( ( (4	$ 	$ 	$ AEC C C C6 :>599=?C	<C <C <C <CD  N N N)" )" )"V  ? ? ? ? ? ?rk   r   )__doc__r$   r7   r   	distutilsr   distutils.dep_utilr   distutils.ccompilerr   r   r   distutils.errorsr   r	   r
   r   r   r8   r9   r   rg   rk   r4   <module>r      s0                      $ $ $ $ $ $8 8 8 8 8 8 8 8 8 8; ; ; ; ; ; ; ; ; ; ; ;      <8$] ] ] ] ]I ] ] ] ] ]rk   