Detect if %zd is supported by printf() during configure and sets
PY_FORMAT_SIZE_T appropriately. Removes warnings on OS X under gcc 4.0.1 when PY_FORMAT_SIZE_T is set to "" instead of "z" as is needed.
This commit is contained in:
parent
dd0c312703
commit
09d1236b89
|
@ -21732,6 +21732,68 @@ else
|
|||
echo "${ECHO_T}no" >&6
|
||||
fi
|
||||
|
||||
echo "$as_me:$LINENO: checking for %zd printf() format support" >&5
|
||||
echo $ECHO_N "checking for %zd printf() format support... $ECHO_C" >&6
|
||||
if test "$cross_compiling" = yes; then
|
||||
{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
|
||||
See \`config.log' for more details." >&5
|
||||
echo "$as_me: error: cannot run test program while cross compiling
|
||||
See \`config.log' for more details." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char buffer[4];
|
||||
|
||||
if(sprintf(buffer, "%zd", (size_t)123) < 0)
|
||||
return 1;
|
||||
|
||||
if (strncmp(buffer, "123", 3))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define PY_FORMAT_SIZE_T "z"
|
||||
_ACEOF
|
||||
|
||||
else
|
||||
echo "$as_me: program exited with status $ac_status" >&5
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
( exit $ac_status )
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
fi
|
||||
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
|
||||
echo "$as_me:$LINENO: checking for socklen_t" >&5
|
||||
echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6
|
||||
if test "${ac_cv_type_socklen_t+set}" = set; then
|
||||
|
|
21
configure.in
21
configure.in
|
@ -3247,6 +3247,27 @@ else
|
|||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for %zd printf() format support)
|
||||
AC_TRY_RUN([#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char buffer[4];
|
||||
|
||||
if(sprintf(buffer, "%zd", (size_t)123) < 0)
|
||||
return 1;
|
||||
|
||||
if (strncmp(buffer, "123", 3))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
|
||||
AC_MSG_RESULT(no))
|
||||
|
||||
AC_CHECK_TYPE(socklen_t,,
|
||||
AC_DEFINE(socklen_t,int,
|
||||
Define to `int' if <sys/socket.h> does not define.),[
|
||||
|
|
|
@ -727,6 +727,9 @@
|
|||
/* Defined if PTHREAD_SCOPE_SYSTEM supported. */
|
||||
#undef PTHREAD_SYSTEM_SCHED_SUPPORTED
|
||||
|
||||
/* Define to printf format modifier for Py_ssize_t */
|
||||
#undef PY_FORMAT_SIZE_T
|
||||
|
||||
/* Define as the integral type used for Unicode representation. */
|
||||
#undef PY_UNICODE_TYPE
|
||||
|
||||
|
|
Loading…
Reference in New Issue