WARNING: quite broken

Plugins now in separate directories.
This commit is contained in:
Stephane Bortzmeyer 2004-04-09 13:05:16 +00:00
parent 5b3b44da62
commit fa09c1a5ca
27 changed files with 11348 additions and 1101 deletions

View File

@ -117,6 +117,9 @@
/* Define to the version of this package. */ /* Define to the version of this package. */
#undef PACKAGE_VERSION #undef PACKAGE_VERSION
/* Directory where the plugins will be installed */
#undef PLUGINS_DIR
/* Define as the return type of signal handlers (`int' or `void'). */ /* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE #undef RETSIGTYPE

17
SRC/configure vendored
View File

@ -5990,6 +5990,23 @@ if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall" CFLAGS="$CFLAGS -Wall"
fi fi
interpolate() {
old=$1
eval new=$old
{ echo "$as_me:$LINENO: WARNING: DEBUG-INTERPOL $new" >&5
echo "$as_me: WARNING: DEBUG-INTERPOL $new" >&2;}
if test "$new" != "$old" ; then
interpolate $new
else
echo $new
fi
}
plugins_dir=`interpolate '$libdir/echoping'`
cat >>confdefs.h <<_ACEOF
#define PLUGINS_DIR $plugins_dir
_ACEOF
subdirs="$subdirs plugins" subdirs="$subdirs plugins"

View File

@ -257,6 +257,20 @@ if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall" CFLAGS="$CFLAGS -Wall"
fi fi
interpolate() {
old=$1
eval new=$old
AC_MSG_WARN(DEBUG-INTERPOL $new)
if test "$new" != "$old" ; then
interpolate $new
else
echo $new
fi
}
dnl TODO: the following is broken because installation prefix can be changed at instal-time,
dnl not compilation time.
plugins_dir=`interpolate '$prefix/lib/echoping'`
AC_DEFINE(PLUGINS_DIR, $plugins_dir, [Directory where the plugins will be installed])
AC_CONFIG_SUBDIRS(plugins) AC_CONFIG_SUBDIRS(plugins)
AC_OUTPUT(Makefile) AC_OUTPUT(Makefile)

View File

@ -120,6 +120,8 @@ main (argc, argv)
unsigned short stop_at_newlines = 1; unsigned short stop_at_newlines = 1;
char *newenv, *curenv;
#ifdef OPENSSL #ifdef OPENSSL
SSL_METHOD *meth; SSL_METHOD *meth;
SSL_CTX *ctx = NULL; SSL_CTX *ctx = NULL;
@ -432,6 +434,13 @@ main (argc, argv)
ext = strstr(plugin_name, ".so"); ext = strstr(plugin_name, ".so");
if ((ext == NULL) || (strcmp (ext, ".so") != 0)) if ((ext == NULL) || (strcmp (ext, ".so") != 0))
sprintf (plugin_name, "%s.so", plugin_name); sprintf (plugin_name, "%s.so", plugin_name);
curenv = getenv ("LD_LIBRARY_PATH");
if (! curenv)
newenv = PLUGINS_DIR;
else
sprintf (newenv, "%s:%s", curenv, PLUGINS_DIR);
if (setenv ("LD_LIBRARY_PATH", newenv, 1) == -1)
err_sys ("Cannot change LD_LIBRARY_PATH");
plugin = dlopen (plugin_name, RTLD_NOW); plugin = dlopen (plugin_name, RTLD_NOW);
if (!plugin) if (!plugin)
{ {

View File

@ -1,31 +1,15 @@
CCFLAGS=-DHAVE_CONFIG_H -Wall -O0 -g SUBDIRS=@subdirs@
CCDYNAMICFLAGS=${CCFLAGS} -fPIC
LDFLAGS=
LDDYNAMICFLAGS=${LDFLAGS} -shared -lpq -lresolv # TODO: add the flags only when necessary
PLUGINS=random.so whois.so postgres dns.so
all: $(PLUGINS)
postgres: postgresql.so
%.o: %.c
${CC} ${CCDYNAMICFLAGS} -c -o $@ $<
%.so: %.o
${CC} ${LDDYNAMICFLAGS} -o $@ $<
test-postgresql: test-postgresql.o
${CC} -o $@ -l pq $<
clean:
-rm -f *.o *.so program
distclean: clean
-rm -f *~
.SECONDARY: ${OBJECTS}
# $Id$
all:
ifneq (${SUBDIRS},)
@for subdir in ${SUBDIRS}; do \
(cd $$subdir && ${MAKE} HAVE_CONFIG_H=1 $@) \
done
endif
install:
ifneq (${SUBDIRS},)
@for subdir in ${SUBDIRS}; do \
(cd $$subdir && ${MAKE} $@) \
done
endif

View File

@ -0,0 +1,30 @@
CCFLAGS=-DHAVE_CONFIG_H -Wall -O0 -g
CCDYNAMICFLAGS=${CCFLAGS} -fPIC
LDFLAGS=
LDDYNAMICFLAGS=${LDFLAGS} -shared
# Autoconf variables
prefix = @prefix@
exec_prefix = @exec_prefix@
DESTDIR=@libdir@/echoping
INSTALL=@INSTALL@
%.o: %.c
${CC} ${CCDYNAMICFLAGS} -c -o $@ $<
%.so: %.o
${CC} ${LDDYNAMICFLAGS} -o $@ $<
prepare-install:
@if [ ! -d ${DESTDIR} ]; then \
mkdir ${DESTDIR}; \
fi
clean:
-rm -f *.o *.so
distclean: clean
-rm -f *~
# $Id$

1246
SRC/plugins/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,7 @@
dnl $Id$ dnl $Id$
AC_INIT(random.c) AC_INIT(Makefile.plugins.in)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL AC_PROG_INSTALL
AC_CONFIG_SUBDIRS(random whois dns postgresql)
AC_CHECK_FUNCS(usleep) AC_OUTPUT(Makefile.plugins Makefile)
AC_OUTPUT(Makefile)

View File

@ -0,0 +1,21 @@
PLUGIN=dns.so
include ../Makefile.plugins
ifeq (@DNS_BUILD@,1)
all: ${PLUGIN}
else
all:
@echo "Not building the DNS plugin"
endif
ifeq (@DNS_BUILD@,1)
install: all prepare-install
${INSTALL} ${PLUGIN} ${DESTDIR}
else
all:
@echo "Not installing the DNS plugin"
endif
# $Id$

View File

@ -0,0 +1,28 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the `popt' library (-lpopt). */
#undef HAVE_LIBPOPT
/* Define to 1 if you have the `resolv' library (-lresolv). */
#undef HAVE_LIBRESOLV
/* Define to 1 if you have the `poptGetContext' function. */
#undef HAVE_POPTGETCONTEXT
/* Define to 1 if you have the `res_init' function. */
#undef HAVE_RES_INIT
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION

3732
SRC/plugins/dns/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
dnl $Id$
AC_INIT(dns.c)
AC_CONFIG_HEADERS(config.h)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
DNS_BUILD=1
AC_CHECK_FUNCS(poptGetContext,,
[AC_CHECK_LIB(popt,poptGetContext,,[AC_MSG_WARN([No popt development environment found, not building this plugin]) && DNS_BUILD=0])])
if test "$DNS_BUILD" != "0"; then
AC_CHECK_FUNCS(res_init, ,
dnl Some Unices has res_init but has it renamed in libc as something else so we
dnl must include <resolv.h> to get the redefinition. (Stolen from rsync)
dnl autoconf AC_CHECK_FUNCS does not allow headers to be easily included :-(
[AC_MSG_CHECKING([$ac_func again by including <resolv.h>])
LIBS=-lresolv AC_TRY_LINK([#include <resolv.h>
],
[$ac_func();],
[AC_MSG_RESULT([yes])],
[AC_MSG_WARN([No DNS resolver development environment found, not building this plugin]) && DNS_BUILD=0]
)])
fi
AC_SUBST(DNS_BUILD,$DNS_BUILD)
AC_OUTPUT(Makefile)

View File

@ -5,7 +5,7 @@
*/ */
#define IN_PLUGIN #define IN_PLUGIN
#include "../echoping.h" #include "../../echoping.h"
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>

View File

@ -0,0 +1,23 @@
PLUGIN=postgresql.so
include ../Makefile.plugins
ifeq (@PGSQL_BUILD@,1)
all: ${PLUGIN}
else
all:
@echo "Not building the PostgreSQL plugin"
endif
ifeq (@PGSQL_BUILD@,1)
install: all prepare-install
${INSTALL} ${PLUGIN} ${DESTDIR}
else
all:
@echo "Not installing the PostgreSQL plugin"
endif
# $Id$

View File

@ -0,0 +1,25 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the `popt' library (-lpopt). */
#undef HAVE_LIBPOPT
/* Define to 1 if you have the `poptGetContext' function. */
#undef HAVE_POPTGETCONTEXT
/* Define to 1 if you have the `PQconnectdb' function. */
#undef HAVE_PQCONNECTDB
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION

View File

@ -0,0 +1,20 @@
dnl $Id$
AC_INIT(postgresql.c)
AC_CONFIG_HEADERS(config.h)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
PGSQL_BUILD=1
AC_CHECK_FUNCS(poptGetContext,,
[AC_CHECK_LIB(popt,poptGetContext,,[AC_MSG_WARN([No popt development environment found, not building this plugin]) && PGSQL_BUILD=0])])
if test "$PGSQL_BUILD" != "0"; then
AC_CHECK_FUNCS(PQconnectdb, ,
[AC_CHECK_LIB(pq,PQconnectdb,,
[AC_MSG_WARN([No PostgreSQL development environment found, not building this plugin]) && PGSQL_BUILD=0])])
fi
AC_SUBST(PGSQL_BUILD,$PGSQL_BUILD)
AC_OUTPUT(Makefile)

View File

@ -5,7 +5,7 @@
*/ */
#define IN_PLUGIN #define IN_PLUGIN
#include "../echoping.h" #include "../../echoping.h"
#include <postgresql/libpq-fe.h> #include <postgresql/libpq-fe.h>

View File

@ -0,0 +1,22 @@
PLUGIN=random.so
include ../Makefile.plugins
ifeq (@RANDOM_BUILD@,1)
all: ${PLUGIN}
else
all:
@echo "Not building the random plugin"
endif
ifeq (@RANDOM_BUILD@,1)
install: all prepare-install
${INSTALL} ${PLUGIN} ${DESTDIR}
else
all:
@echo "Not installing the random plugin"
endif
# $Id$

View File

@ -0,0 +1,19 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the `usleep' function. */
#undef HAVE_USLEEP
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION

3503
SRC/plugins/random/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
dnl $Id$
AC_INIT(random.c)
AC_CONFIG_HEADERS(config.h)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
RANDOM_BUILD=1
AC_CHECK_FUNCS(usleep,, [AC_MSG_WARN([No usleep() found, not building this plugin]) && RANDOM_BUILD=0])
AC_SUBST(RANDOM_BUILD,$RANDOM_BUILD)
AC_OUTPUT(Makefile)

View File

@ -0,0 +1,22 @@
PLUGIN=whois.so
include ../Makefile.plugins
ifeq (@WHOIS_BUILD@,1)
all: ${PLUGIN}
else
all:
@echo "Not building the whois plugin"
endif
ifeq (@WHOIS_BUILD@,1)
install: all prepare-install
${INSTALL} ${PLUGIN} ${DESTDIR}
else
all:
@echo "Not installing the whois plugin"
endif
# $Id$

View File

@ -0,0 +1,22 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the `popt' library (-lpopt). */
#undef HAVE_LIBPOPT
/* Define to 1 if you have the `poptGetContext' function. */
#undef HAVE_POPTGETCONTEXT
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION

3576
SRC/plugins/whois/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
dnl $Id$
AC_INIT(whois.c)
AC_CONFIG_HEADERS(config.h)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
WHOIS_BUILD=1
AC_CHECK_FUNCS(poptGetContext,,
[AC_CHECK_LIB(popt,poptGetContext,,[AC_MSG_WARN([No popt development environment found, not building this plugin]) && WHOIS_BUILD=0])])
AC_SUBST(WHOIS_BUILD,$WHOIS_BUILD)
AC_OUTPUT(Makefile)

View File

@ -5,7 +5,7 @@
*/ */
#define IN_PLUGIN #define IN_PLUGIN
#include "../echoping.h" #include "../../echoping.h"
#define MAX_REQUEST 256 #define MAX_REQUEST 256