Merge pull request #9 from lha/master
[heimdal.git] / cf / have-type.m4
blob4c533a6f2a4e25a2cefc47d74cd626a5416c0340
1 dnl $Id$
2 dnl
3 dnl check for existance of a type
5 dnl AC_HAVE_TYPE(TYPE,INCLUDES)
6 AC_DEFUN([AC_HAVE_TYPE], [
7 AC_REQUIRE([AC_HEADER_STDC])
8 cv=`echo "$1" | sed 'y%./+- %__p__%'`
9 AC_MSG_CHECKING(for $1)
10 AC_CACHE_VAL([ac_cv_type_$cv],
11 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12 #include <sys/types.h>
13 #if STDC_HEADERS
14 #include <stdlib.h>
15 #include <stddef.h>
16 #endif
17 $2]],
18 [[$1 foo;]])],
19 [eval "ac_cv_type_$cv=yes"],
20 [eval "ac_cv_type_$cv=no"]))dnl
21 ac_foo=`eval echo \\$ac_cv_type_$cv`
22 AC_MSG_RESULT($ac_foo)
23 if test "$ac_foo" = yes; then
24   ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
25 if false; then
26         AC_CHECK_TYPES($1)
28   AC_DEFINE_UNQUOTED($ac_tr_hdr, 1, [Define if you have type `$1'])