Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

system.h: remove all CURL_SIZEOF_* defines #1767

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

system.h: remove all CURL_SIZEOF_* defines

... as they're not used externally and internally we check for the sizes
already in configure etc.
  • Loading branch information...
bagder committed Aug 12, 2017
commit b4e20d9f01f9e9f33d3fbf82e20e4ca91633e618
@@ -2718,291 +2718,6 @@ AC_HELP_STRING([--without-ca-fallback], [Don't use the built in CA store of the
fi
])


dnl DO_CURL_OFF_T_CHECK (TYPE, SIZE)
dnl -------------------------------------------------
dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T

AC_DEFUN([DO_CURL_OFF_T_CHECK], [
AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
if test "$curl_typeof_curl_off_t" = "unknown" && test ! -z "$1"; then
tmp_includes=""
tmp_source=""
tmp_fmt=""
case XC_SH_TR_SH([$1]) in
int64_t)
tmp_includes="$curl_includes_inttypes"
tmp_source="char f@<:@@:>@ = PRId64;"
tmp_fmt="PRId64"
;;
int32_t)
tmp_includes="$curl_includes_inttypes"
tmp_source="char f@<:@@:>@ = PRId32;"
tmp_fmt="PRId32"
;;
int16_t)
tmp_includes="$curl_includes_inttypes"
tmp_source="char f@<:@@:>@ = PRId16;"
tmp_fmt="PRId16"
;;
esac
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$tmp_includes
typedef $1 curl_off_t;
typedef char dummy_arr[sizeof(curl_off_t) == $2 ? 1 : -1];
]],[[
$tmp_source
curl_off_t dummy;
]])
],[
if test -z "$tmp_fmt"; then
curl_typeof_curl_off_t="$1"
curl_sizeof_curl_off_t="$2"
else
CURL_CHECK_DEF([$tmp_fmt], [$curl_includes_inttypes], [silent])
AS_VAR_PUSHDEF([tmp_HaveFmtDef], [curl_cv_have_def_$tmp_fmt])dnl
AS_VAR_PUSHDEF([tmp_FmtDef], [curl_cv_def_$tmp_fmt])dnl
if test AS_VAR_GET(tmp_HaveFmtDef) = "yes"; then
curl_format_curl_off_t=AS_VAR_GET(tmp_FmtDef)
curl_typeof_curl_off_t="$1"
curl_sizeof_curl_off_t="$2"
fi
AS_VAR_POPDEF([tmp_FmtDef])dnl
AS_VAR_POPDEF([tmp_HaveFmtDef])dnl
fi
])
fi
])


dnl DO_CURL_OFF_T_SUFFIX_CHECK (TYPE)
dnl -------------------------------------------------
dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T

AC_DEFUN([DO_CURL_OFF_T_SUFFIX_CHECK], [
AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
AC_MSG_CHECKING([constant suffix string for curl_off_t])
#
curl_suffix_curl_off_t="unknown"
curl_suffix_curl_off_tu="unknown"
#
case XC_SH_TR_SH([$1]) in
long_long | __longlong | __longlong_t)
tst_suffixes="LL::"
;;
long)
tst_suffixes="L::"
;;
int)
tst_suffixes="::"
;;
__int64 | int64_t)
tst_suffixes="LL:i64::"
;;
__int32 | int32_t)
tst_suffixes="L:i32::"
;;
__int16 | int16_t)
tst_suffixes="L:i16::"
;;
*)
AC_MSG_ERROR([unexpected data type $1])
;;
esac
#
old_IFS=$IFS; IFS=':'
for tmp_ssuf in $tst_suffixes ; do
IFS=$old_IFS
if test "x$curl_suffix_curl_off_t" = "xunknown"; then
case $tmp_ssuf in
i64 | i32 | i16)
tmp_usuf="u$tmp_ssuf"
;;
LL | L)
tmp_usuf="U$tmp_ssuf"
;;
*)
tmp_usuf=""
;;
esac
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_inttypes
typedef $1 new_t;
]],[[
new_t s1;
new_t s2;
s1 = -10$tmp_ssuf ;
s2 = 20$tmp_ssuf ;
if(s1 > s2)
return 1;
]])
],[
curl_suffix_curl_off_t="$tmp_ssuf"
curl_suffix_curl_off_tu="$tmp_usuf"
])
fi
done
IFS=$old_IFS
#
if test "x$curl_suffix_curl_off_t" = "xunknown"; then
AC_MSG_ERROR([cannot find constant suffix string for curl_off_t.])
else
AC_MSG_RESULT([$curl_suffix_curl_off_t])
AC_MSG_CHECKING([constant suffix string for unsigned curl_off_t])
AC_MSG_RESULT([$curl_suffix_curl_off_tu])
fi
#
])


dnl CURL_CONFIGURE_CURL_OFF_T
dnl -------------------------------------------------
dnl Find out suitable curl_off_t data type definition and associated
dnl items

AC_DEFUN([CURL_CONFIGURE_CURL_OFF_T], [
AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
#
AC_BEFORE([$0],[AC_SYS_LARGEFILE])dnl
AC_BEFORE([$0],[CURL_CONFIGURE_REENTRANT])dnl
AC_BEFORE([$0],[CURL_CHECK_AIX_ALL_SOURCE])dnl
#
if test -z "$SED"; then
AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
fi
#
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(void*)
#
if test -z "$ac_cv_sizeof_long" ||
test "$ac_cv_sizeof_long" -eq "0"; then
AC_MSG_ERROR([cannot find out size of long.])
fi
if test -z "$ac_cv_sizeof_voidp" ||
test "$ac_cv_sizeof_voidp" -eq "0"; then
AC_MSG_ERROR([cannot find out size of void*.])
fi
#
x_LP64_long=""
x_LP32_long=""
#
if test "$ac_cv_sizeof_long" -eq "8" &&
test "$ac_cv_sizeof_voidp" -ge "8"; then
x_LP64_long="long"
elif test "$ac_cv_sizeof_long" -eq "4" &&
test "$ac_cv_sizeof_voidp" -ge "4"; then
x_LP32_long="long"
fi
#
dnl DO_CURL_OFF_T_CHECK results are stored in next 3 vars
#
curl_typeof_curl_off_t="unknown"
curl_sizeof_curl_off_t="unknown"
curl_format_curl_off_t="unknown"
curl_format_curl_off_tu="unknown"
#
if test "$curl_typeof_curl_off_t" = "unknown"; then
AC_MSG_CHECKING([for 64-bit curl_off_t data type])
for t8 in \
"$x_LP64_long" \
'int64_t' \
'__int64' \
'long long' \
'__longlong' \
'__longlong_t' ; do
DO_CURL_OFF_T_CHECK([$t8], [8])
done
AC_MSG_RESULT([$curl_typeof_curl_off_t])
fi
if test "$curl_typeof_curl_off_t" = "unknown"; then
AC_MSG_CHECKING([for 32-bit curl_off_t data type])
for t4 in \
"$x_LP32_long" \
'int32_t' \
'__int32' \
'int' ; do
DO_CURL_OFF_T_CHECK([$t4], [4])
done
AC_MSG_RESULT([$curl_typeof_curl_off_t])
fi
if test "$curl_typeof_curl_off_t" = "unknown"; then
AC_MSG_ERROR([cannot find data type for curl_off_t.])
fi
#
AC_MSG_CHECKING([size of curl_off_t])
AC_MSG_RESULT([$curl_sizeof_curl_off_t])
#
AC_MSG_CHECKING([formatting string directive for curl_off_t])
if test "$curl_format_curl_off_t" != "unknown"; then
x_pull_headers="yes"
curl_format_curl_off_t=`echo "$curl_format_curl_off_t" | "$SED" 's/[["]]//g'`
curl_format_curl_off_tu=`echo "$curl_format_curl_off_t" | "$SED" 's/i$/u/'`
curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/d$/u/'`
curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/D$/U/'`
else
x_pull_headers="no"
case XC_SH_TR_SH([$curl_typeof_curl_off_t]) in
long_long | __longlong | __longlong_t)
curl_format_curl_off_t="lld"
curl_format_curl_off_tu="llu"
;;
long)
curl_format_curl_off_t="ld"
curl_format_curl_off_tu="lu"
;;
int)
curl_format_curl_off_t="d"
curl_format_curl_off_tu="u"
;;
__int64)
curl_format_curl_off_t="I64d"
curl_format_curl_off_tu="I64u"
;;
__int32)
curl_format_curl_off_t="I32d"
curl_format_curl_off_tu="I32u"
;;
__int16)
curl_format_curl_off_t="I16d"
curl_format_curl_off_tu="I16u"
;;
*)
AC_MSG_ERROR([cannot find print format string for curl_off_t.])
;;
esac
fi
AC_MSG_RESULT(["$curl_format_curl_off_t"])
#
AC_MSG_CHECKING([formatting string directive for unsigned curl_off_t])
AC_MSG_RESULT(["$curl_format_curl_off_tu"])
#
DO_CURL_OFF_T_SUFFIX_CHECK([$curl_typeof_curl_off_t])
#
if test "$x_pull_headers" = "yes"; then
if test "x$ac_cv_header_sys_types_h" = "xyes"; then
CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
fi
if test "x$ac_cv_header_stdint_h" = "xyes"; then
CURL_DEFINE_UNQUOTED([CURL_PULL_STDINT_H])
fi
if test "x$ac_cv_header_inttypes_h" = "xyes"; then
CURL_DEFINE_UNQUOTED([CURL_PULL_INTTYPES_H])
fi
fi
#
CURL_DEFINE_UNQUOTED([CURL_TYPEOF_CURL_OFF_T], [$curl_typeof_curl_off_t])
CURL_DEFINE_UNQUOTED([CURL_FORMAT_CURL_OFF_T], ["$curl_format_curl_off_t"])
CURL_DEFINE_UNQUOTED([CURL_FORMAT_CURL_OFF_TU], ["$curl_format_curl_off_tu"])
CURL_DEFINE_UNQUOTED([CURL_FORMAT_OFF_T], ["%$curl_format_curl_off_t"])
CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_OFF_T], [$curl_sizeof_curl_off_t])
CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_T], [$curl_suffix_curl_off_t])
CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_TU], [$curl_suffix_curl_off_tu])
#
])


dnl CURL_CHECK_WIN32_LARGEFILE
dnl -------------------------------------------------
dnl Check if curl's WIN32 large file will be used
@@ -183,9 +183,6 @@ AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])

dnl Checks for programs.

dnl Our curl_off_t internal and external configure settings
CURL_CONFIGURE_CURL_OFF_T

dnl This defines _ALL_SOURCE for AIX
CURL_CHECK_AIX_ALL_SOURCE

@@ -3162,14 +3159,14 @@ CURL_CONFIGURE_LONG
AC_CHECK_SIZEOF(time_t)
AC_CHECK_SIZEOF(off_t)

soname_bump=no
if test x"$curl_cv_native_windows" != "xyes" &&
test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then
AC_MSG_WARN([This libcurl built is probably not ABI compatible with previous])
AC_MSG_WARN([builds! You MUST read lib/README.curl_off_t to figure it out.])
soname_bump=yes
fi
o=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I$srcdir/include"
AC_CHECK_SIZEOF(curl_off_t, unused , [
#include <curl/system.h>
])
CPPFLAGS=$o

soname_bump=no

AC_CHECK_TYPE(long long,
[AC_DEFINE(HAVE_LONGLONG, 1,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.