3 ?RCS: Copyright (c) 2001 Jarkko Hietaniemi
5 ?RCS: You may distribute under the terms of either the GNU General Public
6 ?RCS: License or the Artistic License, as specified in the README file.
8 ?MAKE:run to from targetarch usecrosscompile: src awk grep test rm \
9 echo sed mkdir cp touch chmod
10 ?MAKE: -pick add $@ %<
13 ?S: This variable conditionally defines the USE_CROSS_COMPILE symbol,
14 ?S: and indicates that Perl has been cross-compiled.
17 ?S: This variable contains the command used by Configure
18 ?S: to copy and execute a cross-compiled executable in the
19 ?S: target host. Useful and available only during Perl build.
20 ?S: Empty string '' if not cross-compiling.
23 ?S: This variable contains the command used by Configure
24 ?S: to copy files from the target host. Useful and available
25 ?S: only during Perl build.
26 ?S: The string ':' if not cross-compiling.
29 ?S: This variable contains the command used by Configure
30 ?S: to copy to from the target host. Useful and available
31 ?S: only during Perl build.
32 ?S: The string ':' if not cross-compiling.
35 ?S: If cross-compiling, this variable contains the target architecture.
36 ?S: If not, this will be empty.
39 ?C: This symbol, if defined, indicates that Perl is being cross-compiled.
42 ?C: This symbol, if defined, indicates the target architecture
43 ?C: Perl has been cross-compiled to. Undefined if not a cross-compile.
45 ?H:?%<:#ifndef USE_CROSS_COMPILE
46 ?H:?%<:#$usecrosscompile USE_CROSS_COMPILE /**/
47 ?H:?%<:#define PERL_TARGETARCH "$targetarch" /**/
50 ?T:croak pwd exe f q i j cwd
51 ?LINT:extern usecrosscompile
58 ?LINT:extern targethost
59 ?LINT:extern targetdir
60 ?LINT:change targetdir
61 ?LINT:extern targetuser
62 ?LINT:change targetuser
63 ?LINT:extern targetrun
64 ?LINT:extern targetfrom
66 ?LINT:extern targetmkdir
67 ?LINT:change targetrun
68 ?LINT:change targetfrom
70 ?LINT:change targetmkdir
75 ?LINT:extern locincpth
76 ?LINT:extern loclibpth
77 ?LINT:change locincpth
78 ?LINT:change loclibpth
79 : Check for Cross-Compilation
80 case "$usecrosscompile" in
82 $echo "Cross-compiling..."
85 *-*-gcc) # A cross-compiling gcc, probably.
86 targetarch=`$echo $cc|$sed 's/-gcc$//'`
88 # leave out ld, choosing it is more complex
90 ranlib=$targetarch-ranlib
91 $echo 'extern int foo;' > try.c
92 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
94 if $test $# -gt 0; then
96 incpth="`$echo $incpth|$sed 's/^ //'`"
97 echo "Guessing incpth '$incpth'." >&4
99 j="`$echo $i|$sed 's,/include$,/lib,'`"
104 libpth="`$echo $libpth|$sed 's/^ //'`"
105 echo "Guessing libpth '$libpth'." >&4
110 case "$targetarch" in
111 '') echo "Targetarch not defined." >&4; croak=y ;;
112 *) echo "Using targetarch $targetarch." >&4 ;;
115 '') echo "Incpth not defined." >&4; croak=y ;;
116 *) echo "Using incpth '$incpth'." >&4 ;;
119 '') echo "Libpth not defined." >&4; croak=y ;;
120 *) echo "Using libpth '$libpth'." >&4 ;;
123 '') for i in $incpth; do
124 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
126 echo "Guessing usrinc $usrinc." >&4
131 '') echo "Usrinc not defined." >&4; croak=y ;;
134 *) echo "Using usrinc $usrinc." >&4 ;;
136 case "$targethost" in
137 '') echo "Targethost not defined." >&4; croak=y ;;
138 *) echo "Using targethost $targethost." >&4
143 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
146 /*) run=$src/Cross/run
147 targetmkdir=$src/Cross/mkdir
151 *) pwd=`$test -f ../Configure & cd ..; pwd`
153 targetmkdir=$pwd/Cross/mkdir
164 case "$targetfrom" in
165 '') targetfrom=scp ;;
169 from=$from-$targetfrom
172 echo "Guessing targetdir $targetdir." >&4
175 case "$targetuser" in
177 echo "Guessing targetuser $targetuser." >&4
180 case "$targetfrom" in
196 '') cwd=$targetdir ;;
200 if $test ! -f \$exe.xok; then
204 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
207 *) echo "Unknown targetrun '$targetrun'" >&4
211 case "$targetmkdir" in
213 cat >$targetmkdir <<EOF
215 $targetrun -l $targetuser $targethost "mkdir -p \$@"
217 $chmod a+rx $targetmkdir
219 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
231 $targetmkdir \`dirname \$f\`
232 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
235 $targetmkdir $targetdir/\`dirname \$f\`
236 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
249 $mkdir -p $targetdir/\`dirname \$f\`
250 $cp \$f $targetdir/\$f || exit 1
253 $targetmkdir $targetdir/\`dirname \$f\`
254 $cp \$f $targetdir/\$f || exit 1
261 *) echo "Unknown targetto '$targetto'" >&4
265 case "$targetfrom" in
272 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
282 cp $targetdir/\$f . || exit 1
287 *) echo "Unknown targetfrom '$targetfrom'" >&4
291 if $test ! -f $run; then
292 echo "Target 'run' script '$run' not found." >&4
296 if $test ! -f $to; then
297 echo "Target 'to' script '$to' not found." >&4
301 if $test ! -f $from; then
302 echo "Target 'from' script '$from' not found." >&4
306 if $test ! -f $run -o ! -f $to -o ! -f $from; then
310 Using '$run' for remote execution,
311 and '$from' and '$to'
312 for remote file transfer.
318 usecrosscompile='undef'