Commit 8341d6cf by Patrick Steinhardt

cmake: move regcomp and futimens checks to "features.h"

In our CMakeLists.txt, we have to check multiple functions in order to
determine if we have to use our own or whether we can use the
platform-provided one. For two of these functions, namely `regcomp_l()`
and `futimens`, the defined macro is actually used inside of the header
file "src/unix/posix.h". As such, these macros are not only required by
the library, but also by our test suite, which is makes use of internal
headers.

To prepare for the CMakeLists.txt split, move these two defines inside
of the "features.h" header.
parent a390a846
......@@ -520,12 +520,12 @@ ENDIF()
CHECK_SYMBOL_EXISTS(regcomp_l "regex.h;xlocale.h" HAVE_REGCOMP_L)
IF (HAVE_REGCOMP_L)
ADD_DEFINITIONS(-DHAVE_REGCOMP_L)
SET(GIT_USE_REGCOMP_L 1)
ENDIF ()
CHECK_FUNCTION_EXISTS(futimens HAVE_FUTIMENS)
IF (HAVE_FUTIMENS)
ADD_DEFINITIONS(-DHAVE_FUTIMENS)
SET(GIT_USE_FUTIMENS 1)
ENDIF ()
CHECK_FUNCTION_EXISTS(qsort_r HAVE_QSORT_R)
......
......@@ -14,6 +14,8 @@
#cmakedefine GIT_USE_STAT_MTIM 1
#cmakedefine GIT_USE_STAT_MTIMESPEC 1
#cmakedefine GIT_USE_STAT_MTIME_NSEC 1
#cmakedefine GIT_USE_FUTIMENS 1
#cmakedefine GIT_USE_REGCOMP_L 1
#cmakedefine GIT_SSH 1
#cmakedefine GIT_SSH_MEMORY_CREDENTIALS 1
......
......@@ -72,7 +72,7 @@ GIT_INLINE(int) p_fsync(int fd)
#define p_timeval timeval
#ifdef HAVE_FUTIMENS
#ifdef GIT_USE_FUTIMENS
GIT_INLINE(int) p_futimes(int f, const struct p_timeval t[2])
{
struct timespec s[2];
......@@ -86,7 +86,7 @@ GIT_INLINE(int) p_futimes(int f, const struct p_timeval t[2])
# define p_futimes futimes
#endif
#ifdef HAVE_REGCOMP_L
#ifdef GIT_USE_REGCOMP_L
#include <xlocale.h>
GIT_INLINE(int) p_regcomp(regex_t *preg, const char *pattern, int cflags)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment