MIMEDefang spec file (was Re: [Mimedefang] More on mimedefang and x86_64)

Philip Prindeville philipp_subx at redfish-solutions.com
Sun Nov 19 21:14:36 EST 2006


David F. Skoll wrote:

>Philip Prindeville wrote:
>
>[a bunch of comments on the .spec file]
>
>I don't have any RPM-based Linux systems, except for some QEMU virtual
>machines for building our commercial products, so I haven't been
>maintaining the spec file.  If there's a Red Hat or Fedora user out
>there who wants to submit patches to the spec file, I'll gratefully
>accept them.  It probably needs some work.
>
>Specific questions:
>
>  
>
>>should we add /lib64 and /usr/lib64 before /lib and /usr/lib,
>>respectively?
>>    
>>
>
>Yes.  We do this with our CanIt spec file; it should be ported back
>into the MIMEDefang spec file.
>
>  
>
>>Oh, and do we need the symbol file for /usr/bin/mimedefang
>>to put into mimedefang-debuginfo-2.58?
>>    
>>
>
>I have no idea. :-) We've pretty much been a Debian / Ubuntu shop for
>the last few years, and I'm out of touch with the world of RPM.
>
>Regards,
>
>David.
>  
>


Well, I can test changes.

One thing I noticed in the .spec file after I posted my first
email message is that we should run "autoconf" so that the
configure file gets rebuilt.  This would happen after %setup
gets run, but before ./configure.  Especially if some distros
include %patch changes to configure.in...

So, I'll attach files to show these changes...

I've added a build-time dependency to autoconfig > 2.55, since
we're running it.

-Philip


-------------- next part --------------
dnl $Id: configure.in 12929 2006-11-06 15:01:19Z dfs $
dnl Process this file with autoconf to produce a configure script.

AC_INIT(mimedefang.c)

dnl UGLY hack... set the --sysconfdir to /etc UNLESS it was explicitly
dnl supplied on the command line.  Autoconf has no other nice way to set
dnl the default to other than ${prefix}/etc

echo $* | fgrep -e '--sysconfdir' > /dev/null 2>&1 || sysconfdir='/etc'

AC_PROG_CC                      dnl Find C compiler
AC_CHECK_PROGS(AR, ar, no)
AC_CONFIG_HEADER(config.h)

dnl Add some common directories to PATH in case they are not there
PATH=$PATH:/usr/local/bin

AC_PROG_INSTALL

AC_ARG_ENABLE(embedded-perl, [  --disable-embedded-perl Disable embedded Perl interpreter], ac_cv_embedded_perl=$enableval, ac_cv_embedded_perl=yes)

AC_PATH_PROG(PERL, perl)

dnl Check for socklen_t type
AC_MSG_CHECKING(whether socklen_t is defined)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
], [socklen_t x;], ac_have_socklen_t=yes, ac_have_socklen_t=no)
AC_MSG_RESULT($ac_have_socklen_t)
if test "$ac_have_socklen_t" = "yes" ; then
   AC_DEFINE(HAVE_SOCKLEN_T)
fi

for thing in prefix siteprefix vendorprefix installarchlib installprivlib installbin installman1dir installman3dir installscript installsitearch installsitelib; do
    AC_MSG_CHECKING([for Perl installation variable $thing])
    val=`$PERL -V:$thing | sed -e "s/^.*='//" -e "s/';$//"`
    AC_MSG_RESULT($val)
    dnl Stupid m4....
    up=`echo $thing | tr '[[a-z]]' '[[A-Z]]'`
    eval "PERL$up=$val"
done

dnl wait3
dnl We know that wait3 works fine on Solaris 9, but autoconf
dnl sometimes misses it
un=`uname -s -r`
if test "$un" = "SunOS 5.9" ; then
   ac_cv_func_wait3_rusage=yes
fi

AC_FUNC_WAIT3

if test -z "$PERL" ; then
   AC_MSG_ERROR([*** Cannot continue without Perl.  Sorry.])
   exit 1
fi

AC_PATH_PROG(NM, nm)

dnl Allow user to tell us where Sendmail is (or will be)
SENDMAILPROG=no
AC_ARG_WITH(sendmail,
[  --with-sendmail=PATH    specify location of Sendmail binary],
   SENDMAILPROG=$with_sendmail, SENDMAILPROG=no)

DEFANGUSER=""
AC_ARG_WITH(user,
[  --with-user=LOGIN       use LOGIN as the MIMEDefang user],
   DEFANGUSER=$with_user, DEFANGUSER=defang)

AC_SUBST(DEFANGUSER)

IP_HEADER=no
AC_ARG_WITH(ipheader,
[  --with-ipheader         install /etc/mail/mimedefang-ip-key],
   IP_HEADER=$with_ipheader, IP_HEADER=no)

AC_SUBST(IP_HEADER)

dnl Allow user to tell us where milter includes are
MILTERINC=
AC_ARG_WITH(milterinc,
[  --with-milterinc=PATH   specify alternative location of milter includes],
   MILTERINC=$with_milterinc, MILTERINC=)

dnl Allow user to tell us where milter libraries are
MILTERLIB=
AC_ARG_WITH(milterlib,
[  --with-milterlib=PATH   specify alternative location of milter libraries],
   MILTERLIB=$with_milterlib, MILTERLIB=)

dnl Allow specification of sysconfig subdir
AC_ARG_WITH(confsubdir,
[  --with-confsubdir=DIR   specify configuration subdirectory
			  (mail) ],
	CONFSUBDIR="/$with_confsubdir", CONFSUBDIR=/mail)
if test "$CONFSUBDIR" = "/" -o "$CONFSUBDIR" = "//" ; then
   CONFSUBDIR=""
fi

AC_SUBST(CONFSUBDIR)

dnl Allow specification of spool dir
AC_ARG_WITH(spooldir,
[  --with-spooldir=DIR     specify location of spool directory
			  (/var/spool/MIMEDefang)],
	SPOOLDIR=$with_spooldir, SPOOLDIR=/var/spool/MIMEDefang)

dnl Allow specification of quarantine dir
AC_ARG_WITH(quarantinedir,
[  --with-quarantinedir=DIR
			  specify location of quarantine directory
			  (/var/spool/MD-Quarantine)],
	QDIR=$with_quarantinedir, QDIR=/var/spool/MD-Quarantine)

AC_ARG_ENABLE(cleanup-with-rm,
[  --enable-cleanup-with-rm
			  Fork/exec "/bin/rm" to clean up instead of
			  using built-in C code], ac_cv_cleanup_with_rm=$enableval, ac_cv_cleanup_with_rm=no)

AC_ARG_ENABLE(pthread-flag,
[  --enable-pthread-flag   Supply the -pthread flag to the C compiler], FORCE_PTHREAD_FLAG=-pthread, FORCE_PTHREAD_FLAG="")

if test "$ac_cv_cleanup_with_rm" = "yes" ; then
   CLEANUP_DEFS="-DEXEC_RM_FOR_CLEANUP"
else
   CLEANUP_DEFS=""
fi

AC_SUBST(CLEANUP_DEFS)

AC_ARG_ENABLE(check-perl-modules,
[  --disable-check-perl-modules
			  Disable compile-time checks for Perl modules], ac_cv_perlmodcheck=$enableval, ac_cv_perlmodcheck=yes)

HAVE_UNIX_SYSLOG=no

dnl Check for Perl modules
if test "$ac_cv_perlmodcheck" = "no" ; then
   AC_MSG_RESULT([Compile-time checking for Perl modules disabled])
   dnl for installation of spamassassin.cf
   HAVE_SPAM_ASSASSIN=yes
else
    for module in 'IO::Socket' 'MIME::Tools 5.410 ()' 'MIME::WordDecoder' 'Digest::SHA1' ; do
	AC_MSG_CHECKING([for Perl module $module])
	(echo "use lib '$PERLINSTALLSITELIB'; use $module;" ; echo "exit(0);") | $PERL > /dev/null 2>&1
	if test $? != 0 ; then
	    AC_MSG_WARN([*** Error trying to use Perl module $module])
	    AC_MSG_WARN([*** Make sure the following Perl modules are installed:])
	    AC_MSG_WARN([*** MIME::Tools version 5.410 or higher (5.411a recommended)])
	    AC_MSG_WARN([*** MIME::WordDecoder])
	    AC_MSG_WARN([*** Digest::SHA1])
	    exit 1
	fi
	AC_MSG_RESULT(ok)
    done
    dnl Check for *optional* Perl modules

    AC_MSG_CHECKING([for Perl module Mail::SpamAssassin 1.6 or better])
    (echo "use Mail::SpamAssassin 1.6 ();" ; echo "exit(0);") | $PERL > /dev/null 2>&1
    if test $? != 0 ; then
	HAVE_SPAM_ASSASSIN=no
    else
	HAVE_SPAM_ASSASSIN=yes
    fi
    AC_MSG_RESULT($HAVE_SPAM_ASSASSIN)

    AC_MSG_CHECKING([for Perl module Anomy::HTMLCleaner]);
    (echo "use Anomy::HTMLCleaner;" ; echo "exit(0);") | $PERL > /dev/null 2>&1
    if test $? != 0 ; then
	HAVE_ANOMY_HTMLCLEANER=no
    else
	HAVE_ANOMY_HTMLCLEANER=yes
    fi
    AC_MSG_RESULT($HAVE_ANOMY_HTMLCLEANER)

    AC_MSG_CHECKING([for Perl module HTML::Parser])
    (echo "use HTML::Parser;" ; echo "exit(0);") | $PERL > /dev/null 2>&1
    if test $? != 0 ; then
	HAVE_HTML_PARSER=no
    else
	HAVE_HTML_PARSER=yes
    fi
    AC_MSG_RESULT($HAVE_HTML_PARSER)

    AC_MSG_CHECKING([for Perl module Archive::Zip])
    (echo "use Archive::Zip;" ; echo "exit(0);") | $PERL > /dev/null 2>&1
    if test $? != 0 ; then
	HAVE_ARCHIVE_ZIP=no
    else
	HAVE_ARCHIVE_ZIP=yes
    fi
    AC_MSG_RESULT($HAVE_ARCHIVE_ZIP)

    dnl Check MIME::Tools version
    dirs=`echo 'print "@INC\n";' | $PERL`
    foundit=""
    for i in $dirs ; do
	if test -r "$i/MIME/Field/ParamVal.pm" ; then
	    foundit="$i/MIME/Field/ParamVal.pm"
	    break
	fi
    done

    if test "$foundit" != "" ; then
	AC_MSG_CHECKING([MIME-Tools version])
	mtversion=`echo '$x = $MIME::Tools::VERSION; $y = int($x) * 10000; $z = ($x - int($x)) * 10000; print $y + $z;' | $PERL -I$PERLINSTALLSITELIB -MMIME::Tools 2>/dev/null`
	mt_actual_version=`echo 'print "$MIME::Tools::VERSION";' | $PERL -I$PERLINSTALLSITELIB -MMIME::Tools 2>/dev/null`
	if test "$mtversion" = "" ; then
	   mtversion="unknown"
	   mt_actual_version="unknown"
	fi
	AC_MSG_RESULT($mt_actual_version)
    else
	mtversion="unknown"
    fi
fi

dnl We need at least *one* of Sys::Syslog or Unix::Syslog
HAVE_A_SYSLOG=0
for module in 'Sys::Syslog' 'Unix::Syslog' ; do
    AC_MSG_CHECKING([for Perl module $module])
    (echo "use $module;" ; echo "exit(0);") | $PERL > /dev/null 2>&1
    if test $? = 0 ; then
	HAVE_A_SYSLOG=1
	if test "$module" = "Unix::Syslog" ; then
	    HAVE_UNIX_SYSLOG=yes
	fi
	AC_MSG_RESULT(ok)
    else
	AC_MSG_RESULT(no)
    fi
done

if test $HAVE_A_SYSLOG = 0 ; then
    if test "$ac_cv_perlmodcheck" = "yes" ; then
    	AC_MSG_WARN([*** Error: Could not find Sys::Syslog or Unix::Syslog])
	AC_MSG_WARN([*** One of those Perl modules is required.]);
	exit 1
    fi
fi

dnl Check for ExtUtils::Embed
if test "$ac_cv_embedded_perl" = "no" ; then
    echo "Check for embedded perl disabled by --disable-embedded-perl option"
    HAVE_EXTUTILS_EMBED=no
else
    AC_MSG_CHECKING([for Perl module ExtUtils::Embed])
    (echo "use ExtUtils::Embed;" ; echo "exit(0);") | $PERL > /dev/null 2>&1
    if test $? = 0 ; then
	HAVE_EXTUTILS_EMBED=yes
	AC_MSG_RESULT(ok)
    else
	HAVE_EXTUTILS_EMBED=no
	AC_MSG_RESULT(no)
    fi
fi

dnl Check if "setlocksock('native')" works
AC_MSG_CHECKING([if setlocksock('native') works])
(
    echo 'use Sys::Syslog 0.16 qw(:DEFAULT setlogsock);'
    echo '$x = setlogsock("native");'
    echo 'openlog("testlogsock", "ndelay", "user");'
    echo 'exit(0) if (defined($x) and $x);'
    echo 'exit(1);'
) | $PERL > /dev/null 2>&1

if test $? != 0 ; then
   SETLOGSOCK_NATIVE=no
else
    SETLOGSOCK_NATIVE=yes
fi
AC_MSG_RESULT($SETLOGSOCK_NATIVE)
AC_SUBST(SETLOGSOCK_NATIVE)

dnl Check if "setlogsock('unix')" works
AC_MSG_CHECKING([if setlogsock('unix') works])
(
    echo 'use Sys::Syslog qw(:DEFAULT setlogsock);'
    echo '$x = setlogsock("unix");'
    echo 'openlog("testlogsock", "ndelay", "user");'
    echo 'exit(0) if (defined($x) and $x);'
    echo 'exit(1);'
) | $PERL > /dev/null 2>&1

if test $? != 0 ; then
   SETLOGSOCK_UNIX=no
else
   SETLOGSOCK_UNIX=yes
fi
AC_MSG_RESULT($SETLOGSOCK_UNIX)
AC_SUBST(SETLOGSOCK_UNIX)
AC_SUBST(HAVE_SPAM_ASSASSIN)
AC_CHECK_HEADERS(getopt.h unistd.h stdint.h)

dnl Check if stdint.h defines uint32_t
AC_MSG_CHECKING(whether stdint.h defines uint32_t)
AC_TRY_COMPILE([
#include <stdint.h>
], [uint32_t foo;], ac_uint32_t_defined=yes, ac_uint32_t_defined=no)
AC_MSG_RESULT($ac_uint32_t_defined)

if test "$ac_uint32_t_defined" = "yes" ; then
   AC_DEFINE(HAVE_UINT32_T)
fi

dnl Check if sys/types.h defines uint32_t
AC_MSG_CHECKING(whether sys/types.h defines uint32_t)
AC_TRY_COMPILE([
#include <sys/types.h>
], [uint32_t foo;], ac_uint32_t_defined=yes, ac_uint32_t_defined=no)
AC_MSG_RESULT($ac_uint32_t_defined)

if test "$ac_uint32_t_defined" = "yes" ; then
   AC_DEFINE(HAVE_UINT32_T)
fi

if test "$HAVE_UNIX_SYSLOG" = "no" ; then
   USE_UNIX_SYSLOG=""
   USE_SYS_SYSLOG='use Sys::Syslog qw(:DEFAULT setlogsock); $Features{"Unix::Syslog"} = 0;'
else
   USE_UNIX_SYSLOG='use Unix::Syslog qw(:macros :subs); $Features{"Unix::Syslog"} = 1;'
   USE_SYS_SYSLOG=""
fi
AC_SUBST(USE_UNIX_SYSLOG)
AC_SUBST(USE_SYS_SYSLOG)
dnl sig_atomic_t
AC_MSG_CHECKING(whether sig_atomic_t is defined)
AC_TRY_COMPILE([
#include <signal.h>
], [sig_atomic_t foo;], ac_have_sig_atomic_t=yes, ac_have_sig_atomic_t=no)
AC_MSG_RESULT($ac_have_sig_atomic_t)
if test "$ac_have_sig_atomic_t" = "yes" ; then
   AC_DEFINE(HAVE_SIG_ATOMIC_T)
fi

dnl Check if compiler allows "-pthread" option, but only if
dnl we are using GCC

if test "$FORCE_PTHREAD_FLAG" = "-pthread" ; then
   AC_MSG_RESULT(Forcing use of -pthread C compiler flag)
   PTHREAD_FLAG=-pthread
elif test "$GCC" = yes ; then
   AC_MSG_CHECKING([whether ${CC-cc} accepts -pthread])
   echo 'void f(){}' > conftest.c
   if test -z "`${CC-cc} -pthread -c conftest.c 2>&1`"; then
	   ac_cv_prog_cc_pthread=yes
	   PTHREAD_FLAG="-pthread"
   else
	PTHREAD_FLAG=""
	ac_cv_prog_cc_pthread=no
   fi
   AC_MSG_RESULT($ac_cv_prog_cc_pthread)
   rm -f conftest*
else
   PTHREAD_FLAG=""
fi

if test "$HAVE_EXTUTILS_EMBED" = "yes" ; then
   AC_MSG_CHECKING([if we can embed a Perl interpreter in C])
   OLDCFLAGS="$CFLAGS"
   OLDLDFLAGS="$LDFLAGS"
   OLDLIBS="$LIBS"
   LIBS="-lperl $LIBS"
   EMBPERLLDFLAGS="`$PERL -MExtUtils::Embed -e ldopts`"
   EMBPERLCFLAGS="`$PERL -MExtUtils::Embed -e ccopts`"
   LDFLAGS="$EMBPERLLDFLAGS $LDFLAGS"
   CFLAGS="$EMBPERLCFLAGS $CFLAGS"
   AC_TRY_RUN([
#include <EXTERN.h>
#include <perl.h>
#include <stdlib.h>
static PerlInterpreter *my_perl;
int main(int argc, char **argv, char **env) {
    my_perl = perl_alloc();
    if (!my_perl) exit(1);
    exit(0);
}
], EMBED_PERL=yes, EMBED_PERL=no)
   LIBS="$OLDLIBS"
   CFLAGS="$OLDCFLAGS"
   LDFLAGS="$OLDLDFLAGS"
   AC_MSG_RESULT($EMBED_PERL)
else
   EMBED_PERL=no
fi
if test "$EMBED_PERL" = "no" ; then
   EMBPERLCFLAGS=""
   EMBPERLLDFLAGS=""
   EMBPERLLIBS=""
   EMBPERLDEFS=""
   EMBPERLOBJS=""
else
   EMBPERLLIBS="-lperl"
   EMBPERLDEFS="-DEMBED_PERL"
   EMBPERLOBJS="embperl.o xs_init.o"
   # Check for buggy perl interpreter
   AC_MSG_CHECKING([if it is safe to destroy and recreate a Perl interpreter])
   LIBS="-lperl $LIBS"
   LDFLAGS="$EMBPERLLDFLAGS $LDFLAGS"
   CFLAGS="$EMBPERLCFLAGS $CFLAGS"
   AC_TRY_RUN([
#include <EXTERN.h>
#include <perl.h>

static PerlInterpreter *my_perl = NULL;

int
make_embedded_interpreter()
{
    char *argv[5];
    int argc;

    if (my_perl != NULL) {
	perl_destruct(my_perl);
	perl_free(my_perl);
	my_perl = NULL;
    }
    my_perl = perl_alloc();
    if (!my_perl) {
	return -1;
    }
    PERL_SET_CONTEXT(my_perl);
    PL_perl_destruct_level = 1;
    perl_construct(my_perl);
    PL_perl_destruct_level = 1;
    argv[0] = "";
    argv[1] = "-e";
    argv[2] = "print(\"\");";
    argv[3] = NULL;
    argc = 3;
    perl_parse(my_perl, NULL, argc, argv, NULL);
    perl_run(my_perl);
    return 0;
}

int
main()
{
    make_embedded_interpreter();
    make_embedded_interpreter();
    return 0;
}
], SAFE_EMBED_PERL=yes, SAFE_EMBED_PERL=no)
   LIBS="$OLDLIBS"
   CFLAGS="$OLDCFLAGS"
   LDFLAGS="$OLDLDFLAGS"
   AC_MSG_RESULT($SAFE_EMBED_PERL)
   if test "$SAFE_EMBED_PERL" = "yes" ; then
      EMBPERLDEFS="$EMBPERLDEFS -DSAFE_EMBED_PERL"
   fi
fi


AC_SUBST(EMBPERLCFLAGS)
AC_SUBST(EMBPERLLDFLAGS)
AC_SUBST(EMBPERLLIBS)
AC_SUBST(EMBPERLOBJS)
AC_SUBST(EMBPERLDEFS)

AC_CHECK_LIB(resolv, res_init)
AC_CHECK_LIB(socket, htons)
AC_CHECK_LIB(nsl, gethostbyname)
LIBS_WITHOUT_PTHREAD="$LIBS"
AC_CHECK_LIB(pthread, pthread_once)

dnl Do we have initgroups?
AC_CHECK_FUNCS(initgroups)
dnl How about getpwnam_r?
AC_CHECK_FUNCS(getpwnam_r)
AC_CHECK_FUNCS(setrlimit)
AC_CHECK_FUNCS(snprintf)
AC_CHECK_FUNCS(vsnprintf)
AC_CHECK_FUNCS(readdir_r)
AC_CHECK_FUNCS(pathconf)
AC_CHECK_FUNCS(inet_ntop)

dnl Find sendmail include file.  The nasty path is in case you're building
dnl Sendmail at the same level as MIMEDefang... we want to use that include
dnl file...
SMMILTER=`echo ../sendmail-*/include`
AC_PATH_PROG(MINCLUDE, libmilter/mfapi.h, no, $MILTERINC:$SMMILTER:/usr/include:/usr/local/include:/usr/local/include/sendmail:/opt/local/include)

if test "$SPOOLDIR" = "no" -o "$SPOOLDIR" = "" ; then
	SPOOLDIR=/var/spool/MIMEDefang
fi

if test "$QDIR" = "no" -o "$QDIR" = "" ; then
	QDIR=/var/spool/MIMEDefang
fi

AC_SUBST(SPOOLDIR)
AC_SUBST(QDIR)

dnl debugging
AC_ARG_ENABLE(debugging, [  --enable-debugging      Add debugging messages to syslog], ac_cv_debugging=$enableval, ac_cv_debugging=no)

dnl Check for virus scanners
AC_ARG_ENABLE(anti-virus,
			[  --disable-anti-virus    Do not look for anti-virus scanners], ac_cv_antivirus=$enableval, ac_cv_antivirus=yes)
AC_ARG_ENABLE(antivir,  [  --disable-antivir       Do not include support for H+BEDV antivir], ac_cv_antivir=$enableval, ac_cv_antivir=yes)
AC_ARG_ENABLE(vexira,   [  --disable-vexira        Do not include support for Central Command Vexira], ac_cv_vexira=$enableval, ac_cv_vexira=yes)
AC_ARG_ENABLE(uvscan,   [  --disable-uvscan        Do not include support for NAI uvscan], ac_cv_uvscan=$enableval, ac_cv_uvscan=yes)
AC_ARG_ENABLE(bdc,      [  --disable-bdc           Do not include support for Bitdefender bdc], ac_cv_bdc=$enableval, ac_cv_bdc=yes)
AC_ARG_ENABLE(sweep,    [  --disable-sweep         Do not include support for Sophos sweep], ac_cv_sweep=$enableval, ac_cv_sweep=yes)
AC_ARG_ENABLE(trend,    [  --disable-trend         Do not include support for Trend Filescanner/Interscan], ac_cv_trend=$enableval, ac_cv_trend=yes)
AC_ARG_ENABLE(AvpLinux, [  --disable-AvpLinux      Do not include support for AVP AvpLinux], ac_cv_AvpLinux=$enableval, ac_cv_AvpLinux=yes)
AC_ARG_ENABLE(kavscanner, [  --disable-kavscanner    Do not include support for Kaspersky kavscanner], ac_cv_kavscanner=$enableval, ac_cv_kavscanner=yes)
AC_ARG_ENABLE(aveclient, [  --disable-aveclient     Do not include support for AVP5 aveclient], ac_cv_aveclient=$enableval, ac_cv_aveclient=yes)
AC_ARG_ENABLE(clamav, [  --disable-clamav        Do not include support for clamav], ac_cv_clamav=$enableval, ac_cv_clamav=yes)
AC_ARG_ENABLE(fsav,     [  --disable-fsav          Do not include support for F-Secure Anti-Virus], ac_cv_fsav=$enableval, ac_cv_fsav=yes)
AC_ARG_ENABLE(csav,     [  --disable-csav          Do not include support for Command Software CSAV], ac_cv_csav=$enableval, ac_cv_csav=yes)
AC_ARG_ENABLE(fprot,    [  --disable-fprot         Do not include support for F-prot Anti-Virus], ac_cv_fprot=$enableval, ac_cv_fprot=yes)
AC_ARG_ENABLE(sophie,   [  --disable-sophie        Do not include support for Sophie], ac_cv_sophie=$enableval, ac_cv_sophie=yes)
AC_ARG_ENABLE(nvcc,   [  --disable-nvcc          Do not include support for Nvcc], ac_cv_nvcc=$enableval, ac_cv_nvcc=yes)
AC_ARG_ENABLE(clamd,   [  --disable-clamd         Do not include support for clamd], ac_cv_clamd=$enableval, ac_cv_clamd=yes)
AC_ARG_ENABLE(trophie, [  --disable-trophie       Do not include support for Trophie], ac_cv_trophie=$enableval, ac_cv_trophie=yes)

ANTIVIR_PATH="$PATH:/usr/lib/AntiVir:/usr/local/uvscan:/opt/AVP:/etc/iscan:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bd7:/usr/local/bd7/bin:/opt/kav/bin:/opt/kav/5.5/kav4unix/bin/"

if test "$ac_cv_antivirus" = "yes"; then
    if test "$ac_cv_antivir" = yes; then
	AC_PATH_PROG(HBEDV,  antivir,  /bin/false, $ANTIVIR_PATH)
    fi

    if test "$ac_cv_vexira" = yes; then
	AC_PATH_PROG(VEXIRA,  vascan,  /bin/false, $ANTIVIR_PATH)
    fi

    if test "$ac_cv_uvscan" = yes; then
	AC_PATH_PROG(NAI,    uvscan,   /bin/false, $ANTIVIR_PATH)
    fi

    if test "$ac_cv_bdc" = yes; then
	AC_PATH_PROG(BDC,    bdc,   /bin/false, $ANTIVIR_PATH)
    fi

    if test "$ac_cv_sweep" = yes; then
	AC_PATH_PROG(SOPHOS, sweep,    /bin/false, $ANTIVIR_PATH)
    fi

    if test "$ac_cv_trend" = yes; then
	AC_PATH_PROG(TREND, vscan,    /bin/false, $ANTIVIR_PATH)
    fi

    if test "$ac_cv_kavscanner" = yes ; then
	AC_PATH_PROG(KAVSCANNER, kavscanner, /bin/false, $ANTIVIR_PATH)
    fi

    if test "$ac_cv_clamav" = yes; then
	AC_PATH_PROG(CLAMSCAN,    clamscan, /bin/false, $ANTIVIR_PATH)
    fi

    if test "$ac_cv_AvpLinux" = yes; then
	AC_PATH_PROG(AVP,    AvpLinux, /bin/false, $ANTIVIR_PATH)
	AC_PATH_PROG(AVP_KAVDAEMON, kavdaemon, /bin/false, $ANTIVIR_PATH)
    fi

    if test "$ac_cv_aveclient" = yes; then
	AC_PATH_PROG(AVP5, aveclient, /bin/false, $ANTIVIR_PATH)
    fi

# Update AVP for best scanner: kavdaemon preferred over AvpLinux

    if test "$AVP_KAVDAEMON" != "/bin/false" ; then
	AVP="$AVP_KAVDAEMON"
    fi

    if test "$ac_cv_csav" = yes ; then
        AC_PATH_PROG(CSAV,    csav, /bin/false, $ANTIVIR_PATH)
    fi

    if test "$ac_cv_fsav" = yes; then
	AC_PATH_PROG(FSAV,    fsav, /bin/false, $ANTIVIR_PATH)
    fi

    if test "$ac_cv_fprot" = yes; then
	AC_PATH_PROG(FPROT, f-prot, /bin/false, $ANTIVIR_PATH)
    fi

    if test "$ac_cv_sophie" = yes; then
	AC_PATH_PROG(SOPHIE, sophie, /bin/false, $ANTIVIR_PATH)
    fi

    if test "$ac_cv_nvcc" = yes; then
	AC_PATH_PROG(NVCC, nvcc, /bin/false, $ANTIVIR_PATH)
    fi

    if test "$ac_cv_clamd" = yes; then
	AC_PATH_PROG(CLAMD, clamd, /bin/false, $ANTIVIR_PATH)
    fi

    if test "$ac_cv_trophie" = yes; then
        AC_PATH_PROG(TROPHIE, trophie, /bin/false, $ANTIVIR_PATH)
    fi
fi

test -z "$HBEDV" && HBEDV=/bin/false
test -z "$VEXIRA" && VEXIRA=/bin/false
test -z "$NAI" && NAI=/bin/false
test -z "$BDC" && BDC=/bin/false
test -z "$SOPHOS" && SOPHOS=/bin/false
test -z "$TREND" && TREND=/bin/false
test -z "$CLAMSCAN" && CLAMSCAN=/bin/false
test -z "$AVP" && AVP=/bin/false
test -z "$AVP5" && AVP5=/bin/false
test -z "$AVP_KAVDAEMON" && AVP_KAVDAEMON=/bin/false
test -z "$KAVSCANNER" && KAVSCANNER=/bin/false
test -z "$CSAV" && CSAV=/bin/false
test -z "$FSAV" && FSAV=/bin/false
test -z "$FPROT" && FPROT=/bin/false
test -z "$SOPHIE" && SOPHIE=/bin/false
test -z "$NVCC" && NVCC=/bin/false
test -z "$CLAMD" && CLAMD=/bin/false
test -z "$TROPHIE" && TROPHIE=/bin/false

if test "$ac_cv_debugging" = yes ; then
    ENABLE_DEBUGGING=-DENABLE_DEBUGGING
else
    ENABLE_DEBUGGING=
fi

dnl find libmilter.a and libsm.a
SMPATH=`echo ../sendmail-*/obj.*/libmilter`
AC_PATH_PROG(LIBMILTER, libmilter.a, no, $MILTERLIB:$SMPATH:/usr/local/lib:/lib64:/lib:/usr/lib64:/usr/lib:/usr/lib/libmilter)
SMPATH=`echo ../sendmail-*/obj.*/libsm`
AC_PATH_PROG(LIBSM, libsm.a, no, $SMPATH:/usr/local/lib:/lib:/usr/lib:/usr/lib/libmilter)

dnl find libmilter.so in case we have shared libraries
AC_PATH_PROG(LIBMILTERSO, libmilter.so, no, $MILTERLIB:$SMPATH:/usr/local/lib:/lib:/usr/lib:/usr/lib/libmilter)

dnl find Sendmail
if test "$SENDMAILPROG" = "no" ; then
   AC_PATH_PROG(SENDMAILPROG, sendmail, no, $PATH:/sbin:/usr/sbin:/usr/lib:/usr/libexec)
fi

dnl rm
AC_PATH_PROG(RM, rm, no, $PATH)

AC_DEFUN(MD_MILTER_SFIO,[
    AC_MSG_CHECKING([whether libmilter requires -lsfio])
    RESULT=`$NM $LIBMILTER | grep sfsprintf`
    if test -z "$RESULT" ; then
	AC_MSG_RESULT(no)
    else
	AC_MSG_RESULT(yes)
	LIBS="$LIBS -lsfio"
    fi
])

AC_DEFUN(MD_SM_LDAP,[
    AC_MSG_CHECKING([whether libsm requires -lldap])
    RESULT=`$NM $LIBSM | grep ldap_`
    if test -z "$RESULT" ; then
	AC_MSG_RESULT(no)
    else
	AC_MSG_RESULT(yes)
	LIBS="$LIBS -lldap -llber"
    fi
])

AC_DEFUN(MD_MILTER_SM,[
    AC_MSG_CHECKING([whether libmilter requires -lsm])
    RESULT=`$NM $LIBMILTER | grep sm_strlcpy`
    if test -z "$RESULT" ; then
	AC_MSG_RESULT(no)
	LIBSM=""
    else
	AC_MSG_RESULT(yes)
	LIBS="$LIBS"
	if test "$LIBSM" = "no" ; then
	    AC_MSG_WARN([Oops.. I couldn't find libsm.a.  Please install Sendmail 8.12])
	    AC_MSG_WARN([and its libraries.])
	    PROBLEM=1
	else
	    MD_SM_LDAP
	fi
    fi
])


dnl Sanity checks

if test "$LIBMILTER" = "no" -a "$LIBMILTERSO" = "no" ; then
    AC_MSG_WARN([Oops.. I couldn't find libmilter.a or libmilter.so.  Please install Sendmail])
    AC_MSG_WARN([and its libraries.  You must run Build in the libmilter/ directory])
    AC_MSG_WARN([to compile libmilter.])
    PROBLEM=1
fi

if test "$LIBMILTER" != "no" ; then
    LIBMILTERACTUAL="$LIBMILTER"
else
    LIBMILTERACTUAL="$LIBMILTERSO"
fi

if test "$MINCLUDE" = "no" ; then
    AC_MSG_WARN([Oops.. I couldn't find libmilter/mfapi.h.  Please install Sendmail 8.12])
    AC_MSG_WARN([and its header files.])
    PROBLEM=1
fi

if test "$SENDMAILPROG" = "no" ; then
    AC_MSG_WARN([Oops.. I couldn't find the 'sendmail' program.  Please install it.])
    PROBLEM=1
fi

if test "$PROBLEM" = 1 ; then
    exit 1
fi

dnl GCC warning level
if test "$GCC" = yes; then
    if test "`uname -s`" = Linux; then
	    CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
    fi
fi

dnl Fix up the include stuff
MINCLUDE=`dirname $MINCLUDE`
MINCLUDE=`dirname $MINCLUDE`

dnl If MINCLUDE is "/usr/include", do NOT add to include path, because
dnl this messes up compilation with gcc on Solaris.
if test "$MINCLUDE" = "/usr/include" ; then
   MINCLUDE=""
else
   MINCLUDE="-I${MINCLUDE}"
fi

AC_SUBST(ENABLE_DEBUGGING)
AC_SUBST(PTHREAD_FLAG)
VERSION=2.58
AC_SUBST(VERSION)

NEED_LIBSM=0
dnl Jigger for machines without snprintf
if test "$ac_cv_func_snprintf" != "yes" -o "$ac_cv_func_vsnprintf" != "yes" ; then
   AC_MSG_RESULT([Your OS lacks snprintf or vsnprintf, but we'll use the])
   AC_MSG_RESULT([equivalents in $LIBSM])
   NEED_LIBSM=1
   LIBS_WITHOUT_PTHREAD="$LIBSM $LIBS_WITHOUT_PTHREAD"
fi

dnl Check if our libmilter is old...
if test "$AR" != "no" -a "$LIBMILTER" != "no" ; then
   AC_MSG_CHECKING(whether libmilter must be linked with libsm)
   $AR -t $LIBMILTER | fgrep strl.o > /dev/null 2>&1
   if test "$?" = 0 ; then
      AC_MSG_RESULT(no)
   else
      AC_MSG_RESULT(yes)
      NEED_LIBSM=1
   fi
fi

if test "$NEED_LIBSM" = 1 ; then
   if test "$LIBSM" = "no" ; then
      AC_MSG_ERROR([Problem: we need to link with libsm.a, but I can't find it.])
      exit 1
   fi
   LIBS="$LIBSM $LIBS"
fi

AC_SUBST(LIBS_WITHOUT_PTHREAD)
dnl evaluated versions of conf dir
CONFDIR_EVAL=`echo ${sysconfdir}${CONFSUBDIR}`
AC_SUBST(CONFDIR_EVAL)

AC_SUBST(LIBMILTERACTUAL)
AC_SUBST(PERLPREFIX)
AC_SUBST(PERLSITEPREFIX)
AC_SUBST(PERLVENDORPREFIX)
AC_SUBST(PERLINSTALLARCHLIB)
AC_SUBST(PERLINSTALLPRIVLIB)
AC_SUBST(PERLINSTALLBIN)
AC_SUBST(PERLINSTALLMAN1DIR)
AC_SUBST(PERLINSTALLMAN3DIR)
AC_SUBST(PERLINSTALLSCRIPT)
AC_SUBST(PERLINSTALLSITEARCH)
AC_SUBST(PERLINSTALLSITELIB)
AC_SUBST(PERLINSTALLDATA)
AC_SUBST(PERLINSTALLSITEDATA)
AC_SUBST(PERLINSTALLVENDORDATA)
AC_SUBST(PERLINSTALLCONF)
AC_SUBST(PERLINSTALLSITECONF)
AC_SUBST(PERLINSTALLVENDORCONF)

AC_OUTPUT(Makefile mimedefang.pl examples/init-script mimedefang-filter.5 mimedefang-multiplexor.8 mimedefang-protocol.7 mimedefang-notify.7 mimedefang.8 mimedefang.pl.8 md-mx-ctrl.8 watch-mimedefang redhat/mimedefang-init redhat/mimedefang-sysconfig)
chmod a+x examples/init-script > /dev/null 2>&1
chmod a+x watch-mimedefang > /dev/null 2>&1
chmod a+x redhat/mimedefang-init > /dev/null 2>&1

dnl Status info
echo ""
echo "*** Virus scanner detection results:"
PROBLEM=0
GOT_VIRUS_SCANNER=0
if test "$ac_cv_antivirus" != "yes" ; then
    echo "All virus-scanner detection disabled by --disable-anti-virus"
else
    if test "$HBEDV" = "/bin/false" ; then
	if test "$ac_cv_antivir" != "yes" ; then
	    echo "H+BEDV   'antivir'   NO (Disabled by configure command)"
	else
	    echo "H+BEDV   'antivir'   NO (not found)"
	fi
    else
	echo "H+BEDV   'antivir'   YES - $HBEDV"
	GOT_VIRUS_SCANNER=1
    fi

    if test "$VEXIRA" = "/bin/false" ; then
	if test "$ac_cv_vexira" != "yes" ; then
	    echo "Vexira   'vascan'    NO (Disabled by configure command)"
	else
	    echo "Vexira   'vascan'    NO (not found)"
	fi
    else
	echo "Vexira   'vascan'    YES - $VEXIRA"
	GOT_VIRUS_SCANNER=1
    fi

    if test "$NAI" = "/bin/false" ; then
	if test "$ac_cv_uvscan" != "yes" ; then
	    echo "NAI      'uvscan'    NO (Disabled by configure command)"
	else
	    echo "NAI      'uvscan'    NO (not found)"
	fi
    else
	echo "NAI      'uvscan'    YES - $NAI"
	GOT_VIRUS_SCANNER=1
    fi

    if test "$BDC" = "/bin/false" ; then
	if test "$ac_cv_bdc" != "yes" ; then
	    echo "BDC      'bdc'       NO (Disabled by configure command)"
	else
	    echo "BDC      'bdc'       NO (not found)"
	fi
    else
	echo "BDC      'bdc'       YES - $BDC"
	GOT_VIRUS_SCANNER=1
    fi

    if test "$SOPHOS" = "/bin/false" ; then
	if test "$ac_cv_sweep" != "yes" ; then
	    echo "Sophos   'sweep'     NO (Disabled by configure command)"
	else
	    echo "Sophos   'sweep'     NO (not found)"
	fi
    else
	echo "Sophos   'sweep'     YES - $SOPHOS"
	GOT_VIRUS_SCANNER=1
    fi

    if test "$TREND" = "/bin/false" ; then
	if test "$ac_cv_trend" != "yes" ; then
	    echo "TREND    'vscan'     NO (Disabled by configure command)"
	else
	    echo "TREND    'vscan'     NO (not found)"
	fi
    else
	echo "TREND    'vscan'     YES - $TREND"
 	GOT_VIRUS_SCANNER=1
    fi

    if test "$CLAMSCAN" = "/bin/false" ; then
	if test "$ac_cv_clamav" != "yes" ; then
	    echo "CLAMSCAN 'clamav'    NO (Disabled by configure command)"
	else
	    echo "CLAMSCAN 'clamav'    NO (not found)"
	fi
    else
	echo "CLAMSCAN 'clamav'    YES - $CLAMSCAN"
	GOT_VIRUS_SCANNER=1
    fi

    if test "$AVP" = "/bin/false" ; then
	if test "$ac_cv_AvpLinux" != "yes" ; then
	    echo "AVP      'AvpLinux'  NO (Disabled by configure command)"
	else
	    echo "AVP      'AvpLinux'  NO (not found)"
	fi
    else
	echo "AVP      'AvpLinux'  YES - $AVP"
	GOT_VIRUS_SCANNER=1
    fi

    if test "$AVP5" = "/bin/false" ; then
	if test "$ac_cv_aveclient" != "yes" ; then
	    echo "AVP5     'aveclient' NO (Disabled by configure command)"
	else
	    echo "AVP5     'aveclient' NO (not found)"
	fi
    else
	echo "AVP5     'aveclient' YES - $AVP5"
	GOT_VIRUS_SCANNER=1
    fi

    if test "$KAVSCANNER" = "/bin/false" ; then
	if test "$ac_cv_kavscanner" != "yes" ; then
	    echo "KAVSCANNER 'kavscanner' NO (Disabled by configure command)"
	else
	    echo "KAVSCANNER 'kavscanner' NO (not found)"
	fi
    else
	echo "KAVSCANNER 'kavscanner' YES - $KAVSCANNER"
	GOT_VIRUS_SCANNER=1
    fi

    if test "$CSAV" = "/bin/false" ; then
	if test "$ac_cv_csav" != "yes" ; then
	    echo "CSAV     'csav'      NO (Disabled by configure command)"
	else
	    echo "CSAV     'csav'      NO (not found)"
	fi
    else
	echo "CSAV     'csav'      YES - $CSAV"
	GOT_VIRUS_SCANNER=1
    fi

    if test "$FSAV" = "/bin/false" ; then
	if test "$ac_cv_fsav" != "yes" ; then
	    echo "FSAV     'fsav'      NO (Disabled by configure command)"
	else
	    echo "FSAV     'fsav'      NO (not found)"
	fi
    else
	echo "FSAV     'fsav'      YES - $FSAV"
	GOT_VIRUS_SCANNER=1
    fi

    if test "$FPROT" = "/bin/false" ; then
	if test "$ac_cv_fprot" != "yes" ; then
	    echo "FPROT    'f-prot'    NO (Disabled by configure command)"
	else
	    echo "FPROT    'f-prot'    NO (not found)"
	fi
    else
	echo "FPROT    'f-prot'    YES - $FPROT"
	GOT_VIRUS_SCANNER=1
    fi

    if test "$SOPHIE" = "/bin/false" ; then
	if test "$ac_cv_sophie" != "yes" ; then
	    echo "SOPHIE   'sophie'    NO (Disabled by configure command)"
	else
	    echo "SOPHIE   'sophie'    NO (not found)"
	fi
    else
	echo "SOPHIE   'sophie'    YES - $SOPHIE"
	GOT_VIRUS_SCANNER=1
    fi

    if test "$NVCC" = "/bin/false" ; then
	if test "$ac_cv_nvcc" != "yes" ; then
	    echo "NVCC     'nvcc'      NO (Disabled by configure command)"
	else
	    echo "NVCC     'nvcc'      NO (not found)"
	fi
    else
	echo "NVCC     'nvcc'      YES - $NVCC"
	GOT_VIRUS_SCANNER=1
    fi

    if test "$CLAMD" = "/bin/false" ; then
	if test "$ac_cv_clamd" != "yes" ; then
	    echo "CLAMD    'clamd'     NO (Disabled by configure command)"
	else
	    echo "CLAMD    'clamd'     NO (not found)"
	fi
    else
	echo "CLAMD    'clamd'     YES - $CLAMD"
	GOT_VIRUS_SCANNER=1
    fi

    if test "$TROPHIE" = "/bin/false" ; then
	if test "$ac_cv_trophie" != "yes" ; then
	    echo "TROPHIE  'trophie'   NO (Disabled by configure command)"
	else
	    echo "TROPHIE  'trophie'   NO (not found)"
	fi
    else
	echo "TROPHIE  'trophie'   YES - $TROPHIE"
	GOT_VIRUS_SCANNER=1
    fi

fi

if test "$GOT_VIRUS_SCANNER" = "0" ; then
    echo ""
    echo "Could not find any recognized virus scanner... do not use"
    echo "any of the contains_virus functions in your filter."
fi

if test "$CLAMD" != "/bin/false" -o "$SOPHIE" != "/bin/false" -o "$TROPHIE" != "/bin/false" ; then
   echo ""
   if test "$CLAMD" != "/bin/false" ; then
        echo "Make sure clamd runs as the $DEFANGUSER user!"
        echo "  ...and make sure you use clamd version 0.67 or higher."
   fi
   if test "$SOPHIE" != "/bin/false" ; then
        echo "See README.SOPHIE for more information about running Sophie."
   fi
   if test "$TROPHIE" != "/bin/false" ; then
        echo "Make sure Trophie runs as the $DEFANGUSER user!"
   fi
   echo ""
fi

if test "$ac_cv_perlmodcheck" = "yes" ; then
    if test "$HAVE_SPAM_ASSASSIN" = "yes" ; then
	echo "Found Mail::SpamAssassin.  You may use spam_assassin_* functions"
    else
	echo "Did not find Mail::SpamAssassin.  Do not use spam_assassin_* functions"
    fi

    if test "$HAVE_ANOMY_HTMLCLEANER" = "yes" ; then
	echo "Found Anomy::HTMLCleaner.  You may use anomy_clean_html()"
    else
	echo "Did not find Anomy::HTMLCleaner.  Do not use anomy_clean_html()"
    fi

    if test "$HAVE_HTML_PARSER" = "yes" ; then
	echo "Found HTML::Parser.  You may use append_html_boilerplate()"
    else
	echo "Did not find HTML::Parser.  Do not use append_html_boilerplate()"
    fi
    echo ""
fi

echo "Note: SpamAssassin, HTML::Parser and Anomy::HTMLCleaner are"
echo "detected at run-time, so if you install or remove any of those modules, you"
echo "do not need to re-run ./configure and make a new mimedefang.pl."

if test "$ac_cv_perlmodcheck" = "yes" ; then
    if test "$mtversion" = "unknown" ; then
	echo ""
	echo "Could not determine version of MIME::Tools.  Please use 5.412 or later." 1>&6
    elif test $mtversion -lt 54120 ; then
	echo "" 1>&6
	echo "**** WARNING:  We strongly recommend that you use MIME::Tools" 1>&6
	echo "**** version 5.412 or later instead of version $mt_actual_version." 1>&6
    fi
fi

if test "$DEFANGUSER" != "" ; then
   id $DEFANGUSER > /dev/null 2>&1
   if test "$?" != 0 ; then
      echo ""
      echo "Note:  The MIMEDefang user '$DEFANGUSER' does not seem to"
      echo "exist.  Please create this user before continuing."
   fi
fi

if test "$ENABLE_DEBUGGING" != "" ; then
   echo ""
   echo "*** WARNING: You have configured with --enable-debugging."
   echo "*** This will produce LARGE VOLUMES of syslog messages and"
   echo "*** is NOT RECOMMENDED for a production system."
fi

-------------- next part --------------
##########################################################################
# Copyright @2002, Roaring Penguin Software Inc.  All rights reserved.
#
# Project     : MIMEDefang
# Component   : redhat/mimedefang.spec
# Author      : Michael McLagan <Michael.McLagan at linux.org>
# Creation    : 30-Apr-2002 12:25
# Description : This is the spec file for building the RedHat RPM 
#               distribution SRC and i386 files
#    
# Current Revision:
#
# $Source$
# $Revision: 9982 $
# $Author: dfs $
# $Date: 2004-09-19 15:55:28 -0400 (Sun, 19 Sep 2004) $
#
# Revision History:
# 
# $Log$
# Revision 1.30  2004/09/19 19:55:28  dfs
# Add sa-mimedefang.cf to example.
#
# Revision 1.29  2004/09/01 21:22:52  dfs
# Fixed bug.
#
# Revision 1.28  2004/08/09 22:28:06  dfs
# Fixed spec so as not to disable service on upgrade.
#
# Revision 1.27  2004/07/15 17:13:43  dfs
# Move sa-mimedefang.cf into /etc/mail instead of /etc/mail/spamassassin
#
# Revision 1.26  2004/02/24 14:41:08  dfs
# Loosened spool permissions to make it world-readable.
# Improved spec file to allow detection of AV software at build time.
#
# Revision 1.25  2003/06/04 14:12:24  dfs
# Took out noarch.
#
# Revision 1.24  2003/06/04 14:03:33  dfs
# Copy pid files into /var/run to keep Red Hat killproc() happy.
#
# Revision 1.23  2003/06/04 13:39:33  dfs
# Split out contrib into a separate package.
#
# Revision 1.22  2002/10/25 14:01:51  dfs
# Build RPM with --disable-anti-virus
#
# Revision 1.21  2002/09/25 11:28:13  dfs
# Fixed spec.
#
# Revision 1.20  2002/08/26 03:48:40  dfs
# Install logrotate file
#
# Revision 1.19  2002/08/26 03:15:40  dfs
# Take ip key out!
#
# Revision 1.18  2002/08/26 03:13:52  dfs
# Better RPM file.
#
# Revision 1.17  2002/08/26 03:10:00  dfs
# Better RPM packaging.
#
# Revision 1.16  2002/06/21 14:50:27  dfs
# Fixed spec file.
#
# Revision 1.15  2002/06/11 12:33:14  dfs
# Fixed typo.
#
# Revision 1.14  2002/06/03 14:26:14  dfs
# Fixups for sysconfdir.
#
# Revision 1.13  2002/05/29 18:12:15  dfs
# Put pid files and sockets in /var/spool/MIMEDefang instead of /var/run
#
# Revision 1.12  2002/05/23 19:08:00  dfs
# Fixed spec file to make log directory.
#
# Revision 1.11  2002/05/15 13:39:02  dfs
# Added README.NONROOT
#
# Revision 1.10  2002/05/14 16:19:14  dfs
# Patch from Michael McLagan
#
# Revision 1.9  2002/05/13 20:32:03  dfs
# More spec fixes.
#
# Revision 1.8  2002/05/13 20:20:07  dfs
# Fixed spec file.
#
# Revision 1.7  2002/05/10 13:46:43  dfs
# Backward compatibility with Michael McLagan's RPM setup.
#
# Revision 1.6  2002/05/10 11:30:24  dfs
# Updated spec.
#
# Revision 1.5  2002/05/09 20:30:42  dfs
# Changed spool dir paths back.
#
# Revision 1.4  2002/05/09 20:26:47  dfs
# Fixed typo
#
# Revision 1.3  2002/05/09 20:24:31  dfs
# Fixed bug in spec.
#
# Revision 1.2  2002/05/09 20:22:09  dfs
# Revert spec to our style.
#
# Revision 1.1  2002/05/09 20:18:05  dfs
# Merge Michael McLagan's patch.
#
# Revision 1.7  2002/05/08 16:56:58  dfs
# Added /etc/mail/spamassassin to spec.
#
# Revision 1.6  2002/05/06 15:23:31  dfs
# Update for 2.10.
#
# Revision 1.5  2002/05/03 14:24:24  dfs
# Merge packaging patches.
# Fixed typo.
# Made default value for -n 10.
#
##########################################################################

%define dir_spool      /var/spool/MIMEDefang
%define dir_quarantine /var/spool/MD-Quarantine
%define dir_log        /var/log/mimedefang
%define user           defang
%define with_antivirus 0

%{?_with_antivirus: %{expand: %%define with_antivirus 1}}
%{?_without_antivirus: %{expand: %%define with_antivirus 0}}

Summary:       Email filtering application using sendmail's milter interface
Name:          mimedefang
Version:       2.58
Release:       2
License:       GPL
Group:         Networking/Mail
Source0:       http://www.roaringpenguin.com/%{name}/%{name}-%{version}.tar.gz
Url:           http://www.roaringpenguin.com/%{name}
Vendor:        Roaring Penguin Software Inc.
Buildroot:     %{_tmppath}/%{name}-root
Requires:      sendmail > 8.12.0
Requires:      perl-Digest-SHA1 perl-MIME-tools perl-IO-stringy perl-MailTools
BuildRequires: sendmail-devel > 8.12.0
BuildRequires: autoconf > 2.55

%description
MIMEDefang is an e-mail filter program which works with Sendmail 8.11
and later.  MIMEDefang filters all e-mail messages sent via SMTP.
MIMEDefang splits multi-part MIME messages into their components and
potentially deletes or modifies the various parts.  It then
reassembles the parts back into an e-mail message and sends it on its
way.

There are some caveats you should be aware of before using MIMEDefang.
MIMEDefang potentially alters e-mail messages.  This breaks a "gentleman's
agreement" that mail transfer agents do not modify message bodies.  This
could cause problems, for example, with encrypted or signed messages.

Deleting attachments could cause a loss of information.  Recipients must
be aware of this possibility, and must be willing to explain to senders
exactly why they cannot mail certain types of files.  You must have the
willingness of your e-mail users to commit to security, or they will
complain loudly about MIMEDefang.

%prep
%setup -q -n %{name}-%{version}
autoconf
%configure --prefix=%{_prefix} \
            --mandir=%{_mandir} \
	    --enable-debug \
	    --sysconfdir=/etc   \
	    --disable-check-perl-modules \
            --with-spooldir=%{dir_spool} \
            --with-quarantinedir=%{dir_quarantine} \
%if %{with_antivirus}
	    --with-user=%{user}
%else
	    --with-user=%{user} \
	    --disable-anti-virus
%endif

%build
make

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{dir_log}
make install-redhat RPM_INSTALL_ROOT=$RPM_BUILD_ROOT
# Turn off execute bit on scripts in contrib
find contrib -type f -print0 | xargs -0 chmod a-x

%clean
HERE=`pwd`
cd ..
rm -rf $HERE
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc COPYING Changelog README* examples SpamAssassin
%dir %{dir_spool}
%dir %{dir_log}
%dir %{dir_quarantine}
%{_bindir}/*
%{_mandir}/*
%config(noreplace) /etc/mail/mimedefang-filter
%config(noreplace) /etc/mail/sa-mimedefang.cf
%config(noreplace) /etc/mail/sa-mimedefang.cf.example
%config(noreplace) /etc/sysconfig/%{name}
/etc/rc.d/init.d/%{name}
/etc/logrotate.d/%{name}

%pre
# Backward-compatibility
if test -d /var/spool/mimedefang -a ! -d /var/spool/MIMEDefang ; then
	mv /var/spool/mimedefang /var/spool/MIMEDefang || true
fi

if test -d /var/spool/quarantine -a ! -d /var/spool/MD-Quarantine ; then
	mv /var/spool/quarantine /var/spool/MD-Quarantine || true
fi

# Add user
useradd -M -r -d %{dir_spool} -s /bin/false -c "MIMEDefang User" %{user} > /dev/null 2>&1 || true

%post
# Tighten permissions
chown %{user} %{dir_spool}
chgrp %{user} %{dir_spool}
chmod 750 %{dir_spool}
chown %{user} %{dir_quarantine}
chgrp %{user} %{dir_quarantine}
chmod 750 %{dir_quarantine}
chown %{user} %{dir_log}
chgrp %{user} %{dir_log}
chmod 755 %{dir_log}

cat << EOF

In order to complete the installation of mimedefang, you will need to add the 
following line to your sendmail mc file:

   INPUT_MAIL_FILTER(\`mimedefang', \`S=unix:/var/spool/MIMEDefang/mimedefang.sock, F=T, T=S:1m;R:1m;E:5m')

Use the sendmail-cf package to rebuild your /etc/mail/sendmail.cf file and 
restart your sendmail daemon.

EOF
/sbin/chkconfig --add mimedefang

%preun
if [ $1 = 0 ] ; then
	/sbin/service mimedefang stop > /dev/null 2>&1 || true
	/sbin/chkconfig --del mimedefang || true
fi

%package contrib
Summary:	Contributed software that works with MIMEDefang
Version:	2.58
Release:	1
Group:          Networking/Mail

%description contrib
This package contains contributed software that works with MIMEDefang,
such as the graphdefang graphing package and a sample filter.

%files contrib
%defattr(-,root,root)
%doc contrib

%changelog
* Wed May 29 2002 David F. Skoll <dfs at roaringpenguin.com>
- Put pid files and sockets in /var/spool/MIMEDefang so we can
  drop privileges early.
* Wed May 15 2002 David F. Skoll <dfs at roaringpenguin.com>
- Change log directory to /var/log/mimedefang/ to more easily accomodate
  -U flag.
* Tue May 14 2002 Michael McLagan <Michael.McLagan at linux.org>
- Fixed preinstall script
* Thu May 09 2002 David F. Skoll <dfs at roaringpenguin.com>
- Install SpamAssassin config file
- Changed spool dir to /var/spool/MIMEDefang and quarantine dir
  to /var/spool/MD-Quarantine
* Thu May 09 2002 Michael McLagan <Michael.McLagan at linux.org>
- Modified to build beta releases
* Fri May 03 2002 Michael McLagan <Michael.McLagan at linux.org>
- Updated to 2.9
* Tue Apr 30 2002 Michael McLagan <Michael.McLagan at linux.org>
  Initial version 2.8



More information about the MIMEDefang mailing list