Permalink
Browse files

Remove libltdl: Remove ltld references

http://www.opensc-project.org/pipermail/opensc-devel/2011-December/017490.html
cherry-picked from 'libtool' branch of Alon Barlev's github project git://github.com/alonbl/OpenSC.git
and rebased

Remove libltdl: Remove ltld references
(cherry picked from commit a350326)

Remove libltdl: Detect libdl
(cherry picked from commit 51e7de4)

Remove libltdl: Use libscdl
(cherry picked from commit 09f3ead)

Remove libltdl: Cleanup libscdl
(cherry picked from commit 52d5f1b)

Remove libltdl: Cleanup libscdl usage at Microsoft VC build

Untested, I don't have the environment, Martin, please test.
(cherry picked from commit 7fb18f8)

Change-Id: I73c98ccb9365584b12f4b0b97b69316a190b6e45
  • Loading branch information...
1 parent 594427e commit df8715849d462e617025427ad96a7708bad24445 @alonbl alonbl committed with viktorTarasov Dec 9, 2011
View
@@ -267,23 +267,15 @@ AC_CHECK_LIB(
]
)
-dnl check for libltdl. If libltdl is not found, native dlopen/LoadLibrary is used
-AC_ARG_VAR([LTLIB_CFLAGS], [C compiler flags for libltdl])
-AC_ARG_VAR([LTLIB_LIBS], [linker flags for libltdl])
-if test -z "${LTLIB_LIBS}"; then
+if test "${WIN32}" = "no"; then
+ dnl dl support
AC_CHECK_LIB(
- [ltdl],
- [lt_dlopen],
- [LTLIB_LIBS="-lltdl"]
+ [dl],
+ [dlopen],
+ ,
+ [AC_MSG_ERROR([libdl required])]
)
-fi
-saved_CFLAGS="${CFLAGS}"
-CFLAGS="${CFLAGS} ${LTLIB_CFLAGS}"
-AC_CHECK_HEADERS([ltdl.h])
-CFLAGS="${saved_CFLAGS}"
-
-if test "${WIN32}" = "no"; then
dnl Special check for pthread support.
ACX_PTHREAD(
[AC_DEFINE(
@@ -636,8 +628,6 @@ Compiler flags: ${CFLAGS}
Linker flags: ${LDFLAGS}
Libraries: ${LIBS}
-LTLIB_CFLAGS: ${LTLIB_CFLAGS}
-LTLIB_LIBS: ${LTLIB_LIBS}
READLINE_CFLAGS: ${READLINE_CFLAGS}
READLINE_LIBS: ${READLINE_LIBS}
ZLIB_CFLAGS: ${ZLIB_CFLAGS}
View
@@ -9,7 +9,6 @@ dist_noinst_DATA = \
compat_getopt_main.c \
README.compat_strlcpy compat_strlcpy.3
-AM_CFLAGS = $(LTLIB_CFLAGS)
INCLUDES = -I$(top_srcdir)/src
libcompat_la_SOURCES = \
@@ -18,11 +17,10 @@ libcompat_la_SOURCES = \
compat_strlcpy.h compat_strlcpy.c \
compat_getpass.h compat_getpass.c \
compat_getopt.h compat_getopt.c \
- simclist.c simclist.h libscdl.c
+ simclist.c simclist.h
compat_getopt_main_LDADD = libcompat.la
libpkcs11_la_SOURCES = libpkcs11.c libpkcs11.h
-libpkcs11_la_LIBADD = libscdl.la
libscdl_la_SOURCES = libscdl.c libscdl.h
View
@@ -8,7 +8,7 @@ common.lib: $(COMMON_OBJECTS)
lib $(LIBFLAGS) /out:common.lib $(COMMON_OBJECTS)
libpkcs11.lib: libpkcs11.obj libscdl.obj
- lib $(LIBFLAGS) /out:libpkcs11.lib libpkcs11.obj libscdl.obj
+ lib $(LIBFLAGS) /out:libpkcs11.lib libpkcs11.obj
libscdl.lib: libscdl.obj
lib $(LIBFLAGS) /out:libscdl.lib libscdl.obj
View
@@ -10,9 +10,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#ifdef HAVE_LTDL_H
-#include <ltdl.h>
-#endif
#include "pkcs11/pkcs11.h"
@@ -36,9 +33,6 @@ C_LoadModule(const char *mspec, CK_FUNCTION_LIST_PTR_PTR funcs)
{
sc_pkcs11_module_t *mod;
CK_RV rv, (*c_get_function_list)(CK_FUNCTION_LIST_PTR_PTR);
-#ifdef HAVE_LTDL_H
- lt_dlinit();
-#endif
mod = calloc(1, sizeof(*mod));
mod->_magic = MAGIC;
View
@@ -18,46 +18,22 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "config.h"
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include "libscdl.h"
-#ifdef HAVE_LTDL_H
-#include <ltdl.h>
-/* libltdl is present, pass all calls to it */
-
-void *sc_dlopen(const char *filename)
-{
- return (void *)lt_dlopen(filename);
-}
-
-void *sc_dlsym(void *handle, const char *symbol)
-{
- return lt_dlsym((lt_dlhandle)handle, symbol);
-}
-
-const char *sc_dlerror(void)
-{
- return lt_dlerror();
-}
-
-int sc_dlclose(void *handle)
-{
- return lt_dlclose((lt_dlhandle)handle);
-}
-
-#else
-/* Small wrappers for native functions, bypassing libltdl */
-#ifdef _WIN32
-/* Use Windows calls */
+#ifdef WIN32
+#include <windows.h>
void *sc_dlopen(const char *filename)
{
return (void *)LoadLibrary(filename);
}
void *sc_dlsym(void *handle, const char *symbol)
{
- return GetProcAddress(handle, symbol);
+ return GetProcAddress((HANDLE)handle, symbol);
}
const char *sc_dlerror()
@@ -67,12 +43,10 @@ const char *sc_dlerror()
int sc_dlclose(void *handle)
{
- return FreeLibrary(handle);
+ return FreeLibrary((HANDLE)handle);
}
-
-#elif defined(HAVE_DLFCN_H)
+#else
#include <dlfcn.h>
-/* Use native interfaces */
void *sc_dlopen(const char *filename)
{
return dlopen(filename, RTLD_LAZY);
@@ -92,28 +66,4 @@ int sc_dlclose(void *handle)
{
return dlclose(handle);
}
-
-#else
-/* Dynamic loading is not available */
-void *sc_dlopen(const char *filename)
-{
- return NULL;
-}
-
-void *sc_dlsym(void *handle, const char *symbol)
-{
- return NULL;
-}
-
-const char *sc_dlerror()
-{
- return "dlopen() functionality not available";
-}
-
-int sc_dlclose(void *handle)
-{
- return 0;
-}
-
-#endif
#endif
View
@@ -18,7 +18,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifndef __LIBSCDL_H
+#define __LIBSCDL_H
void *sc_dlopen(const char *filename);
void *sc_dlsym(void *handle, const char *symbol);
int sc_dlclose(void *handle);
const char *sc_dlerror(void);
+#endif
@@ -14,8 +14,7 @@ noinst_HEADERS = cards.h ctbcs.h internal.h esteid.h muscle.h muscle-filesystem.
AM_CPPFLAGS = -DOPENSC_CONF_PATH=\"$(sysconfdir)/opensc.conf\"
AM_CFLAGS = $(OPTIONAL_OPENSSL_CFLAGS) $(OPTIONAL_OPENCT_CFLAGS) \
- $(OPTIONAL_PCSC_CFLAGS) $(OPTIONAL_ZLIB_CFLAGS) \
- $(LTLIB_CFLAGS)
+ $(OPTIONAL_PCSC_CFLAGS) $(OPTIONAL_ZLIB_CFLAGS)
INCLUDES = -I$(top_srcdir)/src
libopensc_la_SOURCES = \
@@ -51,9 +50,10 @@ if WIN32
libopensc_la_SOURCES += $(top_builddir)/win32/versioninfo.rc
endif
libopensc_la_LIBADD = $(OPTIONAL_OPENSSL_LIBS) $(OPTIONAL_OPENCT_LIBS) \
- $(OPTIONAL_ZLIB_LIBS) $(LTLIB_LIBS) \
+ $(OPTIONAL_ZLIB_LIBS) \
$(top_builddir)/src/pkcs15init/libpkcs15init.la \
$(top_builddir)/src/scconf/libscconf.la \
+ $(top_builddir)/src/common/libscdl.la \
$(top_builddir)/src/common/libcompat.la
if WIN32
libopensc_la_LIBADD += -lws2_32
View
@@ -28,15 +28,12 @@
#include <sys/stat.h>
#include <limits.h>
-#ifdef HAVE_LTDL_H
-#include <ltdl.h>
-#endif
-
#ifdef _WIN32
#include <windows.h>
#include <winreg.h>
#endif
+#include "common/libscdl.h"
#include "internal.h"
int _sc_add_reader(sc_context_t *ctx, sc_reader_t *reader)
@@ -663,15 +660,6 @@ int sc_context_create(sc_context_t **ctx_out, const sc_context_param_t *parm)
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "==================================="); /* first thing in the log */
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "opensc version: %s", sc_get_version());
-#ifdef HAVE_LTDL_H
- /* initialize ltdl, if available. See scdl.c for more information */
- if (lt_dlinit() != 0) {
- sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "lt_dlinit() failed");
- sc_release_context(ctx);
- return SC_ERROR_INTERNAL;
- }
-#endif
-
#ifdef ENABLE_PCSC
ctx->reader_driver = sc_get_pcsc_driver();
/* XXX: remove cardmod pseudoreader driver */
View
@@ -36,7 +36,6 @@ extern "C" {
#endif
#include "common/simclist.h"
-#include "common/libscdl.h"
#include "libopensc/opensc.h"
#include "libopensc/log.h"
#include "libopensc/cards.h"
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <assert.h>
+#include "common/libscdl.h"
#include "internal.h"
#include "asn1.h"
#include "pkcs15.h"
View
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <assert.h>
+#include "common/libscdl.h"
#include "cardctl.h"
#include "internal.h"
#include "pkcs15.h"
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <string.h>
+#include "common/libscdl.h"
#include "internal.h"
#include "ctbcs.h"
@@ -33,6 +33,7 @@
#include <arpa/inet.h>
#endif
+#include "common/libscdl.h"
#include "internal.h"
#include "internal-winscard.h"
@@ -16,7 +16,7 @@ INCLUDES = -I$(top_srcdir)/src
opensc_minidriver@LIBRARY_BITNESS@_la_SOURCES = minidriver.c minidriver.exports \
$(top_builddir)/win32/versioninfo.rc
-opensc_minidriver@LIBRARY_BITNESS@_la_LIBADD = $(LTLIB_LIBS) \
+opensc_minidriver@LIBRARY_BITNESS@_la_LIBADD = \
$(top_builddir)/src/libopensc/libopensc.la \
-lcrypt32
opensc_minidriver@LIBRARY_BITNESS@_la_LDFLAGS = $(AM_LDFLAGS) \
View
@@ -14,9 +14,10 @@ OPENSC_PKCS11_SRC = pkcs11-global.c pkcs11-session.c pkcs11-object.c misc.c slot
mechanism.c openssl.c framework-pkcs15.c \
framework-pkcs15init.c debug.c opensc-pkcs11.exports \
pkcs11-display.c pkcs11-display.h
-OPENSC_PKCS11_LIBS = $(OPTIONAL_OPENSSL_LIBS) $(PTHREAD_LIBS) $(LTLIB_LIBS) \
- $(top_builddir)/src/common/libcompat.la \
- $(top_builddir)/src/libopensc/libopensc.la
+OPENSC_PKCS11_LIBS = $(OPTIONAL_OPENSSL_LIBS) $(PTHREAD_LIBS) \
+ $(top_builddir)/src/libopensc/libopensc.la \
+ $(top_builddir)/src/common/libscdl.la \
+ $(top_builddir)/src/common/libcompat.la
opensc_pkcs11_la_SOURCES = $(OPENSC_PKCS11_SRC) $(OPENSC_PKCS11_INC) hack-disabled.c
opensc_pkcs11_la_LIBADD = $(OPENSC_PKCS11_LIBS)
@@ -31,7 +32,10 @@ onepin_opensc_pkcs11_la_LDFLAGS = $(AM_LDFLAGS) \
-module -shared -avoid-version -no-undefined
pkcs11_spy_la_SOURCES = pkcs11-spy.c pkcs11-display.c pkcs11-display.h pkcs11-spy.exports
-pkcs11_spy_la_LIBADD = $(OPTIONAL_OPENSSL_LIBS) $(LTLIB_LIBS) $(top_builddir)/src/common/libpkcs11.la
+pkcs11_spy_la_LIBADD = \
+ $(top_builddir)/src/common/libpkcs11.la \
+ $(top_builddir)/src/common/libscdl.la \
+ $(OPTIONAL_OPENSSL_LIBS)
pkcs11_spy_la_LDFLAGS = $(AM_LDFLAGS) \
-export-symbols "$(srcdir)/pkcs11-spy.exports" \
-module -shared -avoid-version -no-undefined
View
@@ -33,5 +33,5 @@ $(TARGET3): $(OBJECTS3) ..\libopensc\opensc.lib
echo LIBRARY $* > $*.def
echo EXPORTS >> $*.def
type $*.exports >> $*.def
- link $(LINKFLAGS) /dll /def:$*.def /implib:$*.lib /out:$(TARGET3) $(OBJECTS3) ..\libopensc\opensc.lib ..\common\libpkcs11.lib $(OPENSSL_LIB) gdi32.lib advapi32.lib
+ link $(LINKFLAGS) /dll /def:$*.def /implib:$*.lib /out:$(TARGET3) $(OBJECTS3) ..\libopensc\opensc.lib ..\common\libpkcs11.lib ..\common\libscdl.lib $(OPENSSL_LIB) gdi32.lib advapi32.lib
if EXIST $(TARGET3).manifest mt -manifest $(TARGET3).manifest -outputresource:$(TARGET3);2
View
@@ -7,7 +7,9 @@ SUBDIRS = regression
noinst_PROGRAMS = base64 lottery p15dump pintest prngtest
INCLUDES = -I$(top_srcdir)/src
-LIBS = $(top_builddir)/src/libopensc/libopensc.la \
+LIBS = \
+ $(top_builddir)/src/libopensc/libopensc.la \
+ $(top_builddir)/src/common/libscdl.la \
$(top_builddir)/src/common/libcompat.la
COMMON_SRC = sc-test.c
View
@@ -13,8 +13,10 @@ endif
# compile with $(PTHREAD_CFLAGS) to allow debugging with gdb
AM_CFLAGS = $(OPTIONAL_OPENSSL_CFLAGS) $(OPTIONAL_READLINE_CFLAGS) $(PTHREAD_CFLAGS)
INCLUDES = -I$(top_srcdir)/src
-LIBS = $(top_builddir)/src/common/libcompat.la \
- $(top_builddir)/src/libopensc/libopensc.la
+LIBS = \
+ $(top_builddir)/src/libopensc/libopensc.la \
+ $(top_builddir)/src/common/libscdl.la \
+ $(top_builddir)/src/common/libcompat.la
opensc_tool_SOURCES = opensc-tool.c util.c
piv_tool_SOURCES = piv-tool.c util.c
@@ -24,7 +26,7 @@ opensc_explorer_LDADD = $(OPTIONAL_READLINE_LIBS)
pkcs15_tool_SOURCES = pkcs15-tool.c util.c
pkcs15_tool_LDADD = $(OPTIONAL_OPENSSL_LIBS)
pkcs11_tool_SOURCES = pkcs11-tool.c util.c
-pkcs11_tool_LDADD = $(OPTIONAL_OPENSSL_LIBS) $(LTLIB_LIBS) \
+pkcs11_tool_LDADD = $(OPTIONAL_OPENSSL_LIBS) \
$(top_builddir)/src/common/libpkcs11.la
pkcs15_crypt_SOURCES = pkcs15-crypt.c util.c
pkcs15_crypt_LDADD = $(OPTIONAL_OPENSSL_LIBS)
View
@@ -17,6 +17,6 @@ all: $(TARGETS)
cl $(COPTS) /c $<
link $(LINKFLAGS) /pdb:$*.pdb /out:$@ $*.obj util.obj \
..\common\common.lib ..\scconf\scconf.lib ..\libopensc\opensc.lib \
- ..\pkcs15init\pkcs15init.lib ..\common\libpkcs11.lib \
+ ..\pkcs15init\pkcs15init.lib ..\common\libpkcs11.lib ..\common\libscdl.lib \
$(TOPDIR)\win32\versioninfo.res $(OPENSSL_LIB) gdi32.lib
if EXIST $@.manifest mt -manifest $@.manifest -outputresource:$@;1

0 comments on commit df87158

Please sign in to comment.