libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

mhd_check_func_gettimeofday.m4 (1531B)


      1 # SPDX-License-Identifier: FSFAP
      2 #
      3 # SYNOPSIS
      4 #
      5 #   MHD_CHECK_FUNC_GETTIMEOFDAY([ACTION-IF-AVAILABLE],
      6 #                               [ACTION-IF-NOT-AVAILABLE])
      7 #
      8 # DESCRIPTION
      9 #
     10 #   This macro checks for presence of gettimeofday() function.
     11 #   If function is available macro HAVE_GETTIMEOFDAY is defined
     12 #   automatically.
     13 #
     14 #   Example usage:
     15 #
     16 #     MHD_CHECK_FUNC_GETTIMEOFDAY([var_use_gettimeofday='yes'])
     17 #
     18 #   The cache variable used in check so if any test will not work
     19 #   correctly on some platform, user may simply fix it by giving cache
     20 #   variable in configure parameters, for example:
     21 #
     22 #     ./configure mhd_cv_func_memmem_have=no
     23 #
     24 #   This simplifies building from source on exotic platforms as patching
     25 #   of configure.ac is not required to change results of tests.
     26 #
     27 # LICENSE
     28 #
     29 #   Copyright (c) 2019-2023 Karlson2k (Evgeny Grin) <k2k@narod.ru>
     30 #
     31 #   Copying and distribution of this file, with or without modification, are
     32 #   permitted in any medium without royalty provided the copyright notice
     33 #   and this notice are preserved. This file is offered as-is, without any
     34 #   warranty.
     35 
     36 #serial 1
     37 
     38 AC_DEFUN([MHD_CHECK_FUNC_GETTIMEOFDAY],[dnl
     39 AC_CHECK_HEADERS([sys/time.h time.h])dnl
     40 MHD_CHECK_FUNC([[gettimeofday]],
     41   [[
     42 #ifdef HAVE_SYS_TIME_H
     43 #include <sys/time.h>
     44 #endif /* HAVE_SYS_TIME_H */
     45 #ifdef HAVE_TIME_H
     46 #include <time.h>
     47 #endif /* HAVE_TIME_H */
     48   ]],
     49   [[
     50   struct timeval tv;
     51   if (0 != gettimeofday (&tv, (void*) 0))
     52     return 1;
     53   ]],[$1],[$2]
     54 )
     55 ])dnl AC_DEFUN MHD_CHECK_FUNC_GETTIMEOFDAY