| 1 |
# Check compiler characteristics (e.g. type sizes, PRIxx macros, ...) |
| 2 |
|
| 3 |
# If types $1 and $2 are compatible, perform action $3 |
| 4 |
AC_DEFUN([AC_TYPES_COMPATIBLE], |
| 5 |
[AC_TRY_COMPILE([#include <stddef.h>], [$1 v1 = 0; $2 v2 = 0; return (&v1 - &v2)], $3)]) |
| 6 |
|
| 7 |
define(AC_PRIUS_COMMENT, [printf format code for printing a size_t and ssize_t]) |
| 8 |
|
| 9 |
AC_DEFUN([AC_COMPILER_CHARACTERISTICS], |
| 10 |
[AC_CACHE_CHECK(AC_PRIUS_COMMENT, ac_cv_formatting_prius_prefix, |
| 11 |
[AC_TYPES_COMPATIBLE(unsigned int, size_t, |
| 12 |
ac_cv_formatting_prius_prefix=; ac_cv_prius_defined=1) |
| 13 |
AC_TYPES_COMPATIBLE(unsigned long, size_t, |
| 14 |
ac_cv_formatting_prius_prefix=l; ac_cv_prius_defined=1) |
| 15 |
AC_TYPES_COMPATIBLE(unsigned long long, size_t, |
| 16 |
ac_cv_formatting_prius_prefix=ll; ac_cv_prius_defined=1 |
| 17 |
)]) |
| 18 |
if test -z "$ac_cv_prius_defined"; then |
| 19 |
ac_cv_formatting_prius_prefix=z; |
| 20 |
fi |
| 21 |
AC_DEFINE_UNQUOTED(PRIuS, "${ac_cv_formatting_prius_prefix}u", AC_PRIUS_COMMENT) |
| 22 |
AC_DEFINE_UNQUOTED(PRIxS, "${ac_cv_formatting_prius_prefix}x", AC_PRIUS_COMMENT) |
| 23 |
AC_DEFINE_UNQUOTED(PRIdS, "${ac_cv_formatting_prius_prefix}d", AC_PRIUS_COMMENT) |
| 24 |
]) |