diff --git a/Makefile.in b/Makefile.in index a07f47786..cc7b0009c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -93,7 +93,16 @@ AVILIB_INCLUDES = -Iavilib-0.6.10 AVILIB_LIBDIRS = -Lavilib-0.6.10 DEP_AVILIB = avilib-0.6.10/libavi.a -DEP_COMMON = src/common/libmtxcommon.a +LIBMTXCOMMONDLL=@LIBMTXCOMMONDLL@ +ifeq (1,$(LIBMTXCOMMONDLL)) +LIBMTXCOMMONEXT = dll +CXXFLAGS_SRC_COMMON += -DMTX_DLL_EXPORT +CXXFLAGS_NO_SRC_COMMON += -DMTX_DLL +else +LIBMTXCOMMONEXT = a +endif + +DEP_COMMON = src/common/libmtxcommon.$(LIBMTXCOMMONEXT) DEP_EBMLCOMMON = src/common/libmtxebmlcommon.a DEP_KAXCOMMON = src/common/libmtxkaxcommon.a DEP_INPUT = src/input/libmtxinput.a @@ -103,10 +112,11 @@ DEP_RMFF = librmff/librmff.a DEP_MPEGPARSER = src/mpegparser/libmpegparser.a COMPRESSION_LIBRARIES = $(LZO_LIBS) $(BZ2_LIBS) -APPLICATIONS = src/mkvmerge src/mkvinfo src/mkvextract src/base64tool +APPLICATIONS = src/mkvmerge@EXEEXT@ src/mkvinfo@EXEEXT@ \ + src/mkvextract@EXEEXT@ src/base64tool@EXEEXT@ MANPAGES = doc/mkvmerge.1 doc/mkvinfo.1 doc/mkvextract.1 doc/base64tool.1 ifeq (yes,$(USE_WXWINDOWS)) -APPLICATIONS += src/mmg/mmg +APPLICATIONS += src/mmg/mmg@EXEEXT@ MANPAGES += doc/mmg.1 endif @@ -155,6 +165,8 @@ SYSTEM_LIBDIRS = $(AVILIB_LIBDIRS) \ RUNAR = $(AR) rcu LINK = $(CXX) $(LDFLAGS) $(LIBDIRS) $(SYSTEM_LIBDIRS) +LINKSHARED = $(CXX) $(LDFLAGS) $(LIBDIRS) $(SYSTEM_LIBDIRS) \ + -shared -Wl,--export-all CXXCOMPILE = $(CXX) $(CXXFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) CCOMPILE = $(CC) $(CFLAGS) $(INCLUDES) $(SYSTEM_INCLUDES) @@ -173,9 +185,21 @@ else endif # Some general rules +ifeq (1,$(LIBMTXCOMMONDLL)) +%.o: %.cpp + @echo ' CXX ' $< + @if echo $@ | grep src.common > /dev/null 2>&1; then \ + test x$(V) = "x1" && echo $(CXXCOMPILE) $(CXXFLAGS_SRC_COMMON) -c -o $@ $< ; \ + $(CXXCOMPILE) $(CXXFLAGS_SRC_COMMON) -c -o $@ $< ; \ + else \ + test x$(V) = "x1" && echo $(CXXCOMPILE) $(CXXFLAGS_NO_SRC_COMMON) -c -o $@ $< ; \ + $(CXXCOMPILE) $(CXXFLAGS_NO_SRC_COMMON) -c -o $@ $< ; \ + fi +else %.o: %.cpp @echo ' CXX ' $< $(Q)$(CXXCOMPILE) -c -o $@ $< +endif %.o: %.c @echo ' CC ' $< @@ -186,10 +210,11 @@ endif $(Q)msgfmt -o $@ $< clean: - rm -f *.o */*.o */*/*.o */lib*.a */*/lib*.a po/*.mo $(APPLICATIONS) + rm -f *.o */*.o */*/*.o */lib*.a */*/lib*.a po/*.mo $(APPLICATIONS) \ + */*.exe */*/*.exe */*/*.dll */*/*.dll.a distclean dist-clean: clean - rm -f configure config.h config.h.in config.log \ + rm -f configure config.h config.h.in config.log config.cache \ Makefile */Makefile */*/Makefile depend: @@ -355,23 +380,23 @@ mmg_DEPENDENCIES += $(DEP_COMMON) mmg_LDADD = -lmtxcommon -lmatroska -lebml -lexpat $(ICONV_LIBS) \ $(WXWINDOWS_LIBS) $(LIBINTL_LIBS) -src/mkvmerge: $(mkvmerge_OBJECTS) $(mkvmerge_DEPENDENCIES) +src/mkvmerge@EXEEXT@: $(mkvmerge_OBJECTS) $(mkvmerge_DEPENDENCIES) @echo ' LINK ' $@ $(Q)$(LINK) -o $@ $(mkvmerge_OBJECTS) $(mkvmerge_LDADD) -src/mkvinfo: $(mkvinfo_OBJECTS) $(mkvinfo_DEPENDENCIES) +src/mkvinfo@EXEEXT@: $(mkvinfo_OBJECTS) $(mkvinfo_DEPENDENCIES) @echo ' LINK ' $@ $(Q)$(LINK) -o $@ $(mkvinfo_OBJECTS) $(mkvinfo_LDADD) -src/mkvextract: $(mkvextract_OBJECTS) $(mkvextract_DEPENDENCIES) +src/mkvextract@EXEEXT@: $(mkvextract_OBJECTS) $(mkvextract_DEPENDENCIES) @echo ' LINK ' $@ $(Q)$(LINK) -o $@ $(mkvextract_OBJECTS) $(mkvextract_LDADD) -src/base64tool: $(base64tool_OBJECTS) $(base64tool_DEPENDENCIES) +src/base64tool@EXEEXT@: $(base64tool_OBJECTS) $(base64tool_DEPENDENCIES) @echo ' LINK ' $@ $(Q)$(LINK) -o $@ $(base64tool_OBJECTS) $(base64tool_LDADD) -src/mmg/mmg: $(mmg_OBJECTS) $(mmg_DEPENDENCIES) +src/mmg/mmg@EXEEXT@: $(mmg_OBJECTS) $(mmg_DEPENDENCIES) @echo ' LINK ' $@ $(Q)$(LINK) -o $@ $(mmg_OBJECTS) $(mmg_LDADD) diff --git a/configure.in b/configure.in index 605771d83..b8ee11fad 100644 --- a/configure.in +++ b/configure.in @@ -174,10 +174,14 @@ AC_CACHE_CHECK([if being compiled with mingw32], if test "x$ac_cv_mingw32" = "xyes"; then export MINGW=1 MINGW_GUIAPP=-mwindows + LIBMTXCOMMONDLL=1 + else + LIBMTXCOMMONDLL=0 fi AC_SUBST(MINGW_LIBS) AC_SUBST(MINGW_GUIAPP) +AC_SUBST(LIBMTXCOMMONDLL) dnl @@ -186,7 +190,7 @@ dnl can be typedef'ed manually. dnl AC_MSG_CHECKING(for int64_t) AC_LANG_PUSH(C++) -AC_CACHE_VAL(has_int64_t,[ +AC_CACHE_VAL(ac_cv_has_int64_t,[ AC_TRY_COMPILE([ #if HAVE_INTTYPES_H # include @@ -199,13 +203,13 @@ AC_CACHE_VAL(has_int64_t,[ #endif ], [int64_t foo;], - has_int64_t=yes, - has_int64_t=no) + ac_cv_has_int64_t=yes, + ac_cv_has_int64_t=no) ]) -AC_MSG_RESULT($has_int64_t) +AC_MSG_RESULT($ac_cv_has_int64_t) AC_MSG_CHECKING(for uint64_t) -AC_CACHE_VAL(has_uint64_t,[ +AC_CACHE_VAL(ac_cv_has_uint64_t,[ AC_TRY_COMPILE([ #if HAVE_INTTYPES_H # include @@ -218,17 +222,17 @@ AC_CACHE_VAL(has_uint64_t,[ #endif ], [int64_t foo;], - has_uint64_t=yes, - has_uint64_t=no) + ac_cv_has_uint64_t=yes, + ac_cv_has_uint64_t=no) ]) -AC_MSG_RESULT($has_uint64_t) +AC_MSG_RESULT($ac_cv_has_uint64_t) AC_LANG_POP AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) -if test x$has_int64_t = "xyes" ; then +if test x$ac_cv_has_int64_t = "xyes" ; then TYPE64="int64_t" else case 8 in @@ -241,7 +245,7 @@ else [the type to define int64_t manually]) fi -if test x$has_uint64_t = "xyes" ; then +if test x$ac_cv_has_uint64_t = "xyes" ; then TYPEU64="int64_t" else case 8 in