Debian Codegraph @

m4/tree.m4

raw
1 dnl # Check for sys/tree.h and if it is recent enough by looking at a certain
2 dnl # macro. Defines HAVE_SYS_TREE_H if all conditions are met.
3
4 dnl # Copyright (c) 2008 Moritz Grimm <[email protected]>
5 dnl #
6 dnl # Permission to use, copy, modify, and distribute this software for any
7 dnl # purpose with or without fee is hereby granted, provided that the above
8 dnl # copyright notice and this permission notice appear in all copies.
9 dnl #
10 dnl # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 dnl # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 dnl # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 dnl # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 dnl # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 dnl # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 dnl # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
18
19 dnl # AX_HEADER_TREE([REQUIRED-MACRO], [ACTION-IF-FOUND],
20 dnl # [ACTION-IF-NOT-FOUND])
21
22
23 AC_DEFUN([AX_HEADER_TREE],
24 [
25 if test x"$1" = "x"; then
26 _tree_macro="RB_INIT"
27 else
28 _tree_macro=$1
29 fi
30 AC_MSG_CHECKING([for ${_tree_macro} in sys/tree.h])
31 AC_CACHE_VAL([local_cv_header_sys_tree_h],
32 [
33 AC_COMPILE_IFELSE(
34 [AC_LANG_PROGRAM(
35 [[
36 #include <sys/tree.h>
37 #if !defined(${_tree_macro})
38 # error Required tree macro missing
39 #endif /* !${_tree_macro} */
40 ]],
41 [[]])],
42 [local_cv_header_sys_tree_h=yes],
43 [local_cv_header_sys_tree_h=no])
44 ])
45 if test x"${local_cv_header_sys_tree_h}" = "xyes"; then
46 AC_MSG_RESULT([yes])
47 AC_DEFINE([HAVE_SYS_TREE_H], [1],
48 [Define to 1 if you have a sufficiently recent <sys/tree.h> header.])
49 :
50 $2
51 else
52 AC_MSG_RESULT([no])
53 :
54 $3
55 fi
56 ])