annotate config/ax_check_define.m4 @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 # ===========================================================================
kono
parents:
diff changeset
2 # http://www.gnu.org/software/autoconf-archive/ax_check_define.html
kono
parents:
diff changeset
3 # ===========================================================================
kono
parents:
diff changeset
4 #
kono
parents:
diff changeset
5 # SYNOPSIS
kono
parents:
diff changeset
6 #
kono
parents:
diff changeset
7 # AC_CHECK_DEFINE([symbol], [ACTION-IF-FOUND], [ACTION-IF-NOT])
kono
parents:
diff changeset
8 # AX_CHECK_DEFINE([includes],[symbol], [ACTION-IF-FOUND], [ACTION-IF-NOT])
kono
parents:
diff changeset
9 #
kono
parents:
diff changeset
10 # DESCRIPTION
kono
parents:
diff changeset
11 #
kono
parents:
diff changeset
12 # Complements AC_CHECK_FUNC but it does not check for a function but for a
kono
parents:
diff changeset
13 # define to exist. Consider a usage like:
kono
parents:
diff changeset
14 #
kono
parents:
diff changeset
15 # AC_CHECK_DEFINE(__STRICT_ANSI__, CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500")
kono
parents:
diff changeset
16 #
kono
parents:
diff changeset
17 # LICENSE
kono
parents:
diff changeset
18 #
kono
parents:
diff changeset
19 # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
kono
parents:
diff changeset
20 #
kono
parents:
diff changeset
21 # This program is free software; you can redistribute it and/or modify it
kono
parents:
diff changeset
22 # under the terms of the GNU General Public License as published by the
kono
parents:
diff changeset
23 # Free Software Foundation; either version 3 of the License, or (at your
kono
parents:
diff changeset
24 # option) any later version.
kono
parents:
diff changeset
25 #
kono
parents:
diff changeset
26 # This program is distributed in the hope that it will be useful, but
kono
parents:
diff changeset
27 # WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
28 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
kono
parents:
diff changeset
29 # Public License for more details.
kono
parents:
diff changeset
30 #
kono
parents:
diff changeset
31 # You should have received a copy of the GNU General Public License along
kono
parents:
diff changeset
32 # with this program. If not, see <http://www.gnu.org/licenses/>.
kono
parents:
diff changeset
33 #
kono
parents:
diff changeset
34 # As a special exception, the respective Autoconf Macro's copyright owner
kono
parents:
diff changeset
35 # gives unlimited permission to copy, distribute and modify the configure
kono
parents:
diff changeset
36 # scripts that are the output of Autoconf when processing the Macro. You
kono
parents:
diff changeset
37 # need not follow the terms of the GNU General Public License when using
kono
parents:
diff changeset
38 # or distributing such scripts, even though portions of the text of the
kono
parents:
diff changeset
39 # Macro appear in them. The GNU General Public License (GPL) does govern
kono
parents:
diff changeset
40 # all other use of the material that constitutes the Autoconf Macro.
kono
parents:
diff changeset
41 #
kono
parents:
diff changeset
42 # This special exception to the GPL applies to versions of the Autoconf
kono
parents:
diff changeset
43 # Macro released by the Autoconf Archive. When you make and distribute a
kono
parents:
diff changeset
44 # modified version of the Autoconf Macro, you may extend this special
kono
parents:
diff changeset
45 # exception to the GPL to apply to your modified version as well.
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 #serial 8
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 AU_ALIAS([AC_CHECK_DEFINED], [AC_CHECK_DEFINE])
kono
parents:
diff changeset
50 AC_DEFUN([AC_CHECK_DEFINE],[
kono
parents:
diff changeset
51 AS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$1])dnl
kono
parents:
diff changeset
52 AC_CACHE_CHECK([for $1 defined], ac_var,
kono
parents:
diff changeset
53 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
kono
parents:
diff changeset
54 #ifdef $1
kono
parents:
diff changeset
55 int ok;
kono
parents:
diff changeset
56 #else
kono
parents:
diff changeset
57 choke me
kono
parents:
diff changeset
58 #endif
kono
parents:
diff changeset
59 ]])],[AS_VAR_SET(ac_var, yes)],[AS_VAR_SET(ac_var, no)]))
kono
parents:
diff changeset
60 AS_IF([test AS_VAR_GET(ac_var) != "no"], [$2], [$3])dnl
kono
parents:
diff changeset
61 AS_VAR_POPDEF([ac_var])dnl
kono
parents:
diff changeset
62 ])
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 AU_ALIAS([AX_CHECK_DEFINED], [AX_CHECK_DEFINE])
kono
parents:
diff changeset
65 AC_DEFUN([AX_CHECK_DEFINE],[
kono
parents:
diff changeset
66 AS_VAR_PUSHDEF([ac_var],[ac_cv_defined_$2_$1])dnl
kono
parents:
diff changeset
67 AC_CACHE_CHECK([for $2 defined in $1], ac_var,
kono
parents:
diff changeset
68 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <$1>]], [[
kono
parents:
diff changeset
69 #ifdef $2
kono
parents:
diff changeset
70 int ok;
kono
parents:
diff changeset
71 #else
kono
parents:
diff changeset
72 choke me
kono
parents:
diff changeset
73 #endif
kono
parents:
diff changeset
74 ]])],[AS_VAR_SET(ac_var, yes)],[AS_VAR_SET(ac_var, no)]))
kono
parents:
diff changeset
75 AS_IF([test AS_VAR_GET(ac_var) != "no"], [$3], [$4])dnl
kono
parents:
diff changeset
76 AS_VAR_POPDEF([ac_var])dnl
kono
parents:
diff changeset
77 ])
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 AC_DEFUN([AX_CHECK_FUNC],
kono
parents:
diff changeset
80 [AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$2])dnl
kono
parents:
diff changeset
81 AC_CACHE_CHECK([for $2], ac_var,
kono
parents:
diff changeset
82 dnl AC_LANG_FUNC_LINK_TRY
kono
parents:
diff changeset
83 [AC_LINK_IFELSE([AC_LANG_PROGRAM([$1
kono
parents:
diff changeset
84 #undef $2
kono
parents:
diff changeset
85 char $2 ();],[
kono
parents:
diff changeset
86 char (*f) () = $2;
kono
parents:
diff changeset
87 return f != $2; ])],
kono
parents:
diff changeset
88 [AS_VAR_SET(ac_var, yes)],
kono
parents:
diff changeset
89 [AS_VAR_SET(ac_var, no)])])
kono
parents:
diff changeset
90 AS_IF([test AS_VAR_GET(ac_var) = yes], [$3], [$4])dnl
kono
parents:
diff changeset
91 AS_VAR_POPDEF([ac_var])dnl
kono
parents:
diff changeset
92 ])# AC_CHECK_FUNC