X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=configure;h=965623d7c2ab0905d975f4d00ab607d5d6bd7f3d;hp=d3649710c1703e39374adcbb9e74f2fcea0ea56a;hb=1a17cfdb5e261459920212531d8f5e0eedfb267b;hpb=56c79608286deba515608989bd826aff34c0a211 diff --git a/configure b/configure index d3649710..965623d7 100755 --- a/configure +++ b/configure @@ -126,6 +126,7 @@ output_sym() { targetos="" cpu="" +cross_prefix=${cross_prefix-${CROSS_COMPILE}} cc="${CC-${cross_prefix}gcc}" show_help="no" @@ -173,6 +174,12 @@ else targetos=`uname -s` fi +echo "# Automatically generated by configure - do not modify" > $config_host_mak +printf "# Configured with:" >> $config_host_mak +printf " '%s'" "$0" "$@" >> $config_host_mak +echo >> $config_host_mak +echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak + # Some host OSes need non-standard checks for which CPU to use. # Note that these checks are broken for cross-compilation: if you're # cross-compiling to one of these OSes then you'll need to specify @@ -315,10 +322,27 @@ fi cc="${CC-${cross_prefix}gcc}" +########################################## +# check cross compile + +cross_compile="no" +cat > $TMPC </dev/null || cross_compile="yes" +else + fatal "compile test failed" +fi + ########################################## # check endianness bigendian="no" -cat > $TMPC < $TMPC < int main(void) { @@ -326,8 +350,24 @@ int main(void) return (*((uint8_t*)(&i))) == 0x67; } EOF -if compile_prog "" "" "endian"; then - $TMPE && bigendian="yes" + if compile_prog "" "" "endian"; then + $TMPE && bigendian="yes" + fi +else + # If we're cross compiling, try our best to work it out and rely on the + # run-time check to fail if we get it wrong. + cat > $TMPC < +int main(void) +{ +#if __BYTE_ORDER != __BIG_ENDIAN +# error "Unknown endianness" +#endif +} +EOF + compile_prog "" "" "endian" && bigendian="yes" + check_define "__ARMEB__" && bigendian="yes" + check_define "__MIPSEB__" && bigendian="yes" fi @@ -335,22 +375,27 @@ echo "Operating system $targetos" echo "CPU $cpu" echo "Big endian $bigendian" echo "Compiler $cc" +echo "Cross compile $cross_compile" echo ########################################## # check for wordsize wordsize="0" cat > $TMPC < +#include +#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) int main(void) { - unsigned int wsize = sizeof(long) * 8; - printf("%d\n", wsize); + BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE); return 0; } EOF -if compile_prog "" "" "wordsize"; then - wordsize=`$TMPE` +if compile_prog "-DWORDSIZE=32" "" "wordsize"; then + wordsize="32" +elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then + wordsize="64" +else + fatal "Unknown wordsize" fi echo "Wordsize $wordsize" @@ -929,11 +974,6 @@ echo "RLIMIT_MEMLOCK $rlimit_memlock" ############################################################################# -echo "# Automatically generated by configure - do not modify" > $config_host_mak -printf "# Configured with:" >> $config_host_mak -printf " '%s'" "$0" "$@" >> $config_host_mak -echo >> $config_host_mak - if test "$wordsize" = "64" ; then output_sym "CONFIG_64BIT" elif test "$wordsize" = "32" ; then