aboutsummaryrefslogtreecommitdiff
path: root/m4/mhd_check_func_gettimeofday.m4
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 /m4/mhd_check_func_gettimeofday.m4
parent779bbfb525862bbe3a966a8bcfbfa9c560a2c270 (diff)
downloadlibmicrohttpd-dcd8ea98694d3087d1af9f7a11570b73c7d1c249.tar.gz
libmicrohttpd-dcd8ea98694d3087d1af9f7a11570b73c7d1c249.zip
mhd_check_func_gettimeofday.m4: added new autoconf macro
Diffstat (limited to 'm4/mhd_check_func_gettimeofday.m4')
-rw-r--r--m4/mhd_check_func_gettimeofday.m453
1 files changed, 53 insertions, 0 deletions
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