| 1 | #! /bin/sh |
| 2 | # Copyright 2002 Free Software Foundation |
| 3 | # by Alexandre Oliva <[email protected]> |
| 4 | |
| 5 | # This script is Free Software, and it can be copied, distributed and |
| 6 | # modified as defined in the GNU General Public License. A copy of |
| 7 | # its license can be downloaded from http://www.gnu.org/copyleft/gpl.html |
| 8 | |
| 9 | # This is a wrapper for distcc that turns relative pathnames into |
| 10 | # network-neutral ones. It modifies anything containing a slash and |
| 11 | # not starting with dash or slash, as well as -B flags. We need not |
| 12 | # be concerned about -I and -L, since distcc always does preprocessing |
| 13 | # and linking locally. |
| 14 | |
| 15 | |
| 16 | # If the first pathname is relative (.../xgcc, ./libtool, etc), |
| 17 | case "$1" in |
| 18 | [^/]*/*) |
| 19 | nargs=$# |
| 20 | basedir=`${NETPWD-netpwd}` |
| 21 | # then process arguments |
| 22 | for arg |
| 23 | do |
| 24 | case $arg in |
| 25 | -B[^/]*) |
| 26 | arg=-B$basedir/`echo "X$arg" | sed -e '1s/^X-B//'` |
| 27 | ;; |
| 28 | [^-/]*/*) |
| 29 | arg=$basedir/$arg |
| 30 | ;; |
| 31 | esac |
| 32 | set fnord ${1+"$@"} "$arg" |
| 33 | done |
| 34 | shift $nargs # take list of fnords out |
| 35 | shift $nargs # take original args out |
| 36 | ;; |
| 37 | esac |
| 38 | |
| 39 | # Now run the real distcc thingie, or just run the program directly if |
| 40 | # distcc is found to be missing. |
| 41 | if test -x ${REAL_DISTCC-/usr/bin/distcc}; then |
| 42 | x=${REAL_DISTCC-/usr/bin/distcc} |
| 43 | else |
| 44 | x=$1 |
| 45 | shift |
| 46 | fi |
| 47 | exec $x ${1+"$@"} |