From: Ian Jackson Date: Fri, 6 Dec 2019 13:03:46 +0000 (+0000) Subject: configure.ac: Drop checks for systems lacking stdint.h X-Git-Tag: v0.6.0~226 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=secnet.git;a=commitdiff_plain;h=79876cc16592ddd80bd1745a591c11a88ad42b44 configure.ac: Drop checks for systems lacking stdint.h Signed-off-by: Ian Jackson --- diff --git a/config.h.in b/config.h.in index a59a02c..cdba71f 100644 --- a/config.h.in +++ b/config.h.in @@ -89,21 +89,6 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* The size of `unsigned char', as computed by sizeof. */ -#undef SIZEOF_UNSIGNED_CHAR - -/* The size of `unsigned int', as computed by sizeof. */ -#undef SIZEOF_UNSIGNED_INT - -/* The size of `unsigned long', as computed by sizeof. */ -#undef SIZEOF_UNSIGNED_LONG - -/* The size of `unsigned long long', as computed by sizeof. */ -#undef SIZEOF_UNSIGNED_LONG_LONG - -/* The size of `unsigned short', as computed by sizeof. */ -#undef SIZEOF_UNSIGNED_SHORT - /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS @@ -124,53 +109,6 @@ /* These used to be in config.h.bot, but are now in configure.in. */ -#ifdef HAVE_INTTYPES_H -#include -#else -#ifdef HAVE_STDINT_H -#include -#else -#if SIZEOF_UNSIGNED_LONG_LONG==8 -typedef unsigned long long uint64_t; -typedef long long int64_t; -#elif SIZEOF_UNSIGNED_LONG==8 -typedef unsigned long uint64_t; -typedef long int64_t; -#else -#error I do not know what to use for a uint64_t. -#endif - -/* Give us an unsigned 32-bit data type. */ -#if SIZEOF_UNSIGNED_LONG==4 -typedef unsigned long uint32_t; -typedef long int32_t; -#elif SIZEOF_UNSIGNED_INT==4 -typedef unsigned int uint32_t; -typedef int int32_t; -#else -#error I do not know what to use for a uint32_t. -#endif - -/* An unsigned 16-bit data type. */ -#if SIZEOF_UNSIGNED_INT==2 -typedef unsigned int uint16_t; -typedef int int16_t; -#elif SIZEOF_UNSIGNED_SHORT==2 -typedef unsigned short uint16_t; -typedef short int16_t; -#else -#error I do not know what to use for a uint16_t. -#endif - -/* An unsigned 8-bit data type */ -#if SIZEOF_UNSIGNED_CHAR==1 -typedef unsigned char uint8_t; -#else -#error I do not know what to use for a uint8_t. -#endif -#endif -#endif - #ifdef __GNUC__ #define NORETURN(_x) void _x __attribute__ ((noreturn)) #define FORMAT(_a,_b,_c) __attribute__ ((format (_a,_b,_c))) diff --git a/configure b/configure index b069360..97db2ab 100755 --- a/configure +++ b/configure @@ -1646,189 +1646,6 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_header_compile -# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES -# -------------------------------------------- -# Tries to find the compile-time value of EXPR in a program that includes -# INCLUDES, setting VAR accordingly. Returns whether the value could be -# computed -ac_fn_c_compute_int () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= 0)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=0 ac_mid=0 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid; break -else - as_fn_arith $ac_mid + 1 && ac_lo=$as_val - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) < 0)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=-1 ac_mid=-1 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= $ac_mid)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=$ac_mid; break -else - as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - ac_lo= ac_hi= -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid -else - as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in #(( -?*) eval "$3=\$ac_lo"; ac_retval=0 ;; -'') ac_retval=1 ;; -esac - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (($2) < 0) - { - long int i = longval (); - if (i != ($2)) - return 1; - fprintf (f, "%ld", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ($2)) - return 1; - fprintf (f, "%lu", i); - } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - echo >>conftest.val; read $3 >confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - for ac_header in net/if.h net/route.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -4060,171 +3864,6 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned long long" >&5 -$as_echo_n "checking size of unsigned long long... " >&6; } -if ${ac_cv_sizeof_unsigned_long_long+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned long long))" "ac_cv_sizeof_unsigned_long_long" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_unsigned_long_long" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (unsigned long long) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_unsigned_long_long=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_long_long" >&5 -$as_echo "$ac_cv_sizeof_unsigned_long_long" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_UNSIGNED_LONG_LONG $ac_cv_sizeof_unsigned_long_long -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned long" >&5 -$as_echo_n "checking size of unsigned long... " >&6; } -if ${ac_cv_sizeof_unsigned_long+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned long))" "ac_cv_sizeof_unsigned_long" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_unsigned_long" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (unsigned long) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_unsigned_long=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_long" >&5 -$as_echo "$ac_cv_sizeof_unsigned_long" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_UNSIGNED_LONG $ac_cv_sizeof_unsigned_long -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned int" >&5 -$as_echo_n "checking size of unsigned int... " >&6; } -if ${ac_cv_sizeof_unsigned_int+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned int))" "ac_cv_sizeof_unsigned_int" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_unsigned_int" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (unsigned int) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_unsigned_int=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_int" >&5 -$as_echo "$ac_cv_sizeof_unsigned_int" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_UNSIGNED_INT $ac_cv_sizeof_unsigned_int -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned short" >&5 -$as_echo_n "checking size of unsigned short... " >&6; } -if ${ac_cv_sizeof_unsigned_short+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned short))" "ac_cv_sizeof_unsigned_short" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_unsigned_short" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (unsigned short) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_unsigned_short=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_short" >&5 -$as_echo "$ac_cv_sizeof_unsigned_short" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_UNSIGNED_SHORT $ac_cv_sizeof_unsigned_short -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned char" >&5 -$as_echo_n "checking size of unsigned char... " >&6; } -if ${ac_cv_sizeof_unsigned_char+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned char))" "ac_cv_sizeof_unsigned_char" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_unsigned_char" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (unsigned char) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_unsigned_char=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_char" >&5 -$as_echo "$ac_cv_sizeof_unsigned_char" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_UNSIGNED_CHAR $ac_cv_sizeof_unsigned_char -_ACEOF - - hard= if test -z "$hard"; then diff --git a/configure.ac b/configure.ac index 8f8fab3..56d8139 100644 --- a/configure.ac +++ b/configure.ac @@ -44,7 +44,6 @@ AC_PROG_MAKE_SET AC_PROG_CC AC_PROG_INSTALL AC_STDC_HEADERS -AC_CHECK_HEADERS([stdint.h inttypes.h]) AC_CHECK_HEADERS([net/if.h net/route.h]) AC_CHECK_HEADERS([sys/socket.h]) AC_CHECK_HEADERS([linux/if_tun.h], [], [], @@ -54,11 +53,6 @@ AC_CHECK_HEADERS([linux/if_tun.h], [], [], ]) AC_CHECK_HEADERS([stropts.h sys/sockio.h net/if_tun.h]) AC_C_BIGENDIAN -AC_CHECK_SIZEOF(unsigned long long) -AC_CHECK_SIZEOF(unsigned long) -AC_CHECK_SIZEOF(unsigned int) -AC_CHECK_SIZEOF(unsigned short) -AC_CHECK_SIZEOF(unsigned char) AC_PROG_CC_NO_WRITEABLE_STRINGS(WRITESTRINGS) AC_ARG_ENABLE(hacky-parallel, @@ -114,53 +108,6 @@ AH_BOTTOM([ /* These used to be in config.h.bot, but are now in configure.in. */ -#ifdef HAVE_INTTYPES_H -#include -#else -#ifdef HAVE_STDINT_H -#include -#else -#if SIZEOF_UNSIGNED_LONG_LONG==8 -typedef unsigned long long uint64_t; -typedef long long int64_t; -#elif SIZEOF_UNSIGNED_LONG==8 -typedef unsigned long uint64_t; -typedef long int64_t; -#else -#error I do not know what to use for a uint64_t. -#endif - -/* Give us an unsigned 32-bit data type. */ -#if SIZEOF_UNSIGNED_LONG==4 -typedef unsigned long uint32_t; -typedef long int32_t; -#elif SIZEOF_UNSIGNED_INT==4 -typedef unsigned int uint32_t; -typedef int int32_t; -#else -#error I do not know what to use for a uint32_t. -#endif - -/* An unsigned 16-bit data type. */ -#if SIZEOF_UNSIGNED_INT==2 -typedef unsigned int uint16_t; -typedef int int16_t; -#elif SIZEOF_UNSIGNED_SHORT==2 -typedef unsigned short uint16_t; -typedef short int16_t; -#else -#error I do not know what to use for a uint16_t. -#endif - -/* An unsigned 8-bit data type */ -#if SIZEOF_UNSIGNED_CHAR==1 -typedef unsigned char uint8_t; -#else -#error I do not know what to use for a uint8_t. -#endif -#endif -#endif - #ifdef __GNUC__ #define NORETURN(_x) void _x __attribute__ ((noreturn)) #define FORMAT(_a,_b,_c) __attribute__ ((format (_a,_b,_c))) diff --git a/secnet.h b/secnet.h index 7da7c2d..4a42b43 100644 --- a/secnet.h +++ b/secnet.h @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include #include