diff options
Diffstat (limited to 'm4/mhd_check_func_gettimeofday.m4')
-rw-r--r-- | m4/mhd_check_func_gettimeofday.m4 | 53 |
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 | |||
36 | AC_DEFUN([MHD_CHECK_FUNC_GETTIMEOFDAY],[dnl | ||
37 | AC_CHECK_HEADERS([sys/time.h time.h])dnl | ||
38 | MHD_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 | ||