Disallow zero-length entity
[claws.git] / m4 / check-type.m4
1 dnl CLAWS_CHECK_TYPE(TYPE, DEFAULT [, INCLUDES, COMMENT])
2 dnl
3 dnl Like AC_CHECK_TYPE, but in addition to `sys/types.h', `stdlib.h' and
4 dnl `stddef.h' checks files included by INCLUDES, which should be a
5 dnl series of #include statements.  If TYPE is not defined, define it
6 dnl to DEFAULT.
7 dnl
8 dnl Copyright (C) 2003 Free Software Foundation, Inc.
9 dnl This file is free software; the Free Software Foundation
10 dnl gives unlimited permission to copy and/or distribute it,
11 dnl with or without modifications, as long as this notice is preserved.
12 AC_DEFUN([CLAWS_CHECK_TYPE],
13 [AC_REQUIRE([AC_HEADER_STDC])dnl
14 AC_MSG_CHECKING(for $1)
15 AC_CACHE_VAL(claws_cv_type_$1,
16 [AC_TRY_COMPILE([
17 #include <sys/types.h>
18 #if STDC_HEADERS
19 #include <stdlib.h>
20 #include <stddef.h>
21 #endif
22 $3
23 ], [
24 #undef $1
25 int a = sizeof($1);
26 ], claws_cv_type_$1=yes, claws_cv_type_$1=no)])dnl
27 AC_MSG_RESULT($claws_cv_type_$1)
28 if test $claws_cv_type_$1 = no; then
29   AC_DEFINE($1, $2, $4)
30 fi
31 ])