: # @(#)probe.win32 (AT&T Research) 2010-01-01 # # win32 specific make C probe initialization # wrapped cc's are easy on uwin # # 2> easy.err to avoid mysterious hang with bcc # begin preamble shared with the pp probe.ini IFS=$'\n' chmod 777 . # cl.exe setuid workaround typeset -A header version # we are probing on behalf of libpp and nmake # so the native preprocessor must be forced in # order to bootstrap libpp and nmake nativepp=-1 export nativepp probe_header=" stddef.h " for inc in syslimits.h winerror.h ostream bits/ctype_base.h stream.h do echo "#include <$inc>" > easy.c if $cc -E easy.c > /dev/null 2> easy.err then probe_header="$probe_header $inc " fi done { for i in $probe_header do echo "#include <$i>" done echo '#ifdef __cplusplus' echo "int _Pr0b3_cplus=__cplusplus;" echo '#endif' echo '#ifdef _UWIN' echo "int _Pr0b3_uwin=_UWIN;" echo '#endif' echo '#ifdef __BORLANDC__' echo "int _Pr0b3_version_BORLAND=__BORLANDC__;" echo '#endif' echo '#ifdef __DMC__' echo "int _Pr0b3_version_DM=__DMC__;" echo '#endif' echo '#ifdef _MSC_VER' echo "int _Pr0b3_version_MS=_MSC_VER;" echo '#endif' echo '#ifdef __ICL' echo "int _Pr0b3_version_ICL=__ICL;" echo '#endif' echo '#ifdef __LCC__' echo "int _Pr0b3_version_LCC=0+__LCC__;" echo '#endif' echo '#ifdef __MINGW32__' echo "int _Pr0b3_version_MINGW=__MINGW32__;" echo '#endif' echo '#ifdef __INTERIX' echo "int _Pr0b3_version_INTERIX=__INTERIX;" echo '#endif' echo '#ifdef __WATCOMC__' echo "int _Pr0b3_version_WATCOM=__WATCOMC__;" echo '#endif' } > easy.c include= uwin= cplus= $cc -E easy.c 2>&1 | egrep -i '^(#(line)? 1 .*\.[hH]| *int +_Pr0b3_[a-zA-Z_]* *= *[0-9])' | sed -e 's,_Pr0b3_,,' \ -e 's/.*"\(.*\)".*/\1/' \ -e 's,^ *,,' \ -e 's, *$,,' \ -e 's, *= *,=,' \ -e 's,^\(.\):[\\/]*,/\1/,' \ -e 's,[\\/][\\/]*,/,g' \ -e 's,^\(/.*\)/\(.*\)$,header[\2]="\1",' \ -e 's, *int *\(.*\);.*,\1,' \ -e 's,^version_\(.*\)=,version[\1]=,' \ > easy.sh . ./easy.sh include= for i in $probe_header do d=${header[$i]} if [[ $d ]] then include="$include $d" elif [[ $i == */* ]] then d=${header[${i##*/}]} if [[ $d == */${i%/*} ]] then include="$include ${d%/${i%/*}}" fi fi done i=$($cc -V 2> easy.err) if test "" != "$i" -a -d "$i/include" then include="$i/include $include" fi stdinclude= for inc in $include do if [[ ${inc%/*} -ef /msdev/platformsdk ]] then inc=/msdev/platformsdk/${inc##*/} elif [[ ${inc%/*} -ef /platformsdk ]] then inc=/platformsdk/${inc##*/} fi for dup in $stdinclude do [[ $inc -ef $dup ]] && continue 2 done stdinclude="$stdinclude $inc" done # end preamble shared with the pp probe.ini if [[ ${version[@]} == [0-9]* && $stdinclude ]] then : the payoff set -- $cc cmd=$1 shift set -- $(whence $cmd) "$@" typ=$(package) dialect="ANSI CLOSURE DYNAMIC EXPORT=DLL LIBPP -I-" case ${cc##*/} in *CC*) dialect="$dialect C++" cplus=1 ;; esac ld=${cc%cc}ld if [[ ! -x $ld ]] then ld=${cc%/*}/ld if [[ ! -x $ld ]] then case $cc in */ncc) ld=/usr/bin/nld ;; *) ld=/usr/bin/ld ;; esac fi fi { if $cc -v >/dev/null 2>&1 then v=$($cc -v 2>/dev/null) if [[ $v ]] then print "# ;VERSION;-v;$v;PATH;$cc" fi else v= fi cat <&3 exit 0 fi