Change from configure time to compile time probe for intptr_t definition.

2015-03-23  Joel Sherrill <joel.sherrill@oarcorp.com

	* configure.in: Delete logic to determine _UINTPTR_EQ_ULONGLONG
	and _UINTPTR_EQ_ULONG at configuration time.
	*libc/include/sys/config.h: Add logic to determine
	_UINTPTR_EQ_ULONGLONG and _UINTPTR_EQ_ULONG at compilation time.
	* libc/include/inttypes.h: Add include of <sys/config.h>.
	* configure: Regenerated.
This commit is contained in:
Joel Sherrill 2015-03-18 15:44:41 -05:00 committed by Corinna Vinschen
parent dd3d3b10e2
commit 380c00f175
5 changed files with 36 additions and 110 deletions

View File

@ -1,3 +1,12 @@
2015-03-23 Joel Sherrill <joel.sherrill@oarcorp.com
* configure.in: Delete logic to determine _UINTPTR_EQ_ULONGLONG
and _UINTPTR_EQ_ULONG at configuration time.
*libc/include/sys/config.h: Add logic to determine
_UINTPTR_EQ_ULONGLONG and _UINTPTR_EQ_ULONG at compilation time.
* libc/include/inttypes.h: Add include of <sys/config.h>.
* configure: Regenerated.
2015-03-19 Steve Ellcey <sellcey@imgtec.com> 2015-03-19 Steve Ellcey <sellcey@imgtec.com>
* libc/include/sys/time.h: Replace uint32_t and uint64_t * libc/include/sys/time.h: Replace uint32_t and uint64_t

69
newlib/configure vendored
View File

@ -12646,75 +12646,6 @@ _ACEOF
fi fi
#### Determine if uintptr_t is unsigned long long
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether uintptr_t equals unsigned long long" >&5
$as_echo_n "checking whether uintptr_t equals unsigned long long... " >&6; }
if ${newlib_cv_uintptr_eq_ulonglong+:} false; then :
$as_echo_n "(cached) " >&6
else
cat > conftest.c <<EOF
#include <inttypes.h>
extern int foo(uintptr_t);
extern int foo(unsigned long long);
EOF
if { ac_try='${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c
1>&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }
then
newlib_cv_uintptr_eq_ulonglong=yes;
else
newlib_cv_uintptr_eq_ulonglong=no;
fi
rm -f conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $newlib_cv_uintptr_eq_ulonglong" >&5
$as_echo "$newlib_cv_uintptr_eq_ulonglong" >&6; }
if test $newlib_cv_uintptr_eq_ulonglong = yes; then
cat >>confdefs.h <<_ACEOF
#define _UINTPTR_EQ_ULONGLONG 1
_ACEOF
else
#### Determine if uintptr_t is unsigned long
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether uintptr_t equals unsigned long" >&5
$as_echo_n "checking whether uintptr_t equals unsigned long... " >&6; }
if ${newlib_cv_uintptr_eq_ulong+:} false; then :
$as_echo_n "(cached) " >&6
else
cat > conftest.c <<EOF
#include <inttypes.h>
extern int foo(uintptr_t);
extern int foo(unsigned long);
EOF
if { ac_try='${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c
1>&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }
then
newlib_cv_uintptr_eq_ulong=yes;
else
newlib_cv_uintptr_eq_ulong=no;
fi
rm -f conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $newlib_cv_uintptr_eq_ulong" >&5
$as_echo "$newlib_cv_uintptr_eq_ulong" >&6; }
if test $newlib_cv_uintptr_eq_ulong = yes; then
cat >>confdefs.h <<_ACEOF
#define _UINTPTR_EQ_ULONG 1
_ACEOF
fi
fi
ac_config_files="$ac_config_files Makefile" ac_config_files="$ac_config_files Makefile"

View File

@ -617,47 +617,6 @@ if test $newlib_cv_ldbl_eq_dbl = yes; then
AC_DEFINE_UNQUOTED(_LDBL_EQ_DBL) AC_DEFINE_UNQUOTED(_LDBL_EQ_DBL)
fi fi
#### Determine if uintptr_t is unsigned long long
AC_CACHE_CHECK(whether uintptr_t equals unsigned long long,
newlib_cv_uintptr_eq_ulonglong, [dnl
cat > conftest.c <<EOF
#include <inttypes.h>
extern int foo(uintptr_t);
extern int foo(unsigned long long);
EOF
if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c
1>&AS_MESSAGE_LOG_FD])
then
newlib_cv_uintptr_eq_ulonglong=yes;
else
newlib_cv_uintptr_eq_ulonglong=no;
fi
rm -f conftest*])
if test $newlib_cv_uintptr_eq_ulonglong = yes; then
AC_DEFINE_UNQUOTED(_UINTPTR_EQ_ULONGLONG)
else
#### Determine if uintptr_t is unsigned long
AC_CACHE_CHECK(whether uintptr_t equals unsigned long,
newlib_cv_uintptr_eq_ulong, [dnl
cat > conftest.c <<EOF
#include <inttypes.h>
extern int foo(uintptr_t);
extern int foo(unsigned long);
EOF
if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c
1>&AS_MESSAGE_LOG_FD])
then
newlib_cv_uintptr_eq_ulong=yes;
else
newlib_cv_uintptr_eq_ulong=no;
fi
rm -f conftest*])
if test $newlib_cv_uintptr_eq_ulong = yes; then
AC_DEFINE_UNQUOTED(_UINTPTR_EQ_ULONG)
fi
fi
AC_SUBST(CFLAGS) AC_SUBST(CFLAGS)
AC_CONFIG_FILES([Makefile], AC_CONFIG_FILES([Makefile],

View File

@ -14,6 +14,7 @@
#define _INTTYPES_H #define _INTTYPES_H
#include <newlib.h> #include <newlib.h>
#include <sys/config.h>
#include <sys/_intsup.h> #include <sys/_intsup.h>
#include <stdint.h> #include <stdint.h>
#define __need_wchar_t #define __need_wchar_t

View File

@ -287,4 +287,30 @@
#define _MB_EXTENDED_CHARSETS_WINDOWS 1 #define _MB_EXTENDED_CHARSETS_WINDOWS 1
#endif #endif
/* Determine how uintptr_t is defined by gcc for this target. This
is used to determine the correct printf() constant in inttypes.h */
#pragma push_macro("signed")
#pragma push_macro("int")
#pragma push_macro("long")
#undef signed
#undef int
#undef long
#define signed +0
#define int +0
#define long +1
#if __INTPTR_TYPE__ == 2
#define _UINTPTR_EQ_ULONGLONG
#elif __INTPTR_TYPE__ == 1
#define _UINTPTR_EQ_ULONG
#elif __INTPTR_TYPE__ == 0
/* Nothing to define because intptr_t is safe to print as an int. */
#else
#error "Unable to determine type definition of uintptr_t"
#endif
#undef long
#undef int
#undef signed
#pragma pop_macro("signed")
#pragma pop_macro("int")
#pragma pop_macro("long")
#endif /* __SYS_CONFIG_H__ */ #endif /* __SYS_CONFIG_H__ */