diff --git a/configure.ac b/configure.ac index 192ab16..796e5cf 100644 --- a/configure.ac +++ b/configure.ac @@ -180,6 +180,16 @@ else fi fi +# Get the size of long int +AC_CACHE_CHECK([Size of long int], +[iperf3_cv_sizeof_long], +AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[fprintf(stderr, "%d", sizeof(long)); return(0)]])], + [iperf3_cv_sizeof_long=`./conftest$EXEEXT 2>&1`], + [AC_MSG_ERROR(Failed to compile and run size of long test)])) +AC_DEFINE_UNQUOTED([SIZE_OF_LONG_INT], $iperf3_cv_sizeof_long, [Size of long int.]) + # Check for TCP_CONGESTION sockopt (believed to be Linux and FreeBSD only) AC_CACHE_CHECK([TCP_CONGESTION socket option], [iperf3_cv_header_tcp_congestion], diff --git a/src/cjson.c b/src/cjson.c index 02d8d60..2492597 100644 --- a/src/cjson.c +++ b/src/cjson.c @@ -94,13 +94,13 @@ # include #else # ifndef PRIu64 -# if sizeof(long) == 8 +# if SIZE_OF_LONG_INT == 8 # define PRIu64 "lu" # else # define PRIu64 "llu" # endif # ifndef PRId64 -# if sizeof(long) == 8 +# if SIZE_OF_LONG_INT == 8 # define PRId64 "ld" # else # define PRId64 "lld" diff --git a/src/iperf.h b/src/iperf.h index a5eea42..57e5df7 100644 --- a/src/iperf.h +++ b/src/iperf.h @@ -55,7 +55,7 @@ # include #else # ifndef PRIu64 -# if sizeof(long) == 8 +# if SIZE_OF_LONG_INT == 8 # define PRIu64 "lu" # else # define PRIu64 "llu" diff --git a/src/iperf_locale.c b/src/iperf_locale.c index 41d78cb..0457d31 100644 --- a/src/iperf_locale.c +++ b/src/iperf_locale.c @@ -85,7 +85,7 @@ # include #else # ifndef PRId64 -# if sizeof(long) == 8 +# if SIZE_OF_LONG_INT == 8 # define PRId64 "ld" # else # define PRId64 "lld" diff --git a/src/iperf_udp.c b/src/iperf_udp.c index 5f69ee3..3f1cf46 100644 --- a/src/iperf_udp.c +++ b/src/iperf_udp.c @@ -52,7 +52,7 @@ # include #else # ifndef PRIu64 -# if sizeof(long) == 8 +# if SIZE_OF_LONG_INT == 8 # define PRIu64 "lu" # else # define PRIu64 "llu"