From: Alan T. DeKok Date: Tue, 4 Sep 2012 12:19:11 +0000 (+0200) Subject: Switch to using dlopen() instead of libltdl. X-Git-Tag: release_3_0_0_beta0~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=632ada16cbb1c47d6359765ca6695173ab52c056;p=thirdparty%2Ffreeradius-server.git Switch to using dlopen() instead of libltdl. And there was much rejoicing. This commit does little more than change WITHOUT_LIBLTDL for WITH_LIBLTDL. Previously, you had to specifically request WITHOUT_LIBLTDL. Now you have to specifically request LIBLTDL. --- diff --git a/Makefile b/Makefile index adb4c2d91d4..4d0447f332a 100644 --- a/Makefile +++ b/Makefile @@ -42,8 +42,8 @@ ifneq "" "$(BOILERMAKE)" # Don't use libtool or libltdl. # They are a blight upon the face of the earth. LIBLTDL := -INCLTDL := -DWITH_DLOPEN -CFLAGS += -DWITHOUT_LIBLTDL +INCLTDL := +CFLAGS += LIBTOOL := JLIBTOOL LTDL_SUBDIRS := diff --git a/src/include/modpriv.h b/src/include/modpriv.h index 6850730716c..7d25878e2de 100644 --- a/src/include/modpriv.h +++ b/src/include/modpriv.h @@ -8,26 +8,24 @@ #include #include -/* - * Using the native dlopen() API means that we don't want to use libltdl. - */ -#ifdef WITH_DLOPEN -#define WITHOUT_LIBLTDL -#endif - -#ifndef WITHOUT_LIBLTDL +#ifdef WITH_LIBLTDL #ifdef WITH_SYSTEM_LTDL #include #else #include "libltdl/ltdl.h" #endif + +#else +#ifndef HAVE_DLFCN_H +#error FreeRADIUS needs either libltdl, or a working dlopen() #endif +#endif /* WITH_LIBLTDL */ #ifdef __cplusplus extern "C" { #endif -#ifdef WITHOUT_LIBLTDL +#ifndef WITH_LIBLTDL typedef void *lt_dlhandle; int lt_dlinit(void); diff --git a/src/main/modules.c b/src/main/modules.c index dd8c2ed6e81..82ca21d68eb 100644 --- a/src/main/modules.c +++ b/src/main/modules.c @@ -86,8 +86,8 @@ const section_type_value_t section_type_value[RLM_COMPONENT_COUNT] = { }; -#ifdef WITHOUT_LIBLTDL -#ifdef WITH_DLOPEN +#ifndef WITH_LIBLTDL +#ifdef HAVE_DLFCN_H #include #ifndef RTLD_NOW @@ -237,8 +237,8 @@ const char *lt_dlerror(void) return "Unspecified error"; } -#endif /* WITH_DLOPEN */ -#else /* WITHOUT_LIBLTDL */ +#endif /* HAVE_DLFCN_H */ +#else /* WIT_LIBLTDL */ /* * Solve the issues of libraries linking to other libraries @@ -263,7 +263,7 @@ static lt_dlhandle fr_dlopenext(const char *filename) return handle; } #endif /* HAVE_LT_DLADVISE_INIT */ -#endif /* WITHOUT_LIBLTDL */ +#endif /* WITH_LIBLTDL */ static int virtual_server_idx(const char *name) { @@ -501,7 +501,7 @@ static module_entry_t *linkto_module(const char *module_name, p = strrchr(module_struct, '-'); if (p) *p = '\0'; -#if defined(WITHOUT_LIBLTDL) && defined (WITH_DLOPEN) && defined(RTLD_SELF) +#if !defined(WITH_LIBLTDL) && defined(HAVE_DLFCN_H) && defined(RTLD_SELF) module = lt_dlsym(RTLD_SELF, module_struct); if (module) goto open_self; #endif @@ -532,7 +532,7 @@ static module_entry_t *linkto_module(const char *module_name, return NULL; } -#if defined(WITHOUT_LIBLTDL) && defined (WITH_DLOPEN) && defined(RTLD_SELF) +#if !defined(WIT_LIBLTDL) && defined (HAVE_DLFCN_H) && defined(RTLD_SELF) open_self: #endif /* diff --git a/src/modules/rlm_eap/eap.c b/src/modules/rlm_eap/eap.c index 01bccf392cc..d83fb2f3151 100644 --- a/src/modules/rlm_eap/eap.c +++ b/src/modules/rlm_eap/eap.c @@ -103,15 +103,9 @@ int eaptype_load(EAP_TYPES **type, int eap_type, CONF_SECTION *cs) node->typename = eaptype_name; node->type_data = NULL; -#ifdef WITHOUT_LIBLTDL -#ifdef WITH_DLOPEN -#include - -#ifdef RTLD_SELF +#if !defined(WITH_LIBLTDL) && defined(HAVE_DLFCN_H) && defined(RTLD_SELF) node->type = (EAP_TYPE *)lt_dlsym(RTLD_SELF, buffer); if (node->type) goto open_self; -#endif -#endif #endif /* Link the loaded EAP-Type */ @@ -132,7 +126,7 @@ int eaptype_load(EAP_TYPES **type, int eap_type, CONF_SECTION *cs) return -1; } -#if defined(WITHOUT_LIBLTDL) && defined (WITH_DLOPEN) && defined(RTLD_SELF) +#if !defined(WITH_LIBLTDL) && defined(HAVE_DLFCN_H) && defined(RTLD_SELF) open_self: #endif cf_log_module(cs, "Linked to sub-module %s", buffer);