1 # perl-time-hires.m4 serial 1
3 # Copyright (C) 2022 Free Software Foundation, Inc.
5 # Copying and distribution of this file, with or without modification,
6 # are permitted in any medium without royalty provided the copyright
7 # notice and this notice are preserved. This file is offered as-is,
8 # without warranty of any kind.
10 # AClocal_PATH_PROG_GLOBS_FEATURE_CHECK
11 # ---------------------------------
12 # Like AC_PATH_PROGS_FEATURE_CHECK, but each of 'progs-to-check-for' may
13 # be a shell glob, which is expanded once for each path entry.
14 # That is, AClocal_PATH_PROG_GLOBS_FEATURE_CHECK([PERL], [perl-*]) will
15 # test each program named something like 'perl-*' found anywhere on the
16 # path. Due to the syntax conflict with Autoconf string quoting,
17 # character sets (e.g. perl-[56]*) are not supported.
18 m4_define([AClocal_PATH_PROG_GLOBS_FEATURE_CHECK],
19 [if test -z "$$1"; then
20 ac_path_$1_found=false
21 # Loop through the user's path and test for each of PROGNAME-LIST
22 dnl AS_ESCAPE has been excessively optimized and does not work for anything
23 dnl other than constructing strings. I have not been able to figure out how
24 dnl to get [ and ] through this process without mangling them, so
25 dnl character sets are not supported for now.
27 [for ac_prog in m4_bpatsubst([$2], [[!?*]], [\\\&])
29 for ac_exec_ext in '' $ac_executable_extensions; do
30 ac_pathglob_$1="$as_dir$ac_prog$ac_exec_ext"
31 for ac_path_$1 in $ac_pathglob_$1; do
32 AS_EXECUTABLE_P(["$ac_path_$1"]) || continue
34 $ac_path_$1_found && break 4
38 if test -z "$ac_cv_path_$1"; then
40 [AC_MSG_ERROR([no acceptable m4_bpatsubst([$2], [ .*]) could be dnl
41 found in m4_default([$5], [\$PATH])])])
48 # AC_PATH_PERL_WITH_TIME_HIRES_STAT
49 # ---------------------------------
50 # Check for a version of perl that supports Time::HiRes::stat.
51 # This was added to perl core in 5.10 and it's convenient to
52 # have a consistent 'use 5.0xx' baseline for all the perl scripts,
53 # so that is the version we require, even though technically we
54 # could be getting away with 5.8 or even 5.6 in many of the scripts.
55 # (Note: Files shared with Automake do not necessarily use our baseline.)
56 AC_DEFUN([AC_PATH_PERL_WITH_TIME_HIRES_STAT],
57 [AC_ARG_VAR([PERL], [Location of Perl 5.10 or later. Defaults to
58 the first program named 'perl', 'perl5*', or 'perl-5.*' on the PATH
59 that meets Autoconf's needs.])
60 AC_CACHE_CHECK([for Perl >=5.10.0 with Time::HiRes::stat],
62 [AClocal_PATH_PROG_GLOBS_FEATURE_CHECK(
63 [PERL], [perl perl5* perl-5.*],
64 [AS_ECHO("$as_me:${as_lineno-$LINENO}: trying $ac_path_PERL") \
66 $ac_path_PERL >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD -e '
68 use Time::HiRes qw(stat);
70 && ac_cv_path_PERL=$ac_path_PERL ac_path_PERL_found=:],
71 [AC_MSG_ERROR([no acceptable perl could be found in \$PATH.
72 Perl 5.10.0 or later is required, with Time::HiRes::stat.])])])