diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-09-14 18:53:34 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-09-14 18:53:34 -0700 |
commit | 14c81f0a4aa300f7ea23af6130469f97d8b18793 (patch) | |
tree | 82e95cdebbad1398467ea73a553bb3f5fa4f1bbb /configure | |
parent | cd246d166df6ca6e9b460957fa27f12eb0a02f01 (diff) | |
download | tcpdump-14c81f0a4aa300f7ea23af6130469f97d8b18793.tar.gz |
Clean up the stuff we do to get <inttypes.h> stuff defined.
If we have a libpcap with <pcap/pcap-inttypes.h>, include it, so that we
don't have to worry about definitions colliding if we later include a
pcap header file that includes pcap/pcap-inttypes.h.
Otherwise, do the same stuff pcap-inttypes.h does. This means that, on
UN*X, we require that there be an <inttypes.h> that defines everything
we need.
Don't bother doing checks that are no longer necessary as a result of
those changes.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 571 |
1 files changed, 22 insertions, 549 deletions
@@ -1884,136 +1884,6 @@ $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type - -# ac_fn_c_find_intX_t LINENO BITS VAR -# ----------------------------------- -# Finds a signed integer type with width BITS, setting cache variable VAR -# accordingly. -ac_fn_c_find_intX_t () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 -$as_echo_n "checking for int$2_t... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - # Order is important - never check a type that is potentially smaller - # than half of the expected target width. - for ac_type in int$2_t 'int' 'long int' \ - 'long long int' 'short int' 'signed char'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default - enum { N = $2 / 2 - 1 }; -int -main () -{ -static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default - enum { N = $2 / 2 - 1 }; -int -main () -{ -static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) - < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - case $ac_type in #( - int$2_t) : - eval "$3=yes" ;; #( - *) : - eval "$3=\$ac_type" ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if eval test \"x\$"$3"\" = x"no"; then : - -else - break -fi - done -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_find_intX_t - -# ac_fn_c_find_uintX_t LINENO BITS VAR -# ------------------------------------ -# Finds an unsigned integer type with width BITS, setting cache variable VAR -# accordingly. -ac_fn_c_find_uintX_t () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 -$as_echo_n "checking for uint$2_t... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - # Order is important - never check a type that is potentially smaller - # than half of the expected target width. - for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ - 'unsigned long long int' 'unsigned short int' 'unsigned char'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - case $ac_type in #( - uint$2_t) : - eval "$3=yes" ;; #( - *) : - eval "$3=\$ac_type" ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if eval test \"x\$"$3"\" = x"no"; then : - -else - break -fi - done -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_find_uintX_t cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -6455,109 +6325,6 @@ if test -f /dev/bpf0 ; then fi # -# Make sure we have definitions for all the C99 specified-width types -# (regardless of whether the environment is a C99 environment or not). -# -ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t" -case $ac_cv_c_int8_t in #( - no|yes) ;; #( - *) - -cat >>confdefs.h <<_ACEOF -#define int8_t $ac_cv_c_int8_t -_ACEOF -;; -esac - -ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t" -case $ac_cv_c_int16_t in #( - no|yes) ;; #( - *) - -cat >>confdefs.h <<_ACEOF -#define int16_t $ac_cv_c_int16_t -_ACEOF -;; -esac - -ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" -case $ac_cv_c_int32_t in #( - no|yes) ;; #( - *) - -cat >>confdefs.h <<_ACEOF -#define int32_t $ac_cv_c_int32_t -_ACEOF -;; -esac - -ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t" -case $ac_cv_c_int64_t in #( - no|yes) ;; #( - *) - -cat >>confdefs.h <<_ACEOF -#define int64_t $ac_cv_c_int64_t -_ACEOF -;; -esac - -ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" -case $ac_cv_c_uint8_t in #( - no|yes) ;; #( - *) - -$as_echo "#define _UINT8_T 1" >>confdefs.h - - -cat >>confdefs.h <<_ACEOF -#define uint8_t $ac_cv_c_uint8_t -_ACEOF -;; - esac - -ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" -case $ac_cv_c_uint16_t in #( - no|yes) ;; #( - *) - - -cat >>confdefs.h <<_ACEOF -#define uint16_t $ac_cv_c_uint16_t -_ACEOF -;; - esac - -ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" -case $ac_cv_c_uint32_t in #( - no|yes) ;; #( - *) - -$as_echo "#define _UINT32_T 1" >>confdefs.h - - -cat >>confdefs.h <<_ACEOF -#define uint32_t $ac_cv_c_uint32_t -_ACEOF -;; - esac - -ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" -case $ac_cv_c_uint64_t in #( - no|yes) ;; #( - *) - -$as_echo "#define _UINT64_T 1" >>confdefs.h - - -cat >>confdefs.h <<_ACEOF -#define uint64_t $ac_cv_c_uint64_t -_ACEOF -;; - esac - - -# # Make sure we have a definition for C99's uintptr_t (regardless of # whether the environment is a C99 environment or not). # @@ -6600,6 +6367,26 @@ fi # +# Check whether we have pcap/pcap-inttypes.h. +# If we do, we use that to get the C99 types defined. +# +savedcppflags="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $V_INCLS" +for ac_header in pcap/pcap-inttypes.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "pcap/pcap-inttypes.h" "ac_cv_header_pcap_pcap_inttypes_h" "$ac_includes_default" +if test "x$ac_cv_header_pcap_pcap_inttypes_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PCAP_PCAP_INTTYPES_H 1 +_ACEOF + +fi + +done + +CPPFLAGS="$savedcppflags" + +# # Define the old BSD specified-width types in terms of the C99 types; # we may need them with libpcap include files. # @@ -6653,325 +6440,11 @@ fi # -# Check for <inttypes.h> -# -for ac_header in inttypes.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default" -if test "x$ac_cv_header_inttypes_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_INTTYPES_H 1 -_ACEOF - - # - # OK, we have inttypes.h, but does it define all the PRI[doxu]64 macros? - # Some systems have an inttypes.h that doesn't define all of them. - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether inttypes.h defines the PRI[doxu]64 macros" >&5 -$as_echo_n "checking whether inttypes.h defines the PRI[doxu]64 macros... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - #include <inttypes.h> - #include <stdio.h> - #include <sys/types.h> - - main() - { - printf("%" PRId64 "\n", (uint64_t)1); - printf("%" PRIo64 "\n", (uint64_t)1); - printf("%" PRIx64 "\n", (uint64_t)1); - printf("%" PRIu64 "\n", (uint64_t)1); - } - - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ac_lbl_inttypes_h_defines_formats=yes - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ac_lbl_inttypes_h_defines_formats=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -else - - # - # We don't have inttypes.h, so it obviously can't define those - # macros. - # - ac_lbl_inttypes_h_defines_formats=no - -fi - -done - -if test "$ac_lbl_inttypes_h_defines_formats" = no; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether %lx can be used to format 64-bit integers" >&5 -$as_echo_n "checking whether %lx can be used to format 64-bit integers... " >&6; } - if test "$cross_compiling" = 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 $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -# ifdef HAVE_INTTYPES_H - #include <inttypes.h> -# endif - #include <stdio.h> - #include <sys/types.h> - - main() - { - uint64_t t = 1; - char strbuf[16+1]; - sprintf(strbuf, "%016lx", t << 32); - if (strcmp(strbuf, "0000000100000000") == 0) - exit(0); - else - exit(1); - } - - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - -$as_echo "#define PRId64 \"ld\"" >>confdefs.h - - -$as_echo "#define PRIo64 \"lo\"" >>confdefs.h - - -$as_echo "#define PRIx64 \"lx\"" >>confdefs.h - - -$as_echo "#define PRIu64 \"lu\"" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether %llx can be used to format 64-bit integers" >&5 -$as_echo_n "checking whether %llx can be used to format 64-bit integers... " >&6; } - if test "$cross_compiling" = 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 $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -# ifdef HAVE_INTTYPES_H - #include <inttypes.h> -# endif - #include <stdio.h> - #include <sys/types.h> - - main() - { - uint64_t t = 1; - char strbuf[16+1]; - sprintf(strbuf, "%016llx", t << 32); - if (strcmp(strbuf, "0000000100000000") == 0) - exit(0); - else - exit(1); - } - - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - -$as_echo "#define PRId64 \"lld\"" >>confdefs.h - - -$as_echo "#define PRIo64 \"llo\"" >>confdefs.h - - -$as_echo "#define PRIx64 \"llx\"" >>confdefs.h - - -$as_echo "#define PRIu64 \"llu\"" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether %Lx can be used to format 64-bit integers" >&5 -$as_echo_n "checking whether %Lx can be used to format 64-bit integers... " >&6; } - if test "$cross_compiling" = 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 $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -# ifdef HAVE_INTTYPES_H - #include <inttypes.h> -# endif - #include <stdio.h> - #include <sys/types.h> - - main() - { - uint64_t t = 1; - char strbuf[16+1]; - sprintf(strbuf, "%016Lx", t << 32); - if (strcmp(strbuf, "0000000100000000") == 0) - exit(0); - else - exit(1); - } - - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - -$as_echo "#define PRId64 \"Ld\"" >>confdefs.h - - -$as_echo "#define PRIo64 \"Lo\"" >>confdefs.h - - -$as_echo "#define PRIx64 \"Lx\"" >>confdefs.h - - -$as_echo "#define PRIu64 \"Lu\"" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether %qx can be used to format 64-bit integers" >&5 -$as_echo_n "checking whether %qx can be used to format 64-bit integers... " >&6; } - if test "$cross_compiling" = 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 $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -# ifdef HAVE_INTTYPES_H - #include <inttypes.h> -# endif - #include <stdio.h> - #include <sys/types.h> - - main() - { - uint64_t t = 1; - char strbuf[16+1]; - sprintf(strbuf, "%016qx", t << 32); - if (strcmp(strbuf, "0000000100000000") == 0) - exit(0); - else - exit(1); - } - - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - -$as_echo "#define PRId64 \"qd\"" >>confdefs.h - - -$as_echo "#define PRIo64 \"qo\"" >>confdefs.h - - -$as_echo "#define PRIx64 \"qx\"" >>confdefs.h - - -$as_echo "#define PRIu64 \"qu\"" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - - as_fn_error $? "neither %llx nor %Lx nor %qx worked on a 64-bit integer" "$LINENO" 5 - - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - -fi - -# # Check for some headers introduced in later versions of libpcap # and used by some printers. # -# Those headers use the {u_}intN_t types, so we must do this after -# we check for what's needed to get them defined. +# Those headers might use the {u_}intN_t types, so we must do this +# after we check for what's needed to get them defined. # savedcppflags="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $V_INCLS" |