gnulib: update to 776af40e0
[deliverable/binutils-gdb.git] / gnulib / import / m4 / glob_h.m4
CommitLineData
c0c3707f 1# glob_h.m4 serial 5
9c9d63b1 2dnl Copyright (C) 2018-2021 Free Software Foundation, Inc.
c0c3707f
CB
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Bruno Haible.
8
9AC_DEFUN_ONCE([gl_GLOB_H],
10[
11 AC_REQUIRE([gl_GLOB_H_DEFAULTS])
12 m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
13 AC_REQUIRE([AC_C_RESTRICT])
14 AC_CHECK_HEADERS_ONCE([glob.h])
15 gl_CHECK_NEXT_HEADERS([glob.h])
16
17 if test $ac_cv_header_glob_h = yes; then
18 HAVE_GLOB_H=1
19 else
20 HAVE_GLOB_H=0
21 fi
22 AC_SUBST([HAVE_GLOB_H])
23
24 m4_ifdef([gl_POSIXCHECK],
25 [GLOB_H=glob.h],
26 [GLOB_H=''
27 if m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]); then
28 dnl Override <glob.h> always, to support the C++ GNULIB_NAMESPACE.
29 GLOB_H=glob.h
30 else
31 if test $ac_cv_header_glob_h != yes; then
32 dnl Provide a substitute <glob.h> file.
33 GLOB_H=glob.h
34 fi
35 fi
36 ])
37 AC_SUBST([GLOB_H])
38 AM_CONDITIONAL([GL_GENERATE_GLOB_H], [test -n "$GLOB_H"])
39
40 dnl Check for declarations of anything we want to poison if the
41 dnl corresponding gnulib module is not in use.
42 gl_WARN_ON_USE_PREPARE([[#include <glob.h>
43 ]],
44 [glob globfree glob_pattern_p])
45])
46
47dnl Unconditionally enables the replacement of <glob.h>.
48AC_DEFUN([gl_REPLACE_GLOB_H],
49[
50 AC_REQUIRE([gl_GLOB_H_DEFAULTS])
51 GLOB_H='glob.h'
52 AM_CONDITIONAL([GL_GENERATE_GLOB_H], [test -n "$GLOB_H"])
53])
54
55AC_DEFUN([gl_GLOB_MODULE_INDICATOR],
56[
57 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
58 AC_REQUIRE([gl_GLOB_H_DEFAULTS])
59 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
60 dnl Define it also as a C macro, for the benefit of the unit tests.
61 gl_MODULE_INDICATOR_FOR_TESTS([$1])
62])
63
64AC_DEFUN([gl_GLOB_H_DEFAULTS],
65[
66 GNULIB_GLOB=0; AC_SUBST([GNULIB_GLOB])
67 dnl Assume POSIX and GNU behavior unless another module says otherwise.
68 HAVE_GLOB=1; AC_SUBST([HAVE_GLOB])
69 HAVE_GLOB_PATTERN_P=1; AC_SUBST([HAVE_GLOB_PATTERN_P])
70 REPLACE_GLOB=0; AC_SUBST([REPLACE_GLOB])
71 REPLACE_GLOB_PATTERN_P=0; AC_SUBST([REPLACE_GLOB_PATTERN_P])
72])
This page took 0.083663 seconds and 4 git commands to generate.