1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00
cde/src/cmd/INIT/probe.win32
Martijn Dekker d9a85caf22 Remove AT&T UWIN support code
UWIN was David Korn's UNIX emulation layer for Microsoft Windows.
It was never very well known, certainly not like Cygwin or
Microsoft SFU/Interix. It was a very interesting system that
exposed the Windows registry to the file system, making it
UNIX-like, and that natively used ksh and all the AST utilities.

Regrettably, it appears to be dead and buried. Only 32-bit binaries
can still be found in the wild, as well as the source code at:
	https://github.com/att/uwin
The latter does not seem to be usable since (as far as I can tell)
it requires a UWIN environment with a compiler to build, and UWIN
binaries with a compiler are simply nowhere to be found.

The activity level on that repo (which is zero) also shows how much
interest there still is in this project. And of course the
supporting code in this repo is almost certainly broken by now as
we've never been able to test it on a UWIN system.

The AST team clearly cared about it since roughly 8k lines of code
are dedicated to its support, disabled (directly or indirectly) on
non-UWIN systems via the _UWIN macro. This removes all that.
2022-07-21 10:17:14 +02:00

262 lines
4.8 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:
# @(#)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 __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=
$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-"
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 <<!
CC.CC = $*
CC.NATIVE = $*
CC.EXECTYPE = $typ
CC.HOSTTYPE = $typ
CC.ALTPP.FLAGS = -Yp,\$(CPP:D)
CC.ALTPP.ENV =
CC.AR = ar
CC.ARFLAGS =
CC.DEBUG = -g
CC.DIALECT = $dialect
CC.DLL = -D_BLD_DLL
CC.DLLBIG = -D_BLD_DLL
CC.DLL.DEF = -D_BLD_DLL
CC.DLL.DIR = \$(BINDIR)
CC.DLL.LIBRARIES =
CC.DLL.VARIANTS =
CC.DYNAMIC =
CC.EXPORT.DYNAMIC =
CC.LD = $ld
CC.LD.DYNAMIC = -Bdynamic
CC.LD.LAZY =
CC.LD.NOLAZY =
CC.LD.ORIGIN =
CC.LD.RECORD =
CC.LD.NORECORD =
CC.LD.RUNPATH =
CC.LD.STATIC = -Bstatic
CC.LD.STRIP =
CC.LIB.DLL = option
CC.LIB.ALL = -Bwhole-archive
CC.LIB.UNDEF = -Bno-whole-archive
CC.MAKE.OPTIONS = nativepp=0
CC.NM = nm
CC.NMEDIT =
CC.NMFLAGS =
CC.OPTIMIZE = -O
CC.PIC =
CC.PICBIG =
CC.READONLY =
CC.REPOSITORY =
CC.SHARED = -G
CC.SHARED.LD = $ld
CC.SHARED.REGISTRY =
CC.SHARED.REGISTRY.PATH =
CC.SHELLMAGIC =
CC.SIZE = size
CC.STATIC = -Bstatic
!
inc=
lib=
if [[ ${version[LCC]} ]]
then lib=/lcc
fi
if [[ $stdinclude == *' '* ]]
then stdinclude=${stdinclude//' '/''}
fi
stdinc=
stdlib=
for inc in $stdinclude
do stdinc="$stdinc $inc"
d=${inc%/*}/lib
if [[ -d $d ]]
then stdlib="$stdlib $d"
fi
done
cat <<!
CC.STDINCLUDE = $stdinc
CC.STDLIB = $stdlib
!
cat <<!
CC.STRICT =
CC.STRIP = strip
CC.STRIP.FLAGS =
CC.PREFIX.ARCHIVE = lib
CC.PREFIX.DYNAMIC =
CC.PREFIX.SHARED =
CC.PREFIX.SYMBOL = _
CC.SUFFIX.ARCHIVE = .a
CC.SUFFIX.COMMAND =
CC.SUFFIX.DEBUG = .pdb
CC.SUFFIX.DYNAMIC = .dll
CC.SUFFIX.LD = .def .exp .ign .res
CC.SUFFIX.OBJECT = .o
CC.SUFFIX.SHARED = .lib
CC.SUFFIX.SOURCE = .c
CC.SUFFIX.STATIC =
!
if [[ $v ]]
then case $v in
*\"*) v=$(print -r -- | sed -e 's,",\\",g' -e 's,^ ,,' -e 's,.*,"&",') ;;
*\'*) v=\"$v\" ;;
esac
cat <<!
CC.VERSION = -v
CC.VERSION.STRING = $v
!
else cat <<!
CC.VERSION =
CC.VERSION.STRING =
!
fi
if [[ ${version[MINGW]} || ${version[MS]} ]]
then cat <<!
CC.WARN = -Wall
!
else cat <<!
CC.WARN =
!
fi
cat <<!
CC.PREROOT =
CC.UNIVERSE = att
!
} >&3
exit 0
fi