Home | History | Annotate | Line # | Download | only in m4
      1  1.1.1.2  christos # glob_h.m4 serial 9
      2  1.1.1.2  christos dnl Copyright (C) 2018-2022 Free Software Foundation, Inc.
      3      1.1  christos dnl This file is free software; the Free Software Foundation
      4      1.1  christos dnl gives unlimited permission to copy and/or distribute it,
      5      1.1  christos dnl with or without modifications, as long as this notice is preserved.
      6      1.1  christos 
      7      1.1  christos dnl From Bruno Haible.
      8      1.1  christos 
      9      1.1  christos AC_DEFUN_ONCE([gl_GLOB_H],
     10      1.1  christos [
     11      1.1  christos   AC_REQUIRE([gl_GLOB_H_DEFAULTS])
     12      1.1  christos   m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
     13      1.1  christos   AC_REQUIRE([AC_C_RESTRICT])
     14      1.1  christos   AC_CHECK_HEADERS_ONCE([glob.h])
     15      1.1  christos   gl_CHECK_NEXT_HEADERS([glob.h])
     16      1.1  christos 
     17      1.1  christos   if test $ac_cv_header_glob_h = yes; then
     18      1.1  christos     HAVE_GLOB_H=1
     19      1.1  christos   else
     20      1.1  christos     HAVE_GLOB_H=0
     21      1.1  christos   fi
     22      1.1  christos   AC_SUBST([HAVE_GLOB_H])
     23      1.1  christos 
     24      1.1  christos   m4_ifdef([gl_POSIXCHECK],
     25  1.1.1.2  christos     [GL_GENERATE_GLOB_H=true],
     26  1.1.1.2  christos     [GL_GENERATE_GLOB_H=false
     27      1.1  christos      if m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]); then
     28      1.1  christos        dnl Override <glob.h> always, to support the C++ GNULIB_NAMESPACE.
     29  1.1.1.2  christos        GL_GENERATE_GLOB_H=true
     30      1.1  christos      else
     31      1.1  christos        if test $ac_cv_header_glob_h != yes; then
     32      1.1  christos          dnl Provide a substitute <glob.h> file.
     33  1.1.1.2  christos          GL_GENERATE_GLOB_H=true
     34      1.1  christos        fi
     35      1.1  christos      fi
     36      1.1  christos     ])
     37      1.1  christos 
     38      1.1  christos   dnl Check for declarations of anything we want to poison if the
     39      1.1  christos   dnl corresponding gnulib module is not in use.
     40      1.1  christos   gl_WARN_ON_USE_PREPARE([[#include <glob.h>
     41      1.1  christos     ]],
     42      1.1  christos     [glob globfree glob_pattern_p])
     43      1.1  christos ])
     44      1.1  christos 
     45      1.1  christos dnl Unconditionally enables the replacement of <glob.h>.
     46      1.1  christos AC_DEFUN([gl_REPLACE_GLOB_H],
     47      1.1  christos [
     48  1.1.1.2  christos   gl_GLOB_H_REQUIRE_DEFAULTS
     49  1.1.1.2  christos   GL_GENERATE_GLOB_H=true
     50      1.1  christos ])
     51      1.1  christos 
     52  1.1.1.2  christos # gl_GLOB_MODULE_INDICATOR([modulename])
     53  1.1.1.2  christos # sets the shell variable that indicates the presence of the given module
     54  1.1.1.2  christos # to a C preprocessor expression that will evaluate to 1.
     55  1.1.1.2  christos # This macro invocation must not occur in macros that are AC_REQUIREd.
     56      1.1  christos AC_DEFUN([gl_GLOB_MODULE_INDICATOR],
     57      1.1  christos [
     58  1.1.1.2  christos   dnl Ensure to expand the default settings once only.
     59  1.1.1.2  christos   gl_GLOB_H_REQUIRE_DEFAULTS
     60      1.1  christos   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
     61      1.1  christos   dnl Define it also as a C macro, for the benefit of the unit tests.
     62      1.1  christos   gl_MODULE_INDICATOR_FOR_TESTS([$1])
     63      1.1  christos ])
     64      1.1  christos 
     65  1.1.1.2  christos # Initializes the default values for AC_SUBSTed shell variables.
     66  1.1.1.2  christos # This macro must not be AC_REQUIREd.  It must only be invoked, and only
     67  1.1.1.2  christos # outside of macros or in macros that are not AC_REQUIREd.
     68  1.1.1.2  christos AC_DEFUN([gl_GLOB_H_REQUIRE_DEFAULTS],
     69  1.1.1.2  christos [
     70  1.1.1.2  christos   m4_defun(GL_MODULE_INDICATOR_PREFIX[_GLOB_H_MODULE_INDICATOR_DEFAULTS], [
     71  1.1.1.2  christos     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GLOB])
     72  1.1.1.2  christos   ])
     73  1.1.1.2  christos   m4_require(GL_MODULE_INDICATOR_PREFIX[_GLOB_H_MODULE_INDICATOR_DEFAULTS])
     74  1.1.1.2  christos   AC_REQUIRE([gl_GLOB_H_DEFAULTS])
     75  1.1.1.2  christos ])
     76  1.1.1.2  christos 
     77      1.1  christos AC_DEFUN([gl_GLOB_H_DEFAULTS],
     78      1.1  christos [
     79      1.1  christos   dnl Assume POSIX and GNU behavior unless another module says otherwise.
     80      1.1  christos   HAVE_GLOB=1;               AC_SUBST([HAVE_GLOB])
     81      1.1  christos   HAVE_GLOB_PATTERN_P=1;     AC_SUBST([HAVE_GLOB_PATTERN_P])
     82      1.1  christos   REPLACE_GLOB=0;            AC_SUBST([REPLACE_GLOB])
     83      1.1  christos   REPLACE_GLOB_PATTERN_P=0;  AC_SUBST([REPLACE_GLOB_PATTERN_P])
     84      1.1  christos ])
     85