#!/bin/sh GCC="gcc" MAKE="" LEX="" YACC="" OS="" PKG_CONFIG=`which pkg-config` PERL=`which perl` LOCALBASE=/usr/local PREFIX=$LOCALBASE VERSION=0.0.1 COMPAT_DIR="./compat" YACC_SRC="cfg_file.y" LEX_SRC="cfg_file.l" YACC_OUTPUT="cfg_yacc.c" LEX_OUTPUT="cfg_lex.c" CONFIG="config.h" SOURCES="upstream.c cfg_utils.c memcached.c main.c util.c worker.c fstring.c url.c perl.c protocol.c mem_pool.c filter.c plugins/surbl.c ${LEX_OUTPUT} ${YACC_OUTPUT}" MODULES="surbl" CFLAGS="$CFLAGS -W -Wpointer-arith -Wno-unused-parameter" CFLAGS="$CFLAGS -Wno-unused-function -Wunused-variable -Wno-sign-compare" CFLAGS="$CFLAGS -Wunused-value -ggdb -I${LOCALBASE}/include" CFLAGS="$CFLAGS " LDFLAGS="$LDFLAGS -L/usr/lib -L${LOCALBASE}/lib" OPT_FLAGS="-O -pipe -fno-omit-frame-pointer" DEPS="config.h cfg_file.h memcached.h util.h main.h upstream.h fstring.h url.h perl.h mem_pool.h protocol.h filter.h ${LEX_OUTPUT} ${YACC_OUTPUT}" EXEC=rspamd USER=postfix GROUP=postfix INSTALL="/usr/bin/install -v" MKDIR="/usr/bin/install -v -d" MANPATH="${PREFIX}/share/man" SUBDIRS="test utils" MAKEFILE="Makefile" MAKEFILE_IN="Makefile.in" PERL_MAKEFILE="perl/Makefile.PL.in" PERLCFLAGS="" PERLLDFLAGS="" DEPENDS_FILE=".depends" OPTS="" TARGETS="${EXEC}" prepare_config() { echo "#ifndef CONFIG_H_IN" > $CONFIG echo "#define CONFIG_H_IN" >> $CONFIG cat "$CONFIG.in" >> $CONFIG } finish_config() { echo "#endif" >> $CONFIG } cleanup() { rm -f autotest.c rm -f autotest INCLUDE="" } have_opt() { echo "#define HAVE_$1" >> $CONFIG OPTS="$OPTS HAVE_$1" } check_compiler() { GCC=`PATH="$PATH:$PREFIX/bin:$LOCALBASE/bin" which gcc` echo -n "Testing for gcc: " if [ -x $GCC ] ; then echo "found -> $GCC" return 0 else echo "not found" exit 1 fi } check_make() { MAKE=`PATH="$PATH:$PREFIX/bin:$LOCALBASE/bin" which make` echo -n "Testing for make: " if [ -x $MAKE ] ; then echo "found -> $MAKE" return 0 else echo "not found" exit 1 fi } check_lex() { LEX=`PATH="$PATH:$PREFIX/bin:$LOCALBASE/bin" which lex` echo -n "Testing for lex: " if [ -x $LEX ] ; then echo "found -> $LEX" return 0 else echo "not found" exit 1 fi } check_yacc() { YACC=`PATH="$PATH:$PREFIX/bin:$LOCALBASE/bin" which yacc` echo -n "Testing for yacc: " if [ -x $YACC ] ; then echo "found -> $YACC" return 0 else echo "not found" exit 1 fi } check_function() { FUNCTION=$1 while [ $# -ne 0 -a -n $2 ] ; do shift if [ "F$INCLUDE" = "F" ] ; then INCLUDE="$1" else INCLUDE="$INCLUDE $1" fi done echo -n "Testing for $FUNCTION: " echo >> config.log echo "Testing for $FUNCTION: " >> config.log echo "#include " > autotest.c if [ "F$INCLUDE" != "F" ] ; then for inc in $INCLUDE ; do echo "#include \"$inc\"" >> autotest.c done fi echo "#include " >> autotest.c echo "int main (int argc, char **argv) { $FUNCTION; return 0; }" >> autotest.c echo "$GCC $PTHREAD_CFLAGS $CFLAGS -o autotest $LDFLAGS $LIBS $PTHREAD_LDFLAGS autotest.c" >>config.log $GCC $PTHREAD_CFLAGS $CFLAGS -o autotest $LDFLAGS $LIBS $PTHREAD_LDFLAGS autotest.c >>config.log 2>&1 if [ $? -eq 0 ] ; then echo "found" 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_include() { INCLUDE="$1" echo -n "Testing for $INCLUDE: " echo >> config.log echo "Testing for $INCLUDE: " >> config.log echo "#include " > autotest.c echo "#include \"$INCLUDE\"" >> autotest.c echo "#include " >> autotest.c echo "int main (int argc, char **argv) { return 0; }" >> autotest.c echo "$GCC $CFLAGS $PTHREAD_CFLAGS -o autotest $LDFLAGS $LIBS $PTHREAD_LDFLAGS autotest.c" >>config.log $GCC $CFLAGS $PTHREAD_CFLAGS -o autotest $LDFLAGS $LIBS $PTHREAD_LDFLAGS autotest.c >>config.log 2>&1 if [ $? -eq 0 ] ; then echo "found" echo "-> OK" >> config.log _CFLAG=`echo "$INCLUDE" | sed -e 's/[./]/_/g' | tr '[:lower:]' '[:upper:]'` have_opt $_CFLAG cleanup 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_macro() { MACRO=$1 while [ $# -ne 1 -a -n $1 ] ; do shift if [ "F$INCLUDE" = "F" ] ; then INCLUDE="$1" else INCLUDE="$INCLUDE $1" fi done echo -n "Testing for $MACRO: " echo >> config.log echo "Testing for $MACRO: " >> config.log echo "#include " > autotest.c for inc in $INCLUDE ; do echo "#include \"$inc\"" >> autotest.c done echo "#include \"${INCLUDE}\"" >> autotest.c echo "#include " >> autotest.c echo "int main (int argc, char **argv) {" >>autotest.c echo "#ifndef $MACRO" >>autotest.c echo "#error \"$MACRO not defined\"" >>autotest.c echo "#endif" >> autotest.c echo "}" >>autotest.c echo "$GCC $CFLAGS $PTHREAD_CFLAGS -o autotest $LDFLAGS $LIBS $PTHREAD_LDFLAGS autotest.c" >> config.log $GCC $CFLAGS $PTHREAD_CFLAGS -o autotest $LDFLAGS $LIBS $PTHREAD_LDFLAGS autotest.c >>config.log 2>&1 if [ $? -eq 0 ] ; then echo "found" 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_lib() { LIB=$1 while [ $# -ne 1 -a -n $1 ] ; do shift if [ "F$INCLUDE" = "F" ] ; then INCLUDE="$1" else INCLUDE="$INCLUDE $1" fi done echo -n "Testing for lib$LIB: " echo >> config.log echo "Testing for lib$LIB: " >> config.log echo "#include " > autotest.c if [ "F$INCLUDE" != "F" ] ; then for inc in $INCLUDE ; do echo "#include \"$inc\"" >> autotest.c done fi echo "#include " >> autotest.c echo "int main (int argc, char **argv) { return 0; }" >> autotest.c echo "$GCC $CFLAGS $PTHREAD_CFLAGS -o autotest $LDFLAGS $LIBS -l$LIB $PTHREAD_LDFLAGS autotest.c" >>config.log $GCC $CFLAGS $PTHREAD_CFLAGS -o autotest $LDFLAGS $LIBS -l$LIB $PTHREAD_LDFLAGS autotest.c >>config.log 2>&1 if [ $? -eq 0 ] ; then echo "found" LIBS="$LIBS -l$LIB" 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_package() { PACKAGE=$1 PLIBS=`$PKG_CONFIG --libs $PACKAGE` PCFLAGS=`$PKG_CONFIG --cflags $PACKAGE` while [ $# -ne 1 -a -n $1 ] ; do shift if [ "F$INCLUDE" = "F" ] ; then INCLUDE="$1" else INCLUDE="$INCLUDE $1" fi done echo -n "Testing for $PACKAGE: " echo >> config.log echo "Testing for $PACKAGE: " >> config.log echo "#include " > autotest.c if [ "F$INCLUDE" != "F" ] ; then for inc in $INCLUDE ; do echo "#include \"$inc\"" >> autotest.c done fi echo "#include " >> autotest.c echo "int main (int argc, char **argv) { return 0; }" >> autotest.c echo "$GCC $CFLAGS $PCFLAGS $PTHREAD_CFLAGS -o autotest $LDFLAGS $LIBS $PLIBS $PTHREAD_LDFLAGS autotest.c" >>config.log $GCC $CFLAGS $PCFLAGS $PTHREAD_CFLAGS -o autotest $LDFLAGS $LIBS $PLIBS $PTHREAD_LDFLAGS autotest.c >>config.log 2>&1 if [ $? -eq 0 ] ; then echo "found" LIBS="$LIBS $PLIBS" CFLAGS="$CFLAGS $PCFLAGS" 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_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 " > autotest.c echo "#include " >> autotest.c echo "#include " >> 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" 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` case "$_OS" in FreeBSD*) OS="freebsd" CFLAGS="${CFLAGS}" INSTALL="/usr/bin/install -C -S -v" MKDIR="/usr/bin/install -d -v" MANPATH="${PREFIX}/man" echo "#define FREEBSD" >> $CONFIG ;; Linux*) OS="linux" CFLAGS="${CFLAGS} -D_GNU_SOURCE" echo "#define LINUX" >> $CONFIG ;; Solaris*) OS="solaris" CFLAGS="${CFLAGS}" echo "#define SOLARIS" >> $CONFIG ;; *) OS="unknown" ;; esac } check_user() { _user=$1 echo -n "Checking for user $_user: " grep $_user /etc/passwd > /dev/null 2>&1 if [ $? -eq 0 ] ; then echo "found" return 0 else echo "not found" return 1 fi } check_group() { _group=$1 echo -n "Checking for group $_group: " grep $_group /etc/group > /dev/null 2>&1 if [ $? -eq 0 ] ; then echo "found" return 0 else echo "not found" return 1 fi } check_depends() { ifdep="" depends="" if [ ! -f $DEPENDS_FILE ] ; then return 0 fi while read line ; do echo $line | grep '#if' > /dev/null if [ $? -eq 0 ] ; then ifdep=`echo $line | sed -e 's/^#if \([A-Za-z0-9_]*\)$/\1/'` elif [ "F$ifdep" != "F" ] ; then echo $line | grep "#endif" > /dev/null if [ $? -eq 0 ] ; then ifdep="" else echo $OPTS | grep $ifdep > /dev/null if [ $? -eq 0 ] ; then depends="$depends $line" fi fi else depends="$depends $line" fi done < $DEPENDS_FILE obj_depends=`echo $depends | sed -e 's/\([^ ]\{1,\}\)\/\([^/]\{1,\}\).c/\2.o/g'` echo "DEPENDS=$depends" >> $MAKEFILE echo "OBJ_DEPENDS=$obj_depends" >> $MAKEFILE for _dep in $depends ; do _obj_dep=`echo $_dep | sed -e 's/\([^ ]\{1,\}\)\/\([^/]\{1,\}\).c/\2.o/g'` cat >> $MAKEFILE.dep << END ${_obj_dep}: ${_dep} \$(CC) \$(OPT_FLAGS) \$(CFLAGS) \$(PTHREAD_CFLAGS) -o ${_obj_dep} -c ${_dep} END done } write_modules() { # Write modules init function echo "#ifndef MODULES_H" > modules.h echo "#include \"config.h\"" >> modules.h echo "#include \"modules.h\"" > modules.c echo "module_t modules[] = {" >> modules.c; modules_num=0 for m in $MODULES ; do echo "{\"${m}\", ${m}_module_init, ${m}_module_config, ${m}_module_reconfig}," >> modules.c echo "int ${m}_module_init(struct config_file *cfg, struct module_ctx **ctx);" >> modules.h echo "int ${m}_module_config(struct config_file *cfg);" >> modules.h echo "int ${m}_module_reconfig(struct config_file *cfg);" >> modules.h modules_num=`expr $modules_num + 1` done echo "};" >> modules.c echo "#endif" >> modules.h echo "#define MODULES_NUM $modules_num" >> $CONFIG SOURCES="$SOURCES modules.c" OBJECTS=`echo $SOURCES | sed -e 's/\.c/\.o/g'` } write_perl() { # Write to perl Makefile sed -e "s|%%libs%%|${LDFLAGS} ${LIBS}|" < $PERL_MAKEFILE > .pl_tmp sed -e "s|%%include%%|${CFLAGS}|" < .pl_tmp > .pl2_tmp PERL_MAKEFILE=`echo ${PERL_MAKEFILE} | sed -e 's|.in$||'` mv .pl2_tmp $PERL_MAKEFILE rm -f .pl_tmp .pl2_tmp CURDIR=`pwd` cd `dirname ${PERL_MAKEFILE}` $PERL Makefile.PL cd $CURDIR } write_subdirs() { # Write subdirs makefiles clean_target="clean-subdirs: " dist_clean_target="dist-clean-subdirs: " for sub in $SUBDIRS ; do cp $MAKEFILE $sub/$MAKEFILE saved_pwd=`pwd` old_objs=`echo $OBJECTS | sed -e 's/\([^. ]*\.o\)/..\/\1/g'` old_srcs=`echo $SOURCES | sed -e 's/\([^. ]*\.c\)/..\/\1/g'` cd $sub sub_src="`echo *.c`" sub_obj="`echo $sub_src | sed -e 's/\.c/\.o/g'`" echo "SOURCES=$sub_src" >> $MAKEFILE echo "OBJECTS=$sub_obj" >> $MAKEFILE check_depends cat Makefile.in >> $MAKEFILE if [ -f $MAKEFILE.dep ] ; then cat $MAKEFILE.dep >> $MAKEFILE rm -f $MAKEFILE.dep fi for _sub_src in $sub_src ; do _sub_obj=`echo $_sub_src | sed -e 's/\.c/\.o/g'` cat >> $MAKEFILE << END ${_sub_obj}: ${_sub_src} \$(CC) \$(OPT_FLAGS) \$(CFLAGS) \$(PTHREAD_CFLAGS) -o ${_sub_obj} -c ${_sub_src} END done cd $saved_pwd dist_clean_target="$dist_clean_target ${sub}-dist-clean" clean_target="$clean_target ${sub}-clean" done # Write IN file cat $MAKEFILE_IN >> $MAKEFILE # Process clean targets for all subdirs echo $dist_clean_target >> $MAKEFILE echo $clean_target >> $MAKEFILE for sub in $SUBDIRS ; do cat >> $MAKEFILE << END ${sub}-clean: cd ${sub} && make clean && cd .. ${sub}-dist-clean: cd ${sub} && make dist-clean && cd .. ${sub}: cd ${sub} && make && cd .. END done } write_result() { echo "Compiler: $GCC" >> config.log echo "Make: $MAKE" >> config.log echo "Sources: $SOURCES" >> config.log echo "Cflags: $CFLAGS" >> config.log echo "Ldflags: $LDFLAGS" >> config.log echo "Libs: $LIBS" >> config.log echo "#define RVERSION \"${VERSION}\"" >> $CONFIG echo "#define HASH_COMPAT" >> $CONFIG write_modules write_perl # Make CFLAGS more readable CFLAGS="$CFLAGS $PERLCFLAGS" LIBS="$LIBS $PERLLDFLAGS" CFLAGS=`echo $CFLAGS | tr [:space:] \\\n | sed -e 's/$/ \\\/' | sed -e '$,$s/\\\//' | sort -r -k2 | uniq` LDFLAGS=`echo $LDFLAGS | 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 CC=$GCC # Optimization flags OPT_FLAGS=$OPT_FLAGS # Compile time flags CFLAGS=$CFLAGS # Link time flags LDFLAGS=$LDFLAGS # Libraries to link LIBS=$LIBS # ${EXEC} sources SOURCES=$SOURCES # ${EXEC} objects OBJECTS=$OBJECTS # Version of product VERION=$VERSION # Detected operation system OS=$OS # Lex and yacc executables LEX=$LEX YACC=$YACC # Pthread specific flags PTHREAD_CFLAGS=$PTHREAD_CFLAGS PTHREAD_LDFLAGS=$PTHREAD_LDFLAGS # Prefix to install PREFIX=$PREFIX # Where local libs and includes are located LOCALBASE=$LOCALBASE # Install commands INSTALL=$INSTALL MKDIR=$MKDIR # Executable name EXEC=$EXEC # User and group RSPAMD_USER=$USER RSPAMD_GROUP=$GROUP # All target dependenses TARGETS=$TARGETS $SUBDIRS # Common dependenses DEPS=$DEPS # Path to install manual page MANPATH=$MANPATH # Subdirectories SUBDIRS=$SUBDIRS END write_subdirs # Write build targets to makefile cat >> $MAKEFILE << END ${EXEC}: \$(OBJECTS) \$(CC) \$(PTHREAD_LDFLAGS) \$(LDFLAGS) \$(OBJECTS) \$(LIBS) -o \$(EXEC) END for o in $OBJECTS ; do SO=`echo $o | sed -e 's/\.o/\.c/g'` cat >> $MAKEFILE << END ${o}: \$(DEPS) ${SO} \$(CC) \$(OPT_FLAGS) \$(CFLAGS) \$(PTHREAD_CFLAGS) -o ${o} -c ${SO} END done cat >> $MAKEFILE << END ${LEX_OUTPUT}: cfg_file.h ${LEX_SRC} ${YACC_OUTPUT} \$(LEX) -o${LEX_OUTPUT} ${LEX_SRC} ${YACC_OUTPUT}: cfg_file.h ${YACC_SRC} \$(YACC) -d -o ${YACC_OUTPUT} ${YACC_SRC} END } for option do case "$option" in -*=*) value=`echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) value="" ;; esac case "$option" in --help) help=yes ;; --prefix) PREFIX=$value ;; --user) USER=$value ;; --group) GROUP=$value ;; --enable-debug) CFLAGS="$CFLAGS -DWITH_DEBUG" OPT_FLAGS="" ;; --enable-opt) OPT_FLAGS="-O3 -pipe" ;; --add-module) SOURCES="$SOURCES $value" if [ ! -f $value ] ; then echo "Cannot find $value, please check path" exit 1 fi modline=`grep '/***MODULE:' $value` if [ F"$modline" = "F" ] ; then echo "Cannot find /***MODULE line in $value, please check syntax" exit 1 fi name=`echo $modline | sed 's/.*MODULE:\([^: ]*\).*/\1/'` MODULES="$MODULES $name" ;; --disable-module) SOURCES=`echo $SOURCES | sed -e "s/${value}//g"` if [ ! -f $value ] ; then echo "Cannot find $value, please check path" exit 1 fi modline=`grep '/***MODULE:' $value` if [ F"$modline" = "F" ] ; then echo "Cannot find /***MODULE line in $value, please check syntax" exit 1 fi name=`echo $modline | sed 's/.*MODULE:\([^: ]*\).*/\1/'` MODULES=`echo $MODULES | sed -e "s/${name}//g"` ;; *) echo "$0: error: invalid option \"$option\"" exit 1 ;; esac done if [ "F$help" = "Fyes" ] ; then cat << END --help this message --prefix=PATH set the installation prefix --enable-debug turn on extra debug messages --enable-opt turn on extra optimization --add-module add additional C module --disable-module do not include C module --user=USER set user to use --group=GROUP set group to use END exit 1 fi CFLAGS="$CFLAGS -I$PREFIX/include" LDFLAGS="$LDFLAGS -L$PREFIX/lib" echo "Starting configure for rmilter" >config.log echo $0 $@ >> config.log prepare_config check_compiler check_make check_lex check_yacc check_os check_lib "event" "event.h" if [ $? -eq 1 ] ; then echo "Libevent not found, check config.log for details" exit 1 fi check_lib "pcre" "pcre.h" if [ $? -eq 1 ] ; then echo "PCRE not found, check config.log for details" exit 1 fi check_lib "m" check_lib "pcre" check_lib "md" if [ $? -eq 1 ] ; then cp $COMPAT_DIR/md5.c . cp $COMPAT_DIR/md5.h . SOURCES="$SOURCES md5.c" DEPS="$DEPS md5.h" have_opt "OWN_MD5" fi check_lib "util" if [ $? -eq 0 ] ; then have_opt "LIBUTIL" fi check_function "pidfile_open" "sys/param.h" "libutil.h" if [ $? -eq 0 ] ; then have_opt "PIDFILE" fi check_function "strlcpy" "string.h" if [ $? -eq 1 ] ; then cp $COMPAT_DIR/strlcpy.c . cp $COMPAT_DIR/strlcpy.h . SOURCES="$SOURCES strlcpy.c" DEPS="$DEPS strlcpy.h" have_opt "STRLCPY_H" fi check_function "bzero" "string.h" check_function "srandomdev" if [ $? -eq 0 ] ; then have_opt "SRANDOMDEV" fi check_function "getpagesize" "unistd.h" if [ $? -eq 0 ] ; then have_opt "GETPAGESIZE" fi check_function "setproctitle" "unistd.h" if [ $? -eq 0 ] ; then have_opt "SETPROCTITLE" fi check_include "endian.h" check_include "libutil.h" check_include "machine/endian.h" check_include "sys/time.h" check_include "time.h" check_include "stdint.h" if [ $? -eq 1 ] ; then check_include "inttypes.h" fi check_include "strlcpy.h" check_include "md5.h" check_include "sys/queue.h" if [ $? -eq 1 ] ; then cp $COMPAT_DIR/queue.h . DEPS="$DEPS queue.h" fi check_macro "SLIST_FOREACH_SAFE" "sys/queue.h" if [ $? -eq 1 ] ; then cp $COMPAT_DIR/queue.h . DEPS="$DEPS queue.h" have_opt "OWN_QUEUE_H" fi check_macro "PATH_MAX" "limits.h" if [ $? -eq 1 ] ; then check_macro "MAXPATHLEN" "sys/param.h" if [ $? -eq 1 ] ; then have_opt "MAXPATHLEN" echo "#define MAXPATHLEN 4096" >> $CONFIG else have_opt "MAXPATHLEN" fi else have_opt "PATH_MAX" 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 TARGETS="$TARGETS creategroup" fi check_user $USER if [ $? -ne 0 ] ; then TARGETS="$TARGETS createuser" fi write_result finish_config