1# Configure a replacement for <sys/times.h>. 2# serial 11 3 4# Copyright (C) 2008-2021 Free Software Foundation, Inc. 5# This file is free software; the Free Software Foundation 6# gives unlimited permission to copy and/or distribute it, 7# with or without modifications, as long as this notice is preserved. 8 9# Written by Simon Josefsson. 10 11AC_DEFUN_ONCE([gl_SYS_TIMES_H], 12[ 13 AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS]) 14 15 dnl <sys/times.h> is always overridden, because of GNULIB_POSIXCHECK. 16 gl_CHECK_NEXT_HEADERS([sys/times.h]) 17 if test $ac_cv_header_sys_times_h = yes; then 18 HAVE_SYS_TIMES_H=1 19 AC_CHECK_TYPES([struct tms], [], [HAVE_STRUCT_TMS=0], [[ 20#include <sys/times.h> 21 ]]) 22 else 23 HAVE_SYS_TIMES_H=0 24 HAVE_STRUCT_TMS=0 25 fi 26 AC_SUBST([HAVE_SYS_TIMES_H]) 27 28 dnl Check for declarations of anything we want to poison if the 29 dnl corresponding gnulib module is not in use. 30 gl_WARN_ON_USE_PREPARE([[ 31/* Some systems have incomplete headers. */ 32#if !(defined __GLIBC__ && !defined __UCLIBC__) 33# include <time.h> 34#endif 35#include <sys/times.h> 36 ]], [times]) 37]) 38 39# gl_SYS_TIMES_MODULE_INDICATOR([modulename]) 40# sets the shell variable that indicates the presence of the given module 41# to a C preprocessor expression that will evaluate to 1. 42# This macro invocation must not occur in macros that are AC_REQUIREd. 43AC_DEFUN([gl_SYS_TIMES_MODULE_INDICATOR], 44[ 45 dnl Ensure to expand the default settings once only. 46 gl_SYS_TIMES_H_REQUIRE_DEFAULTS 47 gl_MODULE_INDICATOR_SET_VARIABLE([$1]) 48]) 49 50# Initializes the default values for AC_SUBSTed shell variables. 51# This macro must not be AC_REQUIREd. It must only be invoked, and only 52# outside of macros or in macros that are not AC_REQUIREd. 53AC_DEFUN([gl_SYS_TIMES_H_REQUIRE_DEFAULTS], 54[ 55 m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TIMES_H_MODULE_INDICATOR_DEFAULTS], [ 56 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMES]) 57 ]) 58 m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TIMES_H_MODULE_INDICATOR_DEFAULTS]) 59 AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS]) 60]) 61 62AC_DEFUN([gl_SYS_TIMES_H_DEFAULTS], 63[ 64 HAVE_STRUCT_TMS=1; AC_SUBST([HAVE_STRUCT_TMS]) 65 HAVE_TIMES=1; AC_SUBST([HAVE_TIMES]) 66]) 67