#! /bin/sh # Copyright 2002 Free Software Foundation # by Alexandre Oliva # This script is Free Software, and it can be copied, distributed and # modified as defined in the GNU General Public License. A copy of # its license can be downloaded from http://www.gnu.org/copyleft/gpl.html # This is a wrapper for distcc that turns relative pathnames into # network-neutral ones. It modifies anything containing a slash and # not starting with dash or slash, as well as -B flags. We need not # be concerned about -I and -L, since distcc always does preprocessing # and linking locally. # To use it, set the STAGE_CC_WRAPPER to the name of this script, and # the GCC build machinery will use it when buildling bootstrap stages # and target libraries. You will also need to point NETPWD to the # netpwd script, and perhaps customize it to map pathnames properly # for your environment. # If the first pathname is relative (.../xgcc, ./libtool, etc), case "$1" in [^/]*/*) nargs=$# basedir=`${NETPWD-netpwd}` # then process arguments for arg do case $arg in -B[^/]*) arg=-B$basedir/`echo "X$arg" | sed -e '1s/^X-B//'` ;; [^-/]*/*) arg=$basedir/$arg ;; esac set fnord ${1+"$@"} "$arg" done shift $nargs # take list of fnords out shift $nargs # take original args out ;; esac # Since GCC adds the current working directory to the object file's # debugging info, you have to start distcc on all machines in the same # directory (say /tmp) and make sure you never use the localhost # compiler, using the current machine as if it were remote, if at all. case " $DISTCC_HOSTS " in *" localhost "*) HOSTNAME=${HOSTNAME-`uname -n`} DISTCC_HOSTS=`echo $DISTCC_HOSTS | sed "s,localhost,$HOSTNAME,"` ;; esac exec distcc ${1+"$@"}