Blame view

buildroot/buildroot-2016.08.1/package/logrotate/0002-Use-autoconf-checks-for-strndup-and-asprintf.patch 1.76 KB
6b13f685e   김민수   BSP 최초 추가
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  From 24fd7f81f9966071717f6a0effe8190310f1b393 Mon Sep 17 00:00:00 2001
  From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  Date: Fri, 19 Aug 2016 22:39:17 +0200
  Subject: [PATCH] Use autoconf checks for strndup and asprintf
  
  The current code in config.c can provide its own implementation of
  asprintf() and strndup() if not provided by the system. However, in
  order to decide if they should be provided, the check done is:
  
   #if !defined(name_of_function)
  
  which only works if the function is actually defined as a macro, which
  is not necessarily the case.
  
  Therefore, we replace this logic by a proper AC_CHECK_FUNCS() check in
  the configure script.
  
  Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  ---
   config.c     | 4 ++--
   configure.ac | 2 ++
   2 files changed, 4 insertions(+), 2 deletions(-)
  
  diff --git a/config.c b/config.c
  index dbbf563..2209afd 100644
  --- a/config.c
  +++ b/config.c
  @@ -45,7 +45,7 @@
   #include "asprintf.c"
   #endif
   
  -#if !defined(asprintf) && !defined(_FORTIFY_SOURCE)
  +#if !defined(HAVE_ASPRINTF) && !defined(_FORTIFY_SOURCE)
   #include <stdarg.h>
   
   int asprintf(char **string_ptr, const char *format, ...)
  @@ -78,7 +78,7 @@ int asprintf(char **string_ptr, const char *format, ...)
   
   #endif
   
  -#if !defined(strndup)
  +#if !defined(HAVE_STRNDUP)
   char *strndup(const char *s, size_t n)
   {
          size_t nAvail;
  diff --git a/configure.ac b/configure.ac
  index e655b85..73b98da 100644
  --- a/configure.ac
  +++ b/configure.ac
  @@ -13,6 +13,8 @@ AC_STRUCT_ST_BLOCKS
   AC_CHECK_LIB([popt],[poptParseArgvString],,
     AC_MSG_ERROR([libpopt required but not found]))
   
  +AC_CHECK_FUNCS([strndup asprintf])
  +
   AC_ARG_WITH([selinux],
     [AS_HELP_STRING([--with-selinux],
       [support handling SELinux contexts (yes,no,check) @<:@default=check@:>@])],
  -- 
  2.7.4