diff --git a/configure.ac b/configure.ac index 64b39f28b..a8bf724ce 100644 --- a/configure.ac +++ b/configure.ac @@ -11,6 +11,11 @@ AC_CONFIG_AUX_DIR(config) MC_VERSION AM_INIT_AUTOMAKE(mc, ${VERSION} ) +LIBMC_VERSION="0.0.1" +LIBMC_RELEASE="1" +AC_SUBST(LIBMC_VERSION) +AC_SUBST(LIBMC_RELEASE) + dnl Enable silent rules by default (if yes) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) @@ -45,6 +50,24 @@ dnl PKG_CHECK_MODULES([CHECK], [check >= 0.9.4]) AC_CHECK_GLIB +AC_ARG_ENABLE([mclib], + [AS_HELP_STRING([--enable-mclib],[ Compile shared library libmc.so [no]])], + [ + if test "x$enableval" = "xno" ; then + enable_mclib=no + else + if test "x$enable_shared" = "xno" ; then + AC_MSG_WARN([Build of shared library is disabled. Specify --enable-shared first]) + enable_mclib=no + else + enable_mclib=yes + fi + fi + ], + [enable_mclib=no]) + +AM_CONDITIONAL([ENABLE_MCLIB], [test x$enable_mclib = xyes]) + AC_HEADER_MAJOR AC_C_CONST AC_SYS_LARGEFILE diff --git a/lib/Makefile.am b/lib/Makefile.am index bec2d63c5..f57334b2c 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,6 +1,17 @@ SUBDIRS = event filehighlight mcconfig search skin tty vfs strutil widget -noinst_LTLIBRARIES = libmc.la +if ENABLE_MCLIB + LIB_VERSION=`echo $(LIBMC_VERSION) | \ + tr '.' ' '| \ + while read v1 v2 v3; do echo $$v2':'$$v3':'$$v1; done` + + libmc_la_LDFLAGS=-no-undefined -version-info $(LIB_VERSION) -release $(LIBMC_RELEASE) + + lib_LTLIBRARIES = libmc.la +else + noinst_LTLIBRARIES = libmc.la +endif + SUBLIB_includes = \ event.h event-types.h \ @@ -50,3 +61,14 @@ libmc_la_LIBADD = \ tty/libmctty.la \ vfs/libmcvfs.la \ widget/libmcwidget.la + +libmc_la_LIBADD += $(MCLIBS) $(SLANGLIB) + +if HAVE_GMODULE + libmc_la_LIBADD += $(GMODULE_LIBS) +else + libmc_la_LIBADD += $(GLIB_LIBS) +endif + +libmc_la_LIBADD += $(PCRE_LIBS) $(LIBICONV) $(INTLLIBS) + diff --git a/src/Makefile.am b/src/Makefile.am index 0e10e004e..d5ec6b00e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,23 +35,13 @@ mc_LDADD = \ viewer/libmcviewer.la \ filemanager/libmcfilemanager.la \ $(DIFFLIB) $(EDITLIB) \ - ../lib/libmc.la + $(top_builddir)/lib/libmc.la if ENABLE_VFS_SMB # this is a hack for linking with own samba library in simple way mc_LDADD += vfs/smbfs/helpers/libsamba.a endif -mc_LDADD += $(MCLIBS) $(SLANGLIB) - -if HAVE_GMODULE -mc_LDADD += $(GMODULE_LIBS) -else -mc_LDADD += $(GLIB_LIBS) -endif - -mc_LDADD += $(PCRE_LIBS) $(LIBICONV) $(INTLLIBS) - SRC_mc_conssaver = \ cons.handler.c consaver/cons.saver.h