tools/perf/build: Split out feature check: 'strlcpy'
authorIngo Molnar <mingo@kernel.org>
Tue, 8 Oct 2013 08:10:45 +0000 (10:10 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 9 Oct 2013 06:48:46 +0000 (08:48 +0200)
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/n/tip-ektO8cgvupthhyqqczSok2sr@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
tools/perf/config/Makefile
tools/perf/config/feature-checks/Makefile
tools/perf/config/feature-checks/test-strlcpy.c [new file with mode: 0644]

index 7e139694afc2b00165c6c577827307b0b09381db..c8ac4df05db1ebdcd2449f6a9f78ccae8afe265b 100644 (file)
@@ -121,6 +121,7 @@ FEATURE_TESTS =                             \
        libperl                         \
        libpython                       \
        libpython-version               \
+       strlcpy                         \
        libbfd                          \
        libnuma
 
@@ -434,7 +435,7 @@ else
 endif
 
 ifndef NO_STRLCPY
-  ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY_SUPPORT),y)
+  ifeq ($(feature-strlcpy), 1)
     CFLAGS += -DHAVE_STRLCPY_SUPPORT
   endif
 endif
index af65aaa93e16807ed693e92b14e10d904365d2b9..d348aa0ec181e5c6f4f8b8d9ea542b4ff7c0f609 100644 (file)
@@ -19,6 +19,7 @@ FILES=                                        \
        test-libperl                    \
        test-libpython                  \
        test-libpython-version          \
+       test-strlcpy                    \
        test-libbfd                     \
        test-libnuma
 
@@ -113,6 +114,9 @@ test-libpython:
 test-libpython-version:
        $(BUILD) $(FLAGS_PYTHON_EMBED)
 
+test-strlcpy:
+       $(BUILD)
+
 test-libbfd:
        $(BUILD) -DPACKAGE='perf' -DPACKAGE=perf -lbfd -ldl
 
diff --git a/tools/perf/config/feature-checks/test-strlcpy.c b/tools/perf/config/feature-checks/test-strlcpy.c
new file mode 100644 (file)
index 0000000..4a6b6ff
--- /dev/null
@@ -0,0 +1,8 @@
+#include <stdlib.h>
+extern size_t strlcpy(char *dest, const char *src, size_t size);
+
+int main(void)
+{
+       strlcpy(NULL, NULL, 0);
+       return 0;
+}