Check for getprogname() et al, and use config.h for #ifndefs
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
ad70b49790
commit
8f66822b2a
@ -44,6 +44,9 @@ PKG_PROG_PKG_CONFIG
|
||||
AC_REPLACE_FUNCS([pidfile strlcpy strlcat utimensat])
|
||||
AC_CONFIG_LIBOBJ_DIR([lib])
|
||||
|
||||
# Check for other library functions
|
||||
AC_CHECK_FUNCS([getprogname strtobytes])
|
||||
|
||||
# Command line options
|
||||
AC_ARG_WITH(suspend-time,
|
||||
AS_HELP_STRING([--with-suspend-time=SEC], [Retry timeout for remote syslogd servers, default: 180]),
|
||||
|
13
src/compat.h
13
src/compat.h
@ -30,6 +30,7 @@
|
||||
#ifndef SYSKLOGD_COMPAT_H_
|
||||
#define SYSKLOGD_COMPAT_H_
|
||||
|
||||
#include <config.h>
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -48,33 +49,38 @@
|
||||
/* Pthread wrapper for BSD LWP mutexes */
|
||||
typedef pthread_mutex_t mutex_t;
|
||||
|
||||
#ifndef mutex_lock
|
||||
#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
|
||||
#define mutex_lock(m) pthread_mutex_lock(m)
|
||||
#define mutex_unlock(m) pthread_mutex_unlock(m)
|
||||
#endif
|
||||
|
||||
/* BSD have sa_len, Linux/GNU doesn't */
|
||||
#if defined(_AIX) || (defined(BSD) && (BSD >= 199006)) /* sa_len was added with 4.3-Reno */
|
||||
#define HAVE_SA_LEN
|
||||
#endif
|
||||
|
||||
#ifndef strlcpy
|
||||
#ifndef HAVE_STRLCPY
|
||||
size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||
#endif
|
||||
|
||||
#ifndef strlcat
|
||||
#ifndef HAVE_STRLCAT
|
||||
size_t strlcat(char *dst, const char *src, size_t siz);
|
||||
#endif
|
||||
|
||||
#ifndef pidfile
|
||||
#ifndef HAVE_PIDFILE
|
||||
int pidfile(const char *basename);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETPROGNAME
|
||||
static inline char *getprogname(void)
|
||||
{
|
||||
extern char *__progname;
|
||||
return __progname;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRTOBYTES
|
||||
static inline int strtobytes(char *arg)
|
||||
{
|
||||
int mod = 0, bytes;
|
||||
@ -103,6 +109,7 @@ static inline int strtobytes(char *arg)
|
||||
|
||||
return bytes;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void parse_rotation(char *optarg, off_t *size, int *num)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user