Discussion:
Testing gnulib on riscv64 - replacement modules
Richard W.M. Jones
2018-03-08 09:19:52 UTC
Permalink
Platform: riscv64-unknown-linux-gnu
"Verify that Gnulib has built no replacement/workaround code
(gllib/*.o files)"
$ (cd gllib; ls -1 $(${GNULIB_CHECKOUT}/posix-modules | sed -e 's|-posix$||' | sort -u | grep -v 'nonblocking' | sed -e 's|$|.o|') 2>/dev/null )
fclose.o
fcntl.o
fflush.o
fseek.o
fseeko.o
glob.o
ioctl.o
math.o
mbrlen.o
mbrtowc.o
nanosleep.o
strerror_r.o
sys_socket.o
unistd.o
wctype-h.o
"if so, this indicates problems in the libc."
So I suppose there is a problem with glibc. We're running glibc 2.27
(from Fedora Rawhide). What could be the problem?

The ./configure && make output is too large to attach so I placed it here:

http://oirase.annexia.org/tmp/gnulib.txt

Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
Richard W.M. Jones
2018-03-08 11:39:08 UTC
Permalink
Attached are the results of the test suite.

I also have core dumps from all the failing tests, but unfortunately
we don't have 'gdb' working yet so I can't easily convert them into a
stack trace. However most of the failures appear to be assert-fails
so it doesn't look as if a stack trace would be very useful.

Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
Bruno Haible
2018-03-14 21:24:27 UTC
Permalink
Hi Rich,
Post by Richard W.M. Jones
Attached are the results of the test suite.
With your disk image, the newest qemu and the floating-point fix that
you pointed to, I get 0 test failures. All tests passed!
Post by Richard W.M. Jones
I also have core dumps from all the failing tests
You got:

FAIL: test-nonblocking-pipe.sh
FAIL: test-nonblocking-socket.sh

Timing thresholds were exceeded, probably due to a slow execution environment.
=> You can ignore these.

FAIL: test-expf
FAIL: test-fmod
FAIL: test-hypot
FAIL: test-sqrt
FAIL: test-sqrtf

Various floating-point issues, possibly due to the soft-float emulation.

FAIL: test-strtod

This one could be more worrisome.

Bruno
Richard W.M. Jones
2018-03-14 21:41:06 UTC
Permalink
Post by Bruno Haible
FAIL: test-expf
FAIL: test-fmod
FAIL: test-hypot
FAIL: test-sqrt
FAIL: test-sqrtf
Various floating-point issues, possibly due to the soft-float emulation.
FAIL: test-strtod
This one could be more worrisome.
I now suspect that all these are because of the FPU emulation bug
which we only discovered relatively recently -- after I sent the
original message. So I guess we're all good now, thanks for testing it.

Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
Paul Eggert
2018-03-09 20:28:53 UTC
Permalink
Post by Richard W.M. Jones
$ (cd gllib; ls -1 $(${GNULIB_CHECKOUT}/posix-modules | sed -e 's|-posix$||' | sort -u | grep -v 'nonblocking' | sed -e 's|$|.o|') 2>/dev/null )
fclose.o
...
"if so, this indicates problems in the libc."
So I suppose there is a problem with glibc. We're running glibc 2.27
(from Fedora Rawhide). What could be the problem?
You can look at the build log and Gnulib source to get an idea. For
example, for fclose.o, gnulib/modules/fclose suggests that
REPLACE_FCLOSE seems to be 1, and gnulib/m4/fclose.m4 says that it is 1
if either gl_cv_func_fflush_stdin ends in "yes" or if REPLACE_CLOSE is
1, and your log says "checking whether fflush works on input streams...
no" so it sounds like this is the problem. Look in gnulib/m4/fflush.m4
to find the program that failed.

Similarly for the other .o files. Good luck.
Bruno Haible
2018-03-14 11:09:40 UTC
Permalink
Hi Richard,
Post by Richard W.M. Jones
Platform: riscv64-unknown-linux-gnu
Prompted by your mail, I'm trying to run a Linux/riscv64 machine in a qemu
VM, in order to look at the gnulib problems and port GNU libffcall and other
software. According to [1], I'm using qemu built from upstream qemu today with
options
--target-list=riscv32-softmmu,riscv64-softmmu,riscv32-linux-user,riscv64-linux-user
According to [2], I'm taking your disk image and running it as

qemu-system-riscv64 \
-nographic -machine virt -m 2G -smp 4 \
-kernel bbl \
-append "console=ttyS0 ro root=/dev/vda init=/init" \
-device virtio-blk-device,drive=hd0 \
-drive file=stage4-disk.img,format=raw,id=hd0 \
-device virtio-net-device,netdev=usernet \
-netdev user,id=usernet

and it fails like this:

EXT4-fs (vda): couldn't mount as ext3 due to feature incompatibilities
EXT4-fs (vda): couldn't mount as ext2 due to feature incompatibilities
EXT4-fs (vda): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) readonly on device 254:0.
Freeing unused kernel memory: 200K
This architecture does not have kernel memory protection.
Kernel panic - not syncing: Requested init /init failed (error -2).
CPU: 1 PID: 1 Comm: swapper/3 Tainted: G W 4.16.0-rc2-00328-gebea62367bc4 #4
Call Trace:
[<ffffffe0000341ee>] walk_stackframe+0x0/0xa2
[<ffffffe0000342ec>] show_stack+0x26/0x34
[<ffffffe0005e4904>] dump_stack+0x5e/0x7c
[<ffffffe00003771a>] panic+0xce/0x1e8
[<ffffffe0005f5430>] kernel_init+0x94/0xf0
[<ffffffe000033242>] ret_from_syscall+0xa/0xe

The message "This architecture does not have kernel memory protection." seems
to indicate some differences between the qemu you are using and the official
upstream one. Can you help, please?

Bruno

[1] https://wiki.debian.org/RISC-V
[2] https://netcreator.us/news/10245-richard-w-m-jones-fedora-risc-v-runnable-stage-4-disk-images.html
Richard W.M. Jones
2018-03-14 11:24:04 UTC
Permalink
Post by Bruno Haible
Hi Richard,
Post by Richard W.M. Jones
Platform: riscv64-unknown-linux-gnu
Prompted by your mail, I'm trying to run a Linux/riscv64 machine in a qemu
VM, in order to look at the gnulib problems and port GNU libffcall and other
software. According to [1], I'm using qemu built from upstream qemu today with
options
--target-list=riscv32-softmmu,riscv64-softmmu,riscv32-linux-user,riscv64-linux-user
According to [2], I'm taking your disk image and running it as
qemu-system-riscv64 \
-nographic -machine virt -m 2G -smp 4 \
-kernel bbl \
-append "console=ttyS0 ro root=/dev/vda init=/init" \
-device virtio-blk-device,drive=hd0 \
-drive file=stage4-disk.img,format=raw,id=hd0 \
-device virtio-net-device,netdev=usernet \
-netdev user,id=usernet
This command line is slightly different from the one we're using.
See the readme.txt file here for details which are known to work:

https://fedorapeople.org/groups/risc-v/disk-images/

However the main problem is it cannot find systemd on the root
Post by Bruno Haible
EXT4-fs (vda): couldn't mount as ext3 due to feature incompatibilities
EXT4-fs (vda): couldn't mount as ext2 due to feature incompatibilities
EXT4-fs (vda): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) readonly on device 254:0.
Freeing unused kernel memory: 200K
This architecture does not have kernel memory protection.
Kernel panic - not syncing: Requested init /init failed (error -2).
Are you using our bbl (bootloader + kernel)? Are you using our
latest stage4-disk.img, uncompressed?

2a4a27c97e31c9fc78b3b8108067ef58 stage4-disk.img
a0aa455d5b84fd7c41e97043279bc3df bbl

I've not actually tried upstream qemu yet, we're still using:

https://github.com/riscv/riscv-qemu/tree/qemu-upstream-v8

Also we have one extra patch which is not included in any tree yet:

https://github.com/rwmjones/fedora-riscv-bootstrap/blob/master/stage1-riscv-qemu/force-float-save.patch

But as far as I know upstream qemu should work fine.
I'll try it now ...
Post by Bruno Haible
The message "This architecture does not have kernel memory protection." seems
to indicate some differences between the qemu you are using and the official
upstream one. Can you help, please?
Apparently this message can be ignored.

Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
Richard W.M. Jones
2018-03-14 11:30:56 UTC
Permalink
Post by Bruno Haible
-append "console=ttyS0 ro root=/dev/vda init=/init" \
Oh I see, the problem is the init=...

See https://fedorapeople.org/groups/risc-v/disk-images/readme.txt for
the latest and correct instructions.

I tried qemu from upstream now and it works fine, but note the
extra patch which you'll need otherwise the FPU is broken:

https://github.com/rwmjones/fedora-riscv-bootstrap/blob/master/stage1-riscv-qemu/force-float-save.patch

Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
Bruno Haible
2018-03-14 18:01:10 UTC
Permalink
Hi Rich,
Post by Richard W.M. Jones
Post by Bruno Haible
-append "console=ttyS0 ro root=/dev/vda init=/init" \
Oh I see, the problem is the init=...
See https://fedorapeople.org/groups/risc-v/disk-images/readme.txt for
the latest and correct instructions.
Thanks, with these instructions it works! I wasn't aware that the
instructions from the February 2018 blog were already superseded.
Post by Richard W.M. Jones
I tried qemu from upstream now and it works fine, but note the
https://github.com/rwmjones/fedora-riscv-bootstrap/blob/master/stage1-riscv-qemu/force-float-save.patch
Thanks for this hint we well!

Bruno
Bruno Haible
2018-03-14 21:54:07 UTC
Permalink
Post by Richard W.M. Jones
"Verify that Gnulib has built no replacement/workaround code
(gllib/*.o files)"
$ (cd gllib; ls -1 $(${GNULIB_CHECKOUT}/posix-modules | sed -e 's|-posix$||' | sort -u | grep -v 'nonblocking' | sed -e 's|$|.o|') 2>/dev/null )
math.o
sys_socket.o
unistd.o
wctype-h.o
These object files contain no code. Can be ignored.
Post by Richard W.M. Jones
fcntl.o
Replacement required because of
checking whether fcntl understands F_DUPFD_CLOEXEC... needs runtime check
https://www.gnu.org/software/gnulib/manual/html_node/fcntl.html
Post by Richard W.M. Jones
fflush.o
fclose.o
fseeko.o
fseek.o
Replacement required because of
checking whether fflush works on input streams... no
https://www.gnu.org/software/gnulib/manual/html_node/fflush.html
Post by Richard W.M. Jones
glob.o
Replacement required because of
checking for GNU glob interface version 1... no
LOOKS LIKE A BUG!
Not mentioned in
https://www.gnu.org/software/gnulib/manual/html_node/glob.html
Post by Richard W.M. Jones
ioctl.o
Replacement required because of
checking for ioctl with POSIX signature... no
https://www.gnu.org/software/gnulib/manual/html_node/ioctl.html
Post by Richard W.M. Jones
mbrtowc.o
mbrlen.o
Replacement required because of
checking whether the C locale is free of encoding errors... no
https://www.gnu.org/software/gnulib/manual/html_node/mbrtowc.html
Post by Richard W.M. Jones
nanosleep.o
Replacement required because of
checking for working nanosleep... no (mishandles large arguments)
https://www.gnu.org/software/gnulib/manual/html_node/nanosleep.html
Post by Richard W.M. Jones
strerror_r.o
Replacement required because of
checking for strerror_r with POSIX signature... no
https://www.gnu.org/software/gnulib/manual/html_node/strerror_005fr.html


Bruno
Bruno Haible
2018-03-14 22:10:27 UTC
Permalink
Post by Bruno Haible
Post by Richard W.M. Jones
glob.o
Replacement required because of
checking for GNU glob interface version 1... no
This is because /usr/include/gnu-versions.h now defines
_GNU_GLOB_INTERFACE_VERSION to 2, following this commit in glibc:
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=ccf970c7a77e86f4f5ef8ecc5e637114b1c0136a

Adhemerval, does this patch look right? Is gnulib's glob compatible with
_GNU_GLOB_INTERFACE_VERSION == 2?

diff --git a/m4/glob.m4 b/m4/glob.m4
index 9dedb41..6128361 100644
--- a/m4/glob.m4
+++ b/m4/glob.m4
@@ -1,4 +1,4 @@
-# glob.m4 serial 16
+# glob.m4 serial 17
dnl Copyright (C) 2005-2007, 2009-2018 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -14,14 +14,14 @@ AC_DEFUN([gl_GLOB],

if test -z "$GLOB_H"; then
AC_CACHE_CHECK([for GNU glob interface version 1],
- [gl_cv_gnu_glob_interface_version_1],
+ [gl_cv_gnu_glob_interface_version_1_2],
[ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[[#include <gnu-versions.h>
-char a[_GNU_GLOB_INTERFACE_VERSION == 1 ? 1 : -1];]])],
- [gl_cv_gnu_glob_interface_version_1=yes],
- [gl_cv_gnu_glob_interface_version_1=no])])
+char a[_GNU_GLOB_INTERFACE_VERSION == 1 || _GNU_GLOB_INTERFACE_VERSION == 2 ? 1 : -1];]])],
+ [gl_cv_gnu_glob_interface_version_1_2=yes],
+ [gl_cv_gnu_glob_interface_version_1_2=no])])

- if test "$gl_cv_gnu_glob_interface_version_1" = "no"; then
+ if test "$gl_cv_gnu_glob_interface_version_1_2" = "no"; then
GLOB_H=glob.h
fi
fi
Bruno Haible
2018-03-16 15:26:06 UTC
Permalink
Post by Bruno Haible
This is because /usr/include/gnu-versions.h now defines
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=ccf970c7a77e86f4f5ef8ecc5e637114b1c0136a
The motivation of _GNU_GLOB_INTERFACE_VERSION == 2 being the new handling
of dangling symlinks, and this change being already in gnulib since 2017-08-31
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=fd1daf4e1824bb46c08ba6244b4d41c8cecb3642
it looks like gnulib's replacement is not needed when
_GNU_GLOB_INTERFACE_VERSION == 2. And indeed this patch works fine for me.
Tested on glibc 2.23, recent glibc, and mingw; including the C++ tests.
Pushed.


2018-03-16 Bruno Haible <***@clisp.org>

glob: Don't compile replacements on recent glibc systems.
* lib/glob.in.h: Use the usual idiom for the double-inclusion guard. If
REPLACE_GLOB is 0, include the system's <glob.h> and use
_GL_CXXALIAS_SYS.
* m4/glob.m4 (gl_GLOB): Set REPLACE_GLOB instead of GLOB_H. Accept
_GNU_GLOB_INTERFACE_VERSION 2 as well. Delete the file conf$$-globtest
inside the AC_RUN_IFELSE block. Remove GL_GENERATE_GLOB_H conditional.
* modules/glob (Dependencies): Test REPLACE_GLOB instead of GLOB_H.
Remove snippet/warn-on-use.
(configure.ac): Test REPLACE_GLOB instead of GLOB_H.
(Makefile.am): Create glob.h always. Update list of substitutions in
glob.h. Don't depend on $(WARN_ON_USE_H).

diff --git a/lib/glob.in.h b/lib/glob.in.h
index cc3f48c..656c1eb 100644
--- a/lib/glob.in.h
+++ b/lib/glob.in.h
@@ -17,21 +17,22 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <https://www.gnu.org/licenses/>. */

-#ifndef _GL_GLOB_H
-#define _GL_GLOB_H
+#ifndef ***@GUARD_PREFIX@_GLOB_H

-#include <libc-config.h>
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@

-#include <stddef.h>
+/* The include_next requires a split double-inclusion guard. */
+#if !@REPLACE_GLOB@
+# @INCLUDE_NEXT@ @NEXT_GLOB_H@
+#endif

-/* On some systems, such as AIX 5.1, <sys/stat.h> does a "#define stat stat64".
- Make sure this definition is seen before glob-libc.h defines types that
- rely on 'struct stat'. */
-#include <sys/stat.h>
+#ifndef ***@GUARD_PREFIX@_GLOB_H
+#define ***@GUARD_PREFIX@_GLOB_H

-#ifndef __USE_GNU
-# define __USE_GNU 1
-#endif
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */

/* GCC 2.95 and later have "__restrict"; C99 compilers have
"restrict", and "configure" may have defined "restrict".
@@ -48,35 +49,71 @@
# endif
#endif

+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*_gl_glob_errfunc_fn) (const char *, int);
+#ifdef __cplusplus
+}
+#endif
+
+
+#if @REPLACE_GLOB@
+
+
+/* Preparations for including the standard GNU C Library header. */
+
+# include <libc-config.h>
+
+# include <stddef.h>
+
+/* On some systems, such as AIX 5.1, <sys/stat.h> does a "#define stat stat64".
+ Make sure this definition is seen before glob-libc.h defines types that
+ rely on 'struct stat'. */
+# include <sys/stat.h>
+
+# ifndef __USE_GNU
+# define __USE_GNU 1
+# endif
+
+# define glob rpl_glob
+# define globfree rpl_globfree
+# define glob_pattern_p rpl_glob_pattern_p
+# define __glob_pattern_p glob_pattern_p

-#define glob rpl_glob
-#define globfree rpl_globfree
-#define glob_pattern_p rpl_glob_pattern_p
-#define __glob_pattern_p glob_pattern_p
+# define __GLOB_GNULIB 1

-#define __GLOB_GNULIB 1

/* Now the standard GNU C Library header should work. */
-#include "glob-libc.h"
+# include "glob-libc.h"

-__BEGIN_DECLS
-typedef int (*_gl_glob_errfunc_fn) (const char *, int);
-__END_DECLS

-#if defined __cplusplus && defined GNULIB_NAMESPACE
-# undef glob
-# undef globfree
-# undef glob_pattern_p
+# if defined __cplusplus && defined GNULIB_NAMESPACE
+# undef glob
+# undef globfree
+# undef glob_pattern_p
_GL_CXXALIAS_RPL (glob, int, (const char *_Restrict_ __pattern, int __flags,
_gl_glob_errfunc_fn __errfunc,
glob_t *_Restrict_ __pglob));
_GL_CXXALIAS_RPL (globfree, void, (glob_t *__pglob));
_GL_CXXALIAS_RPL (glob_pattern_p, int, (const char *__pattern, int __quote));
-# if 0 /* The C function name is rpl_glob, not glob. */
+# endif
+
+#else
+
+_GL_CXXALIAS_SYS (glob, int, (const char *_Restrict_ __pattern, int __flags,
+ _gl_glob_errfunc_fn __errfunc,
+ glob_t *_Restrict_ __pglob));
+_GL_CXXALIAS_SYS (globfree, void, (glob_t *__pglob));
+_GL_CXXALIAS_SYS (glob_pattern_p, int, (const char *__pattern, int __quote));
+
+#endif
+
+#if 0 /* The C function name is rpl_glob in some cases, not glob. */
_GL_CXXALIASWARN (glob);
_GL_CXXALIASWARN (globfree);
_GL_CXXALIASWARN (glob_pattern_p);
-# endif
#endif

-#endif /* _GL_GLOB_H */
+#endif /* ***@GUARD_PREFIX@_GLOB_H */
+#endif /* ***@GUARD_PREFIX@_GLOB_H */
diff --git a/m4/glob.m4 b/m4/glob.m4
index 9dedb41..37cb917 100644
--- a/m4/glob.m4
+++ b/m4/glob.m4
@@ -1,4 +1,4 @@
-# glob.m4 serial 16
+# glob.m4 serial 18
dnl Copyright (C) 2005-2007, 2009-2018 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -9,54 +9,58 @@ dnl with or without modifications, as long as this notice is preserved.
# always include <glob.h> for the glob prototypes.

AC_DEFUN([gl_GLOB],
-[ GLOB_H=
- AC_CHECK_HEADERS([glob.h], [], [GLOB_H=glob.h])
+[
+ dnl <glob.h> is always overridden, because of the C++ GNULIB_NAMESPACE.
+ gl_CHECK_NEXT_HEADERS([glob.h])
+ if test $ac_cv_header_glob_h = yes; then
+ REPLACE_GLOB=0
+ else
+ REPLACE_GLOB=1
+ fi

- if test -z "$GLOB_H"; then
- AC_CACHE_CHECK([for GNU glob interface version 1],
- [gl_cv_gnu_glob_interface_version_1],
+ if test $REPLACE_GLOB = 0; then
+ AC_CACHE_CHECK([for GNU glob interface version 1 or 2],
+ [gl_cv_gnu_glob_interface_version_1_2],
[ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[[#include <gnu-versions.h>
-char a[_GNU_GLOB_INTERFACE_VERSION == 1 ? 1 : -1];]])],
- [gl_cv_gnu_glob_interface_version_1=yes],
- [gl_cv_gnu_glob_interface_version_1=no])])
+char a[_GNU_GLOB_INTERFACE_VERSION == 1 || _GNU_GLOB_INTERFACE_VERSION == 2 ? 1 : -1];]])],
+ [gl_cv_gnu_glob_interface_version_1_2=yes],
+ [gl_cv_gnu_glob_interface_version_1_2=no])])

- if test "$gl_cv_gnu_glob_interface_version_1" = "no"; then
- GLOB_H=glob.h
+ if test "$gl_cv_gnu_glob_interface_version_1_2" = "no"; then
+ REPLACE_GLOB=1
fi
fi

- if test -z "$GLOB_H"; then
+ if test $REPLACE_GLOB = 0; then
AC_CACHE_CHECK([whether glob lists broken symlinks],
[gl_cv_glob_lists_symlinks],
-[ if ln -s conf-doesntexist conf$$-globtest 2>/dev/null; then
- gl_cv_glob_lists_symlinks=maybe
- else
- # If we can't make a symlink, then we cannot test this issue. Be
- # pessimistic about this.
- gl_cv_glob_lists_symlinks=no
- fi
-
- if test $gl_cv_glob_lists_symlinks = maybe; then
- AC_RUN_IFELSE([
+ [if ln -s conf-doesntexist conf$$-globtest 2>/dev/null; then
+ gl_cv_glob_lists_symlinks=maybe
+ else
+ # If we can't make a symlink, then we cannot test this issue. Be
+ # pessimistic about this.
+ gl_cv_glob_lists_symlinks=no
+ fi
+ if test $gl_cv_glob_lists_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;]])],
- [gl_cv_glob_lists_symlinks=yes],
- [gl_cv_glob_lists_symlinks=no], [gl_cv_glob_lists_symlinks=no])
- fi])
+ [gl_cv_glob_lists_symlinks=yes],
+ [gl_cv_glob_lists_symlinks=no], [gl_cv_glob_lists_symlinks=no])
+ fi
+ rm -f conf$$-globtest
+ ])

if test $gl_cv_glob_lists_symlinks = no; then
- GLOB_H=glob.h
+ REPLACE_GLOB=1
fi
fi

- rm -f conf$$-globtest
-
- AC_SUBST([GLOB_H])
- AM_CONDITIONAL([GL_GENERATE_GLOB_H], [test -n "$GLOB_H"])
+ AC_SUBST([REPLACE_GLOB])
])

# Prerequisites of lib/glob.*.
diff --git a/modules/glob b/modules/glob
index 3a43222..94b3fd0 100644
--- a/modules/glob
+++ b/modules/glob
@@ -16,31 +16,30 @@ c99
extensions
largefile
snippet/c++defs
-snippet/warn-on-use
-alloca [test -n "$GLOB_H"]
-builtin-expect [test -n "$GLOB_H"]
-closedir [test -n "$GLOB_H"]
-d-type [test -n "$GLOB_H"]
-flexmember [test -n "$GLOB_H"]
-fnmatch [test -n "$GLOB_H"]
-getlogin_r [test -n "$GLOB_H"]
-libc-config [test -n "$GLOB_H"]
-lstat [test -n "$GLOB_H"]
-memchr [test -n "$GLOB_H"]
-mempcpy [test -n "$GLOB_H"]
-opendir [test -n "$GLOB_H"]
-readdir [test -n "$GLOB_H"]
-scratch_buffer [test -n "$GLOB_H"]
-stdbool [test -n "$GLOB_H"]
-stdint [test -n "$GLOB_H"]
-strdup [test -n "$GLOB_H"]
-sys_stat [test -n "$GLOB_H"]
-unistd [test -n "$GLOB_H"]
-malloc-posix [test -n "$GLOB_H"]
+alloca [test $REPLACE_GLOB = 1]
+builtin-expect [test $REPLACE_GLOB = 1]
+closedir [test $REPLACE_GLOB = 1]
+d-type [test $REPLACE_GLOB = 1]
+flexmember [test $REPLACE_GLOB = 1]
+fnmatch [test $REPLACE_GLOB = 1]
+getlogin_r [test $REPLACE_GLOB = 1]
+libc-config [test $REPLACE_GLOB = 1]
+lstat [test $REPLACE_GLOB = 1]
+memchr [test $REPLACE_GLOB = 1]
+mempcpy [test $REPLACE_GLOB = 1]
+opendir [test $REPLACE_GLOB = 1]
+readdir [test $REPLACE_GLOB = 1]
+scratch_buffer [test $REPLACE_GLOB = 1]
+stdbool [test $REPLACE_GLOB = 1]
+stdint [test $REPLACE_GLOB = 1]
+strdup [test $REPLACE_GLOB = 1]
+sys_stat [test $REPLACE_GLOB = 1]
+unistd [test $REPLACE_GLOB = 1]
+malloc-posix [test $REPLACE_GLOB = 1]

configure.ac:
gl_GLOB
-if test -n "$GLOB_H"; then
+if test $REPLACE_GLOB = 1; then
AC_LIBOBJ([glob])
AC_LIBOBJ([glob_pattern_p])
AC_LIBOBJ([globfree])
@@ -48,23 +47,22 @@ if test -n "$GLOB_H"; then
fi

Makefile.am:
-BUILT_SOURCES += $(GLOB_H)
+BUILT_SOURCES += glob.h

-# We need the following in order to create <glob.h> when the system
-# doesn't have one that works with the given compiler.
-if GL_GENERATE_GLOB_H
-glob.h: glob.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
+# We need the following in order to create <glob.h>.
+glob.h: glob.in.h $(top_builddir)/config.status $(CXXDEFS_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+ sed -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \
+ -e 's|@''REPLACE_GLOB''@|$(REPLACE_GLOB)|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+ -e 's|@''NEXT_GLOB_H''@|$(NEXT_GLOB_H)|g' \
+ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
< $(srcdir)/glob.in.h; \
} > $@-t && \
mv -f $@-t $@
-else
-glob.h: $(top_builddir)/config.status
- rm -f $@
-endif
MOSTLYCLEANFILES += glob.h glob.h-t

Include:

Loading...