1 ########################################################################
3 # This software is part of the ast package #
4 # Copyright (c) 1994-2016 AT&T Intellectual Property #
5 # and is licensed under the #
6 # Eclipse Public License, Version 1.0 #
7 # by AT&T Intellectual Property #
9 # A copy of the License is available at #
10 # http://www.eclipse.org/org/documents/epl-v10.html #
11 # (with md5 checksum b35adb5213ca9657e911e9befb180842) #
13 # Information and Software Systems Research #
17 # Glenn Fowler <glenn.s.fowler@gmail.com> #
19 ########################################################################
20 ########################################################################
22 # This software is part of the ast package #
23 # Copyright (c) 1994-2011 AT&T Intellectual Property #
24 # and is licensed under the #
25 # Eclipse Public License, Version 1.0 #
26 # by AT&T Intellectual Property #
28 # A copy of the License is available at #
29 # http://www.eclipse.org/org/documents/epl-v10.html #
30 # (with md5 checksum b35adb5213ca9657e911e9befb180842) #
32 # Information and Software Systems Research #
36 # Glenn Fowler <glenn.s.fowler@gmail.com> #
38 ########################################################################
39 ### this script contains archaic constructs that work with all sh variants ###
40 # mamprobe - generate MAM cc probe info
41 # Glenn Fowler <gsf@research.att.com>
43 case $
-:$BASH_VERSION in
44 *x
*:[0123456789]*) : bash
set -x is broken
:; set +ex
;;
53 case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in
56 @(#)$Id: mamprobe (AT&T Labs Research) 2011-02-11 $
58 [+NAME?mamprobe - generate MAM cc probe info]
59 [+DESCRIPTION?\bmamprobe\b generates MAM (make abstract machine) \bcc\b(1)
60 probe information for use by \bmamake\b(1). \acc-path\a is the
61 absolute path of the probed compiler and \ainfo-file\a is where
62 the information is placed. \ainfo-file\a is usually
63 \b$INSTALLROOT/lib/probe/C/mam/\b\ahash\a, where \ahash\a is a hash
64 of \acc-path\a. Any \ainfo-file\a directories are created if needed.
65 If \ainfo-file\a is \b-\b then the probe information is written to
67 [+?\bmamprobe\b and \bmamake\b are used in the bootstrap phase of
68 \bpackage\b(1) installation before \bnmake\b(1) is built. The
69 probed variable names are the \bnmake\b(1) names with a \bmam_\b
70 prefix, \bCC\b converted to \bcc\b, and \b.\b converted to \b_\b.
71 Additional variables are:]{
72 [+_hosttype_?the \bpackage\b(1) host type]
73 [+mam_cc_L?\b-L\b\adir\a supported]
74 [+STDCAT?command to execute for \bcat\b(1); prefixed by
75 \bexecrate\b(1) on \b.exe\b challenged systems]
76 [+STDCHMOD?command to execute for \bchmod\b(1); prefixed by
77 \bexecrate\b(1) on \b.exe\b challenged systems]
78 [+STDCMP?command to execute for \bcmp\b(1); prefixed by
79 \bexecrate\b(1) on \b.exe\b challenged systems]
80 [+STDCP?command to execute for \bcp\b(1); prefixed by
81 \bexecrate\b(1) on \b.exe\b challenged systems]
82 [+STDED?command to execute for \bed\b(1) or \bex\b(1)]
83 [+STDEDFLAGS?flags for \bSTDED\b]
84 [+STDLN?command to execute for \bln\b(1); prefixed by
85 \bexecrate\b(1) on \b.exe\b challenged systems]
86 [+STDMV?command to execute for \bmv\b(1); prefixed by
87 \bexecrate\b(1) on \b.exe\b challenged systems]
88 [+STDRM?command to execute for \brm\b(1); prefixed by
89 \bexecrate\b(1) on \b.exe\b challenged systems]
91 [d:debug?Enable probe script debug trace.]
95 [+SEE ALSO?\bexecrate\b(1), \bpackage\b(1), \bmamake\b(1), \bnmake\b(1),
98 while getopts -a "$command" "$USAGE" OPT
103 shift `expr $OPTIND - 1`
117 -*) echo $command: $1: unknown option
>&2
140 0|
1) echo "Usage: $command info-file cc-path" >&2; exit 2 ;;
146 # find the make probe script
153 script=lib
/probe
/C
/make
/probe
156 0) echo "$0: ../$script: probe script not found on PATH" >&2
163 makeprobe
=`echo $1 | sed 's,[^/]*$,'$script,`
164 if test -x $makeprobe
170 # create the info dir if necessary
201 then mkdir
$path ||
exit
207 # generate info in a tmp file and rename when finished
212 trap "exec >/dev/null; rm -f $tmp" 0 1 2 3 15
214 echo "probing C language processor $cc for mam information" >&2
218 echo "note generated by $0 for $cc"
225 case " $CC_DIALECT " in
226 *" -L "*) echo "CC.L = 1" ;;
231 -e 's/^CC./setv mam_cc_/' \
232 -e 's/^\([^=.]*\)\./\1_/' \
233 -e 's/^\([^=.]*\)\./\1_/' \
235 -e 's/\$("\([^"]*\)")/\1/g' \
236 -e 's/\$(\([^)]*\))/${\1}/g' \
237 -e 's/\${CC\./${mam_cc_}/g'
239 echo 'setv _hosttype_ ${mam_cc_HOSTTYPE}'
241 # STD* are standard commands/flags with possible execrate(1)
247 ) < /dev
/null
> /dev
/null
2>&1
252 set STDCAT
cat STDCHMOD
chmod STDCMP
cmp STDCP
cp STDLN
ln STDMV
mv STDRM
rm
258 for d
in /bin
/usr
/bin
/usr
/sbin
269 then for n
in STDCAT STDCHMOD STDCMP STDCP STDLN STDMV STDRM
270 do eval $n=\"execrate \$
$n\"
273 for n
in STDCAT STDCHMOD STDCMP STDCP STDED STDEDFLAGS STDLN STDMV STDRM
274 do eval echo setv \
$n \$
$n
282 test -f $info && rm -f $info