-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathaclocal.m4
More file actions
executable file
·1528 lines (1381 loc) · 36.6 KB
/
aclocal.m4
File metadata and controls
executable file
·1528 lines (1381 loc) · 36.6 KB
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
dnl
dnl aclocal.m4
dnl
dnl Copyright 2002, 2011 by Anthony Howe. All rights reserved.
dnl
dnl AC_LANG(C)
dnl ----------
dnl CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
dnl
dnl Handle Borland C++ 5.5 where it has none standard output flags that
dnl require the filename argument be abutted to the option letter.
dnl
m4_define([AC_LANG(C)],
[ac_ext=c
dnl Mac OS X gcc 3.x wants to option and argument to be separated.
dnl Don't people read standards like POSIX and SUS?
CC_E='-o '
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
ac_link='$CC ${CC_E}conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
])
dnl
dnl SNERT_GCC_SETTINGS
dnl
m4_define([SNERT_GCC_SETTINGS],[
AS_IF([test $GCC = 'yes'],[
GCC_MAJOR=`$CC -dM -E -xc /dev/null | sed -n -e 's/.*__GNUC__ \(.*\)/\1/p'`
GCC_MINOR=`$CC -dM -E -xc /dev/null | sed -n -e 's/.*__GNUC_MINOR__ \(.*\)/\1/p'`
dnl AS_IF([test $GCC_MAJOR -ge 4],[CFLAGS="-Wno-pointer-sign $CFLAGS"])
AS_IF([test $GCC_MAJOR -ge 3],[CFLAGS="-Wno-char-subscripts $CFLAGS"])
CFLAGS="-Wall $CFLAGS"
])
AS_IF([test ${enable_debug:-no} = 'no'],[
CFLAGS="-O2 ${CFLAGS}"
LDFLAGS="${LDFLAGS}"
],[
CFLAGS="-O0 -g ${CFLAGS}"
])
if test ${platform:-UNKNOWN} = 'CYGWIN'; then
AS_IF([test ${enable_debug:-no} = 'no'],[CFLAGS="-s ${CFLAGS}"])
CFLAGS="-I/usr/include/w32api ${CFLAGS}"
LDFLAGS="-L/usr/lib/w32api ${LDFLAGS}"
dnl if test ${enable_win32:-no} = 'yes'; then
dnl dnl -s strip, no symbols
dnl dnl -mno-cygwin native windows console app
dnl dnl -mwindows native windows gui app
dnl dnl -lws2_32 WinSock2 library
dnl CFLAGS="-mno-cygwin ${CFLAGS}"
dnl LIBS="-lws2_32 ${LIBS}"
dnl fi
fi
])
dnl
dnl SNERT_BCC_SETTINGS
dnl
m4_define([SNERT_BCC_SETTINGS],[
# This assumes a Cygwin environment with Boland C++ 5.5 CLI.
#
# Borland C++ 5.5 CLI tools don't have all the standard options
# and require that arguments be abutted with the option letter.
platform='BorlandC'
ac_libext='lib'
ac_objext='obj'
ac_exeext='.exe'
LIBEXT=$ac_libext
OBJEXT=$ac_objext
EXEEXT=$ac_exeext
CPP='cpp32'
CPPFLAGS=
CFLAGS="-d -w-8064 ${CFLAGS}"
if test ${enable_debug:-no} = 'no'; then
CFLAGS="-O1 -v- ${CFLAGS}"
else
CFLAGS="-v ${CFLAGS}"
fi
CC_E='-e'
CC_E_NAME='-e$''*$E'
CC_O='-o'
CC_O_NAME='-o$''*$O'
COMPILE='${CC} ${CFLAGS} ${CC_O}$''*$O -c $<'
LD='bcc32'
LDFLAGS='-q -lc -L"c:/Borland/Bcc55/lib" -L"c:/Borland/Bcc55/lib/PSDK"'
LIBSNERT=`echo "$abs_tardir/com/snert/lib/libsnert.$LIBEXT" | sed -e 's,/,\\\\\\\\,g'`
ARCHIVE='tlib /C /a ${LIBSNERT} $$obj'
RANLIB='true'
XARGSI='xargs -i{}'
AC_SUBST(FAMILY, [WIN])
])
dnl
dnl SNERT_DEFAULT_CC_SETTINGS
dnl
m4_define([SNERT_DEFAULT_CC_SETTINGS],[
dnl Tradional cc options.
dnl NOTE SunOS as(1) _wants_ a space between -o and its argument.
CC_E='-o'
CC_E_NAME='-o $@'
CC_O='-o'
CC_O_NAME='-o $''*$O'
LD=$CC
# Where to find libsnert includes and library.
dnl CFLAGS='-I${SNERT_INCDIR} '"${CFLAGS}"
dnl LDFLAGS='-L${SNERT_LIBDIR} '"${LDFLAGS}"
LIBSNERT='-lsnert'
# Makefile macro to compile C into an object file.
COMPILE='${CC} ${CFLAGS} ${CC_O} $''*$O -c $<'
dnl COMPILE='${CC} ${CFLAGS} -c $<'
# Makefile macro to archive an object file.
ARCHIVE='${AR} rc ${LIB} $$obj'
# Assume the following traditional extensions.
ac_libext='a'
LIBEXT=$ac_libext
case "$CC" in
gcc)
SNERT_GCC_SETTINGS
;;
bcc32)
SNERT_BCC_SETTINGS
;;
esac
AC_PROG_CC
case "$CC" in
gcc)
SNERT_GCC_SETTINGS
;;
esac
AC_AIX
AC_SUBST(CC_E)
AC_SUBST(CC_E_NAME)
AC_SUBST(CC_O)
AC_SUBST(CC_O_NAME)
AC_SUBST(COMPILE)
AC_SUBST(ARCHIVE)
AC_SUBST(LIBEXT)
AC_SUBST(LIBSNERT)
AC_CHECK_TOOL(RANLIB, ranlib, true)
dnl Check for recent ANSI C additions that HAVE_HEADER_STDC check
dnl doesn't distinguish between C89 and C99.
SNERT_CHECK_DEFINE([va_copy], [stdarg.h])
])
AC_DEFUN([SNERT_TAR_SETTINGS],[
AC_MSG_CHECKING(for tar file list option to use)
if tar --version 2>&1 | grep '(GNU tar)' >/dev/null ; then
TAR_I='-T'
else
TAR_I='-I'
fi
AC_SUBST(TAR_I)
AC_MSG_RESULT($TAR_I)
])
dnl
dnl SNERT_CHECK_LIB(lib, symbol)
dnl
dnl Only check AC_CHECK_LIB if $lib not already in $LIBS
dnl
AC_DEFUN(SNERT_CHECK_LIB,[
if echo "$LIBS" | grep -- "-l$1" >/dev/null ; then
echo "checking for $2 in $1... (cached) yes"
else
AC_CHECK_LIB([$1], [$2])
fi
])
dnl
dnl SNERT_CHECK_DEFINE(symbol, header_file)
dnl
AC_DEFUN(SNERT_CHECK_DEFINE,[
AC_LANG_PUSH(C)
AC_CACHE_CHECK([for $1],ac_cv_define_$1,[
AC_RUN_IFELSE([
AC_LANG_SOURCE([[
#include <$2>
int main()
{
#ifdef $1
return 0;
#else
return 1;
#endif
}
]])
],ac_cv_define_$1=yes, ac_cv_define_$1=no)
])
AC_LANG_POP(C)
AS_IF([test $ac_cv_define_$1 = 'yes'],[
AC_DEFINE_UNQUOTED([HAVE_MACRO_]translit($1, [a-z], [A-Z]))
])
])
dnl
dnl SNERT_CHECK_PREDEFINE(symbol)
dnl
AC_DEFUN(SNERT_CHECK_PREDEFINE,[
AC_LANG_PUSH(C)
AC_CACHE_CHECK([for $1],ac_cv_define_$1,[
AC_RUN_IFELSE([
AC_LANG_SOURCE([[
int main()
{
#ifdef $1
return 0;
#else
return 1;
#endif
}
]])
],ac_cv_define_$1=yes, ac_cv_define_$1=no)
])
AC_LANG_POP(C)
AS_IF([test $ac_cv_define_$1 = 'yes'],[
AC_DEFINE_UNQUOTED([HAVE_MACRO_]translit($1, [a-z], [A-Z]))
])
])
dnl
dnl SNERT_GET_NUMERIC_DEFINE(header_file, symbol)
dnl
AC_DEFUN(SNERT_GET_NUMERIC_DEFINE,[
AS_VAR_PUSHDEF([ac_Header], [snert_define_$1_$2])dnl
AC_CACHE_CHECK([for $2],[ac_Header],[
AC_RUN_IFELSE([
#include <stdio.h>
#include <$1>
int main()
{
#ifdef $2
FILE *fp;
if ((fp = fopen("snert_output.txt", "w")) == NULL)
return 1;
fprintf(fp, "%d", $2);
fclose(fp);
return 0;
#else
return 1;
#endif
}
],[
AS_VAR_SET([ac_Header], [[`cat snert_output.txt`]])
rm -f snert_output.txt
])
])
AS_VAR_POPDEF([ac_Header])dnl
])
AC_DEFUN(SNERT_OPTION_DB_185,[
AC_ARG_ENABLE(db-185
[AS_HELP_STRING([[--enable-db-185 ]],[link with DB 1.85])]
)
])
dnl
dnl SNERT_BERKELEY_DB
dnl
dnl Sets $with_db to yes or no
dnl Sets $db_lib to the library -l option or an empty string.
dnl
AC_DEFUN(SNERT_OPTION_WITH_DB,[
AC_ARG_WITH(db, [[ --with-db[=DIR] include Berkeley DB support]])
])
AC_DEFUN(SNERT_BERKELEY_DB,[
AS_IF([test ${with_db:-default} != 'no'],[
echo
echo "Check for Berkeley DB support..."
echo
bdb_save_LIBS=$LIBS
bdb_save_CFLAGS=$CFLAGS
bdb_save_LDFLAGS=$LDFLAGS
# Find short list of system directories to try.
BDB_BASE_DIRS="$with_db /opt/csw/bdb4 /opt /usr/pkg /usr/local /usr"
bdb_found='no'
for d in $BDB_BASE_DIRS ; do
if test -d "$d/include" ; then
bdb_dir_list="$bdb_dir_list $d"
bdb_i_dirs=`ls -d $d/include/db[[0-9]]* $d/include/db $d/include/. 2>/dev/null | sort -r`
for BDB_I_DIR in $bdb_i_dirs ; do
AC_MSG_CHECKING([for db.h in $BDB_I_DIR])
if test -r $BDB_I_DIR/db.h ; then
AC_MSG_RESULT(yes)
v=`basename $BDB_I_DIR`
if test $v = 'include' ; then
v='.'
fi
if test -d $d/lib64/$v -a "$v" != '.' ; then
BDB_L_DIR="$d/lib64/$v"
elif test -d $d/lib/$v -a "$v" != '.'; then
BDB_L_DIR="$d/lib/$v"
elif test -d $d/lib64 ; then
BDB_L_DIR="$d/lib64"
else
BDB_L_DIR="$d/lib"
fi
if test ${BDB_I_DIR} != '/usr/include/.' ; then
CFLAGS="-I$BDB_I_DIR $CFLAGS"
fi
if test ${BDB_L_DIR} != '/usr/lib64' -a ${BDB_L_DIR} != '/usr/lib' ; then
LDFLAGS="-L$BDB_L_DIR $LDFLAGS"
fi
bdb_major=`grep DB_VERSION_MAJOR $BDB_I_DIR/db.h | cut -f 3`
if test -n "$bdb_major" ; then
bdb_minor=`grep DB_VERSION_MINOR $BDB_I_DIR/db.h | cut -f 3`
bdb_create='db_create'
else
bdb_major=1
bdb_minor=85
bdb_create='dbopen'
fi
for l in $v db ''; do
if test -n "$l" ; then
LIBS="-l$l $LIBS"
bdb_name=$l
else
bdb_name='libc'
fi
AC_MSG_CHECKING([for $bdb_create in library $bdb_name])
AC_LINK_IFELSE([
AC_LANG_SOURCE([[
#include <stdlib.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <db.h>
int
main(int argc, char **argv)
{
#ifdef DB_VERSION_MAJOR
DB *db = NULL;
return db_create(&db, NULL, 0) != 0 || db == NULL;
#else
DB *db = dbopen("access.db", 0, 0, 0, NULL);
return 0;
#endif
}
]])
],[
bdb_found='yes'
AC_DEFINE_UNQUOTED(HAVE_DB_H)
if test $bdb_major = 1 ; then
AC_DEFINE_UNQUOTED(HAVE_DBOPEN)
else
AC_DEFINE_UNQUOTED(HAVE_DB_CREATE)
fi
if test -n "$l" ; then
AC_SUBST(HAVE_LIB_DB, "-l$l")
AC_SUBST(CFLAGS_DB, "-I$BDB_I_DIR")
AC_SUBST(LDFLAGS_DB, "-L$BDB_L_DIR")
AC_DEFINE_UNQUOTED(HAVE_LIB_DB, "-l$l")
AC_DEFINE_UNQUOTED(LDFLAGS_DB, "-I$BDB_I_DIR")
AC_DEFINE_UNQUOTED(CFLAGS_DB, "-L$BDB_L_DIR")
fi
])
AC_MSG_RESULT($bdb_found)
LIBS="$bdb_save_LIBS"
test ${bdb_found:-no} = 'yes' && break
done
test ${bdb_found:-no} = 'yes' && break
LDFLAGS="$bdb_save_LDFLAGS"
CFLAGS="$bdb_save_CFLAGS"
else
AC_MSG_RESULT(no)
fi
done
test ${bdb_found:-no} = 'yes' && break
fi
done
bdb_version="$bdb_major.$bdb_minor"
if test ${bdb_found:-no} = 'yes' -a ${bdb_version} != '1.85' ; then
AC_MSG_CHECKING([for dbopen in library libc])
AC_LINK_IFELSE([
AC_LANG_SOURCE([[
#include <stdlib.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <db.h>
int
main(int argc, char **argv)
{
DB *db = dbopen("access.db", 0, 0, 0, NULL);
return 0;
}
]])
],[
dbopen_found='yes'
AC_DEFINE_UNQUOTED(HAVE_DB_H)
AC_DEFINE_UNQUOTED(HAVE_DBOPEN)
],[
dbopen_found='no'
])
AC_MSG_RESULT(${dbopen_found})
fi
LDFLAGS="$bdb_save_LDFLAGS"
CFLAGS="$bdb_save_CFLAGS"
AC_MSG_RESULT([checking best Berkeley DB version... $bdb_version])
])
])
dnl
dnl SNERT_FIND_LIB([name],[found],[notfound])
dnl
m4_define([SNERT_FIND_LIB],[
AS_VAR_PUSHDEF([snert_lib], [snert_find_lib_$1])dnl
echo
echo "Finding dynamic library $1 ..."
echo
AS_VAR_SET([snert_lib], 'no')
AC_CHECK_HEADER([dlfcn.h], [
AC_DEFINE_UNQUOTED(HAVE_DLFCN_H)
AC_CHECK_TOOL(ldd_tool, ldd)
if test ${ldd_tool:-no} != 'no' ; then
AC_CHECK_LIB([dl],[dlopen])
AC_MSG_CHECKING([for $1])
AC_RUN_IFELSE([
AC_LANG_SOURCE([[
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
#endif
int
main(int argc, char **argv)
{
void *handle;
handle = dlopen(argv[1], RTLD_NOW);
return dlerror() != NULL;
}
]])
],[
libpath=[`$ldd_tool ./conftest$ac_exeext | sed -n -e "/lib$1/s/.* \([^ ]*lib$1[^ ]*\).*/\1/p"`]
if ./conftest$ac_exeext ${libpath:-unknown} ; then
AS_VAR_SET([snert_lib], [${libpath}])
else
AS_VAR_SET([snert_lib], 'no')
fi
])
AC_MSG_RESULT(AS_VAR_GET([snert_lib]))
fi
])
AS_IF([test AS_VAR_GET([snert_lib]) != 'no'], [$2], [$3])[]
AS_VAR_POPDEF([snert_lib])
])
AC_DEFUN(SNERT_FIND_LIBC,[
SNERT_FIND_LIB([c],[AC_DEFINE_UNQUOTED(LIBC_PATH, ["$snert_find_lib_c"])], [])
])
dnl
dnl SNERT_PLATFORM
dnl
AC_DEFUN(SNERT_PLATFORM,[
platform=`uname -s|sed -e 's/^\([[a-zA-Z0-9]]*\)[[^a-zA-Z0-9]].*/\1/'`
AC_SUBST(platform, $platform)
echo "platform is... $platform"
if test -e /etc/debian_version ; then
echo "this Linux is a Debian" `cat /etc/debian_version`
apt-get install -y gcc libc6-dev
isDebian='yes'
fi
AC_CHECK_TOOL(MD5SUM, md5sum)
if test ${MD5SUM:-no} = 'no' ; then
AC_CHECK_TOOL(MD5SUM, md5)
fi
case "$platform" in
NetBSD)
LDFLAGS="-R/usr/pkg/lib $LDFLAGS"
;;
esac
AC_DEFINE_UNQUOTED(${snert_macro_prefix}_PLATFORM, [["${platform}"]])
AC_DEFINE_UNQUOTED(${snert_macro_prefix}_BUILD_HOST, [["`hostname`"]])
dnl case $platform in
dnl Linux*)
dnl kernel=`uname -r`
dnl case "$kernel" in
dnl 1.*|2.0.*)
dnl echo "Linux kernel... $kernel"
dnl dnl Older Linux kernels have a broken poll() where it
dnl dnl might block indefinitely in nanosleep().
dnl AC_DEFINE_UNQUOTED(HAS_BROKEN_POLL)
dnl ;;
dnl esac
dnl esac
])
dnl
dnl SNERT_LIBMILTER
dnl
dnl Depends on SNERT_PTHREAD
dnl
AC_DEFUN(SNERT_OPTION_WITH_MILTER,[
AC_ARG_WITH(lua, [[ --with-milter[=DIR] include milter support]])
])
AC_DEFUN(SNERT_LIBMILTER,[
echo
echo "Check for sendmail's libmilter library & header support..."
echo
saved_libs="$LIBS"
saved_cflags="$CFLAGS"
saved_ldflags="$LDFLAGS"
if test ${with_milter:-default} != 'no' ; then
for d in "$with_milter" /usr /usr/local /usr/pkg ; do
unset ac_cv_search_smfi_main
unset ac_cv_header_libmilter_mfapi_h
if test X$d != X ; then
CFLAGS_MILTER="-I$d/include"
if test -d $d/lib/libmilter ; then
LDFLAGS_MILTER="-L$d/lib/libmilter"
else
LDFLAGS_MILTER="-L$d/lib"
fi
fi
echo "trying with $LDFLAGS_MILTER ..."
CFLAGS="$CFLAGS_MILTER $saved_cflags"
LDFLAGS="$LDFLAGS_MILTER $saved_ldflags"
AC_SEARCH_LIBS([smfi_main], [milter], [AC_DEFINE_UNQUOTED(HAVE_LIBMILTER, "-lmilter -lpthread")], [], [-lpthread])
AC_CHECK_HEADERS([libmilter/mfapi.h],[],[],[/* */])
if test "$ac_cv_search_smfi_main" != 'no' -a "$ac_cv_header_libmilter_mfapi_h" != 'no' ; then
LIBS="-lmilter -lpthread $saved_libs"
AC_CHECK_FUNCS([smfi_addheader smfi_addrcpt smfi_addrcpt_par smfi_chgfrom smfi_chgheader smfi_delrcpt smfi_getpriv smfi_getsymval smfi_insheader smfi_main smfi_opensocket smfi_progress smfi_quarantine smfi_register smfi_replacebody smfi_setbacklog smfi_setconn smfi_setdbg smfi_setmaxdatasize smfi_setmlreply smfi_setpriv smfi_setreply smfi_setsymlist smfi_settimeout smfi_stop smfi_version])
AC_SUBST(HAVE_LIB_MILTER, "-lmilter")
AC_SUBST(LDFLAGS_MILTER)
AC_SUBST(CFLAGS_MILTER)
AC_DEFINE_UNQUOTED(LDFLAGS_MILTER, "${LDFLAGS_MILTER}")
AC_DEFINE_UNQUOTED(CFLAGS_MILTER, "${CFLAGS_MILTER}")
with_milter="$d"
break
fi
done
LIBS="$saved_libs"
CFLAGS="$saved_cflags"
LDFLAGS="$saved_ldflags"
fi
])
dnl
dnl SNERT_LIBSNERT
dnl
AC_DEFUN(SNERT_LIBSNERT,[
saved_cflags=$CFLAGS
saved_ldflags=$LDFLAGS
CFLAGS="-I../../include $CFLAGS"
LDFLAGS="-L../../lib $LDFLAGS"
AC_CHECK_LIB(snert, parsePath)
if test "$ac_cv_lib_snert_parsePath" = 'no'; then
echo
AC_MSG_WARN([The companion library, LibSnert, is required.])
echo
ac_cv_lib_snert_parsePath='required'
CFLAGS=$saved_cflags
LDFLAGS=$saved_ldflags
fi
snert_libsnert=$ac_cv_lib_snert_parsePath
])
dnl
dnl SNERT_OPTION_ENABLE_DEBUG
dnl
AC_DEFUN(SNERT_OPTION_ENABLE_DEBUG,[
dnl Assert that CFLAGS is defined. When AC_PROC_CC is called to
dnl check the compiler and CC == gcc is found and CFLAGS is
dnl undefined, then it gets assigned "-g -O2", which is just
dnl annoying when you want the default to no debugging.
CFLAGS="${CFLAGS}"
AC_ARG_ENABLE(debug,[AS_HELP_STRING([--enable-debug],[enable compiler debug option])])
AS_IF([test ${enable_debug:-no} = 'yes'],[
DBG="-g -O0"
],[
AC_DEFINE(NDEBUG,[1],[Disable debug code])
enable_debug='no'
])
AC_SUBST(DBG)
])
AC_DEFUN(SNERT_OPTION_ENABLE_64BIT,[
dnl Assert that CFLAGS is defined. When AC_PROC_CC is called to
dnl check the compiler and CC == gcc is found and CFLAGS is
dnl undefined, then it gets assigned "-g -O2", which is just
dnl annoying when you want the default to no debugging.
CFLAGS="${CFLAGS}"
LDFLAGS="${LDFLAGS}"
AC_ARG_ENABLE(64bit,[AS_HELP_STRING([--enable-64bit],[enable compile & link options for 64-bit])])
AS_IF([test ${enable_64bit:-no} = 'yes'],[
CFLAGS="-m64 ${CFLAGS}"
dnl LDFLAGS="-m64 ${LDFLAGS}"
])
])
AC_DEFUN(SNERT_OPTION_ENABLE_32BIT,[
dnl Assert that CFLAGS is defined. When AC_PROC_CC is called to
dnl check the compiler and CC == gcc is found and CFLAGS is
dnl undefined, then it gets assigned "-g -O2", which is just
dnl annoying when you want the default to no debugging.
CFLAGS="${CFLAGS}"
LDFLAGS="${LDFLAGS}"
AC_ARG_ENABLE(32bit,[AS_HELP_STRING([--enable-32bit],[enable compile & link options for 32-bit])])
AS_IF([test ${enable_32bit:-no} = 'yes'],[
CFLAGS="-m32 ${CFLAGS}"
dnl LDFLAGS="-m32 ${LDFLAGS}"
])
])
dnl
dnl SNERT_OPTION_ENABLE_MATH
dnl
AC_DEFUN(SNERT_OPTION_ENABLE_MATH,[
AC_ARG_ENABLE(math,
[AS_HELP_STRING([--disable-math ],[disable libm support])],
[
AS_IF([test ${enable_math:-no} = 'yes'],[
AC_CHECK_HEADERS([math.h],[LIBS="${LIBS:+$LIBS }-lm"])
])
],
[
AC_CHECK_HEADERS([math.h],[LIBS="${LIBS:+$LIBS }-lm";enable_math='yes'])
]
)
])
dnl
dnl SNERT_OPTION_ENABLE_WIN32
dnl
AC_DEFUN(SNERT_OPTION_ENABLE_MINGW,[
AC_ARG_ENABLE(mingw,
[AS_HELP_STRING([--enable-mingw ],[generate native Windows application using mingw])],
[
enable_win32='yes'
AC_SUBST(ENABLE_MINGW, 'yes')
CFLAGS="-mno-cygwin -I/usr/include/w32api ${CFLAGS}"
LDFLAGS="-mno-cygwin -L/usr/lib/w32api ${LDFLAGS}"
]
)
])
dnl
dnl SNERT_OPTION_WITH_WINDOWS_SDK
dnl
AC_DEFUN(SNERT_OPTION_WITH_WINDOWS_SDK,[
AC_ARG_WITH(windows-sdk,
[AS_HELP_STRING([--with-windows-sdk=dir ],[Windows Platform SDK base directory])],
[
enable_win32='yes'
AC_SUBST(WITH_WINDOWS_SDK, $with_windows_sdk)
AC_DEFINE(WITH_WINDOWS_SDK, $with_windows_sdk)
CFLAGS="-mno-cygwin -I${with_windows_sdk}/include ${CFLAGS}"
LDFLAGS="-mno-cygwin -L${with_windows_sdk}/lib ${LDFLAGS}"
]
)
])
dnl
dnl SNERT_OPTION_ENABLE_BCC32
dnl
AC_DEFUN(SNERT_OPTION_ENABLE_BCC32,[
AC_ARG_ENABLE(bcc32,
[AS_HELP_STRING([--enable-bcc32 ],[generate native Windows application using Borland C++ 5.5])],
[
enable_bcc32='yes'
CC=bcc32
]
)
])
dnl
dnl SNERT_OPTION_ENABLE_RUN_USER(default_user_name)
dnl
AC_DEFUN(SNERT_OPTION_ENABLE_RUN_USER,[
AC_ARG_ENABLE(run-user,
[AS_HELP_STRING([--enable-run-user=user ],[specifiy the process user name, default is "$1"])],
[enable_run_user="$enableval"], [enable_run_user=$1]
)
AC_DEFINE_UNQUOTED(RUN_AS_USER, ["$enable_run_user"])
AC_SUBST(enable_run_user)
])
dnl
dnl SNERT_OPTION_ENABLE_RUN_GROUP(default_group_name)
dnl
AC_DEFUN(SNERT_OPTION_ENABLE_RUN_GROUP,[
AC_ARG_ENABLE(run-group,
[AS_HELP_STRING([--enable-run-group=group ],[specifiy the process group name, default is "$1"])],
[enable_run_group="$enableval"], [enable_run_group=$1]
)
AC_DEFINE_UNQUOTED(RUN_AS_GROUP, ["$enable_run_group"])
AC_SUBST(enable_run_group)
])
dnl
dnl SNERT_OPTION_ENABLE_CACHE_TYPE(default_cache_type)
dnl
AC_DEFUN(SNERT_OPTION_ENABLE_CACHE_TYPE,[
AC_ARG_ENABLE(cache-type,
[AS_HELP_STRING([--enable-cache-type=type ],[specifiy the cache type: bdb, flatfile, hash])],
[
# Force a specific type.
case "$enableval" in
bdb|flatfile|hash)
enable_cache_type="$enableval"
AC_DEFINE_UNQUOTED(CACHE_TYPE, ["$enable_cache_type"])
;;
*)
enable_cache_type="$1"
esac
], [
# Depends on whether Berkeley DB is available.
enable_cache_type="$1"
]
)
])
dnl
dnl SNERT_OPTION_ENABLE_CACHE_FILE
dnl
AC_DEFUN(SNERT_OPTION_ENABLE_CACHE_FILE,[
AC_ARG_ENABLE(cache-file,
[AS_HELP_STRING([--enable-cache-file=filepath ],[specifiy the cache file])],
[
enable_cache_file="$enableval"
], [
if test -d /var/cache ; then
# Linux http://www.pathname.com/fhs/pub/fhs-2.3.html
enable_cache_file='${localstatedir}/cache/${PACKAGE_NAME}.db'
elif test -d /var/db ; then
# FreeBSD, OpenBSD, NetBSD
enable_cache_file='${localstatedir}/db/${PACKAGE_NAME}.db'
else
echo "Cannot find a suitable location for the cache file."
echo "Please specify --enable-cache-file."
exit 1
fi
]
)
snert_cache_file=`eval echo $enable_cache_file`
AC_DEFINE_UNQUOTED(CACHE_FILE, ["`eval echo ${snert_cache_file}`"])
AC_SUBST(snert_cache_file)
AC_SUBST(enable_cache_file)
])
dnl
dnl SNERT_OPTION_ENABLE_PID(default)
dnl
AC_DEFUN(SNERT_OPTION_ENABLE_PID,[
AC_ARG_ENABLE(pid,
[AS_HELP_STRING([--enable-pid=filepath ],[specifiy an alternative pid file path])],
[
],[
dnl Almost all unix machines agree on this location.
if test -z "$1"; then
enable_pid='${localstatedir}/run/${PACKAGE_NAME}.pid'
else
enable_pid=$1
fi
]
)
snert_pid_file=`eval echo $enable_pid`
AC_DEFINE_UNQUOTED(PID_FILE, ["`eval echo ${snert_pid_file}`"])
AC_SUBST(snert_pid_file)
AC_SUBST(enable_pid)
])
dnl
dnl SNERT_OPTION_ENABLE_SOCKET(default)
dnl
AC_DEFUN(SNERT_OPTION_ENABLE_SOCKET,[
AC_ARG_ENABLE(socket,
[AS_HELP_STRING([--enable-socket=filepath ],[specifiy an alternative Unix domain socket])],
[
],[
dnl Almost all unix machines agree on this location.
dnl Note though that if you have more than one file
dnl here, its recommended to create a subdirectory
dnl with all the related files.
if test -z "$1"; then
enable_socket='${localstatedir}/run/${PACKAGE_NAME}.socket'
else
enable_socket=$1
fi
]
)
snert_socket_file=`eval echo $enable_socket`
AC_DEFINE_UNQUOTED(SOCKET_FILE, ["`eval echo ${snert_socket_file}`"])
AC_SUBST(snert_socket_file)
AC_SUBST(enable_socket)
])
dnl
dnl SNERT_OPTION_ENABLE_STARTUP_DIR
dnl
AC_DEFUN(SNERT_OPTION_ENABLE_STARTUP_DIR,[
AC_ARG_ENABLE(startup-dir,
[AS_HELP_STRING([--enable-startup-dir=dir ],[specifiy the startup script directory location])],
[
STARTUP_DIR="$enableval"
STARTUP_EXT='.sh'
], [
if test -d '/usr/local/etc/rc.d'; then
# FreeBSD
STARTUP_DIR='/usr/local/etc/rc.d'
STARTUP_EXT='.sh'
elif test -d '/etc/init.d'; then
# SunOS, Debian Linux, System V variant
STARTUP_DIR='/etc/init.d'
elif test -d '/etc/rc.d/init.d'; then
# Linux, System V variant
STARTUP_DIR='/etc/rc.d/init.d'
else
# OpenBSD has no place to put startup
# scripts that might be used by rc.local.
STARTUP_DIR='/usr/local/sbin'
STARTUP_EXT='.sh'
fi
]
)
AC_SUBST(STARTUP_DIR)
AC_SUBST(STARTUP_EXT)
])
dnl
dnl SNERT_OPTION_ENABLE_FORK
dnl
AC_DEFUN(SNERT_OPTION_ENABLE_FORK,[
AC_ARG_ENABLE(
fork, [AS_HELP_STRING([--enable-fork],[use process fork model instead of threads])],
[
AC_DEFINE_UNQUOTED(ENABLE_FORK)
]
)
AC_SUBST(enable_fork)
])
dnl
dnl SNERT_FUNC_FLOCK
dnl
AC_DEFUN(SNERT_FUNC_FLOCK,[
echo
echo "Check for flock() support..."
echo
AC_CHECK_HEADER(sys/file.h, [
AC_DEFINE_UNQUOTED(HAVE_SYS_FILE_H)
SNERT_CHECK_DEFINE(LOCK_SH, sys/file.h)
if test $ac_cv_define_LOCK_SH = 'yes'; then
AC_CHECK_FUNC(flock)
fi
])
])
dnl
dnl SNERT_OPTION_ENABLE_FCNTL_LOCKS
dnl
AC_DEFUN(SNERT_OPTION_ENABLE_FCNTL_LOCKS,[
AC_ARG_ENABLE(fcntl-locks,
[AS_HELP_STRING([--enable-fcntl-locks],[use fcntl() file locking instead of flock()])],
[
],[
dnl Option not specified, choose based on OS.
case "$platform" in
Linux)
enable_fcntl_locks='yes'
;;
esac
]
)
AS_IF([test ${enable_fcntl_locks:-'no'} = 'yes'],[AC_DEFINE_UNQUOTED(ENABLE_ALT_FLOCK)])
AC_SUBST(enable_alt_flock)
])
AC_DEFUN(SNERT_FILE_LOCKS,[
AS_ECHO()
AS_ECHO("Check for file locking...")
AS_ECHO()
AC_CHECK_HEADERS([fcntl.h sys/file.h])
AC_CHECK_FUNCS(flock fcntl lockf locking)
SNERT_CHECK_DEFINE(O_BINARY, fcntl.h)
SNERT_CHECK_DEFINE(LOCK_SH, fcntl.h)
])
dnl
dnl SNERT_POSIX_IO
dnl
AC_DEFUN(SNERT_POSIX_IO,[
echo
echo "Check for POSIX File & Directory I/O support..."
echo
AC_HEADER_DIRENT
dnl autoconf says the following should be included:
dnl
dnl #if HAVE_DIRENT_H
dnl # include <dirent.h>
dnl # define NAMLEN(dirent) strlen((dirent)->d_name)
dnl #else
dnl # define dirent direct
dnl # define NAMLEN(dirent) (dirent)->d_namlen
dnl # if HAVE_SYS_NDIR_H
dnl # include <sys/ndir.h>
dnl # endif
dnl # if HAVE_SYS_DIR_H
dnl # include <sys/dir.h>
dnl # endif
dnl # if HAVE_NDIR_H
dnl # include <ndir.h>
dnl # endif
dnl #endif
AC_CHECK_HEADERS([unistd.h fcntl.h sys/stat.h utime.h])
AC_CHECK_FUNCS([chdir getcwd mkdir rmdir closedir opendir readdir])
AC_CHECK_FUNCS([chmod chown chroot fchmod stat fstat link rename symlink unlink umask utime])
AC_CHECK_FUNCS([close creat dup dup2 ftruncate chsize truncate lseek open pipe read write])
AC_CHECK_FUNCS([isatty getdtablesize readlink readlinkat])
AC_FUNC_CHOWN
])
dnl
dnl SNERT_POSIX_SIGNALS
dnl
AC_DEFUN(SNERT_POSIX_SIGNALS,[
echo
echo "Check for POSIX signal support..."
echo
AC_CHECK_HEADER([signal.h],[
AC_DEFINE_UNQUOTED(HAVE_SIGNAL_H)
AC_CHECK_TYPES([sigset_t, struct sigaction, struct sigaltstack],[],[],[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SIGNAL_H
# include <signal.h>
#endif
])
AC_CHECK_FUNCS([kill sigaltstack sigemptyset sigfillset sigaddset sigdelset sigismember])
AC_CHECK_FUNCS([sigaction sigprocmask sigpending sigsuspend])
dnl _POSIX_REAL_TIME_SIGNALS