+
+case "$usecrosscompile" in
+$define|true|[yY]*)
+ croak=''
+ case "$cc" in
+ *-*-gcc) # A cross-compiling gcc, probably.
+ targetarch=`echo $cc|sed 's/-gcc$//'`
+ ar=$targetarch-ar
+ # leave out ld, choosing it is more complex
+ nm=$targetarch-nm
+ ranlib=$targetarch-ranlib
+ ;;
+ esac
+ case "$targetarch" in
+ '') echo "Cross-compiling: you should define targetarch." >&4; croak=y ;;
+ esac
+ case "$usrinc" in
+ '') echo "Cross-compiling: you should define usrinc." >&4; croak=y ;;
+ esac
+ case "$incpth" in
+ '') echo "Cross-compiling: you should define incpth." >&4; croak=y ;;
+ esac
+ case "$libpth" in
+ '') echo "Cross-compiling: you should define libpth." >&4; croak=y ;;
+ esac
+ case "$targethost" in
+ '') echo "Cross-compiling: targethost not defined." >&4; croak=y ;;
+ esac
+ case "$targetdir" in
+ '') echo "Cross compiling: targetdir not defined." >&4; croak=y ;;
+ esac
+ locincpth=''
+ loclibpth=''
+ case "$croak" in
+ y) exit 1 ;;
+ esac
+ case "$src" in
+ /*) run=$src/Cross/run
+ to=$src/Cross/to
+ from=$src/Cross/from
+ ;;
+ *) pwd=`test -f ../Configure & cd ..; pwd`
+ run=$pwd/Cross/run
+ to=$pwd/Cross/to
+ from=$pwd/Cross/from
+ ;;
+ esac
+ case "$targetrun" in
+ '') targetrun=ssh ;;
+ esac
+ case "$targetto" in
+ '') targetto=scp ;;
+ esac
+ case "$targetfrom" in
+ '') targetfrom=scp ;;
+ esac
+ run=$run-$targetrun
+ to=$to-$targetto
+ from=$from-$targetfrom
+ case "$targetuser" in
+ '') targetuser=root ;;
+ esac
+ case "$targetfrom" in
+ scp) q=-q ;;
+ *) q='' ;;
+ esac
+ case "$targetrun" in
+ ssh|rsh)
+ cat >$run <<EOF
+#!/bin/sh
+exe=\$1
+shift
+$to \$exe
+$targetrun -l $targetuser $targethost "cd $targetdir && ./\$exe \$@"
+EOF
+ ;;
+ *) echo "Cross-compiling: unknown targetrun '$targetrun'" >&4
+ exit 1
+ ;;
+ esac
+ case "$targetto" in
+ scp|rcp)
+ cat >$to <<EOF
+#!/bin/sh
+for f in \$@
+do
+ $targetto $q \$f $targetuser@$targethost:$targetdir/. || exit 1
+done
+exit 0
+EOF
+ ;;
+ cp) cat >$to <<EOF
+#!/bin/sh
+cp \$@ $targetdir/.
+EOF
+ ;;
+ *) echo "Cross-compiling: unknown targetto '$targetto'" >&4
+ exit 1
+ ;;
+ esac
+ case "$targetfrom" in
+ scp|rcp)
+ cat >$from <<EOF
+#!/bin/sh
+for f in \$@
+do
+ $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
+done
+exit 0
+EOF
+ ;;
+ cp) cat >$from <<EOF
+#!/bin/sh
+for f in \$@
+do
+ cp $targetdir/\$f . || exit 1
+done
+exit 0
+EOF
+ ;;
+ *) echo "Cross-compiling: unknown targetfrom '$targetfrom'" >&4
+ exit 1
+ ;;
+ esac
+ if test ! -f $run; then
+ echo "Cross-compiling: target 'run' script '$run' not found." >&4
+ else
+ chmod a+rx $run
+ fi
+ if test ! -f $to; then
+ echo "Cross-compiling: target 'to' script '$to' not found." >&4
+ else
+ chmod a+rx $to
+ fi
+ if test ! -f $from; then
+ echo "Cross-compiling: target 'from' script '$from' not found." >&4
+ else
+ chmod a+rx $from
+ fi
+ if test ! -f $run -o ! -f $to -o ! -f $from; then
+ exit 1
+ fi
+ cat >&4 <<EOF
+Cross-compiling: Using
+ $run-ssh
+ $to-ssh
+ $from-ssh
+EOF
+ ;;
+*) run=''
+ to=:
+ from=:
+ usecrosscompile='undef'
+ targetarch=''
+ ;;
+esac
+