]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Switch to using dlopen() instead of libltdl.
authorAlan T. DeKok <aland@freeradius.org>
Tue, 4 Sep 2012 12:19:11 +0000 (14:19 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 4 Sep 2012 12:20:50 +0000 (14:20 +0200)
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.

Makefile
src/include/modpriv.h
src/main/modules.c
src/modules/rlm_eap/eap.c

index adb4c2d91d4ba8335b66330e7579f2aa721108c4..4d0447f332aa73ad3318bf1bc34c36bbf21c8061 100644 (file)
--- 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   :=
 
index 6850730716c576476328ac0afc225113e3387ca4..7d25878e2dec9041c164469917670024743ae6dc 100644 (file)
@@ -8,26 +8,24 @@
 #include <freeradius-devel/radiusd.h>
 #include <freeradius-devel/modules.h>
 
-/*
- *     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 <ltdl.h>
 #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);
index dd8c2ed6e81186ed646f9d37a60004fddde4dfaa..82ca21d68eb18438b9fa0ab0f7a973581936a064 100644 (file)
@@ -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 <dlfcn.h>
 
 #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
        /*
index 01bccf392cce63bd1750ebbc4128932a723bb9b9..d83fb2f31519755ebd9f5e0208fb6fc51557cb79 100644 (file)
@@ -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 <dlfcn.h>
-
-#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);