This repository has been archived by the owner on Jun 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
configure.ac
2505 lines (2217 loc) · 83.4 KB
/
configure.ac
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 Process this file with autoconf to produce a configure script.
dnl
dnl Copyright (c) 1994-2008 Carnegie Mellon University. All rights reserved.
dnl
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that the following conditions
dnl are met:
dnl
dnl 1. Redistributions of source code must retain the above copyright
dnl notice, this list of conditions and the following disclaimer.
dnl
dnl 2. Redistributions in binary form must reproduce the above copyright
dnl notice, this list of conditions and the following disclaimer in
dnl the documentation and/or other materials provided with the
dnl distribution.
dnl
dnl 3. The name "Carnegie Mellon University" must not be used to
dnl endorse or promote products derived from this software without
dnl prior written permission. For permission or any legal
dnl details, please contact
dnl Carnegie Mellon University
dnl Center for Technology Transfer and Enterprise Creation
dnl 4615 Forbes Avenue
dnl Suite 302
dnl Pittsburgh, PA 15213
dnl (412) 268-7393, fax: (412) 268-7395
dnl
dnl 4. Redistributions of any form whatsoever must retain the following
dnl acknowledgment:
dnl "This product includes software developed by Computing Services
dnl at Carnegie Mellon University (http://www.cmu.edu/computing/)."
dnl
dnl CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
dnl THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
dnl AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
dnl FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
dnl AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
dnl OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
dnl
dnl configure.ac for the Cyrus imapd
dnl
AC_INIT([cyrus-imapd],
m4_esyscmd(printf '%s' $(tools/git-version.sh)),
[https://github.com/cyrusimap/cyrus-imapd/issues],
,
[https://www.cyrusimap.org])
AC_PREREQ([2.63])
AC_CONFIG_SRCDIR([imap/imapd.c])
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([cmulocal])
AC_CANONICAL_SYSTEM
dnl shared or static
ENABLE_SHARED="$enable_shared"
AC_SUBST(ENABLE_SHARED)
ENABLE_STATIC="$enable_static"
AC_SUBST(ENABLE_STATIC)
dnl carve the version string (defined in AC_INIT above) into useful chunks
dnl e.g. for version 3.0.0-beta:
dnl CYRUS_IMAPD_SERIES => 3.0
dnl CYRUS_IMAPD_REVISION => 0
dnl CYRUS_IMAPD_PATCH => beta2
CYRUS_IMAPD_SERIES=`echo AC_PACKAGE_VERSION | cut -d- -f1 | cut -d. -f1-2`
CYRUS_IMAPD_REVISION=`echo AC_PACKAGE_VERSION | cut -d- -f1 | cut -d. -f3`
CYRUS_IMAPD_PATCH=`echo AC_PACKAGE_VERSION | cut -d- -f2-`
AC_SUBST([CYRUS_IMAPD_SERIES])
AC_SUBST([CYRUS_IMAPD_REVISION])
AC_SUBST([CYRUS_IMAPD_PATCH])
dnl in case the first use of PKG_CHECK_MODULES is inside a conditional
PKG_PROG_PKG_CONFIG
AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability foreign dist-bzip2
no-installinfo subdir-objects silent-rules tar-ustar])
AC_CONFIG_LIBOBJ_DIR([lib])
dnl Useful hook for distributions
AC_ARG_WITH(extraident,
[AS_HELP_STRING([--with-extraident=STRING],[use STRING as extra version information])],
[AC_DEFINE_UNQUOTED(EXTRA_IDENT,"$withval", [Extra version information for imap/version.h])])
AM_MAINTAINER_MODE
dnl Coverage (disabled by default)
GCOV_CFLAGS=
GCOV_CXXFLAGS=
GCOV_LDFLAGS=
GCOV_LIBS=
AC_ARG_ENABLE(coverage,
AS_HELP_STRING([--enable-coverage],[enable C test coverage])
)
AS_IF([test "x$enable_coverage" = "xyes"], [
GCOV_CFLAGS="--coverage"
GCOV_CXXFLAGS="--coverage"
GCOV_LDFLAGS="--coverage"
GCOV_LIBS="-lgcov"
])
AM_CONDITIONAL([HAVE_COVERAGE], [test "x$enable_coverage" = "xyes"])
AC_SUBST(GCOV_CFLAGS)
AC_SUBST(GCOV_CXXFLAGS)
AC_SUBST(GCOV_LDFLAGS)
AC_SUBST(GCOV_LIBS)
AC_ARG_WITH(login,,AC_MSG_ERROR([--with-login is no longer supported.
Configure SASL appropriately instead.]))
AC_ARG_WITH(cyrus-user,
[AS_HELP_STRING([--with-cyrus-user=USERID], [use USERID cyrus userid])],
cyrus_user="$withval",cyrus_user="cyrus")
AC_SUBST(cyrus_user)
AC_DEFINE_UNQUOTED(CYRUS_USER, "$cyrus_user",[What user will we run as?])
dnl allow users to override $sysconfdir, but retain old default (/etc)
dnl if not specified
if test $sysconfdir = '${prefix}/etc'; then
sysconfdir="/etc"
fi
dnl for some reason AC_PROG_CXX can succeed even though c++ compiler is missing
dnl if it is invoked after AC_PROG_CC, so instead invoke it first
dnl ref: https://lists.gnu.org/archive/html/bug-autoconf/2010-05/msg00001.html
AC_PROG_CXX
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_USE_SYSTEM_EXTENSIONS
AC_ISC_POSIX
AC_PROG_AWK
AC_SYS_LONG_FILE_NAMES
if test $ac_cv_sys_long_file_names = no; then
AC_MSG_ERROR(The Cyrus IMAPD requires support for long file names)
fi
AC_C_INLINE
gl_VISIBILITY
AH_BOTTOM([#if HAVE_VISIBILITY
#define EXPORTED __attribute__((__visibility__("default")))
#define HIDDEN __attribute__((__visibility__("hidden")))
#else
#define EXPORTED
#define HIDDEN
#endif])
AH_BOTTOM([#if defined __GNUC__ && __GNUC__ > 6
#define GCC_FALLTHROUGH __attribute__((fallthrough));
#else
#define GCC_FALLTHROUGH /* fall through */
#endif
])
LT_PREREQ([2.2.6])
LT_INIT([disable-static])
AC_SUBST([LIBTOOL_DEPS])
dnl Check the size of various types
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_SIZEOF(off_t)
AC_CHECK_SIZEOF(time_t)
dnl Warn if time_t is only 32 bits
AS_IF([test "$ac_cv_sizeof_time_t" -lt 8],
[AC_MSG_WARN([Your platform's time_t is less than 64 bits])
])
dnl Check that `long long int' is available
AC_CHECK_SIZEOF(long long int)
AC_CHECK_SIZEOF(unsigned long long int)
if test "$ac_cv_sizeof_long_long_int" -eq 8 -a \
"$ac_cv_sizeof_unsigned_long_long_int" -eq 8; then
AC_C_BIGENDIAN
else
AC_MSG_ERROR(The Cyrus IMAPD requires support for long long int)
fi
dnl Check the required alignment for various types
AC_CHECK_ALIGNOF(uint32_t)
dnl check for -R, etc. switch
CMU_GUESS_RUNPATH_SWITCH
AC_CHECK_HEADERS(unistd.h sys/select.h sys/param.h stdarg.h)
AC_REPLACE_FUNCS(memmove strcasecmp ftruncate strerror posix_fadvise strsep memmem memrchr)
AC_CHECK_FUNCS(strlcat strlcpy strnchr getgrouplist fmemopen pselect futimens futimes)
AC_HEADER_DIRENT
dnl check whether to use getpassphrase or getpass
AC_CHECK_HEADERS(stdlib.h)
AC_CHECK_FUNCS(getpassphrase)
# backwards compat with older pkg-config
m4_ifndef([PKG_CHECK_VAR], [
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])
])
dnl do this before Berkeley DB/IPv6 detection
CMU_SOCKETS
LIBS="$LIBS ${LIB_SOCKET}"
dnl check for IPv6 functions (fall back to sasl's if we don't have them)
cyrus_cv_getaddrinfo=yes
IPv6_CHECK_FUNC(getaddrinfo, [IPv6_CHECK_FUNC(gai_strerror,
AC_DEFINE(HAVE_GETADDRINFO,[],[Do we have a getaddrinfo?]),
cyrus_cv_getaddrinfo=no)], cyrus_cv_getaddrinfo=no)
cyrus_cv_getnameinfo=yes
IPv6_CHECK_FUNC(getnameinfo,
AC_DEFINE(HAVE_GETNAMEINFO,[],[Do we have a getnameinfo?]),
cyrus_cv_getnameinfo=no)
AM_CONDITIONAL([IPV6_noGETADDRINFO], [test $cyrus_cv_getaddrinfo = no])
AM_CONDITIONAL([IPV6_noGETNAMEINFO], [test $cyrus_cv_getnameinfo = no])
IPv6_CHECK_SS_FAMILY()
IPv6_CHECK_SA_LEN()
dnl this is to check for time things
AC_CHECK_HEADERS(sys/time.h)
AC_HEADER_TIME
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
AC_CHECK_FUNCS(timegm)
AC_SUBST(CPPFLAGS)
AC_SUBST(LOCALDEFS)
AC_FUNC_VPRINTF
CYR_INTTYPE([time_t], [#include <time.h>])
AC_DEFINE_UNQUOTED([TIME_T_FMT], ["$cyr_cv_format_time_t"],
[printf formatter for time_t])
AC_DEFINE_UNQUOTED([strtotimet(a,b,c)], [$cyr_cv_parse_time_t(a,b,c)],
[strtol-like parse function for time_t])
CYR_INTTYPE([size_t], [#include <stdlib.h>])
AC_DEFINE_UNQUOTED([SIZE_T_FMT], ["$cyr_cv_format_size_t"],
[printf formatter for size_t])
AC_DEFINE_UNQUOTED([strtosizet(a,b,c)], [$cyr_cv_parse_size_t(a,b,c)],
[strtol-like parse function for size_t])
CYR_INTTYPE([off_t], [#include <sys/types.h>])
AC_DEFINE_UNQUOTED([OFF_T_FMT], ["$cyr_cv_format_off_t"],
[printf formatter for off_t])
AC_DEFINE_UNQUOTED([strtoofft(a,b,c)], [$cyr_cv_parse_off_t(a,b,c)],
[strtol-like parse function for off_t])
CYR_INTTYPE([rlim_t], [#include <sys/resource.h>])
AC_DEFINE_UNQUOTED([RLIM_T_FMT], ["$cyr_cv_format_rlim_t"],
[printf formatter for rlim_t])
AC_DEFINE_UNQUOTED([strtorlimt(a,b,c)], [$cyr_cv_parse_rlim_t(a,b,c)],
[strtol-like parse function for rlim_t])
dnl function for doing each of the database backends
dnl parameters: backend name, variable to set, withval
dnl SQL DB Detection
HAVE_CYRUSDB_SQL=0
dnl MySQL Detection
dnl legacy options --with-mysql-libdir and --with-mysql-incdir
CYRUS_MYSQL_OPTS
if test "$with_mysql_lib" != none ; then
AC_MSG_NOTICE([Legacy option --with-mysql-libdir=DIR detected.]
[You may wish to change to --with-mysql which works now.])
withval="$with_mysql_lib/.."
else
withval="no"
fi
AC_MSG_CHECKING([whether to use MySQL])
AC_ARG_WITH(mysql,
[AS_HELP_STRING([--with-mysql=DIR], [use MySQL (in DIR) [no]])])
with_mysql=$withval
case "$with_mysql" in
no)
# Explicitly disable MySQL
;;
yes)
# Find mysql_config in $PATH
AC_PATH_PROG(mysql_config, mysql_config, [])
AS_IF([test -z "$mysql_config"],
AC_MSG_ERROR([The mysql_config program was not found]))
;;
*)
# Find mysql_config in the specified directory
mysql_config="$with_mysql/bin/mysql_config"
if test ! -x "$mysql_config" ; then
AC_MSG_ERROR([The mysql_config program was not found]
[in $with_mysql/bin, disabling MySQL support])
with_mysql="no"
fi
;;
esac
if test "$with_mysql" != "no"; then
MYSQL_LIBADD=`$mysql_config --libs`
MYSQL_INCADD=`$mysql_config --cflags`
HAVE_CYRUSDB_SQL=1
LIBS="${LIBS} ${MYSQL_LIBADD}"
CPPFLAGS="${MYSQL_INCADD} ${CPPFLAGS}"
AC_DEFINE(HAVE_MYSQL,[],[Build in MySQL support?])
AC_SUBST(MYSQL_LIBADD)
fi
AC_MSG_RESULT($with_mysql)
dnl End MySQL Detection
dnl PgSQL Detection
AC_ARG_WITH(pgsql,
[AS_HELP_STRING([--with-pgsql=DIR], [use PostgreSQL (in DIR) [no]])],
with_pgsql=$withval, with_pgsql="no")
case "$with_pgsql" in
no)
use_pgsql="no"
;;
yes)
use_pgsql="yes"
with_pgsql_lib=none
with_pgsql_inc=none
;;
*)
use_pgsql="yes"
with_pgsql_lib="$with_pgsql/lib"
with_pgsql_inc="$with_pgsql/include"
;;
esac
if test "$use_pgsql" != "no"; then
CYRUS_PGSQL_CHK()
if test "$pgsqllib" = "no"; then
AC_MSG_ERROR([PgSQL was not found. You may need to supply the
--with-pgsql-libdir or --with-pgsql-incdir configure options.])
else
HAVE_CYRUSDB_SQL=1
fi
if test "$with_pgsql_lib" != "none"; then
CMU_ADD_LIBPATH($with_pgsql_lib)
fi
LIBS="${LIBS} ${PGSQL_LIBADD}"
CPPFLAGS="${PGSQL_INCADD} ${CPPFLAGS}"
AC_DEFINE(HAVE_PGSQL,[],[Build in PgSQL support?])
AC_SUBST(PGSQL_LIBADD)
fi
dnl End PgSQL Detection
dnl SQLite Detection
dnl XXX this is a bit gross... the same option for specifying WHERE sqlite is
dnl (--with-sqlite) is also the option for enabling it as a cyrusdb backend,
dnl which means if your sqlite is in a non-default location and you need httpd
dnl or object storage etc, you're suddenly also supporting it as a cyrusdb
dnl backend, possibly unexpectedly.
AC_ARG_WITH(sqlite,
[AS_HELP_STRING([--with-sqlite=DIR], [use SQLite (in DIR) [no]])],
with_sqlite=$withval, with_sqlite=check)
case "$with_sqlite" in
no)
use_sqlite="no"
;;
yes)
use_sqlite="yes"
with_sqlite_lib=none
with_sqlite_inc=none
;;
check)
use_sqlite="check"
with_sqlite_lib=none
with_sqlite_inc=none
;;
*)
use_sqlite="yes"
with_sqlite_lib="$with_sqlite/lib"
with_sqlite_inc="$with_sqlite/include"
;;
esac
if test "$use_sqlite" != "no"; then
CYRUS_SQLITE_CHK()
if test "$use_sqlite" = "yes"; then
dnl sqlite specifically requested: not found is a failure
if test "$sqlitelib" = "no"; then
AC_MSG_ERROR([Sqlite was not found. You may need to supply the
--with-sqlite-libdir or --with-sqlite-incdir configure options.])
else
HAVE_CYRUSDB_SQL=1
HAVE_SQLITE=1
fi
else
dnl sqlite not specifically requested: not found isn't a failure (yet)
use_sqlite="no"
if test "$sqlitelib" = "no"; then
AC_MSG_NOTICE([sqlite was not found, will try to build without it])
else
HAVE_SQLITE=1
fi
fi
dnl other modules might yet need to link against sqlite.
dnl we will update LIBS/CPPFLAGS etc later, once their checks have run.
dnl for now:
dnl * $use_sqlite = "yes" if we definitely need it
dnl * $HAVE_SQLITE = 1 if we have it available
fi
dnl End SQLite Detection
if test "x$HAVE_CYRUSDB_SQL" = x1; then
AC_DEFINE([USE_CYRUSDB_SQL],[],[Build in cyrusdb_sql support?])
fi
AM_CONDITIONAL([USE_CYRUSDB_SQL], [test $HAVE_CYRUSDB_SQL = 1])
dnl End SQL DB Detection
dnl
dnl Object Store support
dnl
dnl Caringo object store backend
AC_MSG_CHECKING([whether to use Caringo])
AC_ARG_WITH(caringo,
[AS_HELP_STRING([--with-caringo], [use Caringo ("yes" or "no")])],,with_caringo="no")
case "$with_caringo" in
yes)
LDFLAGS="$LDFLAGS -lCastorSDK"
;;
esac
AC_MSG_RESULT([$with_caringo])
dnl OpenIO object store backend
dnl deps: metautils gridclient oiosds curl
AC_MSG_CHECKING([whether to use OpenIO])
AC_ARG_WITH(openio,
[AS_HELP_STRING([--with-openio=yes|no], [use OpenIO ("yes" or "no")])],
with_openio=$withval, with_openio="no")
case "$with_openio" in
no)
use_openio="no"
;;
yes)
use_openio="yes"
with_openio_lib=none
with_openio_inc=none
AC_DEFINE([WITH_OPENIO],[1],[Enable support for OpenIO object storage.])
;;
*)
use_openio="yes"
with_openio_lib="$with_openio/lib64"
with_openio_inc="$with_openio/include"
AC_DEFINE([WITH_OPENIO],[1],[Enable support for OpenIO object storage.])
;;
esac
AC_ARG_WITH(openio-libdir,
[AS_HELP_STRING([--with-openio-libdir=DIR], [OpenIO lib files are in DIR])],
with_openio_lib=$withval,
[ test "${with_openio_lib+set}" = set || with_openio_lib=none])
AC_ARG_WITH(openio-incdir,
[AS_HELP_STRING([--with-openio-incdir=DIR], [OpenIO include files are in DIR])],
with_openio_inc=$withval,
[ test "${with_openio_inc+set}" = set || with_openio_inc=none ])
if test "$use_openio" = "yes"; then
if test ! -d "$with_openio_lib"; then
AC_MSG_ERROR([OpenIO library directory '$with_openio_lib' does not exist.])
fi
if test ! -d "$with_openio_inc"; then
AC_MSG_ERROR([OpenIO include directory '$with_openio_inc' does not exist.])
fi
LDFLAGS="$LDFLAGS -L$with_openio_lib"
CFLAGS="$CFLAGS -I$with_openio_inc"
openio_headers="oio_sds.h core/oiourl.h"
for h in $openio_headers; do
AC_CHECK_HEADER($h,[],[
AC_MSG_ERROR([Header $h is missing.])
])
done
AC_CHECK_LIB([oiosds],[oio_error_free],[],[AC_MSG_ERROR([Library oiosds not found.])])
AC_CHECK_LIB([oiocore],[oio_url_empty],[],[AC_MSG_ERROR([Library oiocore not found.])])
AC_CHECK_LIB([curl],[curl_version],[],[AC_MSG_ERROR([Library curl not found.])])
AC_CHECK_LIB([json-c],[json_tokener_parse_ex],[],[AC_MSG_ERROR([Library json-c not found.])])
LDFLAGS="$LDFLAGS -L$with_openio_lib -loiosds -loiocore -lcurl -ljson-c"
fi
AC_MSG_RESULT([$use_openio])
dnl enable object store
AC_MSG_CHECKING([whether to enable object store])
AC_ARG_ENABLE(objectstore,
[AS_HELP_STRING([--enable-objectstore],
[enable IMAP objectstore support. Use --with-caringo or --with-openio to choose a backend])],
[],
[enable_objectstore=no])
with_objectstore_dummy=no
if test "x$enable_objectstore" != xno ; then
dnl we need sqlite for the objectstore database
if test "x$HAVE_SQLITE" != x1; then
AC_MSG_ERROR([Need sqlite3 for objectstore])
else
use_sqlite="yes"
fi
dnl arbitrarily prioritise OpenIO over Caringo if both are requested
AS_IF(
[test "x$with_openio" != xno -a "x$with_caringo" != xno],
[AC_MSG_WARN([both --with-openio and --with-caringo requested: using OpenIO])
enable_objectstore="openio"
with_caringo = "no"],
[test "x$with_openio" != xno],
[enable_objectstore="openio"],
[test "x$with_caringo" != xno],
[enable_objectstore="caringo"],
[enable_objectstore="dummy"
with_objectstore_dummy="yes"])
AC_DEFINE([ENABLE_OBJECTSTORE],[],[Build with Object Store support])
fi
AC_MSG_RESULT([$enable_objectstore])
AM_CONDITIONAL([OBJECTSTORE], [test "x$enable_objectstore" != xno])
AM_CONDITIONAL([WITH_CARINGO], [test "x$with_caringo" != xno])
AM_CONDITIONAL([WITH_OPENIO], [test "x$use_openio" != xno])
AM_CONDITIONAL([WITH_OBJSTR_DUMMY], [test "x$with_objectstore_dummy" != xno])
dnl
dnl Search engines - SQUAT
dnl
AC_ARG_ENABLE(squat,
[AS_HELP_STRING([--disable-squat], [disable Squat support])],,[enable_squat="yes";])
if test "$enable_squat" != "no"; then
AC_DEFINE(USE_SQUAT,[],[Build in Squat support?])
fi
AM_CONDITIONAL([USE_SQUAT], [test "${enable_squat}" != "no"])
dnl
dnl Search engines - Xapian
dnl
xapian_cjk_tokens=none
AC_ARG_ENABLE(xapian,
[AS_HELP_STRING([--enable-xapian], [enable Xapian support])],,
[enable_xapian=no])
if test "x$enable_xapian" != xno ; then
AC_ARG_VAR(RSYNC_BIN, [Location of rsync])
AC_PATH_PROG(RSYNC_BIN, [rsync], [])
AS_IF([test -z "$RSYNC_BIN"],[
AC_MSG_ERROR([Can't find the 'rsync' binary])
])
AC_DEFINE_UNQUOTED([RSYNC_BIN], ["$RSYNC_BIN"], [Path to 'rsync' binary])
AC_ARG_VAR(XAPIAN_CONFIG, [Location of xapian-config])
AC_PATH_PROGS(XAPIAN_CONFIG, [xapian-config-1.5 xapian-config], [])
if test -z "$XAPIAN_CONFIG"; then
AC_MSG_ERROR([Can't find Xapian library])
else
AC_MSG_CHECKING([$XAPIAN_CONFIG works])
dnl check for --ltlibs but not --libs as xapian-config --libs will
dnl fail if xapian isn't installed...
dnl run with exec to avoid leaking output on "real" bourne shells
if (exec >&5 2>&5 ; $XAPIAN_CONFIG --ltlibs --cxxflags; exit $?) then
AC_MSG_RESULT(yes)
else
AC_MSG_ERROR([\`$XAPIAN_CONFIG --ltlibs --cxxflags' doesn't work, aborting])
fi
dnl Xapian requires CXX11
AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
dnl If AC_PROG_LIBTOOL (or the deprecated older version AM_PROG_LIBTOOL)
dnl has already been expanded, enable libtool support now, otherwise add
dnl hooks to the end of AC_PROG_LIBTOOL and AM_PROG_LIBTOOL to enable it
dnl if either is expanded later.
XAPIAN_VERSION="`$XAPIAN_CONFIG --version|sed 's/.* //'`"
AS_VERSION_COMPARE([$XAPIAN_VERSION], [1.4], AC_MSG_ERROR([need at least Xapian 1.4]), [], [])
XAPIAN_CXXFLAGS="`$XAPIAN_CONFIG --cxxflags`"
AC_PROVIDE_IFELSE([AC_PROG_LIBTOOL],
[XAPIAN_LIBS="`$XAPIAN_CONFIG --ltlibs`"],
[AC_PROVIDE_IFELSE([AM_PROG_LIBTOOL],
[XAPIAN_LIBS="`$XAPIAN_CONFIG --ltlibs`"],
dnl Pass magic option so xapian-config knows we called it (so it
dnl can choose a more appropriate error message if asked to link
dnl with an uninstalled libxapian). Also pass ac_top_srcdir
dnl so the error message can correctly say "configure.ac" or
dnl "configure.in" according to which is in use.
[XAPIAN_LIBS="`ac_top_srcdir=\"$ac_top_srcdir\" $XAPIAN_CONFIG --from-xo-lib-xapian --libs`"
define([AC_PROG_LIBTOOL], defn([AC_PROG_LIBTOOL])
[XAPIAN_LIBS="`$XAPIAN_CONFIG --ltlibs`"])
define([AM_PROG_LIBTOOL], defn([AM_PROG_LIBTOOL])
[XAPIAN_LIBS="`$XAPIAN_CONFIG --ltlibs`"])])])
AC_DEFINE(USE_XAPIAN,[],[Build in Xapian support?])
dnl check if Xapian supports Cyruslibs extensions
AC_LANG_PUSH([C++])
ORIG_LDFLAGS=$LDFLAGS
ORIG_CXXFLAGS=$CXXFLAGS
LDFLAGS="$LDFLAGS $XAPIAN_LIBS"
CXXFLAGS="$CXXFLAGS $XAPIAN_CXXFLAGS"
AC_MSG_CHECKING([for Xapian cjk word tokenization])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <xapian.h>]],
[[unsigned cjk_flags = Xapian::TermGenerator::FLAG_CJK_WORDS | Xapian::QueryParser::FLAG_CJK_WORDS | Xapian::MSet::SNIPPET_CJK_WORDS; (void) cjk_flags; ]])],
[xapian_cjkwords="yes"],
[xapian_cjkwords="no"])
AC_MSG_RESULT($xapian_cjkwords)
if test $xapian_cjkwords = yes; then
AC_DEFINE([USE_XAPIAN_CJK_WORDS], [], [Use Xapian CJK word tokenizer, rather than n-grams?])
xapian_cjk_tokens=words
else
AC_MSG_NOTICE([Your Xapian does not support CJK word tokenization. CJK ngram tokenization will be used instead.])
xapian_cjk_tokens=ngrams
fi
LDFLAGS=$ORIG_LDFLAGS
CXXFLAGS=$ORIG_CXXFLAGS
AC_LANG_POP([C++])
fi
AC_SUBST(XAPIAN_CXXFLAGS)
AC_SUBST(XAPIAN_LIBS)
AC_SUBST(XAPIAN_VERSION)
fi
AM_CONDITIONAL([USE_XAPIAN], [test "${enable_xapian}" != "no"])
AC_DEFINE_UNQUOTED([XAPIAN_CJK_TOKENS], ["$xapian_cjk_tokens"], [Which Xapian CJK tokenzation are we using?])
AM_CONDITIONAL([SQUATTER],
[test "${enable_squat}" != "no" -o "${enable_xapian}" != "no" ])
AC_ARG_ENABLE(sieve,
[AS_HELP_STRING([--disable-sieve], [disable Sieve support])],,[enable_sieve="yes";])
AC_ARG_ENABLE(pcre,
[AS_HELP_STRING([--disable-pcre], [disable PCRE library])],[cyrus_cv_pcre_utf8="$enableval"])
if test "$enable_sieve" != "no"; then
AC_DEFINE(USE_SIEVE,[],[Build in Sieve support?])
dnl Sieve configure stuff
AC_PROG_YACC
AM_PROG_LEX
if test -z "$ac_cv_prog_YACC"; then
AC_MSG_ERROR([Sieve requires bison/byacc/yacc, but none is installed])
fi
if test -z "$ac_cv_prog_LEX"; then
AC_MSG_ERROR([Sieve requires flex/lex, but none is installed])
fi
fi
AM_CONDITIONAL([SIEVE], [test "${enable_sieve}" != "no"])
if test "$enable_pcre" != "no"; then
AC_CHECK_HEADER(pcreposix.h)
if test "$ac_cv_header_pcreposix_h" = "yes"; then
AC_MSG_CHECKING(for utf8 enabled pcre)
AC_CACHE_VAL(cyrus_cv_pcre_utf8, AC_TRY_CPP([#include <pcreposix.h>
#ifndef REG_UTF8
#include </nonexistent>
#endif],cyrus_cv_pcre_utf8=yes,cyrus_cv_pcre_utf8=no))
AC_MSG_RESULT($cyrus_cv_pcre_utf8)
else
cyrus_cv_pcre_utf8="no"
fi
fi
LIB_REGEX=
if test "$cyrus_cv_pcre_utf8" = "yes"; then
LIB_REGEX="-lpcre -lpcreposix";
AC_DEFINE(ENABLE_REGEX, [], [Do we have a regex library?])
AC_DEFINE(HAVE_PCREPOSIX_H, [], [Do we have usable pcre library?])
else
AC_CHECK_HEADERS(rxposix.h)
if test "$ac_cv_header_rxposix_h" = "yes"; then
LIB_REGEX="-lrx"
AC_DEFINE(ENABLE_REGEX, [], [Do we have a regex library?])
else
AC_SEARCH_LIBS(regcomp, regex,
AC_DEFINE(ENABLE_REGEX, [], [Do we have a regex library?]), [])
fi
fi
AC_SUBST(LIB_REGEX)
LIBS="$LIBS $LIB_REGEX"
dnl
dnl see if we're compiling with SRS
dnl
AC_MSG_CHECKING([whether to use SRS])
AC_ARG_ENABLE(srs,
[AS_HELP_STRING([--enable-srs], [enable Sender Rewriting Scheme support])],,
[enable_srs=no])
AC_MSG_RESULT($enable_srs)
AM_CONDITIONAL([USE_SRS], [test "${enable_srs}" != "no"])
if test "x$enable_srs" != xno; then
AC_CHECK_HEADER([srs2.h],,
[AC_MSG_ERROR([cannot find SRS headers])])
AC_CHECK_LIB(srs2, srs_forward,,
[AC_MSG_ERROR([cannot find SRS lib])])
LIBS="$LIBS -lsrs2"
AC_DEFINE(USE_SRS,[],[Build with srs functionality])
else
AC_MSG_NOTICE([Outgoing messages will not support the Sender Rewriting Scheme. Consider installing libsrs2 and --enable-srs])
fi
dnl look for an option to disable sign-comparison warnings (needed for
dnl flex-generated sieve sources when building with -Werror)
saved_CFLAGS="$CFLAGS"
NOWARN_SIGN_COMPARE="-Wno-sign-compare"
CFLAGS="$NOWARN_SIGN_COMPARE"
AC_MSG_CHECKING([whether the C compiler supports -Wno-sign-compare])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [])],
[AC_MSG_RESULT([yes])],
[NOWARN_SIGN_COMPARE=]
[AC_MSG_RESULT([no])]
)
CFLAGS="$saved_CFLAGS"
AC_SUBST([NOWARN_SIGN_COMPARE])
dnl for et routines
AC_FUNC_CHECK(strerror,AC_DEFINE(HAS_STRERROR,[],[Do we have strerror()?]),
AC_DEFINE(NEED_SYS_ERRLIST,[],[Do we have a sys_errlist?]))
dnl for master fd limits
AC_CHECK_HEADERS(sys/resource.h)
AC_CHECK_FUNCS(setrlimit)
AC_CHECK_FUNCS(getrlimit)
dnl for detaching terminal
AC_CHECK_FUNCS(daemon setsid)
dnl for turning off sockets
AC_CHECK_FUNCS(shutdown)
AC_EGREP_HEADER(socklen_t, sys/socket.h, AC_DEFINE(HAVE_SOCKLEN_T,[],[Do we have a socklen_t?]))
AC_EGREP_HEADER(sockaddr_storage, sys/socket.h,
AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE,[],[Do we have a sockaddr_storage?]))
AC_EGREP_HEADER(rlim_t, sys/resource.h, AC_DEFINE(HAVE_RLIM_T,[],[Do we have an rlim_t?]))
dnl Bunch of setproctitle stuff
spt_type=""
AC_CHECK_FUNC(setproctitle,spt_type=SPT_BUILTIN)
if test "$spt_type" = ""; then
dnl BSD/OS and FreeBSD put it in -lutil
AC_CHECK_LIB(util,setproctitle,spt_type=SPT_BUILTIN
LIBS="${LIBS} -lutil")
fi
if test "$spt_type" = ""; then
AC_CHECK_HEADER(sys/pstat.h,spt_type=SPT_PSTAT)
fi
if test "$spt_type" = ""; then
AC_CHECK_HEADER(sys/sysnews.h,spt_type=SPT_SYSMIPS)
fi
if test "$spt_type" = ""; then
AC_MSG_CHECKING(for PS_STRINGS)
AC_CACHE_VAL(cyrus_cv_sys_psstrings, AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <machine/vmparam.h>
#include <sys/exec.h>
void *p = PS_STRINGS;
])],cyrus_cv_sys_psstrings=yes,cyrus_cv_sys_psstrings=no))
if test $cyrus_cv_sys_psstrings = yes; then
spt_type=SPT_PSSTRINGS
fi
AC_MSG_RESULT($cyrus_cv_sys_psstrings)
fi
if test "$spt_type" = ""; then
AC_MSG_CHECKING(for SCO)
AC_CACHE_VAL(cyrus_cv_sys_sco, AC_TRY_CPP([
#ifndef _SCO_unix_
#include </nonexistent>
#endif],cyrus_cv_sys_sco=yes,cyrus_cv_sys_sco=no))
if test $cyrus_cv_sys_sco = yes; then
spt_type=SPT_SCO
fi
AC_MSG_RESULT($cyrus_cv_sys_sco)
fi
if test "$spt_type" = ""; then
AC_MSG_CHECKING(for setproctitle usability)
AC_CACHE_VAL(cyrus_cv_sys_setproctitle, AC_TRY_CPP([
#if defined(DGUX) || defined(_SEQUENT_) || defined(apollo)
#include </nonexistent>
#endif],cyrus_cv_sys_setproctitle=yes,cyrus_cv_sys_setproctitle=no))
if test $cyrus_cv_sys_setproctitle = no; then
spt_type=SPT_NONE
fi
AC_MSG_RESULT($cyrus_cv_sys_setproctitle)
fi
if test "$spt_type" != ""; then
AC_DEFINE_UNQUOTED(SPT_TYPE,$spt_type,[Do we already have setproctitle?])
fi
AC_MSG_CHECKING(nonblocking method)
AC_CACHE_VAL(cyrus_cv_sys_nonblock,AC_TRY_LINK([#include <sys/types.h>
#include <sys/file.h>
#include <fcntl.h>
#ifndef FNDELAY
#define FNDELAY O_NDELAY
#endif],[fcntl(0, F_GETFL, 0)&FNDELAY],
cyrus_cv_sys_nonblock=fcntl,cyrus_cv_sys_nonblock=ioctl))
AM_CONDITIONAL([NONBLOCK_FCNTL], [test "$cyrus_cv_sys_nonblock" = "fcntl"])
AC_MSG_RESULT($cyrus_cv_sys_nonblock)
AC_MSG_CHECKING(timezone GMT offset method)
AC_CACHE_VAL(cyrus_cv_struct_sys_gmtoff,AC_TRY_COMPILE([
#include <time.h>],[struct tm tm;
tm.tm_gmtoff = 0;
],cyrus_cv_struct_sys_gmtoff=tm,cyrus_cv_struct_sys_gmtoff=gmtime))
AM_CONDITIONAL([GMTOFF_TM], [test "$cyrus_cv_struct_sys_gmtoff" = "tm"])
AC_MSG_RESULT($cyrus_cv_struct_sys_gmtoff)
AC_MSG_CHECKING(for shared mmap)
AC_CACHE_VAL(cyrus_cv_func_mmap_shared,AC_TRY_RUN([
#include <fcntl.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <unistd.h>
int main() {
char *base;
int mmapflags = MAP_SHARED;
int fd = open("conftestmmap", O_RDWR|O_CREAT|O_TRUNC, 0666);
if (fd == -1) return 1;
if (write(fd, "test", 4) != 4) return 1;
fsync(fd);
#ifdef MAP_FILE
mmapflags |= MAP_FILE;
#endif
#ifdef MAP_VARIABLE
mmapflags |= MAP_VARIABLE;
#endif
base = mmap((caddr_t)0, 100, PROT_READ, mmapflags, fd, 0L);
if (base == (caddr_t)-1) return 1;
if (memcmp(base, "test", 4) != 0) return 1;
if (write(fd, "test", 4) != 4) return 1;
fsync(fd);
if (memcmp(base+4, "test", 4) != 0) return 1;
return 0;
}
],cyrus_cv_func_mmap_shared=yes,cyrus_cv_func_mmap_shared=no,
cyrus_cv_func_mmap_shared=no))
AC_MSG_RESULT($cyrus_cv_func_mmap_shared)
if test $cyrus_cv_func_mmap_shared = yes; then
found_map="shared"
else
AC_MSG_CHECKING(for stupid shared mmap)
AC_CACHE_VAL(cyrus_cv_func_mmap_stupidshared,AC_TRY_RUN([
#include <fcntl.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <unistd.h>
int main() {
char *base;
int fd = open("conftestmmap", O_RDWR|O_CREAT|O_TRUNC, 0666);
int mmapflags = MAP_SHARED;
if (fd == -1) return 1;
if (write(fd, "test", 4) != 4) return 1;
fsync(fd);
#ifdef MAP_FILE
mmapflags |= MAP_FILE;
#endif
#ifdef MAP_VARIABLE
mmapflags |= MAP_VARIABLE;
#endif
base = mmap((caddr_t)0, 4, PROT_READ, mmapflags, fd, 0L);
if (base == (caddr_t)-1) return 1;
if (memcmp(base, "test", 4) != 0) return 1;
lseek(fd, 0L, 0);
if (write(fd, "xyzz", 4) != 4) return 1;
fsync(fd);
if (memcmp(base, "xyzz", 4) != 0) return 1;
return 0;
}
],cyrus_cv_func_mmap_stupidshared=yes,cyrus_cv_func_mmap_stupidshared=no,
cyrus_cv_func_mmap_stupidshared=no))
AC_MSG_RESULT($cyrus_cv_func_mmap_stupidshared)
if test $cyrus_cv_func_mmap_stupidshared = yes; then
found_map="stupidshared"
else
AC_MSG_WARN([*** This system does not have a working mmap()])
AC_MSG_WARN(*** Expect a considerable performance penalty)
found_map=nommap
fi
fi
AC_ARG_WITH(mmap,
[AS_HELP_STRING([--with-mmap=TYPE], [force shared/stupidshared/nommap - JUST FOR TESTING])],
WITH_MAP="$withval",WITH_MAP="$found_map")
AM_CONDITIONAL([MAP_SHARED], [test "$WITH_MAP" = "shared"])
AM_CONDITIONAL([MAP_STUPIDSHARED], [test "$WITH_MAP" = "stupidshared"])
AC_ARG_WITH(lock,
[AS_HELP_STRING([--with-lock=METHOD], [force use of METHOD for locking (flock or fcntl)])],
WITH_LOCK="$withval", [
AC_CHECK_FUNC(fcntl,WITH_LOCK="fcntl",[
AC_CHECK_FUNC(flock,WITH_LOCK="flock",[
AC_MSG_ERROR(unable to detect locking method)
])
])
])
AM_CONDITIONAL([LOCK_FCNTL], [test $WITH_LOCK = "fcntl"])
dnl check for fdatasync (used by cyrusdb_skiplist)
AC_SEARCH_LIBS([fdatasync], [rt], [
AC_DEFINE(HAVE_FDATASYNC,[],[Do we have fdatasync()?])
], [])
dnl check for clock_gettime
AC_SEARCH_LIBS([clock_gettime], [rt], [], [
AC_MSG_ERROR([unable to find the clock_gettime() function])
])
dnl check for libuuid (used when generating mailbox uniqueids)
LIB_UUID=
AC_CHECK_LIB(uuid, uuid_generate,[
LIB_UUID="-luuid"
AC_DEFINE(HAVE_LIBUUID,[],[Do we have the uuid library])
])
dnl for AFS.
cant_find_sigvec=no
AC_CACHE_VAL(cyrus_cv_sigveclib,[
dnl bsd classic flavor
AC_CHECK_FUNC(sigvec, [
cyrus_cv_sigveclib=""
], [
dnl hp flavor
AC_CHECK_LIB(BSD, sigvec, cyrus_cv_sigveclib="-lBSD", [
dnl not hp flavor
SAVE_LDFLAGS="$LDFLAGS"
dnl solaris flavor
LDFLAGS="-L/usr/ucblib -R/usr/ucblib $LDFLAGS"
AC_CHECK_LIB(ucb, sigvec, [
dnl more solaris flavor
cyrus_cv_sigveclib="-lc -L/usr/ucblib -R/usr/ucblib -lucb"],
[ cant_find_sigvec=yes ])
LDFLAGS="$SAVE_LDFLAGS"])
])
])
AC_SUBST(cyrus_cv_sigveclib)
# ok, we still look for this stuff because of checking groups, but
# all authentication goes through SASL
AC_ARG_ENABLE([afs],
[AS_HELP_STRING([--enable-afs], [Enable AFS with ptloader])])
AC_ARG_WITH(afs-libdir,
[AS_HELP_STRING([--with-afs-libdir=DIR], [use AFS libraries from DIR [/usr/lib]])],
afs_libdir="${withval}", afs_libdir="/usr/lib")
AC_ARG_WITH(afs-incdir,
[AS_HELP_STRING([--with-afs-incdir=DIR], [use AFS headers from DIR [/usr/include]])],
afs_incdir="${withval}", afs_incdir="/usr/include")
AC_ARG_WITH(ldap,
[AS_HELP_STRING([--with-ldap=DIR], [use LDAP (in DIR) (experimental) [/usr/local]])],
with_ldap="${withval}", with_ldap="no")
dnl select mode of afspts
AC_ARG_ENABLE(krb5afspts,
[AS_HELP_STRING([--enable-krb5afspts], [compile afskrb PTS module with krb5 support])])
if test "x$enable_afs" = "xyes"; then
# krb5afspts is only valid if AFS is enabled, so check inside here.
AS_IF([test "x$enable_krb5afspts" = "xyes"], [SASL_SET_GSSAPI_LIBS
AC_DEFINE(AFSPTS_USE_KRB5,[],[Should the AFS PTS plugin use krb5?])
])
SAVE_CFLAGS="$CFLAGS"