diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2019-03-19 15:12:03 +0000 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2019-03-19 15:12:03 +0000 |
commit | a69bca5908f1cbc65528eb5fe6811e1ebb6fd7f2 (patch) | |
tree | e8e40fc31b11c7774ca44f437aea08dd19ece8b2 /build | |
parent | 32fe11efec3444c7f91414336d053059b26f8271 (diff) | |
download | apr-a69bca5908f1cbc65528eb5fe6811e1ebb6fd7f2.tar.gz |
Deprecate APR_CHECK_TYPES_COMPATIBLE for new APR_CHECK_TYPES_FMT_COMPATIBLE
macro, testing both type compatibility in a more portable way, and verifying
the printf format token for these types.
Order of preference of long over int is preserved.
(Defers off_t fixes for the subsequent patch.)
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1855839 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'build')
-rw-r--r-- | build/apr_common.m4 | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/build/apr_common.m4 b/build/apr_common.m4 index 6b5c0f033..9d4e686e7 100644 --- a/build/apr_common.m4 +++ b/build/apr_common.m4 @@ -511,9 +511,9 @@ AC_DEFUN([APR_TRY_COMPILE_NO_WARNING], [int main(int argc, const char *const *argv) {] [[$2]] [ return 0; }] - )], - [$3], [$4]) - CFLAGS=$apr_save_CFLAGS + )], [CFLAGS=$apr_save_CFLAGS +$3], [CFLAGS=$apr_save_CFLAGS +$4]) ]) dnl @@ -975,11 +975,35 @@ AC_SUBST(MKDEP) ]) dnl +dnl APR_CHECK_TYPES_COMPATIBLE(TYPE-1, TYPE-2, FMT-TAG, +dnl [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +dnl +dnl Try to determine whether two types are the same and accept the given +dnl printf formatter (bare token, e.g. literal d, ld, etc). +dnl +AC_DEFUN([APR_CHECK_TYPES_FMT_COMPATIBLE], [ +define([apr_cvname], apr_cv_typematch_[]translit([$1], [ ], [_])_[]translit([$2], [ ], [_])_[][$3]) +AC_CACHE_CHECK([whether $1 and $2 use fmt %$3], apr_cvname, [ +APR_TRY_COMPILE_NO_WARNING([#include <sys/types.h> +#include <stdio.h>], [ + $1 chk1, *ptr1; + $2 chk2, *ptr2 = &chk1; + ptr1 = &chk2; + *ptr1 = *ptr2 = 0; + printf("%$3 %$3", chk1, chk2); +], [apr_cvname=yes +$4], [apr_cvname=no +$5])]) +]) + +dnl dnl APR_CHECK_TYPES_COMPATIBLE(TYPE-1, TYPE-2, [ACTION-IF-TRUE]) dnl dnl Try to determine whether two types are the same. Only works dnl for gcc and icc. dnl +dnl @deprecated @see APR_CHECK_TYPES_FMT_COMPATIBLE +dnl AC_DEFUN([APR_CHECK_TYPES_COMPATIBLE], [ define([apr_cvname], apr_cv_typematch_[]translit([$1], [ ], [_])_[]translit([$2], [ ], [_])) AC_CACHE_CHECK([whether $1 and $2 are the same], apr_cvname, [ |