Make memcheck/tests/stpncpy be dependent on the presence/absence of

stpncpy in libc, as determined by a configure test.  n-i-bz.
(Mark Wielaard, mjw@redhat.com)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13180
This commit is contained in:
Julian Seward 2012-12-14 10:30:57 +00:00
parent 4cbf48c509
commit 87d6d6fd1c
4 changed files with 30 additions and 1 deletions

View File

@ -1016,6 +1016,29 @@ AC_MSG_RESULT([no])
AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
# Check for stpncpy function definition in string.h
# This explicitly checks with _GNU_SOURCE defined since that is also
# used in the test case (some systems might define it without anyway
# since stpncpy is part of The Open Group Base Specifications Issue 7
# IEEE Std 1003.1-2008.
AC_MSG_CHECKING([for stpncpy])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <string.h>
]], [[
char *d;
char *s;
size_t n = 0;
char *r = stpncpy(d, s, n);
]])], [
ac_have_gnu_stpncpy=yes
AC_MSG_RESULT([yes])
], [
ac_have_gnu_stpncpy=no
AC_MSG_RESULT([no])
])
AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
# Check for CLOCK_MONOTONIC

View File

@ -288,7 +288,6 @@ check_PROGRAMS = \
sbfragment \
sh-mem sh-mem-random \
sigaltstack signal2 sigprocmask static_malloc sigkill \
stpncpy \
strchr \
str_tester \
supp_unknown supp1 supp2 suppfree \
@ -307,6 +306,10 @@ if DWARF4
check_PROGRAMS += dw4
endif
if HAVE_GNU_STPNCPY
check_PROGRAMS += stpncpy
endif
AM_CFLAGS += $(AM_FLAG_M3264_PRI)
AM_CXXFLAGS += $(AM_FLAG_M3264_PRI)

View File

@ -1,5 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#define _GNU_SOURCE
#include <string.h>
int main(int argc, char **argv)

View File

@ -1,2 +1,3 @@
prog: stpncpy
prereq: test -e ./stpncpy
vgopts: -q