From: green Date: Thu, 31 Jan 2002 22:25:31 +0000 (+0000) Subject: Configure changes to enable cross compiling. X-Git-Tag: upstream/4.9.2~89005 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ed35b400051644eeb1223c7807ee88b5c71c5251;p=platform%2Fupstream%2Flinaro-gcc.git Configure changes to enable cross compiling. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49378 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/libffi/ChangeLog b/libffi/ChangeLog index 8a1b698..2c59c6a 100644 --- a/libffi/ChangeLog +++ b/libffi/ChangeLog @@ -1,3 +1,11 @@ +2002-01-31 Anthony Green + + * configure: Rebuilt. + * configure.in: Replace CHECK_SIZEOF and endian tests with + cross-compiler friendly macros. + * aclocal.m4 (AC_COMPILE_CHECK_SIZEOF, AC_C_BIGENDIAN_CROSS): New + macros. + 2002-01-18 David Edelsohn * src/powerpc/darwin.S (_ffi_call_AIX): New. diff --git a/libffi/aclocal.m4 b/libffi/aclocal.m4 index 63ff942..6d59d17 100644 --- a/libffi/aclocal.m4 +++ b/libffi/aclocal.m4 @@ -19,6 +19,102 @@ AC_DEFUN([AC_PROG_LIBTOOL],) AC_SUBST(LIBTOOL) ]) +AC_DEFUN([AC_COMPILE_CHECK_SIZEOF], +[changequote(<<, >>)dnl +dnl The name to #define. +define(<>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl +dnl The cache variable name. +define(<>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl +changequote([, ])dnl +AC_MSG_CHECKING(size of $1) +AC_CACHE_VAL(AC_CV_NAME, +[for ac_size in 4 8 1 2 16 12 $2 ; do # List sizes in rough order of prevalence. + AC_TRY_COMPILE([#include "confdefs.h" +#include +$2 +], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size) + if test x$AC_CV_NAME != x ; then break; fi +done +]) +if test x$AC_CV_NAME = x ; then + AC_MSG_ERROR([cannot determine a size for $1]) +fi +AC_MSG_RESULT($AC_CV_NAME) +AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1]) +undefine([AC_TYPE_NAME])dnl +undefine([AC_CV_NAME])dnl +]) + +AC_DEFUN([AC_C_BIGENDIAN_CROSS], +[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian, +[ac_cv_c_bigendian=unknown +# See if sys/param.h defines the BYTE_ORDER macro. +AC_TRY_COMPILE([#include +#include ], [ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif], [# It does; now see whether it defined to BIG_ENDIAN or not. +AC_TRY_COMPILE([#include +#include ], [ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)]) +if test $ac_cv_c_bigendian = unknown; then +AC_TRY_RUN([main () { + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes, +[ echo $ac_n "cross-compiling... " 2>&AC_FD_MSG ]) +fi]) +if test $ac_cv_c_bigendian = unknown; then +AC_MSG_CHECKING(to probe for byte ordering) +[ +cat >conftest.c <&AC_FD_MSG + ac_cv_c_bigendian=yes + fi + if test `grep -l LiTTleEnDian conftest.o` ; then + echo $ac_n ' little endian probe OK, ' 1>&AC_FD_MSG + if test $ac_cv_c_bigendian = yes ; then + ac_cv_c_bigendian=unknown; + else + ac_cv_c_bigendian=no + fi + fi + echo $ac_n 'guessing bigendian ... ' >&AC_FD_MSG + fi + fi +AC_MSG_RESULT($ac_cv_c_bigendian) +fi +if test $ac_cv_c_bigendian = yes; then + AC_DEFINE(WORDS_BIGENDIAN, 1, [whether byteorder is bigendian]) + BYTEORDER=4321 +else + BYTEORDER=1234 +fi +AC_DEFINE_UNQUOTED(BYTEORDER, $BYTEORDER, [1234 = LIL_ENDIAN, 4321 = BIGENDIAN]) +if test $ac_cv_c_bigendian = unknown; then + AC_MSG_ERROR(unknown endianess - sorry, please pre-set ac_cv_c_bigendian) +fi +]) + # Like AC_CONFIG_HEADER, but automatically create stamp file. AC_DEFUN(AM_CONFIG_HEADER, diff --git a/libffi/configure b/libffi/configure index f367f2e..4789f85 100755 --- a/libffi/configure +++ b/libffi/configure @@ -2979,33 +2979,33 @@ echo "configure:2979: checking size of short" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } -else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. cat > conftest.$ac_ext < -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(short)); - exit(0); -} +#include "confdefs.h" +#include + + +int main() { +switch (0) case 0: case (sizeof (short) == $ac_size):; +; return 0; } EOF -if { (eval echo configure:2998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_short=`cat conftestval` +if { (eval echo configure:2995: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_short=$ac_size else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_short=0 fi -rm -fr conftest* +rm -f conftest* + if test x$ac_cv_sizeof_short != x ; then break; fi +done + fi +if test x$ac_cv_sizeof_short = x ; then + { echo "configure: error: cannot determine a size for short" 1>&2; exit 1; } fi echo "$ac_t""$ac_cv_sizeof_short" 1>&6 cat >> confdefs.h <&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } -else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. cat > conftest.$ac_ext < -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(int)); - exit(0); -} +#include "confdefs.h" +#include + + +int main() { +switch (0) case 0: case (sizeof (int) == $ac_size):; +; return 0; } EOF -if { (eval echo configure:3037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_int=`cat conftestval` +if { (eval echo configure:3034: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_int=$ac_size else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_int=0 fi -rm -fr conftest* +rm -f conftest* + if test x$ac_cv_sizeof_int != x ; then break; fi +done + fi +if test x$ac_cv_sizeof_int = x ; then + { echo "configure: error: cannot determine a size for int" 1>&2; exit 1; } fi echo "$ac_t""$ac_cv_sizeof_int" 1>&6 cat >> confdefs.h <&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } -else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. cat > conftest.$ac_ext < -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(long)); - exit(0); -} +#include "confdefs.h" +#include + + +int main() { +switch (0) case 0: case (sizeof (long) == $ac_size):; +; return 0; } EOF -if { (eval echo configure:3076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_long=`cat conftestval` +if { (eval echo configure:3073: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_long=$ac_size else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_long=0 fi -rm -fr conftest* +rm -f conftest* + if test x$ac_cv_sizeof_long != x ; then break; fi +done + fi +if test x$ac_cv_sizeof_long = x ; then + { echo "configure: error: cannot determine a size for long" 1>&2; exit 1; } fi echo "$ac_t""$ac_cv_sizeof_long" 1>&6 cat >> confdefs.h <&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } -else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. cat > conftest.$ac_ext < -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(long long)); - exit(0); -} +#include "confdefs.h" +#include + + +int main() { +switch (0) case 0: case (sizeof (long long) == $ac_size):; +; return 0; } EOF -if { (eval echo configure:3115: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_long_long=`cat conftestval` +if { (eval echo configure:3112: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_long_long=$ac_size else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_long_long=0 fi -rm -fr conftest* +rm -f conftest* + if test x$ac_cv_sizeof_long_long != x ; then break; fi +done + fi +if test x$ac_cv_sizeof_long_long = x ; then + { echo "configure: error: cannot determine a size for long long" 1>&2; exit 1; } fi echo "$ac_t""$ac_cv_sizeof_long_long" 1>&6 cat >> confdefs.h <&5 if eval "test \"`echo '$''{'ac_cv_sizeof_float'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } -else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. cat > conftest.$ac_ext < -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(float)); - exit(0); -} +#include "confdefs.h" +#include + + +int main() { +switch (0) case 0: case (sizeof (float) == $ac_size):; +; return 0; } EOF -if { (eval echo configure:3154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_float=`cat conftestval` +if { (eval echo configure:3151: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_float=$ac_size else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_float=0 fi -rm -fr conftest* +rm -f conftest* + if test x$ac_cv_sizeof_float != x ; then break; fi +done + fi +if test x$ac_cv_sizeof_float = x ; then + { echo "configure: error: cannot determine a size for float" 1>&2; exit 1; } fi echo "$ac_t""$ac_cv_sizeof_float" 1>&6 cat >> confdefs.h <&5 if eval "test \"`echo '$''{'ac_cv_sizeof_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } -else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. cat > conftest.$ac_ext < -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(double)); - exit(0); -} +#include "confdefs.h" +#include + + +int main() { +switch (0) case 0: case (sizeof (double) == $ac_size):; +; return 0; } EOF -if { (eval echo configure:3193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_double=`cat conftestval` +if { (eval echo configure:3190: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_double=$ac_size else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_double=0 fi -rm -fr conftest* +rm -f conftest* + if test x$ac_cv_sizeof_double != x ; then break; fi +done + fi +if test x$ac_cv_sizeof_double = x ; then + { echo "configure: error: cannot determine a size for double" 1>&2; exit 1; } fi echo "$ac_t""$ac_cv_sizeof_double" 1>&6 cat >> confdefs.h <&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } -else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. cat > conftest.$ac_ext < -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(long double)); - exit(0); -} +#include "confdefs.h" +#include + + +int main() { +switch (0) case 0: case (sizeof (long double) == $ac_size):; +; return 0; } EOF -if { (eval echo configure:3232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_long_double=`cat conftestval` +if { (eval echo configure:3229: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_long_double=$ac_size else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_long_double=0 fi -rm -fr conftest* +rm -f conftest* + if test x$ac_cv_sizeof_long_double != x ; then break; fi +done + fi +if test x$ac_cv_sizeof_long_double = x ; then + { echo "configure: error: cannot determine a size for long double" 1>&2; exit 1; } fi echo "$ac_t""$ac_cv_sizeof_long_double" 1>&6 cat >> confdefs.h <&5 if eval "test \"`echo '$''{'ac_cv_sizeof_void_p'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } -else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. cat > conftest.$ac_ext < -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(void *)); - exit(0); -} +#include "confdefs.h" +#include + + +int main() { +switch (0) case 0: case (sizeof (void *) == $ac_size):; +; return 0; } EOF -if { (eval echo configure:3272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_void_p=`cat conftestval` +if { (eval echo configure:3269: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_void_p=$ac_size else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_void_p=0 fi -rm -fr conftest* +rm -f conftest* + if test x$ac_cv_sizeof_void_p != x ; then break; fi +done + fi +if test x$ac_cv_sizeof_void_p = x ; then + { echo "configure: error: cannot determine a size for void *" 1>&2; exit 1; } fi echo "$ac_t""$ac_cv_sizeof_void_p" 1>&6 cat >> confdefs.h <&2; exit 1; } + echo $ac_n "cross-compiling... " 2>&6 else cat > conftest.$ac_ext <&6 +if test $ac_cv_c_bigendian = unknown; then +echo $ac_n "checking to probe for byte ordering""... $ac_c" 1>&6 +echo "configure:3376: checking to probe for byte ordering" >&5 + +cat >conftest.c <&6 + ac_cv_c_bigendian=yes + fi + if test `grep -l LiTTleEnDian conftest.o` ; then + echo $ac_n ' little endian probe OK, ' 1>&6 + if test $ac_cv_c_bigendian = yes ; then + ac_cv_c_bigendian=unknown; + else + ac_cv_c_bigendian=no + fi + fi + echo $ac_n 'guessing bigendian ... ' >&6 + fi + fi +echo "$ac_t""$ac_cv_c_bigendian" 1>&6 +fi if test $ac_cv_c_bigendian = yes; then cat >> confdefs.h <<\EOF #define WORDS_BIGENDIAN 1 EOF + BYTEORDER=4321 +else + BYTEORDER=1234 +fi +cat >> confdefs.h <&2; exit 1; } fi diff --git a/libffi/configure.in b/libffi/configure.in index 645b040..d0f2617 100644 --- a/libffi/configure.in +++ b/libffi/configure.in @@ -84,16 +84,16 @@ AC_CHECK_FUNCS(memcpy) AC_FUNC_ALLOCA dnl AC_CHECK_SIZEOF(char) -AC_CHECK_SIZEOF(short) -AC_CHECK_SIZEOF(int) -AC_CHECK_SIZEOF(long) -AC_CHECK_SIZEOF(long long) -AC_CHECK_SIZEOF(float) -AC_CHECK_SIZEOF(double) -AC_CHECK_SIZEOF(long double) - -AC_CHECK_SIZEOF(void *) -AC_C_BIGENDIAN +AC_COMPILE_CHECK_SIZEOF(short) +AC_COMPILE_CHECK_SIZEOF(int) +AC_COMPILE_CHECK_SIZEOF(long) +AC_COMPILE_CHECK_SIZEOF(long long) +AC_COMPILE_CHECK_SIZEOF(float) +AC_COMPILE_CHECK_SIZEOF(double) +AC_COMPILE_CHECK_SIZEOF(long double) + +AC_COMPILE_CHECK_SIZEOF(void *) +AC_C_BIGENDIAN_CROSS AC_SUBST(TARGET) AC_SUBST(TARGETDIR)