X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=configure;fp=configure;h=222befe8a5e178aeee586d956ee79b6f7ac1e87e;hp=5d576e104fc863eabf9da37f31158f34c9f0a51b;hb=d7213923067aa49922962a469a691c3ec951064d;hpb=8ea39c32d29428b17bfe9c806fc33f0c8adfe118 diff --git a/configure b/configure index 5d576e10..222befe8 100755 --- a/configure +++ b/configure @@ -126,6 +126,7 @@ output_sym() { targetos="" cpu="" +cross_prefix=${cross_prefix-${CROSS_COMPILE}} cc="${CC-${cross_prefix}gcc}" # default options @@ -179,6 +180,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 @@ -232,16 +239,6 @@ CYGWIN*) echo "EXTFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak exit 0 ;; -Android) - output_sym "CONFIG_32BIT" - output_sym "CONFIG_LITTLE_ENDIAN" - output_sym "CONFIG_SOCKLEN_T" - output_sym "CONFIG_GETTIMEOFDAY" - output_sym "CONFIG_CLOCK_GETTIME" - output_sym "CONFIG_CLOCK_MONOTONIC" - echo "CC=$cc" >> $config_host_mak - echo "EXTFLAGS=$CFLAGS -include config-host.h -DFIO_NO_HAVE_SHM_H -D_GNU_SOURCE" >> $config_host_mak - exit 0 esac if test ! -z "$cpu" ; then @@ -321,10 +318,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) { @@ -332,8 +346,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 @@ -341,22 +371,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" @@ -835,8 +870,7 @@ echo "inet_aton $inet_aton" # socklen_t probe socklen_t="no" cat > $TMPC << EOF -#include -#include +#include int main(int argc, char **argv) { socklen_t len = 0; @@ -977,11 +1011,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