summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 176a71f)
raw | patch | inline | side by side (parent: 176a71f)
author | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Fri, 19 Aug 2016 20:14:30 +0000 (22:14 +0200) | ||
committer | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Tue, 29 Nov 2016 15:55:18 +0000 (16:55 +0100) |
The only distro that we still support that uses libtool version 1
is RHEL5, but that will be EOL in a few months.
is RHEL5, but that will be EOL in a few months.
.gitignore | patch | blob | history | |
Makefile.am | patch | blob | history | |
README | patch | blob | history | |
build.sh | patch | blob | history | |
clean.sh | patch | blob | history | |
configure.ac | patch | blob | history | |
contrib/redhat/collectd.spec | patch | blob | history | |
src/daemon/Makefile.am | patch | blob | history | |
src/daemon/configfile.c | patch | blob | history | |
src/daemon/plugin.c | patch | blob | history | |
src/daemon/plugin.h | patch | blob | history |
diff --git a/.gitignore b/.gitignore
index 8154d73329ba87a31d90b4182d815f447ddabe21..6927e5114daf8e18b60e243b873b4c97c6e2de2c 100644 (file)
--- a/.gitignore
+++ b/.gitignore
/aclocal.m4
/autom4te.cache
/autom4te.cache
+/build-aux/
/compile
/config.guess
/config.sub
/install-sh
/libltdl/
/ltmain.sh
+/m4/libtool.m4
+/m4/ltargz.m4
+/m4/ltdl.m4
+/m4/lt~obsolete.m4
+/m4/ltoptions.m4
+/m4/ltsugar.m4
+/m4/ltversion.m4
/missing
-src/config.h.in
+/src/config.h.in
# configure stuff:
Makefile
diff --git a/Makefile.am b/Makefile.am
index 03bdd39a3500abf9cd514b02881583510b392238..83b0d647b31d07cb1bdbdd73db4e4923f39dec32 100644 (file)
--- a/Makefile.am
+++ b/Makefile.am
-ACLOCAL_AMFLAGS = -I libltdl/m4
+ACLOCAL_AMFLAGS = -I m4
-SUBDIRS =
-
-if BUILD_INCLUDED_LTDL
-SUBDIRS += libltdl
-endif
-
-SUBDIRS += proto src bindings .
-
-AM_CPPFLAGS = $(LTDLINCL)
+SUBDIRS = proto src bindings .
EXTRA_DIST = contrib version-gen.sh testwrapper.sh
$(mkinstalldirs) $(DESTDIR)$(localstatedir)/log
maintainer-clean-local:
- -rm -f -r libltdl
-rm -f INSTALL
-rm -f aclocal.m4
index 0989312f413f640a9dc5be0d80b1ee44efcab824..7754d87ce69d5af88af8f5484662c16811e12c2a 100644 (file)
--- a/README
+++ b/README
- flex
- bison
- libtool
-- libtool-ltdl
- pkg-config
The `build.sh' script takes no arguments.
diff --git a/build.sh b/build.sh
index 57f3d4449a99bef83b75b50f425dc548bc9ead60..465eff9d8eaffcd1a917382722364c4a152791e2 100755 (executable)
--- a/build.sh
+++ b/build.sh
autoheader \
&& aclocal \
-&& $libtoolize --ltdl --copy --force \
+&& $libtoolize --copy --force \
&& automake --add-missing --copy \
&& autoconf
diff --git a/clean.sh b/clean.sh
index 6780cdabfc9bc4b134b9bbc39cea998d88e420d3..ac3c3105f8d57cd524ea470d5b9ae331c91399a1 100755 (executable)
--- a/clean.sh
+++ b/clean.sh
&& rm -f configure \
&& rm -f depcomp \
&& rm -f install-sh \
-&& rm -f -r libltdl \
&& rm -f libtool \
&& rm -f ltmain.sh \
&& rm -f Makefile \
diff --git a/configure.ac b/configure.ac
index 7f0dd5ca2ad0507ceb2f4acbd83170b508b68908..c66ff7d566be3e8631df807622c0e5e884cff3e6 100644 (file)
--- a/configure.ac
+++ b/configure.ac
AC_INIT([collectd],[m4_esyscmd(./version-gen.sh)])
AC_CONFIG_SRCDIR(src/target_set.c)
AC_CONFIG_HEADERS(src/config.h)
-AC_CONFIG_AUX_DIR([libltdl/config])
+AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_MACRO_DIR([m4])
dnl older automake's default of ARFLAGS=cru is noisy on newer binutils;
dnl we don't really need the 'u' even in older toolchains. Then there is
dnl older libtool, which spelled it AR_FLAGS
m4_divert_text([DEFAULTS], [: "${ARFLAGS=cr} ${AR_FLAGS=cr}"])
-m4_ifdef([LT_PACKAGE_VERSION],
- # libtool >= 2.2
- [
- LT_CONFIG_LTDL_DIR([libltdl])
- LT_INIT([dlopen])
- LTDL_INIT([convenience])
- AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.])
- ]
-,
- # libtool <= 1.5
- [
- AC_LIBLTDL_CONVENIENCE
- AC_SUBST(LTDLINCL)
- AC_SUBST(LIBLTDL)
- AC_LIBTOOL_DLOPEN
- AC_CONFIG_SUBDIRS(libltdl)
- AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.])
- ]
-)
-
-AM_CONDITIONAL([BUILD_INCLUDED_LTDL], [test "x$LTDLDEPS" != "x"])
+LT_INIT([dlopen])
AM_INIT_AUTOMAKE([subdir-objects tar-pax dist-bzip2 no-dist-gzip foreign])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
AC_DISABLE_STATIC
-AC_PROG_LIBTOOL
AC_PROG_LEX
AC_PROG_YACC
AC_MSG_ERROR([bison is missing and you do not have ${srcdir}/src/liboconfig/parser.c. Please install bison])
fi
+AS_IF([test "x$lt_cv_dlopen" = "xno"],
+ [AC_MSG_ERROR([Your system does not support dlopen])]
+)
+
+AC_SUBST([DLOPEN_LIBS], [$lt_cv_dlopen_libs])
+
AC_ARG_VAR([PROTOC], [path to the protoc binary])
AC_PATH_PROG([PROTOC], [protoc])
have_protoc3="no"
index 4fc76e11c4c54bfb6b01386afb1543e1eb6a5a29..09cc3b18feaf554158410d61a9524448f4b7380d 100644 (file)
License: GPLv2
Group: System Environment/Daemons
BuildRoot: %{_tmppath}/%{name}-%{version}-root
-BuildRequires: libgcrypt-devel, kernel-headers, libtool-ltdl-devel, libcap-devel, which
+BuildRequires: libgcrypt-devel, kernel-headers, libcap-devel, which
Vendor: collectd development team <collectd@verplant.org>
%if 0%{?fedora} || 0%{?rhel} >= 7
%configure CFLAGS="%{optflags} -DLT_LAZY_OR_NOW=\"RTLD_LAZY|RTLD_GLOBAL\"" \
%{?_python_config} \
--disable-static \
- --without-included-ltdl \
--enable-all-plugins=yes \
--enable-match_empty_counter \
--enable-match_hashed \
diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am
index 52079438109ce282fbedcbbbc696e2c1cc9f5d89..74af5196a25f07ca0811201b191ec488cd962e43 100644 (file)
--- a/src/daemon/Makefile.am
+++ b/src/daemon/Makefile.am
utils_threshold.c utils_threshold.h
-collectd_CPPFLAGS = $(AM_CPPFLAGS) $(LTDLINCL)
collectd_CFLAGS = $(AM_CFLAGS)
collectd_LDFLAGS = -export-dynamic
-collectd_LDADD = libavltree.la libcommon.la libheap.la -lm $(COMMON_LIBS)
+collectd_LDADD = libavltree.la libcommon.la libheap.la -lm $(COMMON_LIBS) $(DLOPEN_LIBS)
collectd_DEPENDENCIES = libavltree.la libcommon.la libheap.la libmetadata.la
# The daemon needs to call sg_init, so we need to link it against libstatgrab,
endif
if BUILD_WITH_OWN_LIBOCONFIG
-collectd_LDADD += $(LIBLTDL) $(top_builddir)/src/liboconfig/liboconfig.la
+collectd_LDADD += $(top_builddir)/src/liboconfig/liboconfig.la
collectd_DEPENDENCIES += $(top_builddir)/src/liboconfig/liboconfig.la
else
collectd_LDADD += -loconfig
index d5f01e077937934b39b046a4829ec928da9e0c50..b57aadc8500084d5b23b1a92f1644076179ccc2e 100644 (file)
--- a/src/daemon/configfile.c
+++ b/src/daemon/configfile.c
static int dispatch_loadplugin(oconfig_item_t *ci) {
const char *name;
- unsigned int flags = 0;
+ _Bool global = 0;
plugin_ctx_t ctx = {0};
plugin_ctx_t old_ctx;
int ret_val;
oconfig_item_t *child = ci->children + i;
if (strcasecmp("Globals", child->key) == 0)
- cf_util_get_flag(child, &flags, PLUGIN_FLAGS_GLOBAL);
+ cf_util_get_boolean(child, &global);
else if (strcasecmp("Interval", child->key) == 0)
cf_util_get_cdtime(child, &ctx.interval);
else if (strcasecmp("FlushInterval", child->key) == 0)
}
old_ctx = plugin_set_ctx(ctx);
- ret_val = plugin_load(name, (uint32_t)flags);
+ ret_val = plugin_load(name, global);
/* reset to the "global" context */
plugin_set_ctx(old_ctx);
diff --git a/src/daemon/plugin.c b/src/daemon/plugin.c
index f313f3680be60fe442f7596194cbf9b96769953f..c89f1ed18fa9c82ea9bb3931f3a56ef977324d47 100644 (file)
--- a/src/daemon/plugin.c
+++ b/src/daemon/plugin.c
#include <pthread_np.h> /* for pthread_set_name_np(3) */
#endif
-#include <ltdl.h>
+#include <dlfcn.h>
/*
* Private structures
* object, but it will bitch about a shared object not having a
* ``module_register'' symbol..
*/
-static int plugin_load_file(char *file, uint32_t flags) {
- lt_dlhandle dlh;
+static int plugin_load_file(const char *file, _Bool global) {
void (*reg_handle)(void);
- lt_dlinit();
- lt_dlerror(); /* clear errors */
+ int flags = RTLD_NOW;
+ if (global)
+ flags |= RTLD_GLOBAL;
-#if LIBTOOL_VERSION == 2
- if (flags & PLUGIN_FLAGS_GLOBAL) {
- lt_dladvise advise;
- lt_dladvise_init(&advise);
- lt_dladvise_global(&advise);
- dlh = lt_dlopenadvise(file, advise);
- lt_dladvise_destroy(&advise);
- } else {
- dlh = lt_dlopen(file);
- }
-#else /* if LIBTOOL_VERSION == 1 */
- if (flags & PLUGIN_FLAGS_GLOBAL)
- WARNING("plugin_load_file: The global flag is not supported, "
- "libtool 2 is required for this.");
- dlh = lt_dlopen(file);
-#endif
+ void *dlh = dlopen(file, flags);
if (dlh == NULL) {
char errbuf[1024] = "";
ssnprintf(errbuf, sizeof(errbuf),
- "lt_dlopen (\"%s\") failed: %s. "
+ "dlopen (\"%s\") failed: %s. "
"The most common cause for this problem is "
"missing dependencies. Use ldd(1) to check "
"the dependencies of the plugin "
"/ shared object.",
- file, lt_dlerror());
+ file, dlerror());
ERROR("%s", errbuf);
/* Make sure this is printed to STDERR in any case, but also
return (1);
}
- if ((reg_handle = (void (*)(void))lt_dlsym(dlh, "module_register")) == NULL) {
+ reg_handle = (void (*)(void))dlsym(dlh, "module_register");
+ if (reg_handle == NULL) {
WARNING("Couldn't find symbol \"module_register\" in \"%s\": %s\n", file,
- lt_dlerror());
- lt_dlclose(dlh);
+ dlerror());
+ dlclose(dlh);
return (-1);
}
}
#define BUFSIZE 512
-int plugin_load(char const *plugin_name, uint32_t flags) {
+int plugin_load(char const *plugin_name, _Bool global) {
DIR *dh;
const char *dir;
char filename[BUFSIZE] = "";
*/
if ((strcasecmp("perl", plugin_name) == 0) ||
(strcasecmp("python", plugin_name) == 0))
- flags |= PLUGIN_FLAGS_GLOBAL;
+ global = 1;
/* `cpu' should not match `cpufreq'. To solve this we add `.so' to the
* type when matching the filename */
continue;
}
- status = plugin_load_file(filename, flags);
+ status = plugin_load_file(filename, global);
if (status == 0) {
/* success */
plugin_mark_loaded(plugin_name);
diff --git a/src/daemon/plugin.h b/src/daemon/plugin.h
index f6448a581f9fef5783ea781f6a198bb8f5f2cd53..4f877e0ecb2f3407b8e475f99768facc12df03da 100644 (file)
--- a/src/daemon/plugin.h
+++ b/src/daemon/plugin.h
#include <pthread.h>
-#define PLUGIN_FLAGS_GLOBAL 0x0001
-
#ifndef DATA_MAX_NAME_LEN
#define DATA_MAX_NAME_LEN 128
#endif
*
* ARGUMENTS
* `name' Name of the plugin to load.
- * `flags' Hints on how to handle this plugin.
+ * `global' Make this plugins symbols available for other shared libraries.
*
* RETURN VALUE
* Returns zero upon success, a value greater than zero if no plugin was found
* Re-loading an already loaded module is detected and zero is returned in
* this case.
*/
-int plugin_load(const char *name, uint32_t flags);
+int plugin_load(const char *name, _Bool global);
int plugin_init_all(void);
void plugin_read_all(void);