Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3b739b1

Browse files
committed
- Issue #14324: Fix configure tests for cross builds.
when using gcc, use a compilation test for the cross build check for long long format.
1 parent 93a0ef1 commit 3b739b1

3 files changed

Lines changed: 49 additions & 2 deletions

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ Build
111111

112112
- Issue #14321: Do not run pgen during the build if files are up to date.
113113

114+
- Issue #14324: Fix configure tests for cross builds.
115+
114116
Extension Modules
115117
-----------------
116118

configure

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13805,7 +13805,36 @@ $as_echo_n "checking for %lld and %llu printf() format support... " >&6; }
1380513805
$as_echo_n "(cached) " >&6
1380613806
else
1380713807
if test "$cross_compiling" = yes; then :
13808-
ac_cv_have_long_long_format=no
13808+
ac_cv_have_long_long_format="cross -- assuming no"
13809+
if test x$GCC = xyes; then
13810+
save_CFLAGS=$CFLAGS
13811+
CFLAGS="$CFLAGS -Werror -Wformat"
13812+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13813+
/* end confdefs.h. */
13814+
13815+
#include <stdio.h>
13816+
#include <stddef.h>
13817+
13818+
int
13819+
main ()
13820+
{
13821+
13822+
char *buffer;
13823+
sprintf(buffer, "%lld", (long long)123);
13824+
sprintf(buffer, "%lld", (long long)-123);
13825+
sprintf(buffer, "%llu", (unsigned long long)123);
13826+
13827+
;
13828+
return 0;
13829+
}
13830+
_ACEOF
13831+
if ac_fn_c_try_compile "$LINENO"; then :
13832+
ac_cv_have_long_long_format=yes
13833+
13834+
fi
13835+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13836+
CFLAGS=$save_CFLAGS
13837+
fi
1380913838
else
1381013839
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1381113840
/* end confdefs.h. */

configure.ac

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4128,7 +4128,23 @@ then
41284128
]]])],
41294129
[ac_cv_have_long_long_format=yes],
41304130
[ac_cv_have_long_long_format=no],
4131-
[ac_cv_have_long_long_format=no])
4131+
[ac_cv_have_long_long_format="cross -- assuming no"
4132+
if test x$GCC = xyes; then
4133+
save_CFLAGS=$CFLAGS
4134+
CFLAGS="$CFLAGS -Werror -Wformat"
4135+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4136+
#include <stdio.h>
4137+
#include <stddef.h>
4138+
]], [[
4139+
char *buffer;
4140+
sprintf(buffer, "%lld", (long long)123);
4141+
sprintf(buffer, "%lld", (long long)-123);
4142+
sprintf(buffer, "%llu", (unsigned long long)123);
4143+
]])],
4144+
ac_cv_have_long_long_format=yes
4145+
)
4146+
CFLAGS=$save_CFLAGS
4147+
fi])
41324148
)
41334149
AC_MSG_RESULT($ac_cv_have_long_long_format)
41344150
fi

0 commit comments

Comments
 (0)