280N/A### this script contains archaic constructs that work with all sh variants ###
280N/A# mamprobe - generate MAM cc probe info
280N/A# Glenn Fowler <gsf@research.att.com>
280N/Acase $-:$BASH_VERSION in
280N/A*x*:[0123456789]*) : bash set -x is broken :; set +ex ;;
280N/A@(#)$Id: mamprobe (AT&T Labs Research) 2011-02-11 $
280N/A[+NAME?mamprobe - generate MAM cc probe info]
671N/A[+DESCRIPTION?\bmamprobe\b generates MAM (make abstract machine) \bcc\b(1)
280N/A probe information for use by \bmamake\b(1). \acc-path\a is the
280N/A absolute path of the probed compiler and \ainfo-file\a is where
280N/A the information is placed. \ainfo-file\a is usually
766N/A of \acc-path\a. Any \ainfo-file\a directories are created if needed.
671N/A If \ainfo-file\a is \b-\b then the probe information is written to
671N/A[+?\bmamprobe\b and \bmamake\b are used in the bootstrap phase of
618N/A \bpackage\b(1) installation before \bnmake\b(1) is built. The
766N/A probed variable names are the \bnmake\b(1) names with a \bmam_\b
844N/A prefix, \bCC\b converted to \bcc\b, and \b.\b converted to \b_\b.
844N/A Additional variables are:]{
280N/A [+_hosttype_?the \bpackage\b(1) host type]
280N/A [+mam_cc_L?\b-L\b\adir\a supported]
280N/A [+STDCAT?command to execute for \bcat\b(1); prefixed by
280N/A [+STDCHMOD?command to execute for \bchmod\b(1); prefixed by
280N/A [+STDCMP?command to execute for \bcmp\b(1); prefixed by
280N/A [+STDCP?command to execute for \bcp\b(1); prefixed by
280N/A [+STDED?command to execute for \bed\b(1) or \bex\b(1)]
671N/A [+STDEDFLAGS?flags for \bSTDED\b]
671N/A [+STDLN?command to execute for \bln\b(1); prefixed by
747N/A [+STDMV?command to execute for \bmv\b(1); prefixed by
747N/A [+STDRM?command to execute for \brm\b(1); prefixed by
280N/A[d:debug?Enable probe script debug trace.]
280N/A[+SEE ALSO?\bexecrate\b(1), \bpackage\b(1), \bmamake\b(1), \bnmake\b(1),
280N/A while getopts -a "$command" "$USAGE" OPT
280N/A shift `expr $OPTIND - 1`
-*) echo $command: $1: unknown option >&2
0|1) echo "Usage: $command info-file cc-path" >&2; exit 2 ;;
# find the make probe script
0) echo "$0: ../$script: probe script not found on PATH" >&2
makeprobe=`echo $1 | sed 's,[^/]*$,'$script,`
# create the info dir if necessary
# generate info in a tmp file and rename when finished
trap "exec >
/dev/null; rm -f $tmp" 0 1 2 3 15
echo "probing C language processor $cc for mam information" >&2
echo "note generated by $0 for $cc"
*" -L "*) echo "
CC.L = 1" ;;
-e 's/^\([^=.]*\)\./\1_/' \
-e 's/^\([^=.]*\)\./\1_/' \
-e 's/\$("\([^"]*\)")/\1/g' \
-e 's/\$(\([^)]*\))/${\1}/g' \
-e 's/\${CC\./${mam_cc_}/g'
echo 'setv _hosttype_ ${mam_cc_HOSTTYPE}'
set STDCAT cat STDCHMOD chmod STDCMP cmp STDCP cp STDLN ln STDMV mv STDRM rm
then for n in STDCAT STDCHMOD STDCMP STDCP STDLN STDMV STDRM
do eval $n=\"execrate \$$n\"
for n in STDCAT STDCHMOD STDCMP STDCP STDED STDEDFLAGS STDLN STDMV STDRM
do eval echo setv \$n \$$n
test -f $info && rm -f $info