X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=configure;h=76da4ba597674a35ba9a14ef5a1d5cb2d1c20374;hp=d1f277d057ea1e0ed8226f80d63bfb18ee5097cd;hb=50206d9b89b6649d782e988df52438e7984707af;hpb=9c639a76200286bc6db7cefefef425cff65b0d78 diff --git a/configure b/configure index d1f277d0..76da4ba5 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 @@ -226,16 +233,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 @@ -315,10 +312,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 +340,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 +365,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" @@ -774,6 +809,24 @@ if compile_prog "" "-lnuma" "libnuma"; then fi echo "libnuma $libnuma" +########################################## +# libnuma 2.x version API +if test "$libnuma" = "yes" ; then +libnuma_v2="no" +cat > $TMPC << EOF +#include +int main(int argc, char **argv) +{ + struct bitmask *mask = numa_parse_nodestring(NULL); + return 0; +} +EOF +if compile_prog "" "" "libnuma api"; then + libnuma_v2="yes" +fi +echo "libnuma v2 $libnuma_v2" +fi + ########################################## # strsep() probe strsep="no" @@ -829,8 +882,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; @@ -929,11 +981,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 @@ -1017,7 +1064,7 @@ fi if test "$fusion_aw" = "yes" ; then output_sym "CONFIG_FUSION_AW" fi -if test "$libnuma" = "yes" ; then +if test "$libnuma_v2" = "yes" ; then output_sym "CONFIG_LIBNUMA" fi if test "$solaris_aio" = "yes" ; then