Commit 613b375d authored by gates's avatar gates

Make use of dlopen mandatory since it's to be used by bdj.

parent f6720077
......@@ -9,15 +9,15 @@ AM_CONFIG_HEADER(config.h)
# messages
library_not_found="Could not find required library!"
function_not_found="Could not find required function!"
using_dlopen="Using libaacs and libbdplus via dlopen."
using_dlopen_crypto_libs="Using libaacs and libbdplus via dlopen."
using_normal_linking="Using libaacs and libbdplus via normal linking."
# configure options
AC_ARG_WITH([dlopen],
[AS_HELP_STRING([--with-dlopen],
AC_ARG_ENABLE([dlopen-crypto-libs],
[AS_HELP_STRING([--with-dlopen-crypto-libs],
[use libaacs and libbdplus via dlopen (default is auto)])],
[use_dlopen=$withval],
[use_dlopen=auto])
[use_dlopen_crypto_libs=$withval],
[use_dlopen_crypto_libs=auto])
AC_ARG_WITH([jdk],
AS_HELP_STRING([--with-jdk=DIR],
......@@ -82,15 +82,15 @@ AC_SYS_LARGEFILE
AC_CHECK_FUNC([snprintf],, [AC_MSG_ERROR($function_not_found)])
# dlopen check
if [[ $use_dlopen = "auto" ]]; then
if [[ $use_dlopen_crypto_libs = "auto" ]]; then
AC_CHECK_LIB([dl], [dlopen],
[DLOPEN_LDFLAGS="-ldl"; AC_MSG_NOTICE($using_dlopen)
AC_DEFINE([USING_DLOPEN], [1], ["Define to 1 if using dlopen"])],
[use_dlopen="no"; AC_MSG_NOTICE($using_normal_linking)])
elif [[ $use_dlopen = "yes" ]]; then
[DLOPEN_LDFLAGS="-ldl"; AC_MSG_NOTICE($using_dlopen_crypto_libs)
AC_DEFINE([DLOPEN_CRYPTO_LIBS], [1], ["Define to 1 if dlopening crypto libs"])],
[use_dlopen_crypto_libs="no"; AC_MSG_NOTICE($using_normal_linking)])
elif [[ $use_dlopen_crypto_libs = "yes" ]]; then
AC_CHECK_LIB([dl], [dlopen],
[DLOPEN_LDFLAGS="-ldl"; AC_MSG_NOTICE($using_dlopen)
AC_DEFINE([USING_DLOPEN], [1], ["Define to 1 if using dlopen"])],
[DLOPEN_LDFLAGS="-ldl"; AC_MSG_NOTICE($using_dlopen_crypto_libs)
AC_DEFINE([DLOPEN_CRYPTO_LIBS], [1], ["Define to 1 if dlopening crypto libs"])],
[AC_MSG_ERROR($library_not_found)])
else
AC_CHECK_LIB([aacs], [aacs_open],,
......@@ -99,8 +99,8 @@ else
[AC_MSG_ERROR($library_not_found)])
AC_MSG_NOTICE($using_normal_linking)
fi
AM_CONDITIONAL([USING_DLOPEN],
[test $use_dlopen = "auto" || test $use_dlopen = "yes"])
AM_CONDITIONAL([DLOPEN_CRYPTO_LIBS],
[test $use_dlopen_crypto_libs = "auto" || test $use_dlopen_crypto_libs = "yes"])
# function testing for supported compiler options
check_cc_options()
......
......@@ -17,12 +17,6 @@ AM_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_WARNINGS) $(SET_OPTIMIZATIONS) \
$(SET_DEBUG_OPTS) $(SET_INCLUDES)
CFLAGS=$(shell test -z "$$CFLAGS" || echo "$$CFLAGS")
if USING_DLOPEN
LIBBLURAY_LDFLAGS=@DLOPEN_LDFLAGS@
DLOPEN_SOURCES=file/dl.h \
file/dl_posix.c
endif
SOURCES_bdj = libbluray/bdj/bdj.h \
libbluray/bdj/bdj_private.h \
libbluray/bdj/bdj_util.h \
......@@ -63,16 +57,17 @@ libbluray_la_SOURCES=libbluray/bluray.h \
file/file.h \
file/file_posix.c \
file/dir.h \
file/dl.h \
file/dl_posix.c \
util/attributes.h \
util/strutl.c \
util/strutl.h \
util/macro.h \
util/logging.c \
util/bits.h \
util/logging.h \
$(DLOPEN_SOURCES)
util/logging.h
libbluray_la_HEADERS= libbluray/bluray.h
libbluray_la_LDFLAGS= -version-info $(LIB_VERSION_INFO) $(LIBBLURAY_LDFLAGS)
libbluray_la_LDFLAGS= -version-info $(LIB_VERSION_INFO) -ldl
if USING_BDJAVA
libbluray_la_SOURCES+=$(SOURCES_bdj)
......
......@@ -76,7 +76,7 @@ main(int argc, char *argv[])
int chapter_end = -1;
uint8_t buf[BUF_SIZE];
char *keyfile = NULL;
BLURAY_TITLE_INFO* ti;
BLURAY_TITLE_INFO *ti;
do {
opt = getopt(argc, argv, OPTS);
......
......@@ -31,14 +31,14 @@
#include "bdnav/navigation.h"
#include "bdnav/index_parse.h"
#include "file/file.h"
#ifdef USING_DLOPEN
#ifdef DLOPEN_CRYPTO_LIBS
#include "file/dl.h"
#endif
#ifdef USING_BDJAVA
#include "bdj/bdj.h"
#endif
#ifndef USING_DLOPEN
#ifndef DLOPEN_CRYPTO_LIBS
#include <libaacs/aacs.h>
#include <libbdplus/bdplus.h>
#endif
......@@ -189,7 +189,7 @@ static int _open_m2ts(BLURAY *bd)
X_FREE(f_name);
if (bd->bdplus) {
#ifdef USING_DLOPEN
#ifdef DLOPEN_CRYPTO_LIBS
fptr_p_void bdplus_set_title;
bdplus_set_title = dl_dlsym(bd->h_libbdplus, "bdplus_set_title");
if (bdplus_set_title)
......@@ -216,7 +216,7 @@ static int _open_m2ts(BLURAY *bd)
static int _libaacs_open(BLURAY *bd, const char *keyfile_path)
{
#ifdef USING_DLOPEN
#ifdef DLOPEN_CRYPTO_LIBS
if ((bd->h_libaacs = dl_dlopen("libaacs", "0"))) {
DEBUG(DBG_BLURAY, "Downloaded libaacs (%p)\n", bd->h_libaacs);
......@@ -271,7 +271,7 @@ static void _libbdplus_open(BLURAY *bd, const char *keyfile_path)
file_close(fd);
DEBUG(DBG_BDPLUS, "attempting to load libbdplus\n");
#ifdef USING_DLOPEN
#ifdef DLOPEN_CRYPTO_LIBS
if ((bd->h_libbdplus = dl_dlopen("libbdplus", "0"))) {
DEBUG(DBG_BLURAY, "Downloaded libbdplus (%p)\n",
bd->h_libbdplus);
......@@ -349,7 +349,7 @@ void bd_close(BLURAY *bd)
bd_stop_bdj(bd);
if (bd->aacs) {
#ifdef USING_DLOPEN
#ifdef DLOPEN_CRYPTO_LIBS
fptr_p_void fptr = dl_dlsym(bd->h_libaacs, "aacs_close");
fptr(bd->aacs); // FIXME: NULL
dl_dlclose(bd->h_libaacs);
......@@ -359,7 +359,7 @@ void bd_close(BLURAY *bd)
}
if (bd->bdplus) {
#ifdef USING_DLOPEN
#ifdef DLOPEN_CRYPTO_LIBS
fptr_p_void bdplus_free = dl_dlsym(bd->h_libbdplus, "bdplus_free");
if (bdplus_free) bdplus_free(bd->bdplus);
#else
......@@ -367,7 +367,7 @@ void bd_close(BLURAY *bd)
#endif
bd->bdplus = NULL;
#ifdef USING_DLOPEN
#ifdef DLOPEN_CRYPTO_LIBS
dl_dlclose(bd->h_libbdplus);
#endif
bd->h_libbdplus = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment