This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
More cross-compilation defaults gleaned from -Dcc
authorJarkko Hietaniemi <jhi@iki.fi>
Mon, 18 Jun 2001 22:17:05 +0000 (22:17 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Mon, 18 Jun 2001 22:17:05 +0000 (22:17 +0000)
if it is CPU-OS-gcc.

p4raw-id: //depot/metaconfig@10690

U/modified/libc.U
U/perl/Cross.U

index 243ba0a..3d2da9b 100644 (file)
 ?S:    the output of nm and yield the list of defined symbols. It is used
 ?S:    internally by Configure.
 ?S:.
-?INIT:libnames=''
 ?T:thislib try libnames xxx xscan xrun thisname com tans file
 ?F:!libnames
+?LINT:extern libnames
 ?LINT:change libnames
 ?LINT:change nm_opt
+?INIT:libnames=''
 case "$runnm" in
 true)
 ?X: indentation is wrong on purpose--RAM
index 9c67a44..c622432 100644 (file)
@@ -5,7 +5,7 @@
 ?RCS: You may distribute under the terms of either the GNU General Public
 ?RCS: License or the Artistic License, as specified in the README file.
 ?RCS:
-?MAKE:run to from targetarch usecrosscompile: src
+?MAKE:run to from targetarch usecrosscompile: src awk grep test rm echo sed
 ?MAKE: -pick add $@ %<
 ?Y:TOP
 ?S:usecrosscompile:
 ?H:?%<:#define PERL_TARGETARCH "$targetarch"   /**/
 ?H:?%<:#endif
 ?H:.
-?T:croak pwd exe f q
+?T:croak pwd exe f q i j
 ?LINT:extern usecrosscompile
 ?LINT:extern cc
 ?LINT:extern usrinc
-?LINT:extern incpth
-?LINT:extern libpth
+?LINT:change usrinc
 ?LINT:change ar
 ?LINT:change nm
 ?LINT:change ranlib
 ?LINT:extern targethost
 ?LINT:extern targetdir
+?LINT:change targetdir
 ?LINT:extern targetuser
 ?LINT:change targetuser
 ?LINT:extern targetrun
 ?LINT:change targetrun
 ?LINT:change targetfrom
 ?LINT:change targetto
+?LINT:extern incpth
+?LINT:extern libpth
+?LINT:change incpth
+?LINT:change libpth
 ?LINT:extern locincpth
 ?LINT:extern loclibpth
 ?LINT:change locincpth
 
 case "$usecrosscompile" in
 $define|true|[yY]*)
+       $echo "Cross-compiling..."
         croak=''
        case "$cc" in
        *-*-gcc) # A cross-compiling gcc, probably.
-           targetarch=`echo $cc|sed 's/-gcc$//'`
+           targetarch=`$echo $cc|$sed 's/-gcc$//'`
            ar=$targetarch-ar
            # leave out ld, choosing it is more complex
            nm=$targetarch-nm
            ranlib=$targetarch-ranlib
+           $echo 'extern int foo;' > try.c
+           set X `$cc -v -E perl.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
+           shift
+            if $test $# -gt 0; then
+               incpth="$incpth $*"
+               incpth="$echo $incpth|$sed 's/^ //'"
+                echo "Guessing incpth $incpth" >&4
+                for i in $*; do
+                   j=`$echo $i|$sed 's,/include$,/lib,'`
+                   if $test -d $j; then
+                       libpth="$libpth $j"
+                   fi
+                done   
+               libpth="$echo $libpth|$sed 's/^ //'"
+                echo "Guessing libpth $libpth." >&4
+           fi
+           $rm -f try.c
            ;;
        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 ;;
+       '') echo "Targetarch not defined." >&4; croak=y ;;
+        *)  echo "Using targetarch $targetarch." >&4 ;;
        esac
        case "$incpth" in
-       '') echo "Cross-compiling: you should define incpth." >&4; croak=y ;;
+       '') echo "Incpth not defined." >&4; croak=y ;;
+        *)  echo "Using incpth $incpth." >&4 ;;
        esac
        case "$libpth" in
-       '') echo "Cross-compiling: you should define libpth." >&4; croak=y ;;
+       '') echo "Libpth not defined." >&4; croak=y ;;
+        *)  echo "Using libpth $libpth." >&4 ;;
        esac
-       case "$targethost" in
-       '') echo "Cross-compiling: targethost not defined." >&4; croak=y ;;
+       case "$usrinc" in
+       '') for i in $incpth; do
+               if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
+                   usrinc=$i
+                   echo "Guessing usrinc $usrinc." >&4
+                   break
+               fi
+           done
+           case "$usrinc" in
+           '') echo "Usrinc not defined." >&4; croak=y ;;
+           esac
+            ;;
+        *)  echo "Using usrinc $usrinc." >&4 ;;
        esac
-       case "$targetdir" in
-       '') echo "Cross compiling: targetdir not defined." >&4; croak=y ;;
+       case "$targethost" in
+       '') echo "Targethost not defined." >&4; croak=y ;;
+        *)  echo "Using targethost $targethost." >&4
        esac
-       locincpth=''
-       loclibpth=''
+       locincpth=' '
+       loclibpth=' '
        case "$croak" in
-       y) exit 1 ;;
+       y) echo "Cannot continue, aborting." >&4; exit 1 ;;
        esac
        case "$src" in
        /*) run=$src/Cross/run
            to=$src/Cross/to
            from=$src/Cross/from
            ;;
-       *)  pwd=`test -f ../Configure & cd ..; pwd`
+       *)  pwd=`$test -f ../Configure & cd ..; pwd`
            run=$pwd/Cross/run
            to=$pwd/Cross/to
            from=$pwd/Cross/from
@@ -129,8 +163,15 @@ $define|true|[yY]*)
        run=$run-$targetrun
        to=$to-$targetto
        from=$from-$targetfrom
+       case "$targetdir" in
+       '')  targetdir=/tmp
+             echo "Guessing targetdir $targetdir." >&4
+             ;;
+       esac
        case "$targetuser" in
-       '') targetuser=root ;;
+       '')  targetuser=root
+             echo "Guessing targetuser $targetuser." >&4
+             ;;
        esac
        case "$targetfrom" in
        scp)    q=-q ;;
@@ -146,7 +187,7 @@ $to \$exe
 $targetrun -l $targetuser $targethost "cd $targetdir && ./\$exe \$@"
 EOF
            ;;
-       *)  echo "Cross-compiling: unknown targetrun '$targetrun'" >&4
+       *)  echo "Unknown targetrun '$targetrun'" >&4
            exit 1
            ;;
        esac
@@ -166,7 +207,7 @@ EOF
 cp \$@ $targetdir/.
 EOF
            ;;
-       *)  echo "Cross-compiling: unknown targetto '$targetto'" >&4
+       *)  echo "Unknown targetto '$targetto'" >&4
            exit 1
            ;;
        esac
@@ -190,33 +231,31 @@ done
 exit 0
 EOF
            ;;
-       *)  echo "Cross-compiling: unknown targetfrom '$targetfrom'" >&4
+       *)  echo "Unknown targetfrom '$targetfrom'" >&4
            exit 1
            ;;
        esac
-       if test ! -f $run; then
-           echo "Cross-compiling: target 'run' script '$run' not found." >&4
+       if $test ! -f $run; then
+           echo "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
+       if $test ! -f $to; then
+           echo "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
+       if $test ! -f $from; then
+           echo "Target 'from' script '$from' not found." >&4
        else
            chmod a+rx $from
        fi
-       if test ! -f $run -o ! -f $to -o ! -f $from; then
+       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
+Using '$run' for remote execution, and '$from' and '$to'
+for remote file transfer.
 EOF
        ;;
 *)     run=''