4102 |
22 Sep 21 |
peter |
## $Id$ |
4102 |
22 Sep 21 |
peter |
2 |
# |
4102 |
22 Sep 21 |
peter |
# Copyright (C) 2021 Peter Johansson |
4102 |
22 Sep 21 |
peter |
4 |
# |
4102 |
22 Sep 21 |
peter |
# This file is part of the yat library, https://dev.thep.lu.se/yat |
4102 |
22 Sep 21 |
peter |
6 |
# |
4102 |
22 Sep 21 |
peter |
# The yat library is free software; you can redistribute it and/or |
4102 |
22 Sep 21 |
peter |
# modify it under the terms of the GNU General Public License as |
4102 |
22 Sep 21 |
peter |
# published by the Free Software Foundation; either version 3 of the |
4102 |
22 Sep 21 |
peter |
# License, or (at your option) any later version. |
4102 |
22 Sep 21 |
peter |
11 |
# |
4102 |
22 Sep 21 |
peter |
# The yat library is distributed in the hope that it will be useful, |
4102 |
22 Sep 21 |
peter |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4102 |
22 Sep 21 |
peter |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4102 |
22 Sep 21 |
peter |
# General Public License for more details. |
4102 |
22 Sep 21 |
peter |
16 |
# |
4102 |
22 Sep 21 |
peter |
# You should have received a copy of the GNU General Public License |
4102 |
22 Sep 21 |
peter |
# along with yat. If not, see <https://www.gnu.org/licenses/>. |
4102 |
22 Sep 21 |
peter |
19 |
# |
4102 |
22 Sep 21 |
peter |
20 |
|
4102 |
22 Sep 21 |
peter |
21 |
# |
4102 |
22 Sep 21 |
peter |
# serial 1 (yat 0.20) |
4102 |
22 Sep 21 |
peter |
23 |
# |
4102 |
22 Sep 21 |
peter |
24 |
|
4102 |
22 Sep 21 |
peter |
# YAT_CHECK_FUNC(function, [prologue], [body], [action-if-found], |
4102 |
22 Sep 21 |
peter |
# [action-if-not-found]) |
4102 |
22 Sep 21 |
peter |
27 |
# ========================================================== |
4102 |
22 Sep 21 |
peter |
# Wrapper around AC_CACHE_CHECK and AC_COMPILE_IFELSE. Try to compile |
4102 |
22 Sep 21 |
peter |
# program with prologue 'prologue' and body 'body'. If successful, run |
4102 |
22 Sep 21 |
peter |
# shell commands action-if-found, otherwise |
4102 |
22 Sep 21 |
peter |
# action-if-not-found. Result is cached in variable |
4102 |
22 Sep 21 |
peter |
# $yat_cv_func_<function> |
4102 |
22 Sep 21 |
peter |
33 |
AC_DEFUN([YAT_CHECK_FUNC], |
4102 |
22 Sep 21 |
peter |
34 |
[ |
4102 |
22 Sep 21 |
peter |
35 |
AS_VAR_PUSHDEF([yat_CACHE], [AS_TR_SH([yat_cv_func_$1])])dnl |
4102 |
22 Sep 21 |
peter |
36 |
AC_CACHE_CHECK([if $CXX supports $1], [yat_CACHE], [ |
4102 |
22 Sep 21 |
peter |
37 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$2], [$3])], |
4102 |
22 Sep 21 |
peter |
38 |
[yat_CACHE=yes], |
4102 |
22 Sep 21 |
peter |
39 |
[yat_CACHE=no]) |
4102 |
22 Sep 21 |
peter |
40 |
]) |
4102 |
22 Sep 21 |
peter |
41 |
AS_VAR_IF([yat_CACHE], [yes], [$4], [$5]) |
4102 |
22 Sep 21 |
peter |
42 |
AS_VAR_POPDEF([yat_CACHE])dnl |
4102 |
22 Sep 21 |
peter |
43 |
]) |