Skip to content

Commit

Permalink
More autoconf work
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenk committed Dec 5, 2016
1 parent dcb67fd commit 865f2eb
Show file tree
Hide file tree
Showing 14 changed files with 4,581 additions and 4,734 deletions.
9,077 changes: 4,496 additions & 4,581 deletions configure.ac

Large diffs are not rendered by default.

38 changes: 16 additions & 22 deletions src/Makefile.am
@@ -1,8 +1,4 @@
SUBDIRS = libcollectdclient
if BUILD_WITH_OWN_LIBOCONFIG
SUBDIRS += liboconfig
endif
SUBDIRS += daemon
SUBDIRS = libcollectdclient liboconfig daemon

PLUGIN_LDFLAGS = -module -avoid-version -export-symbols-regex '\<module_register\>'

Expand Down Expand Up @@ -381,6 +377,7 @@ if BUILD_PLUGIN_DISK
pkglib_LTLIBRARIES += disk.la
disk_la_SOURCES = disk.c
disk_la_CFLAGS = $(AM_CFLAGS)
disk_la_CPPFLAGS = $(AM_CPPFLAGS)
disk_la_LDFLAGS = $(PLUGIN_LDFLAGS)
disk_la_LIBADD =
if BUILD_WITH_LIBKSTAT
Expand All @@ -397,7 +394,7 @@ disk_la_CFLAGS += $(BUILD_WITH_LIBSTATGRAB_CFLAGS)
disk_la_LIBADD += $(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
endif
if BUILD_WITH_LIBUDEV
disk_la_CFLAGS += $(BUILD_WITH_LIBUDEV_CFLAGS)
disk_la_CPPFLAGS += $(BUILD_WITH_LIBUDEV_CPPFLAGS)
disk_la_LDFLAGS += $(BUILD_WITH_LIBUDEV_LDFLAGS)
disk_la_LIBADD += $(BUILD_WITH_LIBUDEV_LIBS)
endif
Expand All @@ -412,8 +409,9 @@ endif
if BUILD_PLUGIN_DNS
pkglib_LTLIBRARIES += dns.la
dns_la_SOURCES = dns.c utils_dns.c utils_dns.h
dns_la_LDFLAGS = $(PLUGIN_LDFLAGS)
dns_la_LIBADD = -lpcap
dns_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBPCAP_CPPFLAGS)
dns_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBPCAP_LDFLAGS)
dns_la_LIBADD = $(BUILD_WITH_LIBPCAP_LIBS)
endif

if BUILD_PLUGIN_DPDKSTAT
Expand Down Expand Up @@ -728,9 +726,9 @@ endif
if BUILD_PLUGIN_MIC
pkglib_LTLIBRARIES += mic.la
mic_la_SOURCES = mic.c
mic_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_MIC_LIBPATH)
mic_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_MIC_CPPFLAGS)
mic_la_LIBADD = $(BUILD_WITH_MIC_LDADD)
mic_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_MIC_CPPFLAGS)
mic_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_MIC_LDFLAGS)
mic_la_LIBADD = $(BUILD_WITH_MIC_LIBS)
endif

if BUILD_PLUGIN_MODBUS
Expand Down Expand Up @@ -827,8 +825,9 @@ endif
if BUILD_PLUGIN_NOTIFY_EMAIL
pkglib_LTLIBRARIES += notify_email.la
notify_email_la_SOURCES = notify_email.c
notify_email_la_LDFLAGS = $(PLUGIN_LDFLAGS)
notify_email_la_LIBADD = -lesmtp -lssl -lcrypto
notify_email_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBESMTP_CPPFLAGS)
notify_email_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBESMTP_LDFLAGS)
notify_email_la_LIBADD = $(BUILD_WITH_LIBESMTP_LIBS)
endif

if BUILD_PLUGIN_NOTIFY_NAGIOS
Expand Down Expand Up @@ -915,11 +914,6 @@ perl_la_CPPFLAGS += -D_GNU_SOURCE
perl_la_CFLAGS = $(AM_CFLAGS) \
$(PERL_CFLAGS) \
-DXS_VERSION=\"$(VERSION)\" -DVERSION=\"$(VERSION)\"
# Work-around for issues #41 and #42 - Perl 5.10 incorrectly introduced
# __attribute__nonnull__(3) for Perl_load_module().
if HAVE_BROKEN_PERL_LOAD_MODULE
perl_la_CFLAGS += -Wno-nonnull
endif
perl_la_LDFLAGS = $(PLUGIN_LDFLAGS) \
$(PERL_LDFLAGS)
perl_la_LIBADD = $(PERL_LIBS)
Expand Down Expand Up @@ -955,7 +949,7 @@ postgresql_la_SOURCES = postgresql.c \
postgresql_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBPQ_CPPFLAGS)
postgresql_la_LDFLAGS = $(PLUGIN_LDFLAGS) \
$(BUILD_WITH_LIBPQ_LDFLAGS)
postgresql_la_LIBADD = -lpq
postgresql_la_LIBADD = $(BUILD_WITH_LIBPQ_LIBS)
endif

if BUILD_PLUGIN_POWERDNS
Expand Down Expand Up @@ -1033,9 +1027,9 @@ endif
if BUILD_PLUGIN_SENSORS
pkglib_LTLIBRARIES += sensors.la
sensors_la_SOURCES = sensors.c
sensors_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBSENSORS_CFLAGS)
sensors_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBSENSORS_CPPFLAGS)
sensors_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBSENSORS_LDFLAGS)
sensors_la_LIBADD = -lsensors
sensors_la_LIBADD = $(BUILD_WITH_LIBSENSORS_LIBS)
endif

if BUILD_PLUGIN_SERIAL
Expand All @@ -1056,7 +1050,7 @@ if BUILD_PLUGIN_SMART
if BUILD_WITH_LIBUDEV
pkglib_LTLIBRARIES += smart.la
smart_la_SOURCES = smart.c
smart_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBATASMART_CPPFLAGS) $(BUILD_WITH_LIBUDEV_CFLAGS)
smart_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBATASMART_CPPFLAGS) $(BUILD_WITH_LIBUDEV_CPPFLAGS)
smart_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBATASMART_LDFLAGS) $(BUILD_WITH_LIBUDEV_LDFLAGS)
smart_la_LIBADD = $(BUILD_WITH_LIBATASMART_LIBS) $(BUILD_WITH_LIBUDEV_LIBS)
endif
Expand Down
4 changes: 0 additions & 4 deletions src/apple_sensors.c
Expand Up @@ -29,10 +29,6 @@
#include "common.h"
#include "plugin.h"

#if HAVE_CTYPE_H
#include <ctype.h>
#endif

#if HAVE_MACH_MACH_TYPES_H
#include <mach/mach_types.h>
#endif
Expand Down
7 changes: 0 additions & 7 deletions src/daemon/Makefile.am
Expand Up @@ -23,9 +23,6 @@ endif
if BUILD_WITH_LIBSOCKET
COMMON_LIBS += -lsocket
endif
if BUILD_WITH_LIBRESOLV
COMMON_LIBS += -lresolv
endif
if BUILD_WITH_LIBKSTAT
COMMON_LIBS += -lkstat
endif
Expand Down Expand Up @@ -81,12 +78,8 @@ collectd_CFLAGS += $(BUILD_WITH_LIBSTATGRAB_CFLAGS)
collectd_LDADD += $(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
endif

if BUILD_WITH_OWN_LIBOCONFIG
collectd_LDADD += $(top_builddir)/src/liboconfig/liboconfig.la
collectd_DEPENDENCIES += $(top_builddir)/src/liboconfig/liboconfig.la
else
collectd_LDADD += -loconfig
endif

LOG_COMPILER = env VALGRIND="@VALGRIND@" $(abs_top_srcdir)/testwrapper.sh

Expand Down
58 changes: 11 additions & 47 deletions src/daemon/collectd.h
Expand Up @@ -31,36 +31,27 @@
#include "config.h"
#endif

#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#if STDC_HEADERS
#include <stddef.h>
#include <stdlib.h>
#else
#if HAVE_STDLIB_H
#include <stdlib.h>
#endif
#endif
#if HAVE_STRING_H
#if !STDC_HEADERS && HAVE_MEMORY_H
#include <memory.h>
#endif
#include <string.h>
#endif
#if HAVE_STRINGS_H
#include <strings.h>
#endif
#if HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
Expand All @@ -73,18 +64,9 @@
#ifndef WIFEXITED
#define WIFEXITED(stat_val) (((stat_val)&255) == 0)
#endif
#if HAVE_SIGNAL_H
#include <signal.h>
#endif
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
#if HAVE_ERRNO_H
#include <errno.h>
#endif
#if HAVE_LIMITS_H
#include <limits.h>
#endif
#if TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
Expand All @@ -99,18 +81,6 @@
#include <sys/socket.h>
#endif

#if HAVE_ASSERT_H
#include <assert.h>
#else
#define assert(...) /* nop */
#endif

#if !defined(HAVE__BOOL) || !HAVE__BOOL
typedef int _Bool;
#undef HAVE__BOOL
#define HAVE__BOOL 1
#endif

#if NAN_STATIC_DEFAULT
#include <math.h>
/* #endif NAN_STATIC_DEFAULT*/
Expand Down Expand Up @@ -212,12 +182,6 @@ typedef int _Bool;
#endif
#endif

#if HAVE_STDARG_H
#include <stdarg.h>
#endif
#if HAVE_CTYPE_H
#include <ctype.h>
#endif
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
Expand Down
4 changes: 0 additions & 4 deletions src/daemon/common.c
Expand Up @@ -37,10 +37,6 @@
#include "plugin.h"
#include "utils_cache.h"

#ifdef HAVE_MATH_H
#include <math.h>
#endif

/* for getaddrinfo */
#include <netdb.h>
#include <sys/types.h>
Expand Down
20 changes: 10 additions & 10 deletions src/disk.c
Expand Up @@ -139,7 +139,7 @@ static int pnumdisk;
#error "No applicable input method."
#endif

#if HAVE_LIBUDEV
#if HAVE_UDEV_H
#include <libudev.h>

static char *conf_udev_name_attr = NULL;
Expand Down Expand Up @@ -173,7 +173,7 @@ static int disk_config(const char *key, const char *value) {
"on Mach / Mac OS X and will be ignored.");
#endif
} else if (strcasecmp("UdevNameAttr", key) == 0) {
#if HAVE_LIBUDEV
#if HAVE_UDEV_H
if (conf_udev_name_attr != NULL) {
free(conf_udev_name_attr);
conf_udev_name_attr = NULL;
Expand Down Expand Up @@ -209,15 +209,15 @@ static int disk_init(void) {
/* #endif HAVE_IOKIT_IOKITLIB_H */

#elif KERNEL_LINUX
#if HAVE_LIBUDEV
#if HAVE_UDEV_H
if (conf_udev_name_attr != NULL) {
handle_udev = udev_new();
if (handle_udev == NULL) {
ERROR("disk plugin: udev_new() failed!");
return (-1);
}
}
#endif /* HAVE_LIBUDEV */
#endif /* HAVE_UDEV_H */
/* #endif KERNEL_LINUX */

#elif KERNEL_FREEBSD
Expand Down Expand Up @@ -260,10 +260,10 @@ static int disk_init(void) {

static int disk_shutdown(void) {
#if KERNEL_LINUX
#if HAVE_LIBUDEV
#if HAVE_UDEV_H
if (handle_udev != NULL)
udev_unref(handle_udev);
#endif /* HAVE_LIBUDEV */
#endif /* HAVE_UDEV_H */
#endif /* KERNEL_LINUX */
return (0);
} /* int disk_shutdown */
Expand Down Expand Up @@ -325,7 +325,7 @@ static counter_t disk_calc_time_incr(counter_t delta_time,
}
#endif

#if HAVE_LIBUDEV
#if HAVE_UDEV_H
/**
* Attempt to provide an rename disk instance from an assigned udev attribute.
*
Expand Down Expand Up @@ -842,7 +842,7 @@ static int disk_read(void) {

output_name = disk_name;

#if HAVE_LIBUDEV
#if HAVE_UDEV_H
char *alt_name = NULL;
if (conf_udev_name_attr != NULL) {
alt_name =
Expand All @@ -853,7 +853,7 @@ static int disk_read(void) {
#endif

if (ignorelist_match(ignorelist, output_name) != 0) {
#if HAVE_LIBUDEV
#if HAVE_UDEV_H
/* release udev-based alternate name, if allocated */
sfree(alt_name);
#endif
Expand All @@ -879,7 +879,7 @@ static int disk_read(void) {
submit_io_time(output_name, io_time, weighted_time);
} /* if (is_disk) */

#if HAVE_LIBUDEV
#if HAVE_UDEV_H
/* release udev-based alternate name, if allocated */
sfree(alt_name);
#endif
Expand Down
2 changes: 0 additions & 2 deletions src/libcollectdclient/collectd/client.h
Expand Up @@ -39,9 +39,7 @@
/*
* Includes (for data types)
*/
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <inttypes.h>
#include <time.h>

Expand Down
12 changes: 6 additions & 6 deletions src/libcollectdclient/network_buffer.c
Expand Up @@ -35,7 +35,7 @@

#include <pthread.h>

#if HAVE_LIBGCRYPT
#if HAVE_GCRYPT_H
#if defined __APPLE__
/* default xcode compiler throws warnings even when deprecated functionality
* is not used. -Werror breaks the build because of erroneous warnings.
Expand Down Expand Up @@ -106,7 +106,7 @@ struct lcc_network_buffer_s {
char *username;
char *password;

#if HAVE_LIBGCRYPT
#if HAVE_GCRYPT_H
gcry_cipher_hd_t encr_cypher;
size_t encr_header_len;
char encr_iv[16];
Expand All @@ -131,7 +131,7 @@ static _Bool have_gcrypt(void) /* {{{ */
return (result);
need_init = 0;

#if HAVE_LIBGCRYPT
#if HAVE_GCRYPT_H
#if GCRYPT_VERSION_NUMBER < 0x010600
if (gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread))
return (0);
Expand Down Expand Up @@ -475,7 +475,7 @@ static int nb_add_value_list(lcc_network_buffer_t *nb, /* {{{ */
return (0);
} /* }}} int nb_add_value_list */

#if HAVE_LIBGCRYPT
#if HAVE_GCRYPT_H
static int nb_add_signature(lcc_network_buffer_t *nb) /* {{{ */
{
char *buffer;
Expand Down Expand Up @@ -688,7 +688,7 @@ int lcc_network_buffer_initialize(lcc_network_buffer_t *nb) /* {{{ */
nb->ptr = nb->buffer;
nb->free = nb->size;

#if HAVE_LIBGCRYPT
#if HAVE_GCRYPT_H
if (nb->seclevel == SIGN) {
size_t username_len;
uint16_t pkg_type = htons(TYPE_SIGN_SHA256);
Expand Down Expand Up @@ -739,7 +739,7 @@ int lcc_network_buffer_finalize(lcc_network_buffer_t *nb) /* {{{ */
if (nb == NULL)
return (EINVAL);

#if HAVE_LIBGCRYPT
#if HAVE_GCRYPT_H
if (nb->seclevel == SIGN)
return nb_add_signature(nb);
else if (nb->seclevel == ENCRYPT)
Expand Down

0 comments on commit 865f2eb

Please sign in to comment.