Commit 0bae3bc1 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

make: config -- Add testing if we have libbsd installed

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 5f00a9ca
......@@ -3,6 +3,11 @@ include scripts/feature-tests.mak
CONFIG := include/config.h
ifeq ($(call try-cc,$(LIBBSD_DEV_TEST),-lbsd),y)
LIBS += -lbsd
DEFINES += -DCONFIG_HAS_LIBBSD
endif
$(CONFIG): scripts/utilities.mak scripts/feature-tests.mak include/config-base.h
$(E) " GEN " $@
$(Q) @echo '#ifndef __CR_CONFIG_H__' > $@
......@@ -16,10 +21,10 @@ endif
ifeq ($(call try-cc,$(PRLIMIT_TEST),),y)
$(Q) @echo '#define CONFIG_HAS_PRLIMIT' >> $@
endif
ifeq ($(call try-cc,$(STRLCPY_TEST),),y)
ifeq ($(call try-cc,$(STRLCPY_TEST),$(LIBS)),y)
$(Q) @echo '#define CONFIG_HAS_STRLCPY' >> $@
endif
ifeq ($(call try-cc,$(STRLCAT_TEST),),y)
ifeq ($(call try-cc,$(STRLCAT_TEST),$(LIBS)),y)
$(Q) @echo '#define CONFIG_HAS_STRLCAT' >> $@
endif
ifeq ($(call try-cc,$(PTRACE_PEEKSIGINFO_TEST),),y)
......
......@@ -4,6 +4,10 @@
#include <sys/types.h>
#include <string.h>
#ifdef CONFIG_HAS_LIBBSD
# include <bsd/string.h>
#endif
#include "config.h"
#ifndef CONFIG_HAS_STRLCPY
......
......@@ -30,10 +30,23 @@ int main(void)
}
endef
define LIBBSD_DEV_TEST
#include <bsd/string.h>
int main(void)
{
return 0;
}
endef
define STRLCPY_TEST
#include <string.h>
#ifdef CONFIG_HAS_LIBBSD
# include <bsd/string.h>
#endif
int main(void)
{
return strlcpy(NULL, NULL, 0);
......@@ -44,6 +57,10 @@ define STRLCAT_TEST
#include <string.h>
#ifdef CONFIG_HAS_LIBBSD
# include <bsd/string.h>
#endif
int main(void)
{
return strlcat(NULL, NULL, 0);
......
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