File: .%23configure.in.1.51

package info (click to toggle)
amavis 0.3.12pre5.20020310-5
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 1,644 kB
  • ctags: 577
  • sloc: sh: 3,492; ansic: 955; perl: 933; makefile: 137
file content (1002 lines) | stat: -rw-r--r-- 31,889 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
AC_PREREQ(2.10)
AC_INIT(amavis/amavis.in)
AM_CONFIG_HEADER(config.h)

PKG_NAME=amavis
PKG_VERSION=0.3.12pre6
PKG_HOME_URL="http://amavis.org/"
PKG_EMAIL="amavis@aachalon.de"
PKG_REL_DATE="2002-02-25"
PKG_COMPILE_DATE=`LC_TIME= /bin/date`

AC_SUBST(PKG_HOME_URL)
AC_SUBST(PKG_EMAIL)
AC_SUBST(PKG_REL_DATE)
AC_SUBST(PKG_COMPILE_DATE)

dnl This sets PACKAGE and VERSION automatically
AM_INIT_AUTOMAKE($PKG_NAME, $PKG_VERSION)

AC_PROG_MAKE_SET

AC_PREFIX_DEFAULT(/usr)

dnl ### fix unset "--prefix=..." ###
if test "$prefix" = "NONE" ; then
  prefix=$ac_default_prefix
fi

dnl Check for programs.
AC_PROG_INSTALL
AC_PROG_CC

dnl Let users use their own perl.
AC_ARG_WITH(perl,
  [  --with-perl=PERL_PROG         location of perl binary],
  perl=$withval,
  perl=perl)

AC_PATH_PROGS(perl, $perl)
if test "x$perl" = "x" ; then
  AC_MSG_ERROR([Sorry, you need perl])
fi

AC_MSG_CHECKING([for perl modules])
$perl $srcdir/test.pl
if test $? -ne 0 ; then
  AC_MSG_ERROR([You are missing some perl modules.  Please check the README])
else
  AC_MSG_RESULT([found])
fi

dnl Let users use their own file.
AC_ARG_WITH(file,
  [  --with-file=FILE_PROG         location of file binary],
  file=$withval,
  [AC_PATH_PROGS(file, file, , /usr/local/bin:/bin:/usr/bin:$PATH)
  ])

if test "x$file" = "x"; then
  AC_MSG_ERROR([Sorry, you need the "file" command])
fi

AC_PATH_PROGS(id, id, /usr/bin/id, /usr/local/bin:/bin:/usr/bin:/usr/xpg4/bin:$PATH)

AC_PATH_PROGS(arc, arc, , /usr/local/bin:/bin:/usr/bin:$PATH)
dnl if test "x$arc" = "x" ; then
dnl   AC_MSG_ERROR([Sorry, you need arc])
dnl fi

AC_PATH_PROGS(bunzip2, bunzip2, , /usr/local/bin:/bin:/usr/bin:$PATH)
if test "x$bunzip2" = "x" ; then
  AC_MSG_ERROR([Sorry, you need bunzip2])
fi

AC_PATH_PROGS(lha, lha, , /usr/local/bin:/bin:/usr/bin:$PATH)
if test "x$lha" = "x" ; then
  AC_MSG_ERROR([Sorry, you need lha])
fi

AC_PATH_PROGS(unarj, unarj, , /usr/local/bin:/bin:/usr/bin:$PATH)
if test "x$unarj" = "x" ; then
  AC_MSG_ERROR([Sorry, you need unarj])
fi

AC_PATH_PROGS(uncompress, uncompress, /usr/bin/uncompress)
if test "x$uncompress" = "x" ; then
  AC_MSG_ERROR([Sorry, you need uncompress])
fi

#AC_PATH_PROGS(unfreeze, unfreeze, , /usr/local/bin:/bin:/usr/bin:$PATH)
#if test "x$unfreeze" = "x" ; then
#   AC_MSG_ERROR([Sorry, you need unfreeze])
#fi

AC_PATH_PROGS(unrar, unrar, , /usr/local/bin:/bin:/usr/bin:$PATH)
if test "x$unrar" = "x" ; then
  AC_MSG_ERROR([Sorry, you need unrar])
fi

AC_PATH_PROGS(unzip, unzip, , /usr/local/bin:/bin:/usr/bin:$PATH)
if test "x$unzip" = "x" ; then
  AC_MSG_ERROR([Sorry, you need unzip])
fi

AC_PATH_PROGS(zoo, zoo, , /usr/local/bin:/bin:/usr/bin:$PATH)
if test "x$zoo" = "x" ; then
  AC_MSG_ERROR([Sorry, you need zoo])
fi

dnl
dnl Check for sendmail wrapper.  This doesn't mean sendmail has to be used
dnl as the MTA, just that a wrapper that can be used to inject mail is
dnl present
dnl

AC_ARG_WITH(sendmail_wrapper,
  [  --with-sendmail-wrapper=PROG  location of sendmail or wrapper],
  sendmail_wrapper=$withval)

if test "x$sendmail_wrapper" = "x" -o "x$sendmail_wrapper" = "xyes"; then
  AC_PATH_PROGS(sendmail_wrapper, sendmail, /bin/false, /usr/lib:/usr/sbin:/var/qmail/bin:$PATH)

  if test "x$sendmail_wrapper" = "x/bin/false"; then
    AC_MSG_ERROR([Sorry, sendmail or a sendmail-like wrapper is required])
  fi
fi

dnl Where the sendmail source lives - needed by milter
dnl The milter libraries must be installed in the linker search path!

AC_ARG_WITH(sendmail_source,
  [  --with-sendmail-source=DIR    location of sendmail source],
  if test -d "${withval}/include"; then
    CPPFLAGS="$CPPFLAGS -I${withval}/include"
  fi)

dnl
dnl Determine which MTA to use.  Assume sendmail if nothing else
dnl found or specified
dnl

MTA=sendmail
AMAVIS_MILTER=
config_type=simple

dnl
dnl Check for qmail.  If present, assume use of qmail as MTA
dnl unless --disable-qmail specified
dnl

AC_PATH_PROGS(qmailinject, qmail-inject, /bin/false, /var/qmail/bin:/usr/local/qmail/bin)

qmaildir=`dirname $qmailinject`
AC_SUBST(qmaildir)

if test "x$qmailinject" != "x/bin/false"; then
  AC_ARG_ENABLE(qmail,
    [  --enable-qmail                use qmail as MTA],
    if test "x$enableval" != "xno" ; then
      MTA=qmail
    fi,
    MTA=qmail
    config_type=qmail-queue)
fi

AC_ARG_ENABLE(milter,
  [  --enable-milter               use sendmail libmilter as MTA],
  test -z "$enable_milter" && enable_milter=no)

if test "x$enable_milter" = xyes ; then

  AC_PATH_PROGS(libmilter_config, libmilter-config)
  if test "x$libmilter_config" = x ; then

    AC_CHECK_FUNCS(inet_aton,,AC_CHECK_LIB(resolv,inet_aton))
    AC_CHECK_FUNCS(gethostbyname,,AC_CHECK_LIB(nsl,gethostbyname,,AC_CHECK_LIB(socket,gethostbyname)))
    AC_CHECK_FUNCS(setsockopt,,AC_CHECK_LIB(socket,setsockopt))
    AC_CHECK_FUNCS(mktemp mkdtemp strlcpy)

    ACX_PTHREAD([
      LIBS="$PTHREAD_LIBS $LIBS"
      CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
      CC="$PTHREAD_CC"

      AC_CHECK_HEADERS(sm/gen.h,
        AC_EGREP_HEADER([typedef.*bool],sm/gen.h,
          AC_DEFINE(HAVE_SM_GEN_BOOL_TYPE, 1,
                    [ Define if <sm/gen.h> defines the bool type. ])))

      # maybe sendmail is using sfio (for TLS encryption)
      AC_CHECK_LIB(sfio,_stdprintf)

      # sendmail 8.11: need -lsmutil
      # sendmail 8.12: need -lsm
      AC_CHECK_LIB(smutil,errstring,,AC_CHECK_LIB(sm,sm_errstring))
      AC_CHECK_LIB(smutil,strlcpy,
                   AC_DEFINE(HAVE_SMUTIL_STRLCPY, 1,
                             [ Define if you have the strlcpy function in libsmutil. ]),
                   AC_CHECK_LIB(sm,sm_strlcpy,
                                AC_DEFINE(HAVE_SM_SM_STRLCPY, 1,
                                          [ Define if you have the sm_strlcpy function in libsm. ])))

      AC_CHECK_HEADERS(libmilter/mfapi.h,
        AC_CHECK_LIB(milter,smfi_main,,enable_milter=no),
        enable_milter=no)
      ],
      [AC_MSG_WARN([No usable pthreads library found - disabling milter])
       enable_milter=no])

  else
    milter_cflags=`$libmilter_config --cflags`
    milter_libs=`$libmilter_config --libs`
    CFLAGS="$CFLAGS $milter_cflags"
    LIBS="$LIBS $milter_libs"
  fi

  if test "x$enable_milter" = xno ; then
    AC_MSG_ERROR([milter requested but not found])
  else
    AMAVIS_MILTER=amavis-milter
    MTA=libmilter
    config_type="sendmail/milter"
  fi

fi

AC_SUBST(AMAVIS_MILTER)

AC_ARG_ENABLE(postfix,
  [  --enable-postfix              use postfix as MTA],
  if test "x$enableval" = "xyes" ; then
    MTA=postfix
  fi)

dnl Need to find out whether sendmail_wrapper is really postfix' sendmail
if test "x$MTA" = "xsendmail" ; then
  strings ${sendmail_wrapper} | grep -i postfix >/dev/null 2>&1
  if test $? -eq 0 ; then
    MTA=postfix
  fi
fi

AC_ARG_ENABLE(exim,
  [  --enable-exim                 use exim as MTA],
  if test "x$enableval" = "xyes" ; then
    MTA=exim
  fi)

dnl Need to find out whether sendmail_wrapper is really exim's sendmail
if test "x$MTA" = "xsendmail" ; then
  strings ${sendmail_wrapper} | grep -i exim >/dev/null 2>&1
  if test $? -eq 0 ; then
    MTA=exim
  fi
fi

dnl only sendmail
dnl relay/no relay must be known before looking
dnl for original sendmail.cf file
AC_ARG_ENABLE(relay,
  [  --enable-relay                enable relay configuration for sendmail],,
  test -z "$enable_relay" && enable_relay=no)
AC_SUBST(enable_relay)

if test "x$enable_relay" = xyes -a "x$enable_milter" = xyes ; then
  AC_MSG_ERROR([Incompatible options --enable-relay and --enable-milter])
fi

dnl Location of original sendmail.cf file
if test "x$MTA" = "xsendmail" -a "x$enable_relay" = "xyes" ; then
  AC_MSG_CHECKING([original sendmail config file])
  AC_ARG_WITH(origconf,
    [  --with-origconf=FILE          original sendmail config file
                                     [/etc/sendmail.orig.cf]],
    sendmail_cf_orig=$withval)
  if test ! -f "$sendmail_cf_orig" ; then
    if test -f /etc/sendmail.cf ; then
      sendmail_cf_orig=/etc/sendmail.orig.cf
    elif test -f /etc/mail/sendmail.cf ; then
      sendmail_cf_orig=/etc/mail/sendmail.orig.cf
    else
      AC_MSG_ERROR([
Cannot find original sendmail.cf file.  Please see README.sendmail
      ])
    fi
  fi

  config_type="sendmail/relay"

  AC_MSG_RESULT([$sendmail_cf_orig])
fi
AC_SUBST(sendmail_cf_orig)

AC_MSG_RESULT([We will use $MTA as the MTA])
AC_SUBST(MTA)
mta_init_frag=$srcdir/amavis/mta/${MTA}_init
mta_args_frag=$srcdir/amavis/mta/${MTA}_args
mta_send_frag=$srcdir/amavis/mta/${MTA}_send

if test "x$MTA" = "xexim"; then
  sendmail_wrapper_args="-oMr scanned-ok -i -t"
elif test "x$MTA" = "xsendmail" && test "x$enable_relay" = "xyes" ; then
  sendmail_wrapper_args="-C $sendmail_cf_orig -i -t"
else
  sendmail_wrapper_args="-i -t"
fi
AC_SUBST(sendmail_wrapper)
AC_SUBST(sendmail_wrapper_args)

dnl Only postfix for now - automatically configure for smtp
smtp_port=NOT_SET
if test "x$MTA" = "xpostfix" ; then

  if test "$enable_relay" = yes ; then
    AC_MSG_ERROR([Relay configuration not supported with postfix - use SMTP])
  fi

  dnl is libnet module installed?
  AC_MSG_CHECKING([whether libnet module is installed])
  $perl -e "use Net::SMTP;" >/dev/null 2>&1
  if test $? -eq 0 ; then
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(no)
    AC_MSG_ERROR([Postfix setup requires libnet module from CPAN])
    enable_smtp=no
  fi

  AC_MSG_CHECKING([SMTP port to deliver scanned mails to])
  smtp_port=10025
  AC_ARG_WITH(smtp_port,
    [  --with-smtp-port=PORT         Port to deliver scanned mails to [\"10025\"]],
    smtp_port="$withval")
  AC_MSG_RESULT([$smtp_port])

  config_type=SMTP

  # reduce clutter ...
  mta_send_frag=$srcdir/amavis/mta/postfix_send_smtp

  AC_SUBST(smtp_port)

fi # MTA = postfix

if test "x$MTA" != "xqmail" -a "x$MTA" != "xpostfix" ; then
  mta_args_frag=$srcdir/amavis/mta/${MTA}_args
fi

AC_SUBST_FILE(mta_init_frag)
AC_SUBST_FILE(mta_args_frag)
AC_SUBST_FILE(mta_send_frag)

dnl
dnl From here on, we have two choices: normally, check for all scanners
dnl and include all those found
dnl Or: if --enable-all was specified, code for all scanners is included
dnl unconditiomally *without* any testing!
dnl This is meant for package maintainers only!
dnl

AC_ARG_ENABLE(all,
  [  --enable-all                  include code for all scanners [no]],
   all_scanners="$enableval", all_scanners="no")

if test "x$all_scanners" = "xyes" ; then
  AC_MSG_WARN([
********************************************************************************
*** You have specified --enable-all!
*** Configure does not test the presence of any virus scanners now,
*** but adds code for all supported scanners unconditionally.
*** This option should only be used by package maintainers!
********************************************************************************])

  avp_scanner_frag=$srcdir/amavis/av/avp
  avpdc_scanner_frag=$srcdir/amavis/av/avpdc
  cai_scanner_frag=$srcdir/amavis/av/cai
  csav_scanner_frag=$srcdir/amavis/av/csav
  cyber_scanner_frag=$srcdir/amavis/av/cyber
  drweb_scanner_frag=$srcdir/amavis/av/drweb
  fprot_scanner_frag=$srcdir/amavis/av/fprot
  fsec_scanner_frag=$srcdir/amavis/av/fsec
  hbedv_scanner_frag=$srcdir/amavis/av/hbedv
  mks_scanner_frag=$srcdir/amavis/av/mks
  nai_scanner_frag=$srcdir/amavis/av/nai
  nod32_scanner_frag=$srcdir/amavis/av/nod32
  nod32cli_scanner_frag=$srcdir/amavis/av/nod32cli
  panda_scanner_frag=$srcdir/amavis/av/panda
  rav_scanner_frag=$srcdir/amavis/av/rav
  sophos_scanner_frag=$srcdir/amavis/av/sophos
  symantec_scanner_frag=$srcdir/amavis/av/symantec
  trend_scanner_frag=$srcdir/amavis/av/trend
  vbuster_scanner_frag=$srcdir/amavis/av/vbuster
  sophie_scanner_frag=$srcdir/amavis/av/sophie
  trophie_scanner_frag=$srcdir/amavis/av/trophie	
  oav_scanner_frag=$srcdir/amavis/av/oav

  avscanner=" ALL"
else

### Kaspersky Anti-Virus (AVPDaemon)
avp_scanner_frag=/dev/null
avpdc_scanner_frag=/dev/null
AC_CHECKING([*** Kaspersky Anti-Virus (AVPDaemon) ***])
AC_PATH_PROGS(avpd, AvpDaemon AvpBSDDaemon kavdaemon, , $PATH:/usr/bin:/usr/local/bin:/usr/local/AvpLinux:/opt/AVP)
if test "x$avpd" != "x" ; then

  ### Kaspersky AVPDaemonClient
  AC_CHECKING([*** Kaspersky AVPDaemonClient ***])
  AC_PATH_PROGS(avpdc, AvpDaemonClient, , $PATH:/usr/bin:/usr/local/bin:/usr/local/AvpLinux:/opt/AVP)
  if test "x$avpdc" = "x"; then

dnl In the new AVPDaemon package AVPDaemonClient was renamed to
dnl AvpDaemonTst ...
    ### Kaspersky AVPDaemonTst
    AC_CHECKING([*** Kaspersky AVPDaemonTst ***])
    AC_PATH_PROGS(avpdc, AvpDaemonTst, , $PATH:/usr/bin:/usr/local/bin:/usr/local/AvpLinux:/opt/AVP)
    if test "x$avpdc" != "x"; then
      avscanner=" Kaspersky Anti-Virus (AVPDaemonTst)"
    fi

  else
    avscanner=" Kaspersky Anti-Virus (AVPDaemonClient)"
  fi

  if test "x$avpdc" != "x"; then
    avpdc_scanner_frag=$srcdir/amavis/av/avpdc
  fi
fi

### Kaspersky Anti-Virus (command line version)
if test "x$avpd" = "x" -a "x$avpdc" = "x" ; then
  AC_CHECKING([*** Kaspersky Anti-Virus ***])
  AC_PATH_PROGS(avp, AvpLinux kavscanner, , $PATH:/usr/bin:/usr/local/bin:/usr/local/AvpLinux:/opt/AVP)
  if test "x$avp" != "x" ; then
    avscanner="$avscanner Kaspersky Anti-Virus (AVP)"
    avp_scanner_frag=$srcdir/amavis/av/avp
  fi
fi

### CAI InoculateIT Inocucmd command line utility 4.0
cai_scanner_frag=/dev/null
AC_CHECKING([*** CAI InoculateIT Inocucmd command line utility 4.0 ***])
AC_PATH_PROGS(inocucmd, inocucmd, , $PATH:/usr/bin:/usr/local/bin:/usr/local/inoculateit)
if test "x$inocucmd" != "x"; then
  avscanner="$avscanner CAI InoculateIT Inocucmd command line utility 4.0"
  cai_scanner_frag=$srcdir/amavis/av/cai
fi

### Command AntiVirus for Linux
csav_scanner_frag=/dev/null
AC_CHECKING([*** Command AntiVirus for Linux ***])
AC_PATH_PROG(csav, csav, , $PATH:/bin:/usr/bin:/usr/local/bin)
if test "x$csav" != "x" ; then
  avscanner="$avscanner Command AntiVirus for Linux"
  csav_scanner_frag=$srcdir/amavis/av/csav
fi

### CyberSoft vfind
cyber_scanner_frag=/dev/null
AC_CHECKING([*** CyberSoft vfind ***])
AC_PATH_PROGS(vfind, vfind, , $PATH:/usr/bin:/usr/local/bin:/usr/local/vstk:/usr/local/vstkp)
if test "x$vfind" != "x" ; then
  avscanner="$avscanner CyberSoft vfind"
  cyber_scanner_frag=$srcdir/amavis/av/cyber
fi

### DrWeb Antivirus for Linux/FreeBSD/Solaris
drweb_scanner_frag=/dev/null
AC_CHECKING([*** DrWeb for Linux ***])
AC_PATH_PROG(drweb, drweb, , $PATH:/bin:/usr/bin:/usr/local/bin:/opt/drweb)
if test "x$drweb" = "x" ; then
  AC_MSG_WARN([************************************************************])
  AC_MSG_WARN([***             DrWeb for Linux NOT found                ***])
  AC_MSG_WARN([***                  but that's ok                       ***])
  AC_MSG_WARN([************************************************************])
else
  avscanner="$avscanner DrWeb for Linux"
  drweb_scanner_frag=$srcdir/amavis/av/drweb
fi

### FRISK F-Prot Antivirus for Linux
fprot_scanner_frag=/dev/null
AC_CHECKING([*** FRISK F-Prot Antivirus for Linux ***])
AC_PATH_PROG(fprot, f-prot f-prot.sh, , $PATH:/bin:/usr/bin:/usr/local/bin)
if test "x$fprot" != "x" ; then
  avscanner="$avscanner FRISK Antivirus for Linux"
  fprot_scanner_frag=$srcdir/amavis/av/fprot
fi

### DataFellows F-Secure AntiVirus
fsec_scanner_frag=/dev/null
AC_CHECKING([*** DataFellows F-Secure AntiVirus ***])
AC_PATH_PROGS(fsav, fsav, , $PATH:/usr/bin:/usr/local/bin:/usr/local/fsav)
if test "x$fsav" != "x" ; then
  avscanner="$avscanner DataFellows F-Secure AntiVirus"
  fsec_scanner_frag=$srcdir/amavis/av/fsec
fi

### H+BEDV AntiVir/X
hbedv_scanner_frag=/dev/null
AC_CHECKING([*** H+BEDV AntiVir/X ***])
AC_PATH_PROGS(antivir, antivir, , $PATH:/usr/bin:/usr/local/bin)
if test "x$antivir" != "x" ; then
  avscanner="$avscanner H+BEDV AntiVir/X"
  hbedv_scanner_frag=$srcdir/amavis/av/hbedv
fi

### McAfee Virusscan
nai_scanner_frag=/dev/null
AC_CHECKING([*** McAfee Virusscan ***])
AC_PATH_PROGS(uvscan, uvscan, , $PATH:/usr/bin:/usr/local/bin)
if test "x$uvscan" != "x" ; then
  avscanner="$avscanner McAfee Virusscan"
  nai_scanner_frag=$srcdir/amavis/av/nai
fi

### MkS_Vir for Linux
mks_scanner_frag=/dev/null
AC_CHECKING([*** MkS_Vir for Linux ***])
AC_PATH_PROG(mks, mks32, , $PATH:/usr/local/lib/MKS1-2A)
if test "x$mks" = "x" ; then
  AC_MSG_WARN([************************************************************])
  AC_MSG_WARN([***            MkS_Vir for Linux NOT found               ***])
  AC_MSG_WARN([***                  but that's ok                       ***])
  AC_MSG_WARN([************************************************************])
else
  avscanner="$avscanner MkS_Vir for Linux"
  mks_scanner_frag=$srcdir/amavis/av/mks
fi

### ESET Software NOD32
nod32_scanner_frag=/dev/null
AC_CHECKING([*** ESET Software NOD32 ***])
AC_PATH_PROGS(nod32, nod32, , $PATH:/usr/bin:/usr/local/bin:/usr/local/nod32)
if test "x$nod32" != "x"; then
  avscanner="$avscanner ESET Software NOD32"
  nod32_scanner_frag=$srcdir/amavis/av/nod32
fi

### ESET Software NOD32 (Client/Server Version)
nod32cli_scanner_frag=/dev/null
AC_CHECKING([*** ESOFT NOD32 Client/Server Version ***])
AC_PATH_PROGS(nod32cli, nod32cli, , $PATH:/usr/bin:/usr/local/bin)
if test "x$nod32cli" != "x"; then
  avscanner="$avscanner ESOFT NOD32 (Client/Server Version)"
  nod32cli_scanner_frag=$srcdir/amavis/av/nod32cli
fi

### GeCAD RAV AntiVirus 8
rav_scanner_frag=/dev/null
AC_CHECKING([*** GeCAD RAV AntiVirus 8 ***])
AC_PATH_PROGS(rav, ravav, , $PATH:/usr/bin:/usr/local/bin:/usr/local/rav8:/usr/local/rav8/bin)
if test "x$rav" != "x"; then
  avscanner="$avscanner GeCAD RAV AntiVirus 8"
  rav_scanner_frag=$srcdir/amavis/av/rav
  AC_MSG_WARN([you need at least engine version 8.5])
fi

### Sophie (via Sophos SAVI)
sophie_scanner_frag=/dev/null
AC_CHECKING([*** Sophie (via Sophos SAVI) ***])
AC_PATH_PROGS(sophie, sophie,,$PATH:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin)
if test "x$sophie" != "x" ; then
  # ask sophie for socket location - requires 1.15+ or patched older release
  AC_MSG_CHECKING([for Sophie socket location])
  sophie_sockname=`$sophie -v 2>&1 | sed -n '/Socket/ s/^.* "\(.*\)"/\1/p'`
  if test "x$sophie_sockname" = "x" ; then
    AC_MSG_WARN([you need Sophie release 1.15 or better!])
  else
    AC_MSG_RESULT([$sophie_sockname])
    AC_SUBST(sophie_sockname)
    avscanner="$avscanner Sophie"
    sophie_scanner_frag=$srcdir/amavis/av/sophie
  fi
fi

### Sophos Sweep
sophos_scanner_frag=/dev/null
AC_CHECKING([*** Sophos Sweep ***])
AC_PATH_PROG(sophos, sweep, , $PATH:/bin:/usr/bin:/usr/local/bin)
if test "x$sophos" != "x" ; then
  dnl There is a program called "sweep" which is part of LAM package
  dnl (Local Area Multicomputer / MPI programming environment)
  dnl try to identify it and cancel Sophos detection ...
  dnl
  AC_MSG_CHECKING([if $sophos really is Sophos Sweep])
  ${sophos} -v | grep -i "sophos plc" >/dev/null 2>&1
  if test $? -eq 0 ; then
    AC_MSG_RESULT([yes])
    avscanner="$avscanner Sophos Sweep"
    sophos_scanner_frag=$srcdir/amavis/av/sophos
  else
    sophos=
    AC_MSG_RESULT([no])
  fi
  AC_ARG_WITH(sophos_ide,
    [  --with-sophos-ide=DIR         where Sophos IDE files are installed
                                     [/usr/local/lib]],
    sophos_ide=$withval,
    [if test -f /etc/sav.conf ; then
       # assume sweep v 3.37 or better; don't need SAV_IDE in the
       # environment because sweep reads it from /etc/sav.conf
       sophos_ide=""
     elif test "x$SAV_IDE" != x ; then
       sophos_ide="$SAV_IDE"
     else
       sophos_ide="/usr/local/lib"
     fi
    ])

    if test x"$sophos_ide" != x ; then
      AC_MSG_CHECKING([where Sophos Sweep looks for virus identities])
      if test -d ${sophos_ide} ; then
        AC_MSG_RESULT([${sophos_ide}])
      else
        AC_MSG_RESULT([directory ${sophos_ide} not found!])
      fi
    fi
    AC_SUBST(sophos_ide)
fi

### Symantec CarrierScan via CommandLine Scanner
symantec_scanner_frag=/dev/null
AC_CHECKING([*** Symantec Carrier Scan ***])
AC_PATH_PROGS(cscmdline, cscmdline, , $PATH:/bin:/usr/bin:/usr/local/bin:/opt/symantec)
if test "x$cscmdline" != "x" ; then
  avscanner="$avscanner Symantec CarrierScan"
  symantec_scanner_frag=$srcdir/amavis/av/symantec
  scs_host="127.0.0.1"
  scs_port="7777" 
  AC_MSG_RESULT([Carrier Scan host: $scs_host])
  AC_SUBST(scs_host)
  AC_MSG_RESULT([Carrier Scan port: $scs_port])
  AC_SUBST(scs_port)
fi

### Trophie (via Trend Micro API)
trophie_scanner_frag=/dev/null
AC_CHECKING([*** Trophie (via Trend Micro API) ***])
AC_PATH_PROGS(trophie, trophie,,$PATH:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin)
if test "x$trophie" != "x" ; then
  # ask trophie for socket location - requires 1.04+ or patched older release
  AC_MSG_CHECKING([for Trophie socket location])
  trophie_sockname=`$trophie -v 2>&1 | sed -n '/Socket/ s/^.* "\(.*\)"/\1/p'`
  if test "x$trophie_sockname" = "x" ; then
    AC_MSG_WARN([you need Trophie release 1.03 or better!])
  else
    AC_MSG_RESULT([$trophie_sockname])
    AC_SUBST(trophie_sockname)
    avscanner="$avscanner Trophie"
    trophie_scanner_frag=$srcdir/amavis/av/trophie
  fi
fi

### Trend Micro FileScanner
trend_scanner_frag=/dev/null
AC_CHECKING([*** Trend Micro FileScanner ***])
AC_PATH_PROGS(vscan, vscan, , $PATH:/usr/bin:/usr/local/bin:/etc/iscan)
if test "x$vscan" != "x" ; then
  avscanner="$avscanner Trend Micro FileScanner"
  trend_scanner_frag=$srcdir/amavis/av/trend
fi

### VirusBuster VBengDaemon
vbuster_scanner_frag=/dev/null
AC_CHECKING([*** VirusBuster VBengDaemon ***])
AC_PATH_PROGS(vbengd, vbengd, , $PATH:/usr/bin:/usr/local/bin:/usr/local/bin/vbusterd)

### VirusBuster VBengClient
AC_CHECKING([*** VirusBuster VBengClient ***])
AC_PATH_PROGS(vbengcl, vbengcl, , $PATH:/usr/bin:/usr/local/bin:/usr/local/bin/vbusterd)
if test "x$vbengcl" != "x"; then
  if test "x$vbengd" = "x"; then
    AC_MSG_WARN([************************************************************])
    AC_MSG_WARN([***         VirusBuster VBengClient found!               ***])
    AC_MSG_WARN([***         VirusBuster VBengDaemon NOT found!           ***])
    AC_MSG_WARN([***      VBengClient NEEDS (running) VBengDaemon!        ***])
    AC_MSG_WARN([************************************************************])
  else
	avscanner="$avscanner VirusBuster";
	vbuster_scanner_frag=$srcdir/amavis/av/vbuster
 fi 
fi

### Panda AntiVirus for Linux
panda_scanner_frag=/dev/null
AC_CHECKING([*** Panda AntiVirus for Linux ***])
AC_PATH_PROG(panda, pavcl, , $PATH:/bin:/usr/bin:/usr/local/bin)
if test "x$panda" != "x" ; then
  avscanner="$avscanner Panda AntiVirus for Linux"
  panda_scanner_frag=$srcdir/amavis/av/panda
fi

### OpenAntiVirus ScannerDaemon
oav_scanner_frag=/dev/null
dnl AC_CHECKING([*** OpenAntiVirus ScannerDaemon ***])
dnl AC_PATH_PROG(oav, ScannerDaemon.jar, , $PATH:/bin:/usr/bin:/usr/local/bin)
dnl if test "x$oav" != "x" ; then
  avscanner="$avscanner OpenAntiVirus ScannerDaemon"
  oav="ScannerDaemon.jar"
  oav_scanner_frag=$srcdir/amavis/av/oav
dnl fi


AC_MSG_CHECKING([if any virus scanners are installed at all])
if test "x$antivir$uvscan$ufindvir$fvsco$sophos$avp$avpdc$fsav$vscan$vfind$inocucmd$rav$nod32$nod32cli$csav$vbengcl$sophie$trophie$panda$fprot$oav$cscmdline$drweb$mks" = "x" ; then
  AC_MSG_RESULT([no])
  AC_MSG_ERROR([

You have to install at least ONE virusscanner to scan for viruses!
(Just in case you didn't know ...;-)
  ])
else
  AC_MSG_RESULT([yes])
fi

# This lonely fi belongs to the --enable-all option
# Sorry for the poor indentation
fi

dnl Various switches

dnl Base directory for runtime files (log file, temp dirs)
runtime_dir=/var/amavis
AC_MSG_CHECKING([for runtime directory])
AC_ARG_WITH(runtime-dir,
  [  --with-runtime-dir=DIR        directory for runtime files [/var/amavis]],
   runtime_dir=$withval)
AC_MSG_RESULT([$runtime_dir])
dnl AC_DEFINE_UNQUOTED(RUNTIME_DIR, "$runtime_dir")
AC_SUBST(runtime_dir)

dnl Logging to syslog?
AC_MSG_CHECKING([whether to use syslog])
AC_ARG_ENABLE(syslog,
  [  --enable-syslog               use syslog [default MTA-specific]],
   do_syslog="$enableval",
   [if test "x$MTA" = "xqmail" ; then
      do_syslog=no
    else
      do_syslog=yes
    fi
   ])

AC_MSG_RESULT([$do_syslog])
AC_SUBST(do_syslog)

logdir="$runtime_dir"
syslog_level="mail.info"

dnl syslog facility + level
if test "$do_syslog" = "yes" ; then
  AC_MSG_CHECKING([syslog facility.level])
  AC_ARG_WITH(syslog-level,
    [  --with-syslog-level=FAC.LVL   facility and level [\"mail.info\"]],
    syslog_level="$withval")
  AC_MSG_RESULT([$syslog_level])
  AC_SUBST(syslog_level)
else
  dnl If file logging is enabled, log to which directory?
  AC_MSG_CHECKING([directory for logfile(s)])
  AC_ARG_WITH(logdir,
    [  --with-logdir=DIR             log directory if not using syslog [/var/amavis]],
     logdir=$withval)
  AC_MSG_RESULT([$logdir])
fi
AC_SUBST(logdir)

dnl Run amavis under which user id?
AC_MSG_CHECKING([user id amavis runs under])
AC_ARG_WITH(amavisuser,
  [  --with-amavisuser=USER        run amavis as? [default MTA-specific]],
  amavisuser=$withval,
  [if test "x$MTA" = "xqmail"; then
     amavisuser="qmailq"
   elif test "x$MTA" = "xpostfix"; then
     amavisuser="vscan"
   elif test "x$MTA" = "xexim"; then
      amavisuser="amavis"
   elif test "x$MTA" = "xsendmail" && test "x$enable_relay" = "xyes"; then
      amavisuser="amavis"
   else
     amavisuser="root"
   fi])
amavisuser="";

AC_MSG_RESULT([$amavisuser])
AC_SUBST(amavisuser)

dnl keep a backup of infected mail
AC_MSG_CHECKING([whether to keep a backup of infected mails])
AC_ARG_ENABLE(virusbackup,
  [  --disable-virusbackup         dont't backup infected mails [default: backup]],
   virusbackup="$enableval", virusbackup="yes")

AC_MSG_RESULT([$virusbackup])
AC_SUBST(virusbackup)

dnl directory to move infected mails to
AC_MSG_CHECKING([directory to move infected mails to])
AC_ARG_WITH(virusdir,
  [  --with-virusdir=DIR           quarantine directory for infected mail
                                     [default=\"/var/virusmails\"]],
  virusdir=$withval, virusdir="/var/virusmails")

AC_MSG_RESULT([$virusdir])
AC_SUBST(virusdir)

dnl maxlevel
AC_MSG_CHECKING([maximum depth of recursive unpacking])
AC_ARG_WITH(maxlevel,
  [  --with-maxlevel=VALUE         max depth of recursive unpacking [default="20"]],
  maxlevel=$withval, maxlevel="20")

AC_MSG_RESULT([$maxlevel])
AC_SUBST(maxlevel)

dnl maximum archive nesting level
AC_MSG_CHECKING([maximum archive nesting depth])
AC_ARG_WITH(maxdepth,
  [  --with-maxdepth=VALUE         max archive nesting depth [default="3"]],
  maxdepth=$withval, maxdepth="3")

AC_MSG_RESULT([$maxdepth])
AC_SUBST(maxdepth)

dnl maximum number of files when extracting
AC_MSG_CHECKING([maximum number of files when extracting])
AC_ARG_WITH(maxfiles,
  [  --with-maxfiles=VALUE         max number of files when extracting[default="500"]],
  maxfiles=$withval, maxfiles="500")

AC_MSG_RESULT([$maxfiles])
AC_SUBST(maxfiles)

dnl Send notification to sender?
AC_MSG_CHECKING([send notification to sender])
AC_ARG_WITH(warnsender,
  [  --with-warnsender=FILE        send notification to sender [yes]],
  warnsender=$withval, warnsender="yes")

AC_MSG_RESULT([$warnsender])
warn_sender_frag=$srcdir/amavis/notify/sender
if test "x$warnsender" != "xno"; then
  if test "x$warnsender" != "xyes"; then
    warn_sender_frag="$warnsender"
  fi
  warnsender=yes
fi
AC_SUBST(warnsender)
AC_SUBST_FILE(warn_sender_frag)

dnl Send notification to recipient?
AC_MSG_CHECKING([send notification to recipient(s)])
AC_ARG_WITH(warnrecip,
  [  --with-warnrecip=FILE         send notification to receiver(s) [no]],
  warnrecip=$withval, warnrecip="no")

AC_MSG_RESULT([$warnrecip])
warn_recip_frag=$srcdir/amavis/notify/recip
if test "x$warnrecip" != "xno"; then
  if test "x$warnrecip" != "xyes"; then
    warn_recip_frag="$warnrecip"
  fi
  warnrecip=yes
fi
AC_SUBST(warnrecip)
AC_SUBST_FILE(warn_recip_frag)

dnl Mail reports to admin?
AC_MSG_CHECKING([send notification to admin])
AC_ARG_WITH(warnadmin,
  [  --with-warnadmin=FILE         send notification to admin [yes]],
  warnadmin=$withval, warnadmin="yes")

AC_MSG_RESULT([$warnadmin])
warn_admin_frag=$srcdir/amavis/notify/admin
if test "x$warnadmin" != "xno"; then
  if test "x$warnadmin" != "xyes"; then
    warn_admin_frag="$warnadmin"
  fi
  warnadmin=yes
fi
AC_SUBST(warnadmin)
AC_SUBST_FILE(warn_admin_frag)

dnl from address in reports 
AC_MSG_CHECKING([from address in reports])
AC_ARG_WITH(mailfrom,
  [  --with-mailfrom=USER          mail sent from? [default=\"postmaster\"]],
  mailfrom=$withval, mailfrom="postmaster")

AC_MSG_RESULT([$mailfrom])
AC_SUBST(mailfrom)

dnl user to mail reports to
AC_MSG_CHECKING([user to mail reports to])
AC_ARG_WITH(mailto,
  [  --with-mailto=USER            email sent to? [default=\"virusalert\"]],
  mailto=$withval, mailto="virusalert")

AC_MSG_RESULT([$mailto])
AC_SUBST(mailto)

dnl enable display of AMaViS credits
AC_MSG_CHECKING([whether to display AMaVis credits to users])

AC_ARG_ENABLE(credits,
  [  --enable-credits              display AMaViS credits to users [default: no]],
   credits="$enableval", credits="no")

AC_MSG_RESULT([$credits])
AC_SUBST(credits)

dnl Enable header rewrite?
AC_MSG_CHECKING([header rewrite])
AC_ARG_ENABLE(x_header,
  [  --disable-x-header            don't add X-Virus-Scanned header [default: add]],,
  test -z "$enable_x_header" && enable_x_header=yes)

AC_MSG_RESULT([$enable_x_header])
AC_SUBST(enable_x_header)

AC_SUBST_FILE(avp_scanner_frag)
AC_SUBST_FILE(avpdc_scanner_frag)
AC_SUBST_FILE(cai_scanner_frag)
AC_SUBST_FILE(csav_scanner_frag)
AC_SUBST_FILE(cyber_scanner_frag)
AC_SUBST_FILE(drweb_scanner_frag)
AC_SUBST_FILE(fsec_scanner_frag)
AC_SUBST_FILE(hbedv_scanner_frag)
AC_SUBST_FILE(mks_scanner_frag)
AC_SUBST_FILE(nai_scanner_frag)
AC_SUBST_FILE(nod32_scanner_frag)
AC_SUBST_FILE(nod32cli_scanner_frag)
AC_SUBST_FILE(rav_scanner_frag)
AC_SUBST_FILE(sophos_scanner_frag)
AC_SUBST_FILE(symantec_scanner_frag)
AC_SUBST_FILE(trend_scanner_frag)
AC_SUBST_FILE(vbuster_scanner_frag)
AC_SUBST_FILE(sophie_scanner_frag)
AC_SUBST_FILE(trophie_scanner_frag)
AC_SUBST_FILE(fprot_scanner_frag)
AC_SUBST_FILE(panda_scanner_frag)
AC_SUBST_FILE(oav_scanner_frag)

AC_OUTPUT([ Makefile            \
            amavis/Makefile     \
            amavis/checkaccount \
            amavis/amavis       \
            tests/Makefile      \
          ],
[
    test -f amavis/amavis && chmod 755 amavis/amavis
    test -f amavis/checkaccount && chmod 755 amavis/checkaccount
    test -f amavis/post-install && chmod 755 amavis/post-install
])

AC_MSG_RESULT([
** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE:

  Install amavis as:          $prefix/sbin/amavis
  Configured for use with:    $MTA
  Configuration type:         $config_type])

test "$MTA" = sendmail && \
  AC_MSG_RESULT([  Original sendmail.cf:       $sendmail_cf_orig])

AC_MSG_RESULT([  Use virus scanner(s):      $avscanner
  Scanner runs as:            $amavisuser])

if test "$do_syslog" = yes ; then
  AC_MSG_RESULT([  Logging to syslog:          yes])
else
  AC_MSG_RESULT([  Log file directory:         $logdir])
fi

test "$virusbackup" = yes && \
  AC_MSG_RESULT([  Quarantine directory:       $virusdir])

AC_MSG_RESULT([  Max. recursion depth:       $maxlevel
  Max. archive nesting depth: $maxdepth
  Max. number of extracted files: $maxfiles
  Add X-Virus-Scanned header: $enable_x_header])

AC_MSG_RESULT([  Display AMaViS credits:     $credits ])

dnl NB. These three variables are empty
dnl if the feature is enabled!
test x"$warnsender" != xno && \
  AC_MSG_RESULT([  Warn sender:                yes])

test x"$warnrecip" != xno && \
  AC_MSG_RESULT([  Warn recipient(s):          yes])

test x"$warnadmin" != xno && \
  AC_MSG_RESULT([  Reports sent to:            $mailto
  Reports sent by:            $mailfrom

To accept the above, type \"make\"
])