aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2008-06-10 17:41:41 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2008-06-10 17:41:41 +0400
commit25395e554edc13f457e48d5fdf69095b3dbe5e17 (patch)
treee8715de6b909d4b0c7d0f5dcf8122582a6511902
parent2564777f536f6fde73ddaf24eaf4697775970e13 (diff)
downloadrspamd-25395e554edc13f457e48d5fdf69095b3dbe5e17.tar.gz
rspamd-25395e554edc13f457e48d5fdf69095b3dbe5e17.zip
* Remove warning from main.c
* Add perl detection and perl linker's and cflags * Modify configure to work with BSD sed (stupid and ugly)
-rw-r--r--Makefile.in2
-rwxr-xr-xconfigure55
-rw-r--r--main.c3
3 files changed, 55 insertions, 5 deletions
diff --git a/Makefile.in b/Makefile.in
index 5685d6c32..1bf77d694 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -7,7 +7,7 @@ memctest: upstream.c memcached.c memcached-test.c
$(CC) $(OPT_FLAGS) $(CFLAGS) $(PTHREAD_CFLAGS) -c memcached-test.c
$(CC) $(OPT_FLAGS) $(PTHREAD_LDFLAGS) $(LD_PATH) upstream.o memcached.o memcached-test.o $(LIBS) -o memcached-test
-install: $(EXEC) rmilter.8 rmilter.conf.sample
+install: $(EXEC)
$(INSTALL) -b $(EXEC) $(PREFIX)/sbin/$(EXEC)
$(INSTALL) -v $(EXEC).sh $(PREFIX)/etc/rc.d
#$(INSTALL) -m0644 rspamd.8 $(MANPATH)/man8
diff --git a/configure b/configure
index 74e00b7d2..e9471cd78 100755
--- a/configure
+++ b/configure
@@ -7,6 +7,7 @@ YACC=""
OS=""
PKG_CONFIG=`which pkg-config`
+PERL=`which perl`
LOCALBASE=/usr/local
PREFIX=$LOCALBASE
@@ -297,6 +298,44 @@ check_package()
}
+check_perl()
+{
+ echo -n "Testing for $PERL: "
+ echo >> config.log
+ echo "Testing for $PERL: " >> config.log
+ if [ ! -x $PERL ] ; then
+ echo "not found"
+ echo "-> FAILED" >> config.log
+ cleanup
+ return 1
+ fi
+ PERLCFLAGS=`$PERL -MExtUtils::Embed -e ccopts`
+ PERLLDFLAGS=`$PERL -MExtUtils::Embed -e ldopts`
+
+ echo "#include <stdlib.h>" > autotest.c
+ echo "#include <EXTERN.h>" >> autotest.c
+ echo "#include <perl.h>" >> autotest.c
+ echo "int main (int argc, char **argv) { PERL_SYS_INIT3(&argc,&argv,&env); return 0; }" >> autotest.c
+ echo "$GCC $CFLAGS $PERLCFLAGS $PTHREAD_CFLAGS -o autotest $LDFLAGS $LIBS $PERLLDFLAGS $PTHREAD_LDFLAGS autotest.c" >>config.log
+ $GCC $CFLAGS $PERLCFLAGS $PTHREAD_CFLAGS -o autotest $LDFLAGS $LIBS $PERLLDFLAGS $PTHREAD_LDFLAGS autotest.c >>config.log 2>&1
+ if [ $? -eq 0 ] ; then
+ echo "found"
+ LIBS="$LIBS $PERLLDFLAGS"
+ CFLAGS="$CFLAGS $PERLCFLAGS"
+ cleanup
+ echo "-> OK" >> config.log
+ return 0
+ else
+ echo "not found"
+ echo "-> FAILED" >> config.log
+ echo "Failed program was:" >> config.log
+ cat autotest.c >> config.log
+ cleanup
+ return 1
+ fi
+
+}
+
check_os()
{
_OS=`uname -s`
@@ -352,9 +391,9 @@ write_result()
OBJECTS=`echo $SOURCES | sed -e 's/\.c/\.o/g'`
# Make CFLAGS more readable
CFLAGS="$CFLAGS -DRVERSION=\\\"${VERSION}\\\" -DHASH_COMPAT"
- CFLAGS=`echo $CFLAGS | sed -e 's/[ ]/ \\\\\\n/g' | sort -r -k2 | uniq`
- LDFLAGS=`echo $LDLAGS | sed -e 's/[ ]/ \\\\\\n/g' | sort -r -k2 | uniq`
- LIBS=`echo $LIBS | sed -e 's/[ ]/ \\\\\\n/g' | sort -r -k2 | uniq`
+ CFLAGS=`echo $CFLAGS | tr [:space:] \\\n | sed -e 's/$/ \\\/' | sed -e '$,$s/\\\//' | sort -r -k2 | uniq`
+ LDFLAGS=`echo $LDLAGS | tr [:space:] \\\n | sed -e 's/$/ \\\/' | sed -e '$,$s/\\\//' | sort -r -k2 | uniq`
+ LIBS=`echo $LIBS | tr [:space:] \\\n | sed -e 's/$/ \\\/' | sed -e '$,$s/\\\//' | sort -r -k2 | uniq`
cat > $MAKEFILE << END
# This is ${EXEC} Makefile
# For options edit Makefile.in, this file is autogenerated by configure
@@ -558,6 +597,16 @@ fi
check_package "glib-2.0" "glib.h"
check_package "gmime-2.0" "gmime/gmime.h"
+if [ $? -eq 1 ] ; then
+ echo "Package gmime-2.0 not found, check config.log for details"
+ exit 1
+fi
+
+check_perl
+if [ $? -eq 1 ] ; then
+ echo "Perl or libperl not found, check config.log for details"
+ exit 1
+fi
check_group $GROUP
if [ $? -ne 0 ] ; then
diff --git a/main.c b/main.c
index 1b7a00f15..8cc906b09 100644
--- a/main.c
+++ b/main.c
@@ -128,6 +128,7 @@ main (int argc, char **argv)
struct rspamd_worker *cur, *cur_tmp, *active_worker;
struct sockaddr_un *un_addr;
FILE *f;
+ pid_t wrk;
rspamd = (struct rspamd_main *)malloc (sizeof (struct rspamd_main));
bzero (rspamd, sizeof (struct rspamd_main));
@@ -243,7 +244,7 @@ main (int argc, char **argv)
child_dead = 0;
msg_debug ("main: catch SIGCHLD signal, finding terminated worker");
/* Remove dead child form childs list */
- pid_t wrk = waitpid (0, &res, 0);
+ wrk = waitpid (0, &res, 0);
TAILQ_FOREACH_SAFE (cur, &rspamd->workers, next, cur_tmp) {
if (wrk == cur->pid) {
/* Catch situations if active worker is abnormally terminated */