From: <man...@us...> - 2014-10-27 19:32:12
|
Revision: 4512 http://sourceforge.net/p/modplug/code/4512 Author: manxorist Date: 2014-10-27 19:31:59 +0000 (Mon, 27 Oct 2014) Log Message: ----------- [Mod] libopenmpt: For dynamic loading of external libraries, use libltdl from libtool instead of libdl from libc. This allows better portability to non-Linux/BSD systems at the expence of a libtool dependency. [Imp] build: Support libunmo3 in autotools based libopenmpt builds via --enable-unmo3 . Modified Paths: -------------- trunk/OpenMPT/Makefile trunk/OpenMPT/build/autotools/Makefile.am trunk/OpenMPT/build/autotools/autoconfiscate.sh trunk/OpenMPT/build/autotools/configure.ac trunk/OpenMPT/common/misc_util.cpp trunk/OpenMPT/libopenmpt/dox/changelog.md trunk/OpenMPT/libopenmpt/dox/dependencies.md trunk/OpenMPT/libopenmpt/dox/quickstart.md Modified: trunk/OpenMPT/Makefile =================================================================== --- trunk/OpenMPT/Makefile 2014-10-27 19:20:44 UTC (rev 4511) +++ trunk/OpenMPT/Makefile 2014-10-27 19:31:59 UTC (rev 4512) @@ -277,7 +277,7 @@ ifeq ($(USE_MO3),1) CPPFLAGS_MO3 := -DMPT_WITH_MO3 -LDLIBS_MO3 := -ldl +LDLIBS_MO3 := -lltdl else endif Modified: trunk/OpenMPT/build/autotools/Makefile.am =================================================================== --- trunk/OpenMPT/build/autotools/Makefile.am 2014-10-27 19:20:44 UTC (rev 4511) +++ trunk/OpenMPT/build/autotools/Makefile.am 2014-10-27 19:31:59 UTC (rev 4512) @@ -68,10 +68,10 @@ lib_LTLIBRARIES += libopenmpt.la libopenmpt_la_LDFLAGS = -version-info 0:7:0 nobase_include_HEADERS += libopenmpt/libopenmpt.h libopenmpt/libopenmpt.hpp libopenmpt/libopenmpt_version.h libopenmpt/libopenmpt_config.h libopenmpt/libopenmpt_stream_callbacks_fd.h libopenmpt/libopenmpt_stream_callbacks_file.h -libopenmpt_la_CPPFLAGS = -DLIBOPENMPT_BUILD -I$(srcdir)/build/svn_version -I$(srcdir)/ -I$(srcdir)/common $(ZLIB_CFLAGS) +libopenmpt_la_CPPFLAGS = -DLIBOPENMPT_BUILD -I$(srcdir)/build/svn_version -I$(srcdir)/ -I$(srcdir)/common $(ZLIB_CFLAGS) $(LTDL_CPPFLAGS) libopenmpt_la_CXXFLAGS = $(ZLIB_CFLAGS) libopenmpt_la_CFLAGS = $(ZLIB_CFLAGS) -libopenmpt_la_LIBADD = $(ZLIB_LIBS) +libopenmpt_la_LIBADD = $(ZLIB_LIBS) $(LTDL_LIBS) libopenmpt_la_SOURCES = libopenmpt_la_SOURCES += build/svn_version/svn_version.h libopenmpt_la_SOURCES += common/AudioCriticalSection.cpp @@ -263,10 +263,10 @@ endif check_PROGRAMS += libopenmpttest -libopenmpttest_CPPFLAGS = -DLIBOPENMPT_BUILD -DLIBOPENMPT_BUILD_TEST -I$(srcdir)/build/svn_version -I$(srcdir)/ -I$(srcdir)/common $(ZLIB_CFLAGS) +libopenmpttest_CPPFLAGS = -DLIBOPENMPT_BUILD -DLIBOPENMPT_BUILD_TEST -I$(srcdir)/build/svn_version -I$(srcdir)/ -I$(srcdir)/common $(ZLIB_CFLAGS) $(LTDL_CPPFLAGS) libopenmpttest_CXXFLAGS = $(ZLIB_CFLAGS) libopenmpttest_CFLAGS = $(ZLIB_CFLAGS) -libopenmpttest_LDADD = $(ZLIB_LIBS) +libopenmpttest_LDADD = $(ZLIB_LIBS) $(LTDL_LIBS) libopenmpttest_SOURCES = libopenmpttest_SOURCES += libopenmpt/libopenmpt_test.cpp libopenmpttest_SOURCES += test/test.cpp Modified: trunk/OpenMPT/build/autotools/autoconfiscate.sh =================================================================== --- trunk/OpenMPT/build/autotools/autoconfiscate.sh 2014-10-27 19:20:44 UTC (rev 4511) +++ trunk/OpenMPT/build/autotools/autoconfiscate.sh 2014-10-27 19:31:59 UTC (rev 4512) @@ -93,7 +93,7 @@ cd test-tarball tar xvaf ../libopenmpt*.tar.gz cd libopenmpt* -./configure +./configure --enable-unmo3 make make check cd .. Modified: trunk/OpenMPT/build/autotools/configure.ac =================================================================== --- trunk/OpenMPT/build/autotools/configure.ac 2014-10-27 19:20:44 UTC (rev 4511) +++ trunk/OpenMPT/build/autotools/configure.ac 2014-10-27 19:31:59 UTC (rev 4512) @@ -26,6 +26,48 @@ # Required libopenmpt dependency: zlib PKG_CHECK_MODULES([ZLIB], [zlib], AC_DEFINE([MPT_WITH_ZLIB], [], [with libz])) +# Optional libopenmpt dependency: libltdl +AC_ARG_ENABLE([unmo3], AS_HELP_STRING([--enable-unmo3], [Enable the use of dynamically loaded libunmo3.])) +AS_IF([test "x$enable_unmo3" = "xyes"], + [ + AC_CHECK_HEADER([ltdl.h], + [ + AC_CHECK_LIB([ltdl], [lt_dlinit], + [ + have_ltdl=1 + ], + [ + have_ltdl=0 + ] + ) + ], + [ + have_ltdl=0 + ] + ) + AS_IF([test "x$have_ltdl" = "x0"], + [ + AC_MSG_ERROR([Unable to find libltdl.]) + ] + ) + ], + [ + have_ltdl=0 + ] +) +AS_IF([test "x$have_ltdl" = "x1"], + [ + LTDL_CPPFLAGS=-DMPT_WITH_MO3 + LTDL_LIBS=-lltdl + ], + [ + LTDL_CPPFLAGS= + LTDL_LIBS= + ] +) +AC_SUBST([LTDL_CPPFLAGS]) +AC_SUBST([LTDL_LIBS]) + # Optional openmpt123 dependency: PortAudio, try SDL if PortAudio is unavailable PKG_CHECK_MODULES([PORTAUDIO], [portaudio-2.0], [ Modified: trunk/OpenMPT/common/misc_util.cpp =================================================================== --- trunk/OpenMPT/common/misc_util.cpp 2014-10-27 19:20:44 UTC (rev 4511) +++ trunk/OpenMPT/common/misc_util.cpp 2014-10-27 19:31:59 UTC (rev 4512) @@ -18,7 +18,7 @@ #if defined(MPT_WITH_DYNBIND) #if !MPT_OS_WINDOWS -#include <dlfcn.h> +#include <ltdl.h> #endif #endif @@ -912,39 +912,51 @@ private: - void * handle; + bool inited; + lt_dlhandle handle; public: LibraryHandle(const mpt::LibraryPath &path) - : handle(NULL) + : inited(false) + , handle(0) { - handle = dlopen(path.GetFileName().AsNative().c_str(), RTLD_NOW); + if(lt_dlinit() != 0) + { + return; + } + inited = true; + handle = lt_dlopenext(path.GetFileName().AsNative().c_str()); } ~LibraryHandle() { if(IsValid()) { - dlclose(handle); + lt_dlclose(handle); } - handle = NULL; + handle = 0; + if(inited) + { + lt_dlexit(); + inited = false; + } } public: bool IsValid() const { - return handle != NULL; + return handle != 0; } FuncPtr GetProcAddress(const std::string &symbol) const { if(!IsValid()) { - return NULL; + return nullptr; } - return reinterpret_cast<FuncPtr>(dlsym(handle, symbol.c_str())); + return reinterpret_cast<FuncPtr>(lt_dlsym(handle, symbol.c_str())); } }; @@ -979,26 +991,22 @@ mpt::PathString LibraryPath::GetDefaultPrefix() //--------------------------------------------- { -#if MPT_OS_WINDOWS - return MPT_PATHSTRING(""); -#elif MPT_OS_MACOSX_OR_IOS - return MPT_PATHSTRING("lib"); -#else - return MPT_PATHSTRING("lib"); -#endif + #if MPT_OS_WINDOWS + return MPT_PATHSTRING(""); + #else + return MPT_PATHSTRING("lib"); + #endif } mpt::PathString LibraryPath::GetDefaultSuffix() //--------------------------------------------- { -#if MPT_OS_WINDOWS - return MPT_PATHSTRING(".dll"); -#elif MPT_OS_MACOSX_OR_IOS - return MPT_PATHSTRING(".dylib"); -#else - return MPT_PATHSTRING(".so"); -#endif + #if MPT_OS_WINDOWS + return MPT_PATHSTRING(".dll"); + #else + return MPT_PATHSTRING(""); // handled by libltdl + #endif } Modified: trunk/OpenMPT/libopenmpt/dox/changelog.md =================================================================== --- trunk/OpenMPT/libopenmpt/dox/changelog.md 2014-10-27 19:20:44 UTC (rev 4511) +++ trunk/OpenMPT/libopenmpt/dox/changelog.md 2014-10-27 19:31:59 UTC (rev 4512) @@ -10,6 +10,7 @@ * xmp-openmpt / in_openmpt: libopenmpt_settings.dll no longer requires .NET 4 to be installed. * foo_openmpt: Settings are now accessable via foobar2000 advanced settings. + * Autotools based build now supports libunmo3. Specify --enable-unmo3. * [Bug] The -autotools tarballs were not working at all. Modified: trunk/OpenMPT/libopenmpt/dox/dependencies.md =================================================================== --- trunk/OpenMPT/libopenmpt/dox/dependencies.md 2014-10-27 19:20:44 UTC (rev 4511) +++ trunk/OpenMPT/libopenmpt/dox/dependencies.md 2014-10-27 19:31:59 UTC (rev 4512) @@ -20,6 +20,9 @@ * **J2B** support requires an inflate (deflate decompression) implementation: * **zlib** * **miniz** can be used internally if no zlib is available. + * **MO3** support requires: + * closed-source **libunmo3** from un4seen + * **libltdl** from libtool on Unix-like platforms * Building on Unix-like systems requires: * **GNU make** * **pkg-config** Modified: trunk/OpenMPT/libopenmpt/dox/quickstart.md =================================================================== --- trunk/OpenMPT/libopenmpt/dox/quickstart.md 2014-10-27 19:20:44 UTC (rev 4511) +++ trunk/OpenMPT/libopenmpt/dox/quickstart.md 2014-10-27 19:31:59 UTC (rev 4512) @@ -12,6 +12,7 @@ - **zlib** - **doxygen >= 1.8** 3. *Optional*: + - **libltdl** - **portaudio-v19** - **libSDL == 1.2.x** - **libFLAC** @@ -43,6 +44,7 @@ - **pkg-config** 2. *Optional*: - **zlib** + - **libltdl** - **portaudio-v19** - **libSDL == 1.2.x** - **doxygen >= 1.8** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |