annotate m4/glob.m4 @ 5986:f84b6f02ec36

* m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for glob symlink bug.
author Derek R. Price <derek@ximbiot.com>
date Thu, 14 Jul 2005 14:45:40 +0000
parents fade30172414
children 3abf83a68fce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5898
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
1 # glob.m4 serial 1
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
2 dnl Copyright (C) 2005 Free Software Foundation, Inc.
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
6
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
7 # The glob module assumes you want GNU glob, with glob_pattern_p etc,
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
8 # rather than vanilla POSIX glob. This means your your code should
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
9 # always include <glob.h> for the glob prototypes.
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
10
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
11 AC_DEFUN([gl_GLOB_SUBSTITUTE],
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
12 [
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
13 gl_PREREQ_GLOB
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
14
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
15 GLOB_H=glob.h
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
16 AC_LIBOBJ([glob])
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
17 AC_DEFINE([GLOB_PREFIX], [[rpl_]],
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
18 [Define to rpl_ if the glob replacement functions and variables
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
19 should be used.])
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
20 AC_SUBST([GLOB_H])
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
21 ])
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
22
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
23 AC_DEFUN([gl_GLOB],
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
24 [ GLOB_H=
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
25 AC_CHECK_HEADERS([glob.h], [], [GLOB_H=glob.h])
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
26
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
27 if test -z "$GLOB_H"; then
5986
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
28 AC_CACHE_CHECK([for GNU glob interface version 1],
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
29 [gl_cv_gnu_glob_interface_version_1],
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
30 [ AC_COMPILE_IFELSE(
5898
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
31 [[#include <gnu-versions.h>
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
32 char a[_GNU_GLOB_INTERFACE_VERSION == 1 ? 1 : -1];]],
5986
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
33 [gl_cv_gnu_glob_interface_version_1=yes],
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
34 [gl_cv_gnu_glob_interface_version_1=no])])
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
35
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
36 if test "$gl_cv_gnu_glob_interface_version_1" = "no"; then
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
37 GLOB_H=glob.h
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
38 fi
5898
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
39 fi
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
40
5986
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
41 if test -z "$GLOB_H"; then
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
42 AC_CACHE_CHECK([whether glob lists broken symlinks],
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
43 [gl_cv_glob_lists_symlinks],
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
44 [ if ln -s conf-doesntexist conf$$-globtest 2>/dev/null; then
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
45 gl_cv_glob_lists_symlinks=maybe
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
46 else
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
47 # If we can't make a symlink, then we cannot test this issue. Be
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
48 # pessimistic about this.
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
49 gl_cv_glob_lists_symlinks=no
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
50 fi
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
51
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
52 if test $gl_cv_glob_lists_symlinks = maybe; then
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
53 AC_RUN_IFELSE(
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
54 AC_LANG_PROGRAM(
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
55 [[#include <stddef.h>
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
56 #include <glob.h>]],
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
57 [[glob_t found;
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
58 if (glob ("conf*-globtest", 0, NULL, &found) == GLOB_NOMATCH) return 1;]]),
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
59 [gl_cv_glob_lists_symlinks=yes],
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
60 [gl_cv_glob_lists_symlinks=no], [gl_cv_glob_lists_symlinks=no])
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
61 fi])
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
62
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
63 if test $gl_cv_glob_lists_symlinks = no; then
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
64 GLOB_H=glob.h
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
65 fi
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
66 fi
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
67
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
68 rm -f conf$$-globtest
f84b6f02ec36 * m4/glob.m4 (gl_GLOB): Cache glob interface check result. Add check for
Derek R. Price <derek@ximbiot.com>
parents: 5901
diff changeset
69
5898
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
70 if test -n "$GLOB_H"; then
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
71 gl_GLOB_SUBSTITUTE
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
72 fi
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
73 ])
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
74
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
75 # Prerequisites of lib/glob.*.
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
76 AC_DEFUN([gl_PREREQ_GLOB],
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
77 [ AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])dnl
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
78 AC_REQUIRE([AC_HEADER_DIRENT])dnl
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
79 AC_CHECK_HEADERS_ONCE([sys/cdefs.h unistd.h])dnl
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
80 AC_CHECK_FUNCS_ONCE([getlogin_r getpwnam_r])dnl
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
81 AC_CHECK_HEADERS([sys/cdefs.h], [SYS_CDEFS_H=yes], [SYS_CDEFS_H=no])
5901
fade30172414 Sync from cvs.
Derek R. Price <derek@ximbiot.com>
parents: 5898
diff changeset
82
fade30172414 Sync from cvs.
Derek R. Price <derek@ximbiot.com>
parents: 5898
diff changeset
83 dnl Note the reversal of the common HAVE_SYS_CDEFS_H idiom below. In this
fade30172414 Sync from cvs.
Derek R. Price <derek@ximbiot.com>
parents: 5898
diff changeset
84 dnl way, #ifndef _SYS_CDEFS_H may be used to include <sys/cdefs.h> both when
fade30172414 Sync from cvs.
Derek R. Price <derek@ximbiot.com>
parents: 5898
diff changeset
85 dnl it has been checked for via the GNULIB configure test and found and when
fade30172414 Sync from cvs.
Derek R. Price <derek@ximbiot.com>
parents: 5898
diff changeset
86 dnl it has not been checked for, which we can presume means that the <glob.h>
fade30172414 Sync from cvs.
Derek R. Price <derek@ximbiot.com>
parents: 5898
diff changeset
87 dnl GNULIB shares with GLIBC is being included as a system header and not as
fade30172414 Sync from cvs.
Derek R. Price <derek@ximbiot.com>
parents: 5898
diff changeset
88 dnl part of GNULIB, in which case <sys/cdefs.h> may be assumed.
5898
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
89 if test $SYS_CDEFS_H = no; then
5901
fade30172414 Sync from cvs.
Derek R. Price <derek@ximbiot.com>
parents: 5898
diff changeset
90 AC_DEFINE(_SYS_CDEFS_H, 1,
5898
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
91 [Define to `1' if <sys/cdefs.h> is *not* available on this system.])
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
92 fi
429b55c14554 * MODULES.html.sh: Add glob to Enhanced POSIX.2001 section.
Derek R. Price <derek@ximbiot.com>
parents:
diff changeset
93 :])