From 2e8f2f03e794144701a0e391b9d582cda224ba1b Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 17 Sep 2018 07:29:48 +0200 Subject: [PATCH] cmake: Correctly detect if glob has gl_flags member Thanks to Baruch Siach. Signed-off-by: Andreas Schneider --- ConfigureChecks.cmake | 5 +++-- config.h.cmake | 3 +++ src/config.c | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index f91bd038..de17b850 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -4,7 +4,7 @@ include(CheckSymbolExists) include(CheckFunctionExists) include(CheckLibraryExists) include(CheckTypeSize) -include(CheckCXXSourceCompiles) +include(CheckStructHasMember) include(TestBigEndian) set(PACKAGE ${PROJECT_NAME}) @@ -156,7 +156,8 @@ 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_struct_has_member(glob_t gl_flags glob.h HAVE_GLOB_GL_FLAGS_MEMBER) + check_function_exists(glob HAVE_GLOB) endif (HAVE_GLOB_H) if (NOT WIN32) diff --git a/config.h.cmake b/config.h.cmake index 96dd4a87..d7adb154 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -89,6 +89,9 @@ /* Define to 1 if you have DSA */ #cmakedefine HAVE_DSA 1 +/* Define to 1 if you have gl_flags as a glob_t sturct member */ +#cmakedefine HAVE_GLOB_GL_FLAGS_MEMBER 1 + /*************************** FUNCTIONS ***************************/ /* Define to 1 if you have the `EVP_aes128_ctr' function. */ diff --git a/src/config.c b/src/config.c index 537b3ba9..df6b48bf 100644 --- a/src/config.c +++ b/src/config.c @@ -347,7 +347,7 @@ static void local_parse_file(ssh_session session, const char *filename, int *par return; } -#ifdef HAVE_GLOB +#if defined(HAVE_GLOB) && defined(HAVE_GLOB_GL_FLAGS_MEMBER) static void local_parse_glob(ssh_session session, const char *fileglob, int *parsing, @@ -376,7 +376,7 @@ static void local_parse_glob(ssh_session session, globfree(&globbuf); } -#endif /* HAVE_GLOB */ +#endif /* HAVE_GLOB HAVE_GLOB_GL_FLAGS_MEMBER */ static enum ssh_config_match_e ssh_config_get_match_opcode(const char *keyword)