diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2008-06-10 17:41:41 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2008-06-10 17:41:41 +0400 |
commit | 25395e554edc13f457e48d5fdf69095b3dbe5e17 (patch) | |
tree | e8715de6b909d4b0c7d0f5dcf8122582a6511902 /configure | |
parent | 2564777f536f6fde73ddaf24eaf4697775970e13 (diff) | |
download | rspamd-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)
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 55 |
1 files changed, 52 insertions, 3 deletions
@@ -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 |