diff options
Diffstat (limited to 'build/apr_common.m4')
-rw-r--r-- | build/apr_common.m4 | 95 |
1 files changed, 46 insertions, 49 deletions
diff --git a/build/apr_common.m4 b/build/apr_common.m4 index 6b5c0f0..ac2312c 100644 --- a/build/apr_common.m4 +++ b/build/apr_common.m4 @@ -452,43 +452,6 @@ fi dnl -dnl APR_CHECK_SIZEOF_EXTENDED(INCLUDES, TYPE [, CROSS_SIZE]) -dnl -dnl A variant of AC_CHECK_SIZEOF which allows the checking of -dnl sizes of non-builtin types -dnl -AC_DEFUN([APR_CHECK_SIZEOF_EXTENDED], -[changequote(<<, >>)dnl -dnl The name to #define. -define(<<AC_TYPE_NAME>>, translit(sizeof_$2, [a-z *], [A-Z_P]))dnl -dnl The cache variable name. -define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$2, [ *], [_p]))dnl -changequote([, ])dnl -AC_MSG_CHECKING(size of $2) -AC_CACHE_VAL(AC_CV_NAME, -[AC_TRY_RUN([#include <stdio.h> -$1 -#ifdef WIN32 -#define binmode "b" -#else -#define binmode -#endif -main() -{ - FILE *f=fopen("conftestval", "w" binmode); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof($2)); - exit(0); -}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$3],,, -AC_CV_NAME=$3))])dnl -AC_MSG_RESULT($AC_CV_NAME) -AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The size of ]$2) -undefine([AC_TYPE_NAME])dnl -undefine([AC_CV_NAME])dnl -]) - - -dnl dnl APR_TRY_COMPILE_NO_WARNING(INCLUDES, FUNCTION-BODY, dnl [ACTIONS-IF-NO-WARNINGS], [ACTIONS-IF-WARNINGS]) dnl @@ -505,15 +468,18 @@ AC_DEFUN([APR_TRY_COMPILE_NO_WARNING], fi AC_COMPILE_IFELSE( [AC_LANG_SOURCE( - [#include "confdefs.h" + [ +#ifndef PACKAGE_NAME +#include "confdefs.h" +#endif ] [[$1]] [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 @@ -526,12 +492,14 @@ dnl string. dnl dnl AC_DEFUN([APR_CHECK_STRERROR_R_RC], [ -AC_MSG_CHECKING(for type of return code from strerror_r) -AC_TRY_RUN([ +AC_CACHE_CHECK([whether return code from strerror_r has type int], +[ac_cv_strerror_r_rc_int], +[AC_TRY_RUN([ #include <errno.h> #include <string.h> #include <stdio.h> -main() +#include <stdlib.h> +int main(void) { char buf[1024]; if (strerror_r(ERANGE, buf, sizeof buf) < 1) { @@ -543,14 +511,10 @@ main() }], [ ac_cv_strerror_r_rc_int=yes ], [ ac_cv_strerror_r_rc_int=no ], [ - ac_cv_strerror_r_rc_int=no ] ) + ac_cv_strerror_r_rc_int=no ] ) ] ) if test "x$ac_cv_strerror_r_rc_int" = xyes; then AC_DEFINE(STRERROR_R_RC_INT, 1, [Define if strerror returns int]) - msg="int" -else - msg="pointer" fi -AC_MSG_RESULT([$msg]) ] ) dnl @@ -975,11 +939,44 @@ AC_SUBST(MKDEP) ]) dnl +dnl APR_CHECK_TYPES_FMT_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> +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif +], [ + $1 chk1, *ptr1; + $2 chk2, *ptr2 = &chk1; + ptr1 = &chk2; + *ptr1 = *ptr2 = 0; + printf("%$3 %$3", chk1, chk2); +], [apr_cvname=yes], [apr_cvname=no])]) +if test "$apr_cvname" = "yes"; then + : + $4 +else + : + $5 +fi +]) + +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, [ |