forked from groonga/groonga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
2033 lines (1866 loc) · 59.7 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
AC_PREREQ(2.59)
m4_define([groonga_version], m4_include(base_version))
AC_INIT([groonga], groonga_version, [groonga@razil.jp])
AC_CONFIG_MACRO_DIR([m4])
AM_CONFIG_HEADER(config.h)
GRN_VERSION_MAJOR=`echo groonga_version | cut -d. -f1`
AC_SUBST(GRN_VERSION_MAJOR)
GRN_VERSION_MINOR=`echo groonga_version | cut -d. -f2`
AC_SUBST(GRN_VERSION_MINOR)
GRN_VERSION_MICRO=`echo groonga_version | cut -d. -f3`
AC_SUBST(GRN_VERSION_MICRO)
GRN_VERSION_RC=`echo groonga_version | sed -e 's/\./,/g'`
AC_SUBST(GRN_VERSION_RC)
AM_INIT_AUTOMAKE([foreign tar-pax subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
PACKAGE_LABEL=Groonga
AC_SUBST(PACKAGE_LABEL)
AC_DEFINE_UNQUOTED(PACKAGE_LABEL, ["$PACKAGE_LABEL"], [Label of package])
# for Autoconf 2.60 or earlier.
if test -z "${datarootdir}"; then
datarootdir="\${prefix}/share"
AC_SUBST(datarootdir)
fi
# for Autoconf 2.59 or earlier.
if test -z "${docdir}"; then
docdir="\${datarootdir}/doc/\${PACKAGE_TARNAME}"
AC_SUBST(docdir)
fi
AC_CANONICAL_HOST
AC_DEFINE_UNQUOTED(HOST_CPU, ["$host_cpu"], [host CPU])
AC_DEFINE_UNQUOTED(HOST_OS, ["$host_os"], [host OS])
AC_MSG_CHECKING([for native Win32])
case "$host_os" in
mingw*)
os_win32=yes
;;
*)
os_win32=no
;;
esac
AC_MSG_RESULT([$os_win32])
AC_MSG_CHECKING([for some Win32 platform])
case "$host_os" in
mingw*|cygwin*)
platform_win32=yes
;;
*)
platform_win32=no
;;
esac
AC_MSG_RESULT([$platform_win32])
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
AC_MSG_CHECKING([for NetBSD.])
case "$host_os" in
netbsd*)
netbsd=yes
;;
*)
netbsd=no
;;
esac
AC_MSG_RESULT([$netbsd])
AC_MSG_CHECKING([for Solaris.])
case "$host_os" in
solaris*)
solaris=yes
;;
*)
solaris=no
;;
esac
AC_MSG_RESULT([$solaris])
AC_C_BIGENDIAN
AC_PROG_CXX
m4_ifdef([AX_CXX_COMPILE_STDCXX_17],
[AX_CXX_COMPILE_STDCXX_17([ext], [optional])])
if test "$HAVE_CXX17" != "1"; then
m4_ifdef([AX_CXX_COMPILE_STDCXX_11],
[AX_CXX_COMPILE_STDCXX_11([ext], [optional])])
fi
AC_PROG_CC
m4_ifdef([AC_PROG_CC_C99],
[AC_PROG_CC_C99])
AM_PROG_CC_C_O
m4_ifdef([PKG_PROG_PKG_CONFIG],
[PKG_PROG_PKG_CONFIG([0.19])
m4_pattern_allow(PKG_CONFIG_LIBDIR)])
AC_MSG_CHECKING([for clang])
if test "$CC" = "clang"; then
CLANG=yes
else
CLANG=no
fi
AC_MSG_RESULT([$CLANG])
AC_DEFUN([CHECK_CFLAG], [
AC_MSG_CHECKING([if gcc supports $1])
old_CFLAGS=$CFLAGS
flag=`echo '$1' | sed -e 's,^-Wno-,-W,'`
CFLAGS="$CFLAGS $flag -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[check_cflag=yes],
[check_cflag=no])
CFLAGS="$old_CFLAGS"
if test "x$check_cflag" = "xyes"; then
CFLAGS="$CFLAGS $1"
fi
AC_MSG_RESULT([$check_cflag])
])
AC_DEFUN([CHECK_CXXFLAG], [
AC_MSG_CHECKING([if g++ supports $1])
old_CXXFLAGS=$CXXFLAGS
flag=`echo '$1' | sed -e 's,^-Wno-,-W,'`
CXXFLAGS="$CXXFLAGS $flag -Werror"
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[check_cxxflag=yes],
[check_cxxflag=no])
AC_LANG_POP([C++])
CXXFLAGS="$old_CXXFLAGS"
if test "x$check_cxxflag" = "xyes"; then
CXXFLAGS="$CXXFLAGS $1"
fi
AC_MSG_RESULT([$check_cxxflag])
])
AC_DEFUN([CHECK_BUILD_FLAG], [
CHECK_CFLAG([$1])
CHECK_CXXFLAG([$1])
])
AC_DEFUN([REMOVE_CXXFLAG], [
AC_MSG_CHECKING([whether g++ option $1 is needed to be removed])
if echo "$CXXFLAGS" | grep -q -- "$1"; then
CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's,$1,,'`
remove_cxxflag=yes
else
remove_cxxflag=no
fi
AC_MSG_RESULT([$remove_cxxflag])
])
TEST_CFLAGS=""
TEST_CXXFLAGS=""
NO_STRICT_ALIASING_CFLAGS=""
NO_FLOAT_EQUAL_CFLAGS=""
NO_BAD_FUNCTION_CAST_CFLAGS=""
if test "$GCC" = "yes"; then
CHECK_BUILD_FLAG([-Wall])
if test "x$check_cflag" = "xno"; then
CHECK_BUILD_FLAG([-W])
fi
CHECK_BUILD_FLAG([-Wno-unused-but-set-variable]) # FIXME: enable it.
CHECK_CFLAG([-Wno-pointer-sign])
CHECK_CFLAG([-Wno-declaration-after-statement])
CHECK_BUILD_FLAG([-Wformat])
CHECK_BUILD_FLAG([-Wno-format-truncation])
CHECK_BUILD_FLAG([-Wstrict-aliasing=2])
if test "x$check_cflag" = "xyes"; then
NO_STRICT_ALIASING_CFLAGS="-fno-strict-aliasing"
fi
CHECK_BUILD_FLAG([-Wdisabled-optimization])
CHECK_BUILD_FLAG([-Wfloat-equal])
if test "x$check_cflag" = "xyes"; then
NO_FLOAT_EQUAL_CFLAGS="-Wno-float-equal"
fi
CHECK_BUILD_FLAG([-Wpointer-arith])
CHECK_CFLAG([-Wbad-function-cast])
if test "x$check_cflag" = "xyes"; then
NO_BAD_FUNCTION_CAST_CFLAGS="-Wno-bad-function-cast"
fi
# if test "$CLANG" = "no"; then
# CHECK_BUILD_FLAG([-Wcast-align])
# fi
# CHECK_BUILD_FLAG([-Wredundant-decls])
# CHECK_BUILD_FLAG([-Wunsafe-loop-optimizations])
# CHECK_BUILD_FLAG([-Wunreachable-code])
# CHECK_BUILD_FLAG([-Wswitch-enum])
# CHECK_BUILD_FLAG([-Wshadow])
# CHECK_BUILD_FLAG([-Wconversion])
CHECK_BUILD_FLAG([-Wwrite-strings])
# CHECK_BUILD_FLAG([-Winline])
CHECK_BUILD_FLAG([-Wmissing-field-initializers])
if test "x$check_cflag" = "xyes"; then
NO_MISSING_FIELD_INITIALIZES_CFLAGS="-Wno-missing-field-initializers"
fi
CHECK_BUILD_FLAG([-Wsign-compare])
CHECK_CXXFLAG([-fexceptions])
CHECK_CXXFLAG([-fimplicit-templates])
fi
AC_SUBST(TEST_CFLAGS)
AC_SUBST(TEST_CXXFLAGS)
AC_SUBST(NO_STRICT_ALIASING_CFLAGS)
AC_SUBST(NO_FLOAT_EQUAL_CFLAGS)
AC_SUBST(NO_BAD_FUNCTION_CAST_CFLAGS)
AC_SUBST(NO_MISSING_FIELD_INITIALIZES_CFLAGS)
LT_INIT([dlopen win32-dll])
LT_LANG([Windows Resource])
LT_OUTPUT
LT_CURRENT=0
LT_REVISION=0
LT_AGE=0
LT_VERSION_INFO="\$(LT_CURRENT):\$(LT_REVISION):\$(LT_AGE)"
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
AC_SUBST(LT_VERSION_INFO)
GRN_DLL_FILENAME="libgroonga-\$(LT_CURRENT).dll"
AC_SUBST(GRN_DLL_FILENAME)
if test "$srcdir/version.sh"; then
. "$srcdir/version.sh"
AC_SUBST(GRN_VERSION)
fi
if test "$GCC" = "yes"; then
AC_DEFINE(_GNU_SOURCE, [1], [Define to 1 if you use GCC.])
fi
if test "$netbsd" = "yes"; then
AC_DEFINE(_NETBSD_SOURCE, [1], [Define to 1 if you are on NetBSD.])
fi
if test "$solaris" = "yes"; then
AC_DEFINE(_XPG4_2, [1],
[Define to 1 for msghdr.msg_control if you are on Solaris.])
AC_DEFINE(__EXTENSIONS__, [1],
[Define to 1 for singal.h with _XPG4_2 if you are on Solaris.])
fi
# For debug
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug],
[use debug flags (default=no)])],
[grn_debug="$enableval"],
[grn_debug="no"])
if test "x$grn_debug" != "xno"; then
grn_debug="yes"
if test "$CLANG" = "yes"; then
CFLAGS="$CFLAGS -O0 -g"
CXXFLAGS="$CXXFLAGS -O0 -g"
elif test "$GCC" = "yes"; then
CFLAGS="$CFLAGS -O0 -g3"
CXXFLAGS="$CXXFLAGS -O0 -g3"
fi
fi
AC_SUBST(grn_debug)
# For optimization
AC_ARG_ENABLE(optimize,
[AS_HELP_STRING([--enable-optimize],
[use optimize flags (default=no)])],
[grn_optimize="$enableval"],
[grn_optimize="no"])
if test "x$grn_optimize" != "xno"; then
grn_optimize="yes"
if test "$CLANG" = "yes"; then
CFLAGS="$CFLAGS -O3 -march=native"
CXXFLAGS="$CXXFLAGS -O3 -march=native"
elif test "$GCC" = "yes"; then
CFLAGS="$CFLAGS -O3 -march=native"
CXXFLAGS="$CXXFLAGS -O3 -march=native"
fi
fi
AC_ARG_ENABLE(windows-back-trace,
[AS_HELP_STRING([--enable-windows-back-trace],
[enable back trace on Windows (default=yes)])],
[grn_with_windows_back_trace="$enableval"],
[grn_with_windows_back_trace="yes"])
if test "x$grn_with_windows_back_trace" = "yes"; then
AC_DEFINE(GRN_WITH_WINDOWS_BACK_TRACE, [1], [enable back trace on Windows])
fi
AC_SEARCH_LIBS(log, m, [], [AC_MSG_ERROR("No libm found")])
AC_MSG_CHECKING([for fpclassify])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#include <math.h>],
[if (fpclassify(0.0)) {return 0;}]
)],
[
AC_DEFINE(HAVE_FPCLASSIFY, [1], [use fpclassify])
AC_MSG_RESULT(yes)
],
[
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#define _ISOC99_SOURCE
#include <math.h>],
[if (fpclassify(0.0)) {return 0;}]
)],
[
AC_DEFINE(_ISOC99_SOURCE, [1], [Define to 1 for fpclassify])
AC_DEFINE(HAVE_FPCLASSIFY, [1], [use fpclassify with _ISOC99_SOURCE])
AC_MSG_RESULT(yes)
],
[
AC_MSG_RESULT(no)
])
])
m4_include(build/ac_macros/check_headers.m4)
m4_include(build/ac_macros/check_functions.m4)
AC_SEARCH_LIBS(backtrace, execinfo,
[AC_DEFINE(HAVE_BACKTRACE, [1],
[Define to 1 if you have the `backtrace' function.])])
AC_SEARCH_LIBS(clock_gettime, rt,
[AC_DEFINE(HAVE_CLOCK_GETTIME, [1], [use clock_gettime])])
AC_SYS_LARGEFILE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_CHECK_SIZEOF(off_t)
AC_CHECK_MEMBERS(
[struct tm.tm_gmtoff],
,
,
[
#include <time.h>
])
# MAP_HUGETLB
AC_ARG_ENABLE(map-hugetlb,
[AS_HELP_STRING([--enable-map-hugetlb],
[use MAP_HUGETLB. [default=no]])],
,
[enable_map_hugetlb="no"])
if test "x$enable_map_hugetlb" != "xno"; then
AC_MSG_CHECKING([for MAP_HUGETLB])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[
#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif /* HAVE_SYS_MMAN_H */
],
[MAP_HUGETLB;]
)],
[
AC_DEFINE(USE_MAP_HUGETLB, [1], [use MAP_HUGETLB])
AC_MSG_RESULT(yes)
],
[
AC_MSG_RESULT(no)
AC_MSG_ERROR("MAP_HUGETLB isn't available.")
]
)
fi
# log path
AC_ARG_WITH(log_path,
[AS_HELP_STRING([--with-log-path=PATH],
[specify groonga log path.])],
grn_log_path="$withval",
grn_log_path="\$(localstatedir)/log/\$(PACKAGE_NAME)/\$(PACKAGE_NAME).log")
AC_SUBST(grn_log_path)
# default encoding
AC_ARG_WITH(default_encoding,
[AS_HELP_STRING([--with-default-encoding=ENCODING],
[specify groonga default encoding(euc_jp/sjis/utf8/latin1/koi8r/none)])],
GRN_DEFAULT_ENCODING="$withval",
GRN_DEFAULT_ENCODING="utf8")
AC_DEFINE_UNQUOTED(GRN_DEFAULT_ENCODING, "$GRN_DEFAULT_ENCODING", "specified default encoding")
# default match escalation threshold
AC_ARG_WITH(match_escalation_threshold,
[AS_HELP_STRING([--with-match-escalation-threshold=NUMBER],
[specify groonga default match escalation threshold])],
GRN_DEFAULT_MATCH_ESCALATION_THRESHOLD="$withval",
GRN_DEFAULT_MATCH_ESCALATION_THRESHOLD="0")
AC_DEFINE_UNQUOTED(GRN_DEFAULT_MATCH_ESCALATION_THRESHOLD, $GRN_DEFAULT_MATCH_ESCALATION_THRESHOLD, "specified match escalation threshold")
# default DB key management algorithm
AC_ARG_WITH(default_db_key,
[AS_HELP_STRING([--with-default-db-key=ALGORITHM],
[specify groonga default DB key (pat/dat/auto)])],
GRN_DEFAULT_DB_KEY="$withval",
GRN_DEFAULT_DB_KEY="auto")
AC_DEFINE_UNQUOTED(GRN_DEFAULT_DB_KEY, "$GRN_DEFAULT_DB_KEY",
"specified default DB key management algorithm")
# DANGER!!!: stack size
GRN_STACK_SIZE=1024
AC_ARG_WITH(stack_size,
[AS_HELP_STRING([--with-stack-size=SIZE],
[DANGER!!!
This option specifies stack size. (default=$GRN_STACK_SIZE)
Normally, you should not use this option.])],
GRN_STACK_SIZE="$withval")
AC_DEFINE_UNQUOTED(GRN_STACK_SIZE, [$GRN_STACK_SIZE], [stack size])
# lock timeout
GRN_LOCK_TIMEOUT=900000
AC_ARG_WITH(lock_timeout,
[AS_HELP_STRING([--with-lock-timeout=N],
[This option specifies how many times Groonga tries to acquire a lock.
Each try waits --with-lock-wait-time nanoseconds to acquire a lock.
It means that Groonga gives up after
(--with-lock-wait-time * --with-lock-timeout) nanoseconds.
(default=$GRN_LOCK_TIMEOUT)])],
GRN_LOCK_TIMEOUT="$withval")
AC_DEFINE_UNQUOTED(GRN_LOCK_TIMEOUT,
[$GRN_LOCK_TIMEOUT],
[lock timeout])
# lock wait time
GRN_LOCK_WAIT_TIME_NANOSECOND=1000000
AC_ARG_WITH(lock_wait_time,
[AS_HELP_STRING([--with-lock-wait-time=NANOSECONDS],
[This option specifies wait time in nanosecond to acquire a lock.
(default=$GRN_LOCK_WAIT_TIME_NANOSECOND)])],
GRN_LOCK_WAIT_TIME_NANOSECOND="$withval")
AC_DEFINE_UNQUOTED(GRN_LOCK_WAIT_TIME_NANOSECOND,
[$GRN_LOCK_WAIT_TIME_NANOSECOND],
[lock wait time in nanosecond])
if test "$os_win32" != "yes"; then
AC_CHECK_HEADERS(pthread.h)
AC_SEARCH_LIBS(pthread_create, pthread,
[],
[AC_MSG_ERROR("No libpthread found")])
fi
AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(socket, socket)
AC_SEARCH_LIBS(dlopen, dl)
# nfkc
AC_ARG_ENABLE(nfkc,
[AS_HELP_STRING([--enable-nfkc],
[use nfkc based utf8 normalization. [default=yes]])],,
[enable_nfkc="yes"])
if test "x$enable_nfkc" = "xyes"; then
AC_DEFINE(GRN_WITH_NFKC, [1], [compile with nfkc.c])
fi
# coverage
m4_ifdef([AC_CHECK_COVERAGE], [AC_CHECK_COVERAGE])
GENHTML_OPTIONS="--title 'groonga Code Coverage'"
# microyield
AC_MSG_CHECKING([whether enable uyield])
AC_ARG_ENABLE(uyield,
[AS_HELP_STRING([--enable-uyield],
[build for detecting race conditions. [default=no]])],
,
[enable_uyield="no"])
AC_MSG_RESULT($enable_uyield)
# exact-alloc-count
AC_MSG_CHECKING([whether enable exact-alloc-count])
AC_ARG_ENABLE(exact-alloc-count,
[AS_HELP_STRING([--enable-exact-alloc-count],
[atomic counting for memory alloc count. [default=yes]])],,
[enable_exact_alloc_count="yes"])
if test "x$enable_exact_alloc_count" != "xno"; then
AC_DEFINE(USE_EXACT_ALLOC_COUNT, [1], [alloc_count with atomic])
fi
AC_MSG_RESULT($enable_exact_alloc_count)
# memory debug
AC_MSG_CHECKING([whether debug memory management])
AC_ARG_ENABLE(memory-debug,
[AS_HELP_STRING([--enable-memory-debug],
[debug memory management. [default=no]])],
,
[enable_memory_debug="no"])
AC_MSG_RESULT([$enable_memory_debug])
if test "x$enable_memory_debug" = "xyes"; then
AC_DEFINE(USE_MEMORY_DEBUG, [1],
[Define to 1 if you enable debuging memory management])
fi
# epoll/kqueue/poll/select check
AC_CHECK_HEADER(sys/epoll.h, [
AC_CHECK_FUNC(epoll_create, [
AC_TRY_RUN([
#include <sys/epoll.h>
int main(int argc, char **argv) { return (epoll_create(16) < 0); }
],
[
have_epoll="yes"
AC_DEFINE(USE_EPOLL, [1], [use epoll])
]
)
])
])
if test "x$have_epoll" != "xyes"; then
AC_CHECK_HEADER(sys/event.h, [
AC_CHECK_FUNC(kevent, [
have_kqueue="yes"
AC_DEFINE(USE_KQUEUE, [1], [use kqueue])
])
])
if test "x$have_kqueue" != "xyes"; then
AC_CHECK_HEADER(poll.h, [
AC_CHECK_FUNC(poll, [
have_poll="yes"
AC_DEFINE(USE_POLL, [1], [use poll])
])
])
if test "x$have_poll" != "xyes"; then
if test "$os_win32" = "yes"; then
AC_CHECK_HEADER(winsock2.h, [have_select="yes"])
else
AC_CHECK_FUNC(select, [
have_select="yes"
AC_CHECK_HEADERS(sys/select.h)
])
fi
if test "x$have_select" = "xyes"; then
AC_DEFINE(USE_SELECT, [1], [use select])
else
AC_MSG_ERROR([epoll/kqueue/poll/select is missing.])
fi
fi
fi
fi
# check MSG_MORE defined
AC_MSG_CHECKING([whether MSG_MORE defined])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <sys/types.h>
#include <sys/socket.h>
int main(int argc, char **argv)
{
return MSG_MORE;
}
])],
[
AC_MSG_RESULT(yes)
AC_DEFINE(USE_MSG_MORE, [1], [use MSG_MORE])
],
[
AC_MSG_RESULT(no)
])
# check MSG_NOSIGNAL defined
AC_MSG_CHECKING([whether MSG_NOSIGNAL defined])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <sys/types.h>
#include <sys/socket.h>
int main(int argc, char **argv)
{
return MSG_NOSIGNAL;
}
])],
[
AC_MSG_RESULT(yes)
AC_DEFINE(USE_MSG_NOSIGNAL, [1], [use MSG_NOSIGNAL])
],
[
AC_MSG_RESULT(no)
])
# MinGW
if test "$os_win32" = "yes"; then
WINDOWS_LDFLAGS="-mwindows"
WINDOWS_LIBS="-ladvapi32 -lws2_32 -ldbghelp -lpsapi"
else
WINDOWS_LDFLAGS=
WINDOWS_LIBS=
fi
AC_SUBST(WINDOWS_LDFLAGS)
AC_SUBST(WINDOWS_LIBS)
# groonga binary path
GROONGA="${ac_pwd}/src/groonga"
AC_SUBST(GROONGA)
# groonga-benchmark binary path
GROONGA_BENCHMARK="${ac_pwd}/src/groonga-benchmark"
AC_SUBST(GROONGA_BENCHMARK)
# groonga-suggest-create-dataset binary path
GROONGA_SUGGEST_CREATE_DATASET="${ac_pwd}/src/suggest/groonga-suggest-create-dataset"
AC_SUBST(GROONGA_SUGGEST_CREATE_DATASET)
# groonga-mruby binary path
GROONGA_MRUBY="${ac_pwd}/src/groonga-mruby"
AC_SUBST(GROONGA_MRUBY)
# check Cutter with GLib support if available
REQUIRED_MINIMUM_CUTTER_VERSION=1.1.6
REQUIRED_MINIMUM_CPPCUTTER_VERSION=1.2.0
m4_ifdef([AC_CHECK_GCUTTER],
[AC_CHECK_GCUTTER(>= $REQUIRED_MINIMUM_CUTTER_VERSION)],
[cutter_use_cutter="no"])
m4_ifdef([AC_CHECK_CPPCUTTER],
[AC_CHECK_CPPCUTTER(>= $REQUIRED_MINIMUM_CPPCUTTER_VERSION)],
[cutter_use_cppcutter="no"])
AM_CONDITIONAL([WITH_CUTTER], [test "$cutter_use_cutter" = "yes"])
AM_CONDITIONAL([WITH_CPPCUTTER], [test "$cutter_use_cppcutter" = "yes"])
if test "$cutter_use_cutter" = "yes"; then
AC_DEFINE(GRN_WITH_CUTTER, 1, [Define to 1 if you use Cutter])
fi
# check for benchmark
AC_ARG_ENABLE(benchmark,
[AS_HELP_STRING([--disable-benchmark],
[don't build benchmark programs.])],,
[enable_benchmark="yes"])
if test "x$enable_benchmark" = "xno"; then
benchmark_available="no"
else
REQUIRED_GLIB_VERSION=2.14.0
m4_ifdef([AM_PATH_GLIB_2_0],
[AM_PATH_GLIB_2_0($REQUIRED_GLIB_VERSION,
[benchmark_available="yes"],
[benchmark_available="no"],
[gobject gthread])],
[benchmark_available="no"])
AC_MSG_CHECKING(for benchmark availablity)
AC_MSG_RESULT($ac_benchmark_available)
fi
if test "$benchmark_available" = "yes"; then
AC_DEFINE(GRN_WITH_BENCHMARK, 1, [Define to 1 if benchamrk is available])
fi
AM_CONDITIONAL([WITH_BENCHMARK], [test "$benchmark_available" = "yes"])
# check Ruby for HTTP test
ac_cv_ruby_available="no"
AC_ARG_WITH([ruby],
AS_HELP_STRING([--with-ruby=PATH],
[Ruby interpreter path (default: no)]),
[RUBY="$withval"],
[RUBY="no"])
if test "x$RUBY" = "xno"; then
RUBY=
else
if test "x$RUBY" = "xyes"; then
AC_PATH_PROGS(RUBY,
[ dnl
ruby3.0 ruby30 dnl
ruby2.7 ruby27 dnl
ruby2.6 ruby26 dnl
ruby2.5 ruby25 dnl
ruby2.4 ruby24 dnl
ruby2.3 ruby23 dnl
ruby2.2 ruby22 dnl
ruby2.1 ruby21 dnl
ruby dnl
],
ruby-not-found)
if test "$RUBY" != "ruby-not-found"; then
ruby_version="`$RUBY --version`"
if echo "$ruby_version" | grep -q -- 'ruby \(2\|3\)\.'; then
ac_cv_ruby_available="yes"
else
AC_MSG_WARN([$RUBY isn't Ruby 2.0 or later ($ruby_version)])
fi
fi
else
ruby_not_found_warning_message="$RUBY is not found."
case "$RUBY" in
/*)
AC_CHECK_FILE([$RUBY],
[ac_cv_ruby_available="yes"],
[AC_MSG_WARN([$ruby_not_found_warning_message])
RUBY="$RUBY-not-found"])
;;
*)
ruby_not_found="$RUBY-not-found"
AC_PATH_PROGS(RUBY, "$RUBY", "$ruby_not_found")
if test "$RUBY" = "$ruby_not_found"; then
AC_MSG_WARN([$ruby_not_found_warning_message])
else
ac_cv_ruby_available="yes"
fi
;;
esac
fi
fi
AC_SUBST(RUBY)
AM_CONDITIONAL([WITH_RUBY], [test "$ac_cv_ruby_available" = "yes"])
AM_CONDITIONAL([WITH_UNIT_TEST],
[test "$cutter_use_cutter" = "yes" -o \
"$ac_cv_ruby_available" = "yes"])
AM_CONDITIONAL([WITH_COMMAND_TEST],
[test "$ac_cv_ruby_available" = "yes"])
# check Lemon for generating .c and .h files from .y file
lemon_available="no"
AC_ARG_WITH([lemon],
AS_HELP_STRING([--with-lemon=PATH],
[Lemon path (default: auto)]),
[LEMON="$withval"],
[: ${LEMON:=auto}])
if test "$LEMON" = "no"; then
LEMON=
else
if test "$LEMON" = "auto"; then
AC_PATH_PROGS(LEMON, [lemon], none)
if test "$LEMON" != "none"; then
lemon_available="yes"
fi
elif test "$LEMON" = "yes"; then
AC_PATH_PROGS(LEMON, [lemon], none)
if test "$LEMON" = "none"; then
AC_MSG_WARN([lemon is not found. Disable .y compilation.])
else
lemon_available="yes"
fi
else
AC_CHECK_FILE([$LEMON],
[lemon_available="yes"],
[AC_MSG_WARN([$LEMON is not found. Disable .y compilation.])])
fi
fi
AC_SUBST(LEMON)
AM_CONDITIONAL([WITH_LEMON], [test "$lemon_available" = "yes"])
# libedit
libedit_available="no"
AC_ARG_WITH([libedit],
AS_HELP_STRING([--with-libedit],
[Support line editing (default: auto)]),
[with_libedit="$withval"],
[: ${with_libedit:=auto}])
if test "${with_libedit}" = "no"; then
LIBEDIT_CFLAGS=
LIBEDIT_LIBS=
else
if test "${with_libedit}" = "yes" -o "${with_libedit}" = "auto"; then
LIBEDIT_CFLAGS=
LIBEDIT_LIBS=
m4_ifdef([PKG_CHECK_MODULES], [
PKG_CHECK_MODULES([LIBEDIT],
[libedit >= 3.0],
[],
[LIBEDIT_LIBS="-ledit"])
])
else
LIBEDIT_CFLAGS="-I${with_libedit}/include"
LIBEDIT_LIBS="-L${with_libedit}/lib -ledit"
fi
CFLAGS_SAVE="${CFLAGS}"
LDFLAGS_SAVE="${LDFLAGS}"
CFLAGS="${LIBEDIT_CFLAGS} ${CFLAGS}"
LDFLAGS="${LIBEDIT_LIBS} ${LDFLAGS}"
AC_SEARCH_LIBS(el_wline,
,
[libedit_available="yes"],
[libedit_available="no"])
if test "${libedit_available}" = "yes"; then
AC_CHECK_HEADERS(histedit.h,
[],
[libedit_available="no"])
fi
CFLAGS="${CFLAGS_SAVE}"
LDFLAGS="${LDFLAGS_SAVE}"
if test "${libedit_available}" = "yes"; then
AC_DEFINE(GRN_WITH_LIBEDIT, 1, [Define to 1 if libedit works])
else
LIBEDIT_CFLAGS=
LIBEDIT_LIBS=
if test "${with_libedit}" != "auto"; then
AC_MSG_ERROR("No libedit found")
fi
fi
fi
AC_SUBST(LIBEDIT_CFLAGS)
AC_SUBST(LIBEDIT_LIBS)
# zlib
AC_ARG_WITH(zlib,
[AS_HELP_STRING([--with-zlib],
[Support data compression by zlib. [default=auto]])],
[with_zlib="$withval"],
[with_zlib="auto"])
GRN_WITH_ZLIB=no
if test "x$with_zlib" = "xno"; then
ZLIB_CFLAGS=
ZLIB_LIBS=
ZLIB_LIB_DIR=
else
if test "${with_zlib}" = "yes" -o "${with_zlib}" = "auto"; then
ZLIB_CFLAGS=
ZLIB_LIBS=
m4_ifdef([PKG_CHECK_MODULES], [
PKG_CHECK_MODULES([ZLIB],
[zlib],
[GRN_WITH_ZLIB=yes],
[GRN_WITH_ZLIB=no])
if test "${GRN_WITH_ZLIB}" = "yes"; then
_PKG_CONFIG(ZLIB_LIB_DIR, [variable=libdir], [zlib])
ZLIB_LIB_DIR="${pkg_cv_ZLIB_LIB_DIR}"
fi
],
[
CFLAGS_SAVE="${CFLAGS}"
LDFLAGS_SAVE="${LDFLAGS}"
AC_SEARCH_LIBS(compress, z,
[
GRN_WITH_ZLIB=yes
ZLIB_LIBS=-lz
# TODO
ZLIB_LIB_DIR=/usr/lib
],
[GRN_WITH_ZLIB=no])
CFLAGS="${CFLAGS_SAVE}"
LDFLAGS="${LDFLAGS_SAVE}"
])
else
GRN_WITH_ZLIB=yes
ZLIB_CFLAGS="-I${with_zlib}/include"
ZLIB_LIB_DIR="${with_zlib}/lib"
ZLIB_LIBS="-L${ZLIB_LIB_DIR} -lz"
fi
if test "${GRN_WITH_ZLIB}" = "yes"; then
AC_DEFINE(GRN_WITH_ZLIB, [1],
[Support data compression by zlib.])
else
if test "${with_zlib}" = "yes"; then
AC_MSG_ERROR("No zlib found")
fi
fi
fi
AC_SUBST(ZLIB_CFLAGS)
AC_SUBST(ZLIB_LIBS)
AC_SUBST(ZLIB_LIB_DIR)
AC_SUBST(GRN_WITH_ZLIB)
# LZ4
AC_ARG_WITH(lz4,
[AS_HELP_STRING([--with-lz4],
[Support data compression by LZ4. [default=auto]])],
[with_lz4="$withval"],
[with_lz4="auto"])
if test "x$with_lz4" != "xno"; then
m4_ifdef([PKG_CHECK_MODULES], [
PKG_CHECK_MODULES([LIBLZ4],
[liblz4],
[GRN_WITH_LZ4=yes],
[GRN_WITH_LZ4=no])
],
[GRN_WITH_LZ4=no])
if test "$GRN_WITH_LZ4" = "yes"; then
AC_DEFINE(GRN_WITH_LZ4, [1],
[Support data compression by LZ4.])
else
if test "x$with_lz4" != "xauto"; then
AC_MSG_ERROR("No liblz4 found")
fi
fi
else
GRN_WITH_LZ4=no
fi
# Zstandard
AC_ARG_WITH(zstd,
[AS_HELP_STRING([--with-zstd],
[Support data compression by Zstandard. [default=auto]])],
[with_zstd="$withval"],
[with_zstd="auto"])
if test "x$with_zstd" != "xno"; then
m4_ifdef([PKG_CHECK_MODULES], [
PKG_CHECK_MODULES([LIBZSTD],
[libzstd],
[GRN_WITH_ZSTD=yes],
[GRN_WITH_ZSTD=no])
],
[GRN_WITH_ZSTD=no])
if test "$GRN_WITH_ZSTD" = "yes"; then
AC_DEFINE(GRN_WITH_ZSTD, [1],
[Support data compression by Zstandard.])
else
if test "x$with_zstd" != "xauto"; then
AC_MSG_ERROR("No libzstd found")
fi
fi
else
GRN_WITH_ZSTD=no
fi
# LuaJIT
AC_ARG_WITH(luajit,
[AS_HELP_STRING([--with-luajit],
[Support LuaJIT. [default=auto]])],
[with_luajit="$withval"],
[with_luajit="auto"])
if test "x$with_luajit" != "xno"; then
m4_ifdef([PKG_CHECK_MODULES], [
PKG_CHECK_MODULES([LUAJIT],
[luajit],
[GRN_WITH_LUAJIT=yes],
[GRN_WITH_LUAJIT=no])
],
[GRN_WITH_LUAJIT=no])
if test "$GRN_WITH_LUAJIT" = "yes"; then
AC_DEFINE(GRN_WITH_LUAJIT, [1],
[Support LuaJIT.])
else
if test "x$with_luajit" != "xauto"; then
AC_MSG_ERROR("No LuaJIT found")
fi
fi
else
GRN_WITH_LUAJIT=no
fi
AC_SUBST(LUAJIT_CFLAGS)
AC_SUBST(LUAJIT_LIBS)
# jemalloc
AC_ARG_WITH(jemalloc,
[AS_HELP_STRING([--with-jemalloc],
[Use jemalloc for memory allocation. [default=no]])],
[with_jemalloc="$withval"],
[with_jemalloc="no"])
jemalloc_available="no"
if test "x$with_jemalloc" != "xno"; then
if test "x$with_jemalloc" != "xyes"; then
LDFLAGS="-L$with_jemalloc $LDFLAGS"
fi
AC_SEARCH_LIBS(malloc_conf, jemalloc,
[jemalloc_available="yes"],
[AC_MSG_ERROR("No libjemalloc found")])
fi
# Apache Arrow
AC_ARG_ENABLE(apache-arrow,
[AS_HELP_STRING([--disable-apache-arrow],
[disable Apache Arrow support. [default=auto-detect]])],
[enable_apache_arrow="$enableval"],
[enable_apache_arrow="auto"])
if test "x$enable_apache_arrow" != "xno"; then
m4_ifdef([PKG_CHECK_MODULES], [
PKG_CHECK_MODULES([APACHE_ARROW],
[arrow >= 3.0.0],
[GRN_WITH_APACHE_ARROW=yes],
[GRN_WITH_APACHE_ARROW=no])
],
[GRN_WITH_APACHE_ARROW=no])
if test "x$GRN_WITH_APACHE_ARROW" = "xyes"; then
AC_DEFINE(GRN_WITH_APACHE_ARROW, [1], [Enable Apache Arrow support.])
else
if test "x$enable_apache_arrow" = "xyes"; then
AC_MSG_ERROR("No Apache Arrow found")
fi
fi
else
GRN_WITH_APACHE_ARROW=no
fi
AM_CONDITIONAL([GRN_WITH_APACHE_ARROW], [test "$GRN_WITH_APACHE_ARROW" = "yes"])
# RapidJSON
BUNDLED_RAPIDJSON_VERSION=m4_include([bundled_rapidjson_version])
AC_SUBST(BUNDLED_RAPIDJSON_VERSION)
RAPIDJSON_CFLAGS=
AC_ARG_WITH(rapidjson,
[AS_HELP_STRING([--with-rapidjson],
[Use RapidJSON. [default=auto]])],
[with_rapidjson="$withval"],
[with_rapidjson="auto"])
if test "x$with_rapidjson" != "xno"; then
if test "x$with_rapidjson" = "xbundled"; then
RAPIDJSON_CFLAGS="-I\$(top_srcdir)/vendor/rapidjson-${BUNDLED_RAPIDJSON_VERSION}/include"
GRN_WITH_RAPIDJSON=yes
else
m4_ifdef([PKG_CHECK_MODULES], [
PKG_CHECK_MODULES([RAPIDJSON],
[RapidJSON],
[GRN_WITH_RAPIDJSON=yes],
[GRN_WITH_RAPIDJSON=no])
],
[GRN_WITH_RAPIDJSON=no])
if test "$GRN_WITH_RAPIDJSON" = "no"; then