Skip to content

Commit

Permalink
Define SIZE_OF_LONG_INT to replace sizeof(long) in #if
Browse files Browse the repository at this point in the history
  • Loading branch information
davidBar-On committed Jan 20, 2024
1 parent 3510239 commit a181adc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
10 changes: 10 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdio.h>]],
[[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],
Expand Down
4 changes: 2 additions & 2 deletions src/cjson.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@
# include <inttypes.h>
#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"
Expand Down
2 changes: 1 addition & 1 deletion src/iperf.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# include <inttypes.h>
#else
# ifndef PRIu64
# if sizeof(long) == 8
# if SIZE_OF_LONG_INT == 8
# define PRIu64 "lu"
# else
# define PRIu64 "llu"
Expand Down
2 changes: 1 addition & 1 deletion src/iperf_locale.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
# include <inttypes.h>
#else
# ifndef PRId64
# if sizeof(long) == 8
# if SIZE_OF_LONG_INT == 8
# define PRId64 "ld"
# else
# define PRId64 "lld"
Expand Down
2 changes: 1 addition & 1 deletion src/iperf_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
# include <inttypes.h>
#else
# ifndef PRIu64
# if sizeof(long) == 8
# if SIZE_OF_LONG_INT == 8
# define PRIu64 "lu"
# else
# define PRIu64 "llu"
Expand Down

0 comments on commit a181adc

Please sign in to comment.