Updating for 1.0.2 release
[awesomized/libmemcached] / m4 / protocol_binary.m4
1 dnl ---------------------------------------------------------------------------
2 dnl Macro: PROTOCOL_BINARY_TEST
3 dnl ---------------------------------------------------------------------------
4
5 AC_DEFUN([PROTOCOL_BINARY_TEST],
6 [
7 AC_CACHE_CHECK([for supported struct padding], [ac_cv_supported_struct_padding], [
8 AC_LANG_PUSH([C])
9 save_CFLAGS="$CFLAGS"
10 CFLAGS="$CFLAGS -I${srcdir}"
11 AC_TRY_COMPILE([
12 #include <inttypes.h>
13 #include "libmemcached/memcached/protocol_binary.h"
14 ], [
15 protocol_binary_request_set request;
16 int a = 1;
17 switch (a) {
18 case sizeof(request):
19 case sizeof(request.bytes):
20 break;
21 default:
22 a = 2;
23 }
24 ],
25 [ ac_cv_supported_struct_padding=no ],
26 [ ac_cv_supported_struct_padding=yes ])
27 CFLAGS="$save_CFLAGS"
28 AC_LANG_POP
29 ])
30 AS_IF([test "x$ac_cv_supported_struct_padding" = "xno"],[
31 AC_MSG_ERROR([Unsupported struct padding done by compiler.])])
32 ])
33
34 dnl ---------------------------------------------------------------------------
35 dnl End Macro: PROTOCOL_BINARY_TEST
36 dnl ---------------------------------------------------------------------------