From: Brian Aker Date: Sun, 12 Feb 2012 19:29:44 +0000 (-0800) Subject: Fix for binary test. X-Git-Tag: 1.0.5~55 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=4f1a4c1176c209f773aadff7419484af6642d8b0;p=m6w6%2Flibmemcached Fix for binary test. --- diff --git a/m4/protocol_binary.m4 b/m4/protocol_binary.m4 index 5c00b556..9568f0de 100644 --- a/m4/protocol_binary.m4 +++ b/m4/protocol_binary.m4 @@ -2,34 +2,28 @@ dnl --------------------------------------------------------------------------- dnl Macro: PROTOCOL_BINARY_TEST dnl --------------------------------------------------------------------------- -AC_DEFUN([PROTOCOL_BINARY_TEST], -[ - AC_CACHE_CHECK([for supported struct padding], [ac_cv_supported_struct_padding], [ - AC_LANG_PUSH([C]) - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -I${srcdir}" - AC_TRY_COMPILE([ -#include +AC_DEFUN([PROTOCOL_BINARY_TEST], [ + AC_LANG_PUSH([C++]) + AC_CACHE_CHECK([for supported struct padding], [ac_cv_supported_struct_padding], [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [ #include #include "libmemcached/memcached/protocol_binary.h" - ], [ - protocol_binary_request_set request; - int a = 1; - switch (a) { - case sizeof(request): - case sizeof(request.bytes): + ], [ protocol_binary_request_set request; + int a = 1; + switch (a) { + case sizeof(request): + case sizeof(request.bytes): break; - default: + default: a = 2; - } - ], - [ ac_cv_supported_struct_padding=no ], - [ ac_cv_supported_struct_padding=yes ]) - CFLAGS="$save_CFLAGS" - AC_LANG_POP - ]) - AS_IF([test "x$ac_cv_supported_struct_padding" = "xno"],[ - AC_MSG_ERROR([Unsupported struct padding done by compiler.])]) -]) + } + ])], + [ ac_cv_supported_struct_padding=no ], + [ ac_cv_supported_struct_padding=yes ]) + ]) + AC_LANG_POP + AS_IF([test "x$ac_cv_supported_struct_padding" = "xno"],[ AC_MSG_ERROR([Unsupported struct padding done by compiler.])]) + ]) dnl --------------------------------------------------------------------------- dnl End Macro: PROTOCOL_BINARY_TEST