Use AC_REPLACE_FUNCS

strndup is removed from AC_CHECK_FUNCS since it will be provided if not
found.

Fixes #2610
next
Orestis Floros 2019-10-13 13:12:14 +03:00
parent 70c850ac13
commit b0d6f44779
No known key found for this signature in database
GPG Key ID: A09DBD7D3222C1C3
4 changed files with 6 additions and 10 deletions

View File

@ -72,7 +72,8 @@ AC_CHECK_TYPES([mode_t, off_t, pid_t, size_t, ssize_t], , [AC_MSG_FAILURE([canno
AC_FUNC_FORK
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_STRNLEN
AC_CHECK_FUNCS([atexit dup2 ftruncate getcwd gettimeofday localtime_r memchr memset mkdir rmdir setlocale socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strspn strstr strtol strtoul], , [AC_MSG_FAILURE([cannot find the $ac_func function, which i3 requires])])
AC_CHECK_FUNCS([atexit dup2 ftruncate getcwd gettimeofday localtime_r memchr memset mkdir rmdir setlocale socket strcasecmp strchr strdup strerror strncasecmp strrchr strspn strstr strtol strtoul], , [AC_MSG_FAILURE([cannot find the $ac_func function, which i3 requires])])
AC_REPLACE_FUNCS([mkdirp strndup])
# Checks for libraries.

View File

@ -341,8 +341,7 @@ gchar *g_utf8_make_valid(const gchar *str, gssize len);
*/
uint32_t get_colorpixel(const char *hex) __attribute__((const));
#if defined(__APPLE__)
#ifndef HAVE_strndup
/**
* Taken from FreeBSD
* Returns a pointer to a new string which is a duplicate of the
@ -350,7 +349,6 @@ uint32_t get_colorpixel(const char *hex) __attribute__((const));
*
*/
char *strndup(const char *str, size_t n);
#endif
/**
@ -528,7 +526,7 @@ char *resolve_tilde(const char *path);
*/
char *get_config_path(const char *override_configpath, bool use_system_paths);
#if !defined(__sun)
#ifndef HAVE_mkdirp
/**
* Emulates mkdir -p (creates any missing folders)
*

View File

@ -12,12 +12,11 @@
#include <string.h>
#include <sys/stat.h>
#ifndef HAVE_mkdirp
/*
* Emulates mkdir -p (creates any missing folders)
*
*/
#if !defined(__sun)
int mkdirp(const char *path, mode_t mode) {
if (mkdir(path, mode) == 0)
return 0;

View File

@ -10,8 +10,7 @@
#include <sys/types.h>
#include <string.h>
#if defined(__APPLE__)
#ifndef HAVE_strndup
/*
* Taken from FreeBSD
* Returns a pointer to a new string which is a duplicate of the
@ -30,5 +29,4 @@ char *strndup(const char *str, size_t n) {
copy[len] = '\0';
return (copy);
}
#endif