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 |
25 |
|
4102 |
22 Sep 21 |
peter |
# YAT_FUNC_STRING_CONTAINS([action-if-found], [action-if-not-found] |
4102 |
22 Sep 21 |
peter |
27 |
# ================================================================= |
4102 |
22 Sep 21 |
peter |
# Test if CXX supports std::string::contains. If not successful issue |
4102 |
22 Sep 21 |
peter |
# action-if-not-found. If successful issue action-if-found, or if |
4102 |
22 Sep 21 |
peter |
# empty issue AC_DEFINE([YAT_HAVE_FUNC_STRING_CONTAINS]) |
4102 |
22 Sep 21 |
peter |
31 |
AC_DEFUN([YAT_FUNC_STRING_CONTAINS], |
4102 |
22 Sep 21 |
peter |
32 |
[ |
4102 |
22 Sep 21 |
peter |
33 |
YAT_FUNC_STRING([contains], [$1], [$2]) |
4102 |
22 Sep 21 |
peter |
34 |
]) |
4102 |
22 Sep 21 |
peter |
35 |
|
4102 |
22 Sep 21 |
peter |
36 |
|
4102 |
22 Sep 21 |
peter |
# YAT_FUNC_STRING_ENDS_WITH([action-if-found], [action-if-not-found] |
4102 |
22 Sep 21 |
peter |
38 |
# ================================================================= |
4102 |
22 Sep 21 |
peter |
# Test if CXX supports std::string::ends_with. If not successful issue |
4102 |
22 Sep 21 |
peter |
# action-if-not-found. If successful issue action-if-found, or if |
4102 |
22 Sep 21 |
peter |
# empty issue AC_DEFINE([YAT_HAVE_FUNC_STRING_ENDS_WITH]) |
4102 |
22 Sep 21 |
peter |
42 |
AC_DEFUN([YAT_FUNC_STRING_ENDS_WITH], |
4102 |
22 Sep 21 |
peter |
43 |
[ |
4102 |
22 Sep 21 |
peter |
44 |
YAT_FUNC_STRING([ends_with], [$1], [$2]) |
4102 |
22 Sep 21 |
peter |
45 |
]) |
4102 |
22 Sep 21 |
peter |
46 |
|
4102 |
22 Sep 21 |
peter |
47 |
|
4102 |
22 Sep 21 |
peter |
# YAT_FUNC_STRING_STARTS_WITH([action-if-found], [action-if-not-found] |
4102 |
22 Sep 21 |
peter |
49 |
# ================================================================= |
4102 |
22 Sep 21 |
peter |
# Test if CXX supports std::string::starts_with. If not successful |
4102 |
22 Sep 21 |
peter |
# issue action-if-not-found. If successful issue action-if-found, or |
4102 |
22 Sep 21 |
peter |
# if empty issue AC_DEFINE([YAT_HAVE_FUNC_STRING_STARTS_WITH]) |
4102 |
22 Sep 21 |
peter |
53 |
AC_DEFUN([YAT_FUNC_STRING_STARTS_WITH], |
4102 |
22 Sep 21 |
peter |
54 |
[ |
4102 |
22 Sep 21 |
peter |
55 |
YAT_FUNC_STRING([starts_with], [$1], [$2]) |
4102 |
22 Sep 21 |
peter |
56 |
]) |
4102 |
22 Sep 21 |
peter |
57 |
|
4102 |
22 Sep 21 |
peter |
58 |
|
4102 |
22 Sep 21 |
peter |
# YAT_FUNC_STRING(funcion, [action-if-found], [action-if-not-found]) |
4102 |
22 Sep 21 |
peter |
60 |
# ================================================================= |
4102 |
22 Sep 21 |
peter |
# Test if CXX supports std::string::func-name. The test includes a |
4102 |
22 Sep 21 |
peter |
# test for std::string::<function>(std::string), |
4102 |
22 Sep 21 |
peter |
# std::string::<function>(char), and std::string::<function>(const |
4102 |
22 Sep 21 |
peter |
# char*) If not successful issue action-if-not-found. If successful |
4102 |
22 Sep 21 |
peter |
# issue action-if-found, or if empty issue |
4102 |
22 Sep 21 |
peter |
# AC_DEFINE([YAT_HAVE_FUNC_STRING_<function>]) |
4102 |
22 Sep 21 |
peter |
67 |
AC_DEFUN([YAT_FUNC_STRING], |
4102 |
22 Sep 21 |
peter |
68 |
[ |
4102 |
22 Sep 21 |
peter |
69 |
YAT_CHECK_FUNC([string::$1], [ |
4102 |
22 Sep 21 |
peter |
70 |
@%:@include <string> |
4102 |
22 Sep 21 |
peter |
71 |
], [ |
4102 |
22 Sep 21 |
peter |
72 |
std::string str("Hello world!"); |
4102 |
22 Sep 21 |
peter |
73 |
str.$1("world"); |
4102 |
22 Sep 21 |
peter |
74 |
str.$1('H'); |
4102 |
22 Sep 21 |
peter |
75 |
str.$1(str); |
4102 |
22 Sep 21 |
peter |
76 |
], [m4_default([$2], |
4102 |
22 Sep 21 |
peter |
77 |
[AC_DEFINE(AS_TR_CPP([YAT_HAVE_FUNC_STRING_$1]), [1], |
4102 |
22 Sep 21 |
peter |
78 |
[Define if you have function std::string::$1]) |
4102 |
22 Sep 21 |
peter |
79 |
]) |
4102 |
22 Sep 21 |
peter |
80 |
], [$3] |
4102 |
22 Sep 21 |
peter |
81 |
) |
4102 |
22 Sep 21 |
peter |
82 |
]) |