[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 21/21: mhd_check_func_gettimeofday.m4: added new autocon
From: |
gnunet |
Subject: |
[libmicrohttpd] 21/21: mhd_check_func_gettimeofday.m4: added new autoconf macro |
Date: |
Tue, 14 Mar 2023 19:37:06 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit dcd8ea98694d3087d1af9f7a11570b73c7d1c249
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Tue Mar 14 17:36:40 2023 +0300
mhd_check_func_gettimeofday.m4: added new autoconf macro
---
configure.ac | 16 +-----------
m4/mhd_check_func_gettimeofday.m4 | 53 +++++++++++++++++++++++++++++++++++++++
m4/mhd_shutdown_socket_trigger.m4 | 19 ++------------
3 files changed, 56 insertions(+), 32 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6037e061..9396240e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2578,21 +2578,7 @@ choke me now
]
)
-MHD_CHECK_FUNC([[gettimeofday]],
- [[
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif /* HAVE_SYS_TIME_H */
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif /* HAVE_TIME_H */
- ]],
- [[
- struct timeval tv;
- i][f (0 != gettimeofday (&tv, (void*) 0))
- return 1;
- ]]
-)
+MHD_CHECK_FUNC_GETTIMEOFDAY
# IPv6
AC_CACHE_CHECK([for IPv6],[mhd_cv_have_inet6],
diff --git a/m4/mhd_check_func_gettimeofday.m4
b/m4/mhd_check_func_gettimeofday.m4
new file mode 100644
index 00000000..8ef69ccb
--- /dev/null
+++ b/m4/mhd_check_func_gettimeofday.m4
@@ -0,0 +1,53 @@
+# SYNOPSIS
+#
+# MHD_CHECK_FUNC_GETTIMEOFDAY([ACTION-IF-AVAILABLE],
+# [ACTION-IF-NOT-AVAILABLE])
+#
+# DESCRIPTION
+#
+# This macro checks for presence of gettimeofday() function.
+# If function is available macro HAVE_GETTIMEOFDAY is defined
+# automatically.
+#
+# Example usage:
+#
+# MHD_CHECK_FUNC_GETTIMEOFDAY([var_use_gettimeofday='yes'])
+#
+# 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 simplifies building from source on exotic platforms as patching
+# of configure.ac is not required to change results of tests.
+#
+# LICENSE
+#
+# Copyright (c) 2019-2023 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_CHECK_FUNC_GETTIMEOFDAY],[dnl
+AC_CHECK_HEADERS([sys/time.h time.h])dnl
+MHD_CHECK_FUNC([[gettimeofday]],
+ [[
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif /* HAVE_SYS_TIME_H */
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif /* HAVE_TIME_H */
+ ]],
+ [[
+ struct timeval tv;
+ if (0 != gettimeofday (&tv, (void*) 0))
+ return 1;
+ ]],[$1],[$2]
+)
+])dnl AC_DEFUN MHD_CHECK_FUNC_GETTIMEOFDAY
diff --git a/m4/mhd_shutdown_socket_trigger.m4
b/m4/mhd_shutdown_socket_trigger.m4
index 33505d81..d33c4b18 100644
--- a/m4/mhd_shutdown_socket_trigger.m4
+++ b/m4/mhd_shutdown_socket_trigger.m4
@@ -18,29 +18,14 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 4
+#serial 5
AC_DEFUN([MHD_CHECK_SOCKET_SHUTDOWN_TRIGGER],[dnl
AC_PREREQ([2.64])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AX_PTHREAD])dnl
- AC_CHECK_HEADERS([sys/time.h time.h])dnl
- MHD_CHECK_FUNC([[gettimeofday]],
- [[
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif /* HAVE_SYS_TIME_H */
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif /* HAVE_TIME_H */
- ]],
- [[
- struct timeval tv;
- if (0 != gettimeofday (&tv, (void*) 0))
- return 1;
- ]]
- )
+ AC_REQUIRE([MHD_CHECK_FUNC_GETTIMEOFDAY])dnl
MHD_CHECK_FUNC([[usleep]], [[#include <unistd.h>]], [[usleep(100000);]])
MHD_CHECK_FUNC([[nanosleep]], [[#include <time.h>]], [[struct timespec ts2,
ts1 = {0, 0}; nanosleep(&ts1, &ts2);]])
AC_CHECK_HEADERS([string.h sys/types.h sys/socket.h netinet/in.h time.h
sys/select.h netinet/tcp.h],[],[], [AC_INCLUDES_DEFAULT])
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] 12/21: libcurl.m4: patched to fix compiler warning, (continued)
- [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
- [libmicrohttpd] 19/21: configure: improved compatibility with POSIX, gnunet, 2023/03/14
- [libmicrohttpd] 20/21: configure: cosmetics: deleted extra spaces, gnunet, 2023/03/14
- [libmicrohttpd] 21/21: mhd_check_func_gettimeofday.m4: added new autoconf macro,
gnunet <=