summaryrefslogtreecommitdiff
path: root/gl/m4/glob.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/glob.m4')
-rw-r--r--gl/m4/glob.m441
1 files changed, 40 insertions, 1 deletions
diff --git a/gl/m4/glob.m4 b/gl/m4/glob.m4
index 0d142638..f59b84ff 100644
--- a/gl/m4/glob.m4
+++ b/gl/m4/glob.m4
@@ -1,4 +1,4 @@
-# glob.m4 serial 24
+# glob.m4 serial 26
dnl Copyright (C) 2005-2007, 2009-2022 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -66,6 +66,45 @@ char a[_GNU_GLOB_INTERFACE_VERSION == 1 || _GNU_GLOB_INTERFACE_VERSION == 2 ? 1
esac
fi
+ if test $REPLACE_GLOB = 0; then
+ AC_CACHE_CHECK([whether glob NOTDIR*/ omits symlink to nondir],
+ [gl_cv_glob_omit_nondir_symlinks],
+ [if test $cross_compiling != yes; then
+ if ln -s conf$$-file conf$$-globtest 2>/dev/null && touch conf$$-file
+ then
+ gl_cv_glob_omit_nondir_symlinks=maybe
+ else
+ # If we can't make a symlink, then we cannot test this issue. Be
+ # pessimistic about this.
+ gl_cv_glob_omit_nondir_symlinks=no
+ fi
+ if test $gl_cv_glob_omit_nondir_symlinks = maybe; then
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stddef.h>
+ #include <glob.h>]],
+ [[glob_t found;
+ if (glob ("conf*-globtest/", 0, NULL, &found) != GLOB_NOMATCH)
+ return 1;
+ globfree (&found);
+ ]])],
+ [gl_cv_glob_omit_nondir_symlinks=yes],
+ [gl_cv_glob_omit_nondir_symlinks=no],
+ [dnl We don't get here.
+ :
+ ])
+ fi
+ rm -f conf$$-file conf$$-globtest
+ else
+ gl_cv_glob_omit_nondir_symlinks="$gl_cross_guess_normal"
+ fi
+ ])
+ case "$gl_cv_glob_omit_nondir_symlinks" in
+ *yes) ;;
+ *) REPLACE_GLOB=1 ;;
+ esac
+ fi
+
fi
if test $ac_cv_func_glob_pattern_p = no; then