[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 10/21: mhd_check_func.m4: added check for function decla
From: |
gnunet |
Subject: |
[libmicrohttpd] 10/21: mhd_check_func.m4: added check for function declaration |
Date: |
Tue, 14 Mar 2023 19:36:55 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit da73f7abf93c92ad49ef27af333846de66598458
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Mar 6 18:33:23 2023 +0300
mhd_check_func.m4: added check for function declaration
---
m4/mhd_check_func.m4 | 96 ++++++++++++++++++++++++++++++----------------------
1 file changed, 55 insertions(+), 41 deletions(-)
diff --git a/m4/mhd_check_func.m4 b/m4/mhd_check_func.m4
index 502a9b15..77e6baca 100644
--- a/m4/mhd_check_func.m4
+++ b/m4/mhd_check_func.m4
@@ -9,13 +9,15 @@
#
# This macro checks for presence of specific function by including
# specified headers and compiling and linking CHECK_CODE.
-# This check both declaration and presence in library.
+# This checks both declaration and presence in library.
+# If function is available then macro HAVE_function_name (the name
+# of the function convetedd to all uppercase characters) is defined
+# automatically.
# Unlike AC_CHECK_FUNCS macro, this macro do not produce false
# negative result if function is declared with specific calling
# conventions like __stdcall' or attribute like
-# __attribute__((__dllimport__)) and linker failed to build test
-# program if library contains function with calling conventions
-# different from declared.
+# __attribute__((__dllimport__)) and linker failing to build test
+# program due to the different calling conventions.
# By using definition from provided headers, this macro ensures that
# correct calling convention is used for detection.
#
@@ -26,13 +28,13 @@
# [const void *ptr = memmem("aa", 2, "a", 1); (void)ptr;],
# [var_use_memmem='yes'], [var_use_memmem='no'])
#
-# Defined cache variable used in check so if any test will not work
+# The cache variable used in check so if any test will not work
# correctly on some platform, user may simply fix it by giving cache
# variable in configure parameters, for example:
#
# ./configure mhd_cv_func_memmem_have=no
#
-# This simplify building from source on exotic platforms as patching
+# This simplifies building from source on exotic platforms as patching
# of configure.ac is not required to change results of tests.
#
# LICENSE
@@ -44,47 +46,59 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 4
+#serial 5
AC_DEFUN([MHD_CHECK_FUNC],[dnl
- AC_PREREQ([2.64])dnl for AS_VAR_IF, m4_ifblank, m4_ifnblank
- m4_ifblank(m4_translit([$1],[()],[ ]), [m4_fatal([First macro argument must
not be empty])])dnl
- m4_ifblank([$3], [m4_fatal([Third macro argument must not be empty])])dnl
- m4_bmatch(m4_normalize([$1]), [\s],dnl
- [m4_fatal([First macro argument must not contain whitespaces])])dnl
- m4_if(m4_index([$3], m4_normalize(m4_translit([$1],[()],[ ]))), [-1], dnl
- [m4_fatal([CHECK_CODE parameter (third macro argument) does not
contain ']m4_normalize([$1])[' token])])dnl
- AS_VAR_PUSHDEF([cv_Var],
[mhd_cv_func_]m4_bpatsubst(_mhd_norm_expd(m4_translit([$1],[()],[
])),[[^a-zA-Z0-9]],[_]))dnl
- dnl
- AC_CACHE_CHECK([for function $1], cv_Var,
- [dnl
- m4_ifnblank([$6],[dnl
- mhd_check_func_SAVE_LIBS="$LIBS"
- LIBS="$LIBS _mhd_norm_expd([$6])"
- ])dnl
- AC_LINK_IFELSE(
- [AC_LANG_SOURCE([
+AC_PREREQ([2.64])dnl for AS_VAR_IF, m4_ifblank, m4_ifnblank
+m4_newline([[# Expansion of $0 macro starts here]])
+AC_LANG_ASSERT([C])dnl
+m4_ifblank(m4_translit([$1],[()],[ ]), [m4_fatal([First macro argument must
not be empty])])dnl
+m4_ifblank([$3], [m4_fatal([Third macro argument must not be empty])])dnl
+m4_bmatch(m4_normalize([$1]), [\s],dnl
+ [m4_fatal([First macro argument must not contain whitespaces])])dnl
+m4_if(m4_index([$3], m4_normalize(m4_translit([$1],[()],[ ]))), [-1], dnl
+ [m4_fatal([CHECK_CODE parameter (third macro argument) does not contain
']m4_normalize([$1])[' token])])dnl
+AS_VAR_PUSHDEF([decl_cv_Var],[ac_cv_have_decl_]m4_bpatsubst(_mhd_norm_expd(m4_translit([$1],[()],[
])),[[^a-zA-Z0-9]],[_]))dnl
+AS_VAR_PUSHDEF([cv_Var],[mhd_cv_func_]m4_bpatsubst(_mhd_norm_expd(m4_translit([$1],[()],[
])),[[^a-zA-Z0-9]],[_]))dnl
+AS_VAR_SET_IF([cv_Var],[],[AC_CHECK_DECL(_mhd_norm_expd([$1]),[],[],[$2])])
+AC_CACHE_CHECK([for function $1], [cv_Var],dnl
+ [dnl
+ AS_VAR_IF([decl_cv_Var],["yes"],dnl
+ [dnl
+ m4_ifnblank([$6],[dnl
+ mhd_check_func_SAVE_LIBS="$LIBS"
+ LIBS="_mhd_norm_expd([$6]) $LIBS"
+ ])dnl
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([
m4_default_nblank([$2],[AC_INCLUDES_DEFAULT])
-int main(void)
+[int main(void)
{
- $3
+ ]$3[
return 0;
}
- ])
- ],
- [AS_VAR_SET([cv_Var],["yes"])], [AS_VAR_SET([cv_Var],["no"])] )
- m4_ifnblank([$6],[dnl
- LIBS="${mhd_check_func_SAVE_LIBS}"
- AS_UNSET([mhd_check_func_SAVE_LIBS])
- ])dnl
- ])
- AS_VAR_IF([cv_Var], ["yes"],
-
[AC_DEFINE([[HAVE_]]m4_bpatsubst(m4_toupper(_mhd_norm_expd(m4_translit([$1],[()],[
]))),[[^A-Z0-9]],[_]),
- [1], [Define to 1 if you have the
']_mhd_norm_expd(m4_translit([$1],[()],[ ]))[' function.])
- m4_n([$4])dnl
- ], [$5])
- AS_VAR_POPDEF([cv_Var])dnl
-])
+ ]])
+ ],
+ [AS_VAR_SET([cv_Var],["yes"])],
+ [AS_VAR_SET([cv_Var],["no"])]dnl
+ )
+ m4_ifnblank([$6],[dnl
+ LIBS="${mhd_check_func_SAVE_LIBS}"
+ AS_UNSET([mhd_check_func_SAVE_LIBS])
+ ])dnl
+ ],[AS_VAR_SET([cv_Var],["no"])]dnl
+ )dnl
+ ]dnl
+)
+AS_VAR_IF([cv_Var], ["yes"],
+
[AC_DEFINE([[HAVE_]]m4_bpatsubst(m4_toupper(_mhd_norm_expd(m4_translit([$1],[()],[
]))),[[^A-Z0-9]],[_]),
+ [1], [Define to 1 if you have the
']_mhd_norm_expd(m4_translit([$1],[()],[ ]))[' function.])
+ m4_n([$4])dnl
+ ],[$5])
+AS_VAR_POPDEF([cv_Var])dnl
+AS_VAR_POPDEF([decl_cv_Var])dnl
+m4_newline([[# Expansion of $0 macro ends here]])
+])dnl AC_DEFUN MHD_CHECK_FUNC
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (12f637aa -> dcd8ea98), gnunet, 2023/03/14
- [libmicrohttpd] 01/21: daemon.c: fixed heap manipulations with mutex held, gnunet, 2023/03/14
- [libmicrohttpd] 03/21: configure: reordered checks for compiler flags, gnunet, 2023/03/14
- [libmicrohttpd] 06/21: Makefile: fixed build with 'make' without nested vars support, gnunet, 2023/03/14
- [libmicrohttpd] 08/21: mhd_shutdown_socket_trigger.m4: fixed compiler warning, gnunet, 2023/03/14
- [libmicrohttpd] 05/21: configure: fixed checks for tsearch() and related, gnunet, 2023/03/14
- [libmicrohttpd] 07/21: mhd_check_func.m4: updated, gnunet, 2023/03/14
- [libmicrohttpd] 09/21: configure: fixed some compiler warnings for checks, gnunet, 2023/03/14
- [libmicrohttpd] 10/21: mhd_check_func.m4: added check for function declaration,
gnunet <=
- [libmicrohttpd] 11/21: libcurl.m4: updated to the latest version, gnunet, 2023/03/14
- [libmicrohttpd] 13/21: mhd_find_lib.m4: added new autoconf macro, gnunet, 2023/03/14
- [libmicrohttpd] 12/21: libcurl.m4: patched to fix compiler warning, gnunet, 2023/03/14
- [libmicrohttpd] 18/21: configure: cosmetics, gnunet, 2023/03/14
- [libmicrohttpd] 14/21: configure: fixed checking for system libs, fixed .pc file, gnunet, 2023/03/14
- [libmicrohttpd] 15/21: configure: removed check for unused lib and function, gnunet, 2023/03/14
- [libmicrohttpd] 02/21: tsearch.{h,c}: updated to the latest fixed version, gnunet, 2023/03/14
- [libmicrohttpd] 04/21: mhd_check_link_run.m4: fixed typo in comment, gnunet, 2023/03/14
- [libmicrohttpd] 16/21: configure: fixed more compiler warnings in log, gnunet, 2023/03/14
- [libmicrohttpd] 17/21: configure: fixed potential compiler warnings, added usage of cache vars, gnunet, 2023/03/14