[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 11/12: Added two helper macros to manipulate *FLAGS vars
From: |
gnunet |
Subject: |
[libmicrohttpd] 11/12: Added two helper macros to manipulate *FLAGS vars |
Date: |
Sun, 03 Apr 2022 19:20:04 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit a3579e7061d233d20170d3d3ac04a04a49be12a1
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun Apr 3 19:44:15 2022 +0300
Added two helper macros to manipulate *FLAGS vars
---
m4/mhd_append_flag_to_var.m4 | 46 +++++++++++++++++++++++++++++++++++++++++++
m4/mhd_prepend_flag_to_var.m4 | 46 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 92 insertions(+)
diff --git a/m4/mhd_append_flag_to_var.m4 b/m4/mhd_append_flag_to_var.m4
new file mode 100644
index 00000000..ee9e71cd
--- /dev/null
+++ b/m4/mhd_append_flag_to_var.m4
@@ -0,0 +1,46 @@
+# SYNOPSIS
+#
+# MHD_APPEND_FLAG_TO_VAR([VARIABLE-TO-EXTEND], [FLAG-TO-APPEND])
+#
+# DESCRIPTION
+#
+# This macro sets VARIABLE-TO-EXTEND to the value of VARIABLE-TO-EXTEND with
+# appended FLAG-TO-APPEND. If current value of VARIABLE-TO-EXTEND and
+# FLAG-TO-APPEND are both non-empty strings then space is added between them.
+#
+# Example usage:
+#
+# MHD_APPEND_FLAG_TO_VAR([my_CFLAGS], [-Wall])
+#
+#
+# LICENSE
+#
+# Copyright (c) 2022 Karlson2k (Evgeny Grin) <k2k@narod.ru>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 1
+
+AC_DEFUN([MHD_APPEND_FLAG_TO_VAR],[dnl
+m4_ifblank([$1],[m4_fatal([$0: First macro argument must not be empty])])dnl
+m4_bmatch([$1], [\$], [m4_fatal([$0: First macro argument must not contain
'$'])])dnl
+m4_bmatch([$1], [,], [m4_fatal([$0: First macro argument must not contain
','])])dnl
+m4_bmatch(_mhd_norm_expd([$1]), [\s],dnl
+[m4_fatal([$0: First macro argument must not contain whitespaces])])dnl
+m4_pushdef([varExtd],_mhd_norm_expd([$1]))dnl
+m4_bmatch([$2],[\$],dnl
+[dnl The second parameter is a variable value
+AS_IF([test -z "_mhd_norm_expd([$2])"],dnl
+[varExtd="${varExtd}"],dnl
+[AS_IF([test -z
"${varExtd}"],[varExtd="_mhd_norm_expd([$2])"],[varExtd="${varExtd}
_mhd_norm_expd([$2])"])])
+],dnl
+[dnl The second parameter is not a variable value
+m4_ifnblank(_mhd_norm_expd([$2]),dnl
+[AS_IF([test -z
"${varExtd}"],[varExtd="_mhd_norm_expd([$2])"],[varExtd="${varExtd}
_mhd_norm_expd([$2])"])
+],dnl
+[m4_n([varExtd="${varExtd}"])])])dnl m4_ifnblank m4_bmatch
+m4_popdef([varExtd])dnl
+])dnl AC_DEFUN
diff --git a/m4/mhd_prepend_flag_to_var.m4 b/m4/mhd_prepend_flag_to_var.m4
new file mode 100644
index 00000000..788ce3ca
--- /dev/null
+++ b/m4/mhd_prepend_flag_to_var.m4
@@ -0,0 +1,46 @@
+# SYNOPSIS
+#
+# MHD_PREPEND_FLAG_TO_VAR([VARIABLE-TO-EXTEND], [FLAG-TO-PREPEND])
+#
+# DESCRIPTION
+#
+# This macro sets VARIABLE-TO-EXTEND to the value of VARIABLE-TO-EXTEND with
+# appended FLAG-TO-APPEND. If current value of VARIABLE-TO-EXTEND and
+# FLAG-TO-APPEND are both non-empty strings then space is added between them.
+#
+# Example usage:
+#
+# MHD_PREPEND_FLAG_TO_VAR([my_CFLAGS], [-Wall])
+#
+#
+# LICENSE
+#
+# Copyright (c) 2022 Karlson2k (Evgeny Grin) <k2k@narod.ru>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 1
+
+AC_DEFUN([MHD_PREPEND_FLAG_TO_VAR],[dnl
+m4_ifblank([$1],[m4_fatal([$0: First macro argument must not be empty])])dnl
+m4_bmatch([$1], [\$], [m4_fatal([$0: First macro argument must not contain
'$'])])dnl
+m4_bmatch([$1], [,], [m4_fatal([$0: First macro argument must not contain
','])])dnl
+m4_bmatch(_mhd_norm_expd([$1]), [\s],dnl
+[m4_fatal([$0: First macro argument must not contain whitespaces])])dnl
+m4_pushdef([varExtd],_mhd_norm_expd([$1]))dnl
+m4_bmatch([$2],[\$],dnl
+[dnl The second parameter is a variable value
+AS_IF([test -z "_mhd_norm_expd([$2])"],dnl
+[varExtd="${varExtd}"],dnl
+[AS_IF([test -z
"${varExtd}"],[varExtd="_mhd_norm_expd([$2])"],[varExtd="_mhd_norm_expd([$2])
${varExtd}"])])
+],dnl
+[dnl The second parameter is not a variable value
+m4_ifnblank(_mhd_norm_expd([$2]),dnl
+[AS_IF([test -z
"${varExtd}"],[varExtd="_mhd_norm_expd([$2])"],[varExtd="_mhd_norm_expd([$2])
${varExtd}"])
+],dnl
+[m4_n([varExtd="${varExtd}"])])])dnl m4_ifnblank m4_bmatch
+m4_popdef([varExtd])dnl
+])dnl AC_DEFUN
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (c310c029 -> 15e2a3a2), gnunet, 2022/04/03
- [libmicrohttpd] 03/12: configure: modified z/OS settings, gnunet, 2022/04/03
- [libmicrohttpd] 01/12: configure: added "auto-optional" value for sanitizers parameter, gnunet, 2022/04/03
- [libmicrohttpd] 04/12: mhd_norm_expd.m4: added autoconf helper macro, gnunet, 2022/04/03
- [libmicrohttpd] 02/12: configure: moved initialisation block, gnunet, 2022/04/03
- [libmicrohttpd] 05/12: mhd_check_func.m4: fixed macro, gnunet, 2022/04/03
- [libmicrohttpd] 07/12: Added autoconf macro for checking compiler parameters/flags, gnunet, 2022/04/03
- [libmicrohttpd] 10/12: configure: added final reporting for *FLAGS, gnunet, 2022/04/03
- [libmicrohttpd] 08/12: configure: used more reliable test for -fvisibility, gnunet, 2022/04/03
- [libmicrohttpd] 09/12: Moved libtool-specific flags to Makefile, gnunet, 2022/04/03
- [libmicrohttpd] 11/12: Added two helper macros to manipulate *FLAGS vars,
gnunet <=
- [libmicrohttpd] 12/12: configure: netter format reporting for *FLAGS, gnunet, 2022/04/03
- [libmicrohttpd] 06/12: configure: added workaround for problematic formating tools, gnunet, 2022/04/03