Clean up modular build
Signed-off-by: Lon Hohberger <lhh@redhat.com>
This commit is contained in:
parent
f796c64fc3
commit
64d0f596f6
@ -5,3 +5,10 @@ CFLAGS+=-fPIC -Wall -Wstrict-prototypes -Wshadow -Werror -D_GNU_SOURCE
|
||||
|
||||
LEX=@LEX@
|
||||
YACC=@YACC@
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
sbindir=@sbindir@
|
||||
libdir=@libdir@
|
||||
|
||||
PACKAGE_NAME=@PACKAGE_NAME@
|
||||
|
2
build
Normal file → Executable file
2
build
Normal file → Executable file
@ -8,4 +8,4 @@ else
|
||||
LIBDIR=/usr/lib
|
||||
fi
|
||||
|
||||
./configure --prefix=/ --libdir=$LIBDIR
|
||||
./configure --prefix=/ --libdir=$LIBDIR $*
|
||||
|
@ -10,37 +10,36 @@
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
|
||||
include=../Makefile.top
|
||||
include ../Makefile.top
|
||||
|
||||
TARGETS=fence_virt fence_xvm
|
||||
TARGET=fence_virt
|
||||
LINK=fence_xvm
|
||||
|
||||
fence_virt_SOURCES = mcast.c serial.c main.c options.c
|
||||
|
||||
INCLUDES=-I../include -I/usr/include/nss3 -I/usr/include/nspr4 \
|
||||
-I/usr/include/libxml2
|
||||
INCLUDES=-I../include `nss-config --cflags` `nspr-config --cflags` \
|
||||
`xml2-config --cflags`
|
||||
|
||||
CFLAGS+=-DFENCE_RELEASE_NAME=\"devel\"
|
||||
# nss sucks in way too much stuff
|
||||
LIBS+=-lnss3 `xml2-config --libs`
|
||||
|
||||
LIBS+=-lnss3 -lxml2
|
||||
all: ${TARGET} ${LINK}
|
||||
|
||||
all: ${TARGETS}
|
||||
|
||||
fence_xvm: fence_virt
|
||||
ln -snf fence_virt fence_xvm
|
||||
fence_xvm: ${TARGET}
|
||||
ln -snf $^ $@
|
||||
|
||||
fence_virt: ${fence_virt_SOURCES:.c=.o}
|
||||
gcc -o $@ $^ $(LIBS) -L../common -lfence_virt
|
||||
$(CC) -o $@ $^ $(LIBS) -L../common -lfence_virt
|
||||
|
||||
%.o: %.c
|
||||
gcc $(CFLAGS) -c -o $@ $^ $(INCLUDES)
|
||||
$(CC) $(CFLAGS) -c -o $@ $^ $(INCLUDES)
|
||||
|
||||
install: all
|
||||
# XXX hardcoded sbin
|
||||
if [ ! -d /usr/sbin]; then \
|
||||
install -d /usr/sbin; \
|
||||
if [ ! -d ${sbindir} ]; then \
|
||||
install -d ${sbindir} ; \
|
||||
fi
|
||||
install -m755 ${TARGETS} /usr/sbin
|
||||
install -m755 ${TARGET} ${sbindir}
|
||||
ln -snf ${sbindir}/${TARGET} ${sbindir}/${LINK}
|
||||
|
||||
clean:
|
||||
rm -f ${TARGETS} *.o *.d *~
|
||||
|
||||
rm -f ${TARGET} ${LINK} *.o *.d *~
|
||||
|
@ -17,16 +17,7 @@ TARGETS=libfence_virt.a
|
||||
libfence_virt_a_SOURCE=mcast.c ip_lookup.c simple_auth.c tcp.c \
|
||||
debug.c simple_auth.c fdops.c log.c
|
||||
|
||||
INCLUDES=-I../include \
|
||||
-I/usr/include/openais -I/usr/include/libvirt \
|
||||
-I/usr/include/nss3 -I/usr/include/nspr4 \
|
||||
-I../../../cman/lib -I../../../ccs/lib -I/usr/include/libxml2 \
|
||||
-I/usr/include/libvirt
|
||||
|
||||
CFLAGS+=-DFENCE_RELEASE_NAME=\"devel\"
|
||||
|
||||
LIBS+=-L../../../cman/lib -L../../../ccs/lib -L${libdir}/openais \
|
||||
-L../../../dlm/lib -lnss3 -lxml2
|
||||
INCLUDES=-I../include `nss-config --cflags` `nspr-config --cflags`
|
||||
|
||||
all: ${TARGETS}
|
||||
|
||||
@ -34,7 +25,7 @@ libfence_virt.a: ${libfence_virt_a_SOURCE:.c=.o}
|
||||
ar rc $@ $^
|
||||
|
||||
%.o: %.c
|
||||
gcc $(CFLAGS) -c -o $@ $^ $(INCLUDES)
|
||||
$(CC) $(CFLAGS) -c -o $@ $^ $(INCLUDES)
|
||||
|
||||
clean:
|
||||
rm -f ${TARGETS} *~ *.o testprog
|
||||
|
51
configure.in
51
configure.in
@ -48,6 +48,57 @@ AC_TYPE_SIGNAL
|
||||
AC_FUNC_STAT
|
||||
AC_CHECK_FUNCS([gettimeofday memmove memset select socket strcasecmp strchr strdup strerror])
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Modular build for fence_virtd to split up dependencies
|
||||
# (default)
|
||||
#
|
||||
AC_ARG_ENABLE(modules,
|
||||
[AS_HELP_STRING([--disable-modules],
|
||||
[Disable modular build])],
|
||||
[ modules=$enableval ], [ modules=yes ])
|
||||
AC_SUBST(modules)
|
||||
|
||||
### The following options only are used when $modules="yes" ###
|
||||
|
||||
# Null plugin: Disabled by default
|
||||
AC_ARG_ENABLE(null-plugin,
|
||||
[AS_HELP_STRING([--enable-null-plugin],
|
||||
[Enable null (no-op) backend plugin])],
|
||||
[ mod_null=$enableval ], [ mod_null=no ])
|
||||
AC_SUBST(mod_null)
|
||||
|
||||
# libvirt plugin: Enabled by default
|
||||
AC_ARG_ENABLE(libvirt-plugin,
|
||||
[AS_HELP_STRING([--disable-libvirt-plugin],
|
||||
[Disable local-mode libvirt backend plugin])],
|
||||
[ mod_libvirt=$enableval ], [ mod_libvirt=yes ])
|
||||
AC_SUBST(mod_libvirt)
|
||||
|
||||
# checkpoint plugin: Enabled by default
|
||||
AC_ARG_ENABLE(checkpoint-plugin,
|
||||
[AS_HELP_STRING([--disable-checkpoint-plugin],
|
||||
[Disable cluster checkpoint backend plugin])],
|
||||
[ --enable-checkpoint-plugin Do not include cluster checkpoint plugin.],
|
||||
[ mod_checkpoint=$enableval ], [ mod_checkpoint=yes ])
|
||||
AC_SUBST(mod_checkpoint)
|
||||
|
||||
# multicast plugin: Enabled by default
|
||||
AC_ARG_ENABLE(multicast-plugin,
|
||||
[AS_HELP_STRING([--disable-multicast-plugin],
|
||||
[Disable multicast listener plugin])],
|
||||
[ mod_multicast=$enableval ], [ mod_multicast=yes ])
|
||||
AC_SUBST(mod_multicast)
|
||||
|
||||
# serial/libvirt plugin: Disabled by default
|
||||
AC_ARG_ENABLE(serial-plugin,
|
||||
[AS_HELP_STRING([--disable-serial-plugin],
|
||||
[Enable serial listener plugin])],
|
||||
[ mod_serial=$enableval ], [ mod_serial=no ])
|
||||
AC_SUBST(mod_serial)
|
||||
|
||||
|
||||
AC_CONFIG_FILES([Makefile.top
|
||||
Makefile
|
||||
client/Makefile
|
||||
|
@ -12,22 +12,12 @@
|
||||
|
||||
include ../Makefile.top
|
||||
|
||||
#
|
||||
# Modular information
|
||||
#
|
||||
with_modules=@modules@
|
||||
|
||||
TARGETS=fence_virtd
|
||||
|
||||
MODULES=libvirt.so checkpoint.so multicast.so null.so
|
||||
|
||||
fence_virtd_SOURCES = main.c plugin.c
|
||||
libvirt_so_SOURCES = libvirt.c
|
||||
null_so_SOURCES = null.c
|
||||
multicast_so_SOURCES = mcast.c history.c
|
||||
checkpoint_so_SOURCES = virt.c vm_states.c history.c checkpoint.c
|
||||
|
||||
INCLUDES=-I../include `nss-config --cflags` `nspr-config --cflags`
|
||||
|
||||
CFLAGS+=-DFENCE_RELEASE_NAME=\"devel\" -D_MODULE -DSYSCONFDIR=\"@sysconfdir@\"
|
||||
|
||||
LIBS+=-L../common -lfence_virt -Wl,-wrap,syslog,-wrap,closelog -lpthread
|
||||
|
||||
MAIN_LIBS=-L../config -lsimpleconfig -ldl
|
||||
AIS_LIBS=-L@libdir@/openais -lSaCkpt
|
||||
@ -35,37 +25,106 @@ COROSYNC_LIBS=-L@libdir@/corosync -lcpg
|
||||
VIRT_LIBS=-lvirt
|
||||
NSS_LIBS=-lnss3
|
||||
|
||||
INCLUDES=-I../include `nss-config --cflags` `nspr-config --cflags`
|
||||
|
||||
LIBS+=-L../common -lfence_virt -Wl,-wrap,syslog,-wrap,closelog -lpthread
|
||||
|
||||
MODULE_PATH=${libdir}/${PACKAGE_NAME}
|
||||
|
||||
#
|
||||
# Module sources
|
||||
#
|
||||
fence_virtd_SOURCES = main.c plugin.c
|
||||
libvirt_so_SOURCES = libvirt.c
|
||||
null_so_SOURCES = null.c
|
||||
multicast_so_SOURCES = mcast.c history.c
|
||||
checkpoint_so_SOURCES = virt.c vm_states.c history.c checkpoint.c
|
||||
|
||||
|
||||
################################
|
||||
ifeq ($(with_modules),yes)
|
||||
|
||||
mod_null=@mod_null@
|
||||
mod_libvirt=@mod_libvirt@
|
||||
mod_checkpoint=@mod_checkpoint@
|
||||
mod_multicast=@mod_multicast@
|
||||
mod_serial=@mod_serial@ # XXX Not done yet
|
||||
|
||||
#################
|
||||
# Modular build #
|
||||
#################
|
||||
CFLAGS+=-D_MODULE -DMODULE_PATH=\"${MODULE_PATH}\"
|
||||
MODULES=
|
||||
ifneq ($(mod_libvirt),no)
|
||||
MODULES+=libvirt.so
|
||||
endif
|
||||
ifneq ($(mod_checkpoint),no)
|
||||
MODULES+=checkpoint.so
|
||||
endif
|
||||
ifneq ($(mod_multicast),no)
|
||||
MODULES+=multicast.so
|
||||
endif
|
||||
ifneq ($(mod_null),no)
|
||||
MODULES+=null.so
|
||||
endif
|
||||
|
||||
|
||||
else
|
||||
|
||||
####################
|
||||
# Monolithic build #
|
||||
####################
|
||||
ifneq ($(mod_libvirt),no)
|
||||
fence_virtd_SOURCES+=${libvirt_so_SOURCES}
|
||||
LIBS+=$(VIRT_LIBS)
|
||||
endif
|
||||
ifneq ($(mod_checkpoint),no)
|
||||
fence_virtd_SOURCES+=${checkpoint_so_SOURCES}
|
||||
LIBS+=$(AIS_LIBS) $(COROSYNC_LIBS)
|
||||
endif
|
||||
ifneq ($(mod_multicast),no)
|
||||
fence_virtd_SOURCES+=${multicast_so_SOURCES}
|
||||
LIBS+=$(AIS_LIBS) $(NSS_LIBS)
|
||||
endif
|
||||
ifneq ($(mod_null),no)
|
||||
fence_virtd_SOURCES+=${null_so_SOURCES}
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
CFLAGS+=-DSYSCONFDIR=\"@sysconfdir@\"
|
||||
|
||||
all: ${TARGETS} ${MODULES}
|
||||
|
||||
fence_virtd: ${fence_virtd_SOURCES:.c=.o}
|
||||
gcc -o $@ $^ $(LIBS) $(MAIN_LIBS)
|
||||
$(CC) -o $@ $^ $(LIBS) $(MAIN_LIBS)
|
||||
|
||||
multicast.so: ${multicast_so_SOURCES:.c=.o}
|
||||
gcc -o $@ $^ $(LIBS) -shared $(NSS_LIBS)
|
||||
$(CC) -o $@ $^ $(LIBS) -shared $(NSS_LIBS)
|
||||
|
||||
libvirt.so: ${libvirt_so_SOURCES:.c=.o}
|
||||
gcc -o $@ $^ $(LIBS) -shared $(VIRT_LIBS)
|
||||
$(CC) -o $@ $^ $(LIBS) -shared $(VIRT_LIBS)
|
||||
|
||||
null.so: ${null_so_SOURCES:.c=.o}
|
||||
gcc -o $@ $^ $(LIBS) -shared
|
||||
$(CC) -o $@ $^ $(LIBS) -shared
|
||||
|
||||
checkpoint.so: ${checkpoint_so_SOURCES:.c=.o}
|
||||
gcc -o $@ $^ $(LIBS) -shared $(AIS_LIBS) $(VIRT_LIBS) $(COROSYNC_LIBS)
|
||||
$(CC) -o $@ $^ $(LIBS) -shared $(AIS_LIBS) $(VIRT_LIBS) $(COROSYNC_LIBS)
|
||||
|
||||
%.o: %.c
|
||||
gcc $(CFLAGS) -c -o $@ $^ $(INCLUDES)
|
||||
$(CC) $(CFLAGS) -c -o $@ $^ $(INCLUDES)
|
||||
|
||||
install: all
|
||||
# XXX hardcoded sbin
|
||||
if [ ! -d /usr/sbin ]; then \
|
||||
install -d /usr/sbin; \
|
||||
if [ ! -d ${sbindir} ]; then \
|
||||
install -d ${sbindir} ; \
|
||||
fi
|
||||
install -m755 ${TARGETS} /usr/sbin
|
||||
# XXX hardcoded sbin
|
||||
if [ ! -d /usr/lib64/fence_virt ]; then \
|
||||
install -d /usr/lib64/fence_virt ; \
|
||||
install -m755 ${TARGETS} ${sbindir}
|
||||
ifeq ($(with_modules),yes)
|
||||
if [ ! -d ${MODULE_PATH} ]; then \
|
||||
install -d ${MODULE_PATH} ; \
|
||||
fi
|
||||
install -m755 ${MODULES} /usr/lib64/fence_virt
|
||||
install -m755 ${MODULES} ${MODULE_PATH}
|
||||
endif
|
||||
|
||||
clean:
|
||||
rm -f ${TARGETS} ${MODULES} *.o *.d *~
|
||||
|
@ -186,6 +186,6 @@ BACKEND_INFO_SYM(void)
|
||||
static void __attribute__((constructor))
|
||||
ckpt_register_plugin(void)
|
||||
{
|
||||
plugin_register(&ckpt_plugin);
|
||||
plugin_reg_backend(&ckpt_plugin);
|
||||
}
|
||||
#endif
|
||||
|
@ -349,8 +349,10 @@ libvirt_init(backend_context_t *c, config_object_t *config)
|
||||
dbg_printf(5, "[%s:%d %s]\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
memset(info, 0, sizeof(*info));
|
||||
|
||||
#ifdef _MODULE
|
||||
if (sc_get(config, "fence_virtd/@debug", value, sizeof(value))==0)
|
||||
dset(atoi(value));
|
||||
#endif
|
||||
|
||||
if (sc_get(config, "backends/libvirt/@uri",
|
||||
value, sizeof(value)) == 0) {
|
||||
@ -443,6 +445,6 @@ BACKEND_INFO_SYM(void)
|
||||
static void __attribute__((constructor))
|
||||
libvirt_register_plugin(void)
|
||||
{
|
||||
plugin_register(&libvirt_plugin);
|
||||
plugin_reg_backend(&libvirt_plugin);
|
||||
}
|
||||
#endif
|
||||
|
@ -94,8 +94,12 @@ main(int argc, char **argv)
|
||||
#ifdef _MODULE
|
||||
if (sc_get(config, "fence_virtd/@module_path", val,
|
||||
sizeof(val))) {
|
||||
#ifdef MODULE_PATH
|
||||
snprintf(val, sizeof(val), MODULE_PATH);
|
||||
#else
|
||||
printf("Failed to determine module path.\n");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
dbg_printf(1, "Searching %s for plugins...\n", val);
|
||||
@ -108,9 +112,9 @@ main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
if (dget() > 3)
|
||||
plugin_dump();
|
||||
#endif
|
||||
|
||||
lp = plugin_find_listener(listener_name);
|
||||
if (!lp) {
|
||||
|
@ -311,8 +311,10 @@ mcast_config(config_object_t *config, mcast_options *args)
|
||||
char value[1024];
|
||||
int errors = 0;
|
||||
|
||||
#ifdef _MODULE
|
||||
if (sc_get(config, "fence_virtd/@debug", value, sizeof(value))==0)
|
||||
dset(atoi(value));
|
||||
#endif
|
||||
|
||||
if (sc_get(config, "listeners/multicast/@key_file",
|
||||
value, sizeof(value)-1) == 0) {
|
||||
|
@ -192,6 +192,6 @@ BACKEND_INFO_SYM(void)
|
||||
static void __attribute__((constructor))
|
||||
null_register_plugin(void)
|
||||
{
|
||||
plugin_register(&null_plugin);
|
||||
plugin_reg_backend(&null_plugin);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user