aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2023-03-14 17:36:40 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2023-03-14 21:34:26 +0300
commitdcd8ea98694d3087d1af9f7a11570b73c7d1c249 (patch)
treea0c194bad0f4f22a0ad9f8f5f05b1dd62a00ba1b
parent779bbfb525862bbe3a966a8bcfbfa9c560a2c270 (diff)
downloadlibmicrohttpd-dcd8ea98694d3087d1af9f7a11570b73c7d1c249.tar.gz
libmicrohttpd-dcd8ea98694d3087d1af9f7a11570b73c7d1c249.zip
mhd_check_func_gettimeofday.m4: added new autoconf macro
-rw-r--r--configure.ac16
-rw-r--r--m4/mhd_check_func_gettimeofday.m453
-rw-r--r--m4/mhd_shutdown_socket_trigger.m419
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
2578 ] 2578 ]
2579) 2579)
2580 2580
2581MHD_CHECK_FUNC([[gettimeofday]], 2581MHD_CHECK_FUNC_GETTIMEOFDAY
2582 [[
2583#ifdef HAVE_SYS_TIME_H
2584#include <sys/time.h>
2585#endif /* HAVE_SYS_TIME_H */
2586#ifdef HAVE_TIME_H
2587#include <time.h>
2588#endif /* HAVE_TIME_H */
2589 ]],
2590 [[
2591 struct timeval tv;
2592 i][f (0 != gettimeofday (&tv, (void*) 0))
2593 return 1;
2594 ]]
2595)
2596 2582
2597# IPv6 2583# IPv6
2598AC_CACHE_CHECK([for IPv6],[mhd_cv_have_inet6], 2584AC_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 @@
1# SYNOPSIS
2#
3# MHD_CHECK_FUNC_GETTIMEOFDAY([ACTION-IF-AVAILABLE],
4# [ACTION-IF-NOT-AVAILABLE])
5#
6# DESCRIPTION
7#
8# This macro checks for presence of gettimeofday() function.
9# If function is available macro HAVE_GETTIMEOFDAY is defined
10# automatically.
11#
12# Example usage:
13#
14# MHD_CHECK_FUNC_GETTIMEOFDAY([var_use_gettimeofday='yes'])
15#
16# The cache variable used in check so if any test will not work
17# correctly on some platform, user may simply fix it by giving cache
18# variable in configure parameters, for example:
19#
20# ./configure mhd_cv_func_memmem_have=no
21#
22# This simplifies building from source on exotic platforms as patching
23# of configure.ac is not required to change results of tests.
24#
25# LICENSE
26#
27# Copyright (c) 2019-2023 Karlson2k (Evgeny Grin) <k2k@narod.ru>
28#
29# Copying and distribution of this file, with or without modification, are
30# permitted in any medium without royalty provided the copyright notice
31# and this notice are preserved. This file is offered as-is, without any
32# warranty.
33
34#serial 1
35
36AC_DEFUN([MHD_CHECK_FUNC_GETTIMEOFDAY],[dnl
37AC_CHECK_HEADERS([sys/time.h time.h])dnl
38MHD_CHECK_FUNC([[gettimeofday]],
39 [[
40#ifdef HAVE_SYS_TIME_H
41#include <sys/time.h>
42#endif /* HAVE_SYS_TIME_H */
43#ifdef HAVE_TIME_H
44#include <time.h>
45#endif /* HAVE_TIME_H */
46 ]],
47 [[
48 struct timeval tv;
49 if (0 != gettimeofday (&tv, (void*) 0))
50 return 1;
51 ]],[$1],[$2]
52)
53])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 @@
18# and this notice are preserved. This file is offered as-is, without any 18# and this notice are preserved. This file is offered as-is, without any
19# warranty. 19# warranty.
20 20
21#serial 4 21#serial 5
22 22
23AC_DEFUN([MHD_CHECK_SOCKET_SHUTDOWN_TRIGGER],[dnl 23AC_DEFUN([MHD_CHECK_SOCKET_SHUTDOWN_TRIGGER],[dnl
24 AC_PREREQ([2.64])dnl 24 AC_PREREQ([2.64])dnl
25 AC_REQUIRE([AC_CANONICAL_HOST])dnl 25 AC_REQUIRE([AC_CANONICAL_HOST])dnl
26 AC_REQUIRE([AC_PROG_CC])dnl 26 AC_REQUIRE([AC_PROG_CC])dnl
27 AC_REQUIRE([AX_PTHREAD])dnl 27 AC_REQUIRE([AX_PTHREAD])dnl
28 AC_CHECK_HEADERS([sys/time.h time.h])dnl 28 AC_REQUIRE([MHD_CHECK_FUNC_GETTIMEOFDAY])dnl
29 MHD_CHECK_FUNC([[gettimeofday]],
30 [[
31#ifdef HAVE_SYS_TIME_H
32#include <sys/time.h>
33#endif /* HAVE_SYS_TIME_H */
34#ifdef HAVE_TIME_H
35#include <time.h>
36#endif /* HAVE_TIME_H */
37 ]],
38 [[
39 struct timeval tv;
40 if (0 != gettimeofday (&tv, (void*) 0))
41 return 1;
42 ]]
43 )
44 MHD_CHECK_FUNC([[usleep]], [[#include <unistd.h>]], [[usleep(100000);]]) 29 MHD_CHECK_FUNC([[usleep]], [[#include <unistd.h>]], [[usleep(100000);]])
45 MHD_CHECK_FUNC([[nanosleep]], [[#include <time.h>]], [[struct timespec ts2, ts1 = {0, 0}; nanosleep(&ts1, &ts2);]]) 30 MHD_CHECK_FUNC([[nanosleep]], [[#include <time.h>]], [[struct timespec ts2, ts1 = {0, 0}; nanosleep(&ts1, &ts2);]])
46 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]) 31 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])