[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] cmake: check for GNU compatible glob support


The GLOB_TILDE flag is a GNU extension. musl libc does not implement
this extension, which leads to build failure:

.../libssh-0.8.1/src/config.c: In function 'local_parse_glob':
/home/buildroot/autobuild/run/instance-1/output/build/libssh-0.8.1/src/config.c:329:10: error: 'glob_t {aka struct <anonymous>}' has no member named 'gl_flags'; did you mean 'gl_offs'?
         .gl_flags = 0,
          ^~~~~~~~
          gl_offs
.../libssh-0.8.1/src/config.c:334:25: error: 'GLOB_TILDE' undeclared (first use in this function); did you mean '_IO_FILE'?
     rt = glob(fileglob, GLOB_TILDE, NULL, &globbuf);
                         ^~~~~~~~~~
                         _IO_FILE

Check for GLOB_TILDE directly to make sure the libc provides the
required extension.

Signed-off-by: Baruch Siach <baruch@xxxxxxxxxx>
---
 ConfigureChecks.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index f91bd038f5a3..dac61bcf678e 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -156,7 +156,7 @@ check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO)
 check_function_exists(memset_s HAVE_MEMSET_S)
 
 if (HAVE_GLOB_H)
-  check_function_exists(glob HAVE_GLOB)
+  check_symbol_exists(GLOB_TILDE "glob.h" HAVE_GLOB)
 endif (HAVE_GLOB_H)
 
 if (NOT WIN32)
-- 
2.18.0


Archive administrator: postmaster@lists.cynapses.org