Andrew Savchenko

Build both clsync and libclsync conditionally

Configure now supports both --enable-{lib,}clsync.
ACLOCAL_AMFLAGS = -I m4
if CLSYNC
bin_PROGRAMS = clsync
clsync_SOURCES = sync.c cluster.c main.c error.c fileutils.c malloc.c glibex.c
clsync_CFLAGS = $(AM_CFLAGS)
if SOCKET
lib_LTLIBRARIES = libclsync.la
libclsync_la_SOURCES = malloc.c libclsync.c socket.c
libclsync_la_LDFLAGS = -version-info 0:0:0
clsync_SOURCES += socket.c control.c
endif
... ... @@ -15,13 +13,20 @@ main.o: revision.h
man_MANS = man/man1/clsync.1
doc_DATA = CONTRIB DEVELOPING LICENSE PROTOCOL README.md TODO
exampledir=$(docdir)/examples
example_DATA = \
$(wildcard $(srcdir)/examples/*.c) \
$(wildcard $(srcdir)/examples/*.sh)
endif
doc_DATA = CONTRIB DEVELOPING LICENSE PROTOCOL README.md TODO
if LIBCLSYNC
lib_LTLIBRARIES = libclsync.la
libclsync_la_SOURCES = malloc.c libclsync.c socket.c
libclsync_la_LDFLAGS = -version-info 0:0:0
endif
REVISION=$(shell [ -d .git ] &&\
(echo -n \
... ... @@ -37,34 +42,44 @@ AM_CFLAGS := -DREVISION=$(REVISION)
clsync_includedir = $(includedir)/clsync
clsync_include_HEADERS = \
configuration.h \
error.h \
malloc.h
if CLSYNC
clsync_include_HEADERS += \
clsync.h \
malloc.h \
indexes.h \
configuration.h \
ctx.h \
error.h
indexes.h
if SOCKET
clsync_include_HEADERS += \
socket.h \
libclsync.h
socket.h
endif
endif
if LIBCLSYNC
clsync_include_HEADERS += \
libclsync.h \
socket.h
endif
doc:
doxygen .doxygen
install-data-local:
if SOCKET
if LIBCLSYNC
mkdir -p $(DESTDIR)/$(libdir)/pkgconfig
cp pkgconfig/*.pc $(DESTDIR)/$(libdir)/pkgconfig/
endif
if CLSYNC
mkdir -p $(DESTDIR)/$(exampledir)
cp -R examples/production $(DESTDIR)/$(exampledir)/
endif
uninstall-local:
rm -rf $(DESTDIR)/$(exampledir)/production
CLEANFILES = revision.h
if CLSYNC
CLEANFILES += examples/rules
clean-local:
-rm -rf examples/testdir examples/*.o examples/*.so examples/*.xz doc
endif
... ...
... ... @@ -11,6 +11,12 @@ AC_CONFIG_MACRO_DIR([m4])
LT_INIT
dnl --enable-clsync
AC_ARG_ENABLE(clsync,
AS_HELP_STRING(--disable-clsync,
[do not build clsync binary, default: build clsync]))
AM_CONDITIONAL([CLSYNC], [test "x$enable_clsync" != "xno"])
dnl --enable-cluster
AC_ARG_ENABLE(cluster,
AS_HELP_STRING(--enable-cluster,
... ... @@ -40,6 +46,12 @@ AS_IF([test "x$enable_socket" = "xyes"],
AM_CONDITIONAL([SOCKET], [test "x$enable_socket" = "xyes"])
dnl --enable-libclsync
AC_ARG_ENABLE(libclsync,
AS_HELP_STRING(--enable-libclsync,
[build libclsync socket library, default: no]))
AM_CONDITIONAL([LIBCLSYNC], [test "x$enable_libclsync" = "xyes"])
dnl --enable-debug
AC_ARG_ENABLE(debug,
AS_HELP_STRING(--enable-debug,
... ...