-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathconfigure.ac
2910 lines (2549 loc) · 77.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
dnl Process this file with autoconf to produce a configure script.
dnl
AC_INIT([DataparkSearch Engine],[4.54-2017-09-05],[[email protected]],[dpsearch])
dnl AC_INIT([DataparkSearch Engine],[4.53],[[email protected]],[dpsearch])
AC_CONFIG_SRCDIR([TODO])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
AC_CONFIG_HEADERS(include/dps_config.h)
AC_PROG_MAKE_SET
AC_CONFIG_MACRO_DIR([build/m4])
PKG_PROG_PKG_CONFIG
OPENSSL_MINIMUM=0.9.8
AC_SUBST(OPENSSL_MINIMUM)
WOLFSSL_MINIMUM=3.4.0
AC_SUBST(WOLFSSL_MINIMUM)
MBEDTLS_MINIMUM=0x01030000 #1.3
AC_SUBST(MBEDTLS_MINIMUM)
# Set all version vars based on $VERSION. How do we do this more elegant ?
# Remember that regexps needs to quote [ and ] since this is run through m4
DPS_TRIM_VERSION=`echo $VERSION | sed -e "s|\.*pre[[0-9]]*$||"`
DPS_BASE_VERSION=`echo $DPS_TRIM_VERSION | sed -e "s|\.[[^.]]*$||" | sed -e "s|^\(.\)\.\(.\)$|\\1\.0\\2|" | sed -e "s|\.||g"`
dnl DPS_TAIL_VERSION=`echo $DPS_TRIM_VERSION | sed -e "s|^[[0-9]]\.[[0-9]]*\.||" | sed -e "s|^\(.\)$|0\\1|"`
DPS_TAIL_VERSION=`echo $DPS_TRIM_VERSION | sed -e "s|^[[0-9]]\.[[0-9]]*\.||" | sed -e "s|^\(.\)$|0\\1|" | sed -e "s|-.*||" | sed -e "s|^.*\.||"`
DPS_VERSION_ID=${DPS_BASE_VERSION}${DPS_TAIL_VERSION}
AC_DEFINE_UNQUOTED(DPS_VERSION_ID,$DPS_VERSION_ID)
AC_DEFINE_UNQUOTED(DPS_BASE_VERSION,$DPS_BASE_VERSION)
AC_DEFINE_UNQUOTED(DPS_TAIL_VERSION,$DPS_TAIL_VERSION)
AC_SUBST(DPS_BASE_VERSION)
AC_SUBST(DPS_TAIL_VERSION)
AC_SUBST(DPS_VERSION_ID)
AC_SUBST(PORTNAME)
dnl Installation prefix by default
AC_PREFIX_DEFAULT(/usr/local/dpsearch)
dnl Check if build env is sane
AM_SANITY_CHECK
dnl Enable shared libs by default (to disable - place AC_DISABLE_SHARED([]))
LT_INIT
dnl LT_INIT
dnl LT_INIT
AC_SUBST(LIBTOOL_DEPS)
dnl Check for programs.
AC_PROG_CC
AX_CHECK_CFLAGS([-std=c99 -pedantic])
AC_PROG_INSTALL
AM_PROG_CC_C_O
LT_INIT
dnl Check if we are little or big endian
AC_C_BIGENDIAN
dnl large file support
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
AM_CPPFLAGS=""
dnl OS specific flags and options
case "$host" in
*-*-irix*)
CFLAGS="$CFLAGS -D_BSD_COMPAT"
dnl LDADD="$LDADD -lbsd"
LDFLAGS="$LDFLAGS -lbsd"
;;
*-*-freebsd*)
LIBS="$LIBS -L/usr/local/lib -lc"
CFLAGS="$CFLAGS -I/usr/local/include"
AM_CPPFLAGS="$AM_CPPFLAGS -I/usr/local/include"
;;
*-*-solaris*)
LDFLAGS="$LDFLAGS -lsocket -lresolv -lnsl"
;;
*-*-linux*)
dnl CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
LIBS="$LIBS -L/usr/local/lib -lrt -lc -lresolv"
;;
esac
dnl platform specific flags and options
case "$host" in
sparc-*-*)
CFLAGS="$CFLAGS -xmemalign=1i"
;;
esac
dnl Checks for header files.
AC_CHECK_HEADERS(sys/types.h fcntl.h unistd.h bsd/unistd.h sys/cdefs.h libutil.h bsd/libutil.h \
sys/ioctl.h sys/time.h sys/times.h sys/param.h sys/wait.h limits.h sched.h \
syslog.h select.h sys/select.h sys/socket.h arpa/inet.h sys/un.h netdb.h sys/sysctl.h sys/mman.h sys/shm.h \
netinet/in.h netinet/in_systm.h netinet/tcp.h arpa/nameser.h sys/ipc.h semaphore.h sys/sem.h sys/msg.h \
bsd/stdlib.h)
AC_CHECK_HEADERS(netinet/ip.h resolv.h,,,
[
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#endif
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
]
)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_LONG_LONG_INT
PGAC_UNION_SEMUN
# Check if we have socklen_t
AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t,
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <sys/types.h>
#include <sys/socket.h>
]],
[[socklen_t s;]])],
ac_cv_have_socklen_t=yes, ac_cv_have_socklen_t=no)])
if test "$ac_cv_have_socklen_t" = "no"
then
AC_DEFINE(socklen_t, int)
fi
dnl Check for tm_gmtoff in struct tm
AC_MSG_CHECKING(for tm_gmtoff in struct tm)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <time.h>
]],
[[
struct tm tm;
tm.tm_gmtoff=0;
]])],
AC_DEFINE(HAVE_TM_GMTOFF)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
dnl Check if libbsd is required, e.g. on Linux
AC_CHECK_LIB(bsd, mergesort, CTOR_LIBS=`pkg-config libbsd-ctor --libs` LIBS="$LIBS -lbsd $CTOR_LIBS")
dnl Check for library functions
AC_CHECK_FUNCS(strdup strndup strstr strnlen strcasecmp strncasecmp bzero strtok_r strcasestr timegm)
AC_CHECK_FUNCS(regcomp socket vsnprintf snprintf mergesort heapsort setproctitle)
AC_CHECK_FUNCS(setenv putenv break)
AC_CHECK_FUNCS(unsetenv daemon)
AC_CHECK_FUNC(inet_addr, , AC_CHECK_LIB(xnet, inet_addr, LIBS="$LIBS -lxnet"))
dnl AC_CHECK_FUNC(setproctitle, , AC_CHECK_LIB(util, setproctitle, LIBS="$LIBS -lutil"))
AC_CHECK_FUNC(sqrt, , AC_CHECK_LIB(m, sqrt, LIBS="$LIBS -lm"))
dnl Check for libtre
tre=yes
AC_MSG_CHECKING(for libtre)
AC_ARG_WITH(tre,
[ --without-tre disable support for libtre],
[tre=$withval],
[tre=yes])
AC_MSG_RESULT([$tre])
if test "$tre" != "no" ; then
AC_CHECK_HEADERS(tre/regex.h)
if test "$ac_cv_header_tre_regex_h" = "yes"; then
LIBS="$LIBS -ltre"
fi
fi
dnl Check for libbind or libdns
MODLIB=""
LIBLIB=""
AC_CHECK_LIB(cares, ares_init, AC_DEFINE(HAVE_LIBCARES) LIBS="$LIBS -lcares",
AC_CHECK_LIB(ares, ares_init, AC_DEFINE(HAVE_LIBARES) LIBS="$LIBS -lares",
AC_CHECK_LIB(bind, getaddrinfo, AC_DEFINE(HAVE_LIBBIND) LIBS="$LIBS -lbind",
AC_CHECK_LIB(dns, getaddrinfo, AC_DEFINE(HAVE_LIBDNS) LIBS="$LIBS -ldns")
)
)
)
dnl Check for libextractor
libextractor=yes
AC_MSG_CHECKING(for libextractor)
AC_ARG_WITH(libextractor,
[ --without-libextractor disable support for libextractor],
[libextractor=$withval],
[libextractor=yes])
AC_MSG_RESULT([$libextractor])
if test "$libextractor" != "no" ; then
AC_CHECK_LIB(extractor, EXTRACTOR_plugin_add_defaults, AC_DEFINE(HAVE_LIBEXTRACTOR) LIBS="$LIBS -lextractor",
AC_CHECK_LIB(extractor, EXTRACTOR_loadDefaultLibraries, AC_DEFINE(HAVE_LIBEXTRACTOR) LIBS="$LIBS -lextractor")
)
fi
dnl AC_CHECK_LIB(bind, getaddrinfo, AC_DEFINE(HAVE_LIBBIND) [
dnl if test "$pthreads" != no; then
dnl LIBLIB="-lbind_r"
dnl MODLIB="-lbind"
dnl else
dnl LIBS="$LIBS -lbind"
dnl fi
dnl ],
dnl AC_CHECK_LIB(dns, getaddrinfo, AC_DEFINE(HAVE_LIBDNS) LIBS="$LIBS -ldns")
dnl )
AC_SUBST(LIBLIB)
AC_SUBST(MODLIB)
AC_CHECK_FUNCS(hstrerror getaddrinfo)
AC_CHECK_FUNC_PROTO(inet_net_pton, arpa/inet.h)
AC_CHECK_FUNC_PROTO([pthread_setconcurrency], [pthread.h])
AC_CHECK_FUNC_PROTO([pthread_tryjoin_np], [pthread.h])
AC_CHECK_FUNC_PROTO([thr_setconcurrency], [thread.h])
dnl Check sizeof_type
AC_CHECK_SIZEOF(char*)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(void*)
AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(time_t)
dnl AC_CHECK_SIZEOF(off_t)
debug=no
AC_MSG_CHECKING(for debug info)
AC_ARG_WITH(debug,
[ --with-debug Build with debugging info],
[debug=$withval],
[debug=no])
if test "$debug" = "yes"
then
CFLAGS="$CFLAGS -O0 -g"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
optimise=no
AC_MSG_CHECKING(for compilation optimisation)
AC_ARG_WITH(optimise,
[ --with-optimise Build with compilation optimisation],
[optimise=$withval],
[optimise=no])
if test "$optimise" = "yes"; then
CFLAGS="$CFLAGS -O2"
AC_MSG_RESULT([yes, -O2])
elif test "$optimise" != "no"; then
CFLAGS="$CFLAGS -O$optimise"
AC_MSG_RESULT([yes, -O$optimise])
else
# No optimisation
AC_MSG_RESULT(default)
fi
dnl Check for libc performance
AC_MSG_CHECKING(for libc functions performance, please be patient)
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include "confdefs.h"
#define DPS_CONFIGURE
#include "src/dp.c"
]])], AC_MSG_RESULT(done), AC_MSG_FAILURE(unable to complete tests), AC_MSG_RESULT(cross-compiling?)
)
dnl Check for libraries
dnl Next line was commented out by Kir
dnl Does inet_addr and inet_aton belongs to one lib?
dnl If so we don't need to check for inet_aton
dnl AC_CHECK_FUNCS(inet_addr inet_aton)
dnl sinclude(net.m4)
AC_LIBRARY_NET
dnl Determine where getopt function denined
AC_MSG_CHECKING(for getopt location)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#include <unistd.h>
]],
[[getopt(0, NULL, "h?");]])],
AC_MSG_RESULT(unistd.h),
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#include <getopt.h>
]],
[[getopt(0, NULL, "h?");]])],
AC_DEFINE(HAVE_GETOPT_H)
AC_MSG_RESULT(getopt.h),
AC_MSG_RESULT(not found))
)
dnl Determine signal handling standard
AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <signal.h>
]],
[[return *(signal (0, 0)) (0) == 1;]])],
[ac_cv_type_signal=int],
[ac_cv_type_signal=void])])
AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
(`int' or `void').])
AC_MSG_CHECKING(for POSIX signals)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#include <signal.h>
]],
[[ sigset_t ss;
struct sigaction sa;
sigemptyset(&ss); sigsuspend(&ss);
sigaction(SIGINT, &sa, (struct sigaction *) 0);
sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
]])],
AC_DEFINE(HAVE_POSIX_SIGNALS)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
dnl check for memory model
mcmodel=medium
AC_ARG_ENABLE([mcmodel],
[AS_HELP_STRING([--enable-mcmodel=ARG],
[Use compiler option -mcmodel, avaiable arguments --> tiny; --> small; -->medium; -->large
(defalut is medium)])],
[ case "${enableval}" in
large) mcmodel=large ;;
medium) mcmodel=medium ;;
small) mcmodel=small ;;
tiny) mcmodel=tiny ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-mcmodel) ;;
esac],
[ dnl switching to mcmodel=small for freebsd due to a buf in cc: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213870
case "$host" in
*-*-freebsd*)
mcmodel=small
;;
*)
mcmodel=medium
;;
esac
])
AX_CHECK_CFLAGS([-mcmodel=$mcmodel],,AC_MSG_NOTICE([$CC compiler option -mcmodel=$mcmodel is not avaiable]))
dnl check for paranoia support
paranoia=no
AC_MSG_CHECKING(for paranoia support)
AC_ARG_ENABLE(paranoia,
[ --enable-paranoia Enable paranoia support. Stack will be checked like with libparanoia
This works only on Intel architecture using gcc. Optimisation should be switched off.],
[
if test "$enableval" != "no"; then
AC_MSG_RESULT($enableval)
CFLAGS="$CFLAGS -O0"
AC_DEFINE(WITH_PARANOIA)
else
AC_MSG_RESULT(no)
fi
],[
AC_MSG_RESULT(no)
])
dnl check needs for -lc
sharedmem=no
cok=no
if test "$sharedmem" = no; then
AC_MSG_CHECKING(for POSIX shared memory library)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/mman.h>
]],
[[shm_open("/tmp", 0, 0644);]])],
cok=yes
sharedmem=posix
AC_DEFINE(HAVE_SHAREDMEM_POSIX)
AC_MSG_RESULT(ok)
)
if test "$cok" = no; then
ac_save_libs="$LIBS"
LIBS="$LIBS -lc"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/mman.h>
]],
[[shm_open("/tmp", 0, 0644);]])],
cok=yes
sharedmem=posix
AC_DEFINE(HAVE_SHAREDMEM_POSIX)
AC_MSG_RESULT(-lc),
LIBS="$ac_save_libs"
)
fi
if test "$cok" = no; then
ac_save_libs="$LIBS"
LIBS="$LIBS -lrt"
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#include <sys/types.h>
#include <sys/mman.h>
]], [[
shm_open("/tmp", 0, 0644);
]])],
cok=yes
sharedmem=posix
AC_DEFINE(HAVE_SHAREDMEM_POSIX)
AC_MSG_RESULT(-lrt),
LIBS="$ac_save_libs"
)
fi
fi
if test "$sharedmem" = no; then
AC_MSG_CHECKING(for SystemV shared memory library)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/shm.h>
]], [[
shmat(1, 0, 0);
]])],[cok=yes
sharedmem=sysV
AC_DEFINE(HAVE_SHAREDMEM_SYSV)
AC_MSG_RESULT(ok)],[])
if test "$cok" = no; then
ac_save_libs="$LIBS"
LIBS="$LIBS -lc"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/shm.h>
]], [[
shmat(1, 0, 0);
]])],[cok=yes
sharedmem=sysV
AC_DEFINE(HAVE_SHAREDMEM_SYSV)
AC_MSG_RESULT(-lc)],[LIBS="$ac_save_libs"
])
fi
if test "$cok" = no; then
ac_save_libs="$LIBS"
LIBS="$LIBS -lrt"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/shm.h>
]], [[
shmat(1, 0, 0);
]])],[cok=yes
sharedmem=sysV
AC_DEFINE(HAVE_SHAREDMEM_SYSV)
AC_MSG_RESULT(-lrt)],[LIBS="$ac_save_libs"
])
fi
fi
if test "$sharedmem" = no; then
AC_MSG_ERROR([No shared memory support found])
fi
syslog=yes
AC_MSG_CHECKING(for syslog support)
AC_ARG_ENABLE(syslog,
[ --enable-syslog Use syslog (default)
--enable-syslog=LOG_FACILITY
Use syslog facility LOG_FACILITY, which should be
valid name defined in /usr/include/sys/syslog.h
--disable-syslog Use stdout/stderr], syslog=$enableval)
if test "$syslog" != no; then
AC_DEFINE(WITH_SYSLOG)
if test "$syslog" != yes; then
AC_DEFINE_UNQUOTED(LOG_FACILITY, $syslog, syslog facility)
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <sys/syslog.h>
int main(void){
openlog("Test", LOG_NDELAY, LOG_FACILITY);
closelog();
return 0;
}
]])],[AC_MSG_RESULT(enabled (will use $syslog facility))],[
AC_MSG_RESULT(error)
echo "You probably gave wrong facility argument ($syslog)"
echo "to --enable-syslog. This argument should be one defined in"
echo "/usr/include/sys/syslog.h, for example LOG_DAEMON or LOG_LOCAL7."
AC_MSG_ERROR([** Unknown syslog facility given **])
],[echo $ac_n "cross compiling; assumed OK... $ac_c"
])
else
AC_MSG_RESULT(enabled)
fi
else
AC_MSG_RESULT([disabled (will use stdout/stderr)])
fi
trace=no
AC_MSG_CHECKING(for tracing support)
AC_ARG_ENABLE(trace,
[ --enable-trace Use tracing (for debug purpose), disabled by default], trace=$enableval)
if test "$trace" != no; then
AC_DEFINE(WITH_TRACE)
AC_MSG_RESULT(enabled)
else
AC_MSG_RESULT(disabled)
fi
googlegrp=no
AC_MSG_CHECKING(for Google-like groupping)
AC_ARG_ENABLE(googlegrp,
[ --enable-googlegrp Use Google-like groupping by site (two result from each), disabled by default], googlegrp=$enableval)
if test "$googlegrp" != no; then
AC_DEFINE(WITH_GOOGLEGRP)
AC_MSG_RESULT(enabled)
else
AC_MSG_RESULT(disabled)
fi
multidbaddr=no
AC_MSG_CHECKING(for multi DBAddr support)
AC_ARG_ENABLE(multidbaddr,
[ --enable-multidbaddr Enable support for multi DBAddr, disabled by default], multidbaddr=$enableval)
if test "$multidbaddr" != no; then
AC_DEFINE(WITH_MULTIDBADDR)
AC_MSG_RESULT(enabled)
else
AC_MSG_RESULT(disabled)
fi
dnl Relevance related
rel_distance_factor=25
rel_position_factor=1.5
rel_wrd_cnt_factor=3.5
rel_unicnt_factor=2000
pophops_factor=0.1
pophops=no
AC_MSG_CHECKING(for take hops for the Neo PopRank calculation)
AC_ARG_ENABLE(pophops,
[ --enable-pophops Take hops for the Neo Popularity Rank calculation], pophops=$enableval)
if test "$pophops" = yes; then
AC_DEFINE(WITH_POPHOPS)
fi
AC_MSG_RESULT([$pophops])
AC_MSG_CHECKING(for hops factor in the Neo PopRank)
AC_ARG_WITH(pophopsfactor,
[ --with-pophopsfactor=NUM Define NUM as factor of hops in the Neo Popularity Rank calculation.
Default value is 0.1.],
[
if test "x$withval" != "x"; then
pophops_factor="$withval"
AC_MSG_RESULT($withval)
else
AC_MSG_RESULT($pophops_factor)
fi
],[
AC_MSG_RESULT($pophops_factor)
])
AC_DEFINE_UNQUOTED(DPS_POPHOPS_FACTOR, $pophops_factor)
sort=heap
AC_MSG_CHECKING(for search results sorting method)
AC_ARG_ENABLE(sort,
[ --enable-sort=[heap|quick] Select method for search results sorting, heap by default], rel=$enableval)
if test "$sort" = heap; then
AC_DEFINE(HEAP_SORTING)
elif test "$sort" = quick; then
AC_DEFINE(QUICK_SORTING)
else
AC_MSG_ERROR([Results sorting method should be only one of heap or quick])
fi
AC_MSG_RESULT([$sort])
rel=full
AC_MSG_CHECKING(for relevance method)
AC_ARG_ENABLE(rel,
[ --enable-rel=[full|fast|ultra] Select method for relevance calculation, full by default], rel=$enableval)
if test "$rel" = full; then
AC_DEFINE(FULL_RELEVANCE)
elif test "$rel" = fast; then
AC_DEFINE(FAST_RELEVANCE)
elif test "$rel" = ultra; then
AC_DEFINE(ULTRA_RELEVANCE)
else
AC_MSG_ERROR([Relevance method should be only one of fast, full or ultra])
fi
AC_MSG_RESULT([$rel])
reldistance=yes
AC_MSG_CHECKING(for average word distance in relevency)
AC_ARG_ENABLE(reldistance,
[ --disable-reldistance Disable average word distance calculation in relevance
enabled by default], reldistance=$enableval)
if test "$reldistance" != no; then
AC_DEFINE(WITH_REL_DISTANCE)
AC_MSG_RESULT(enabled)
else
AC_MSG_RESULT(disabled)
fi
relposition=yes
AC_MSG_CHECKING(for first word position in relevency)
AC_ARG_ENABLE(relposition,
[ --disable-relposition Disable first word position calculation in relevance
enabled by default], relposition=$enableval)
if test "$relposition" != no; then
AC_DEFINE(WITH_REL_POSITION)
AC_MSG_RESULT(enabled)
else
AC_MSG_RESULT(disabled)
fi
relwrdcount=yes
AC_MSG_CHECKING(for word count in relevency)
AC_ARG_ENABLE(relwrdcount,
[ --disable-relwrdcount Disable word count calculation in relevance
enabled by default], relwrdcount=$enableval)
if test "$relwrdcount" != no; then
AC_DEFINE(WITH_REL_WRDCOUNT)
AC_MSG_RESULT(enabled)
else
AC_MSG_RESULT(disabled)
fi
relposition=13
AC_MSG_CHECKING(for best first word position in relevance)
AC_ARG_WITH(bestpos,
[ --with-bestpos=NUM Define NUM as best first word position for relevance calculation.
Default value is 13.],
[
if test "x$withval" != "x" && test "x$withval" != "xyes"; then
relposition="$withval"
fi
AC_MSG_RESULT($relposition)
],[
AC_MSG_RESULT($relposition)
])
AC_DEFINE_UNQUOTED(DPS_BEST_POSITION, $relposition)
rel_avgpos=390
AC_MSG_CHECKING(for best average word position in relevance)
AC_ARG_WITH(avgpos,
[ --with-avgpos=NUM Define NUM as best average word position for relevance calculation.
Default value is 390.],
[
if test "x$withval" != "x" && test "x$withval" != "xyes"; then
rel_avgpos="$withval"
fi
AC_MSG_RESULT($rel_avgpos)
],[
AC_MSG_RESULT($rel_avgpos)
])
AC_DEFINE_UNQUOTED(DPS_AVG_POSITION, $rel_avgpos)
rel_wrd_cnt=30
AC_MSG_CHECKING(for best words count in relevance)
AC_ARG_WITH(bestwrdcnt,
[ --with-bestwrdcnt=NUM Define NUM as best words count for relevance calculation.
Default value is 30.],
[
if test "x$withval" != "x" && test "x$withval" != "xyes"; then
rel_wrd_cnt="$withval"
fi
AC_MSG_RESULT($rel_wrd_cnt)
],[
AC_MSG_RESULT($rel_wrd_cnt)
])
AC_DEFINE_UNQUOTED(DPS_BEST_WRD_CNT, $rel_wrd_cnt)
rel_best_dist=20
AC_MSG_CHECKING(for best average distance between words in relevance)
AC_ARG_WITH(avgdist,
[ --with-avgdist=NUM Define NUM as best words count for relevance calculation.
Default value is 20.],
[
if test "x$withval" != "x" && test "x$withval" != "xyes"; then
rel_best_dist="$withval"
fi
AC_MSG_RESULT($rel_best_dist)
],[
AC_MSG_RESULT($rel_best_dist)
])
AC_DEFINE_UNQUOTED(DPS_AVG_DISTANCE, $rel_best_dist)
AC_MSG_CHECKING(for word distance factor in relevance)
AC_ARG_WITH(distfactor,
[ --with-distfactor=NUM Define NUM as factor of word distance in relevance calculation.
Default value is 25.],
[
if test "x$withval" != "x" && test "x$withval" != "xyes"; then
rel_distance_factor="$withval"
fi
AC_MSG_RESULT($rel_distance_factor)
],[
AC_MSG_RESULT($rel_distance_factor)
])
AC_DEFINE_UNQUOTED(DPS_DISTANCE_FACTOR, $rel_distance_factor)
rel_less_distance_factor="1.0"
AC_MSG_CHECKING(for word less distance factor in relevance)
AC_ARG_WITH(lessdistfactor,
[ --with-lessdistfactor=NUM Define NUM as factor of word distance in relevance calculation.
Default value is 1.0.],
[
if test "x$withval" != "x" && test "x$withval" != "xyes"; then
rel_less_distance_factor="$withval"
fi
AC_MSG_RESULT($rel_less_distance_factor)
],[
AC_MSG_RESULT($rel_less_distance_factor)
])
AC_DEFINE_UNQUOTED(DPS_LESS_DISTANCE_FACTOR, $rel_less_distance_factor)
AC_MSG_CHECKING(for first word position factor in relevance)
AC_ARG_WITH(posfactor,
[ --with-posfactor=NUM Define NUM as factor of first word position in relevance calculation.
Default value is 1.5.],
[
if test "x$withval" != "x" && test "x$withval" != "xyes"; then
rel_position_factor="$withval"
fi
AC_MSG_RESULT($rel_position_factor)
],[
AC_MSG_RESULT($rel_position_factor)
])
AC_DEFINE_UNQUOTED(DPS_POSITION_FACTOR, $rel_position_factor)
rel_less_position_factor="0.31"
AC_MSG_CHECKING(for first word less position factor in relevance)
AC_ARG_WITH(lessposfactor,
[ --with-lessposfactor=NUM Define NUM as factor of first word position in relevance calculation.
Default value is 0.31.],
[
if test "x$withval" != "x" && test "x$withval" != "xyes"; then
rel_less_position_factor="$withval"
fi
AC_MSG_RESULT($rel_less_position_factor)
],[
AC_MSG_RESULT($rel_less_position_factor)
])
AC_DEFINE_UNQUOTED(DPS_LESS_POSITION_FACTOR, $rel_less_position_factor)
AC_MSG_CHECKING(for word count factor in relevance)
AC_ARG_WITH(wrdcntfactor,
[ --with-wrdcntfactor=NUM Define NUM as factor of word count in relevance calculation.
Default value is 3.5.],
[
if test "x$withval" != "x" && test "x$withval" != "xyes"; then
rel_wrd_cnt_factor="$withval"
fi
AC_MSG_RESULT($rel_wrd_cnt_factor)
],[
AC_MSG_RESULT($rel_wrd_cnt_factor)
])
AC_DEFINE_UNQUOTED(DPS_WRD_CNT_FACTOR, $rel_wrd_cnt_factor)
rel_less_wrd_cnt_factor="70.5"
AC_MSG_CHECKING(for word less count factor in relevance)
AC_ARG_WITH(lesswrdcntfactor,
[ --with-lesswrdcntfactor=NUM Define NUM as factor of word count in relevance calculation.
Default value is 70.5.],
[
if test "x$withval" != "x" && test "x$withval" != "xyes"; then
rel_less_wrd_cnt_factor="$withval"
fi
AC_MSG_RESULT($rel_less_wrd_cnt_factor)
],[
AC_MSG_RESULT($rel_less_wrd_cnt_factor)
])
AC_DEFINE_UNQUOTED(DPS_LESS_WRD_CNT_FACTOR, $rel_less_wrd_cnt_factor)
rel_unicnt_border="10"
AC_MSG_CHECKING(for non-uniform word count border value)
AC_ARG_WITH(wrduniborder,
[ --with-wrduniborder=NUM Define NUM as border value for non-uniform word count distribution in relevance calculation.
Default value is 10.],
[
if test "x$withval" != "x" && test "x$withval" != "xyes"; then
rel_unicnt_border="$withval"
fi
AC_MSG_RESULT($rel_unicnt_border)
],[
AC_MSG_RESULT($rel_unicnt_border)
])
AC_DEFINE_UNQUOTED(DPS_UNICNT_BORDER, $rel_unicnt_border)
rel_unicnt_factor="2000"
AC_MSG_CHECKING(for non-uniform word count factor in relevance)
AC_ARG_WITH(wrdunifactor,
[ --with-wrdunifactor=NUM Define NUM as factor of non-uniform word count distribution in relevance calculation.
Default value is 2000.],
[
if test "x$withval" != "x" && test "x$withval" != "xyes"; then
rel_unicnt_factor="$withval"
fi
AC_MSG_RESULT($rel_unicnt_factor)
],[
AC_MSG_RESULT($rel_unicnt_factor)
])
AC_DEFINE_UNQUOTED(DPS_UNICNT_FACTOR, $rel_unicnt_factor)
rel_less_unicnt_factor="20"
AC_MSG_CHECKING(for non-uniform words less count factor in relevance)
AC_ARG_WITH(lesswrdunifactor,
[ --with-lesswrdunifactor=NUM Define NUM as factor of non-uniform words count distribution in relevance calculation.
Default value is 20.],
[
if test "x$withval" != "x" && test "x$withval" != "xyes"; then
rel_less_unicnt_factor="$withval"
fi
AC_MSG_RESULT($rel_less_unicnt_factor)
],[
AC_MSG_RESULT($rel_less_unicnt_factor)
])
AC_DEFINE_UNQUOTED(DPS_LESS_UNICNT_FACTOR, $rel_less_unicnt_factor)
reltrack=no
AC_MSG_CHECKING(for relevance summands tracking)
AC_ARG_ENABLE(reltrack,
[ --enable-reltrack Enable tracking of relevance summands], reltrack=$enableval)
if test "$reltrack" != no; then
AC_DEFINE(WITH_REL_TRACK)
fi
AC_MSG_RESULT($reltrack)
dnl Hack to build statically linked binary distributions
STATIC_LFLAGS=""
static_lflags=no
AC_MSG_CHECKING(for -all-static linker flags)
AC_ARG_ENABLE(all-static,
[ --enable-all-static build statically linked binaries],static_lflags=$enableval)
if test "$static_lflags" != no; then
AC_MSG_RESULT(enabled)
STATIC_LFLAGS="-all-static"
LINKING="static"
else
AC_MSG_RESULT([disabled])
LINKING="dynamic"
fi
AC_SUBST(STATIC_LFLAGS)
AC_SUBST(LINKING)
PTHREAD_CFLAGS=""
PTHREAD_LFLAGS=""
PTHREAD_LDADD=""
dnl #sinclude(threads.m4)
pthreads=yes
AC_MSG_CHECKING(for pthreads)
AC_ARG_ENABLE(pthreads,
[ --disable-pthreads disable POSIX pthreads],pthreads=$enableval)
if test "$pthreads" != no; then
if test -z "$host"; then
AC_MSG_ERROR(host is not set. Make sure to run config.guess)
fi
case "$host" in
*-*-bsdi*)
PTHREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE"
;;
*-*-darwin*)
PTHREAD_CFLAGS="-D_THREAD_SAFE"
# causes Carbon.p complaints?
# PTHREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE"
;;
*-*-freebsd4*)
# PTHREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE -pthread"
PTHREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE"
# PTHREAD_LFLAGS="-pthread"
# PTHREAD_LDADD="-lpthread"
;;
*-*-freebsd5*)
PTHREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE"
# PTHREAD_LFLAGS="-pthread"
# PTHREAD_LDADD="-lc_r"
;;
*-*-netbsd*)
PTHREAD_CFLAGS="-I/usr/pkg/include -D_REENTRANT"
AM_CPPFLAGS="$AM_CPPFLAGS -I/usr/pkg/include"
PTHREAD_LDADD="-L/usr/pkg/lib -lpthread -lsem"
;;
*-*-openbsd*)
PTHREAD_CFLAGS="-D_REENTRANT"
PTHREAD_LFLAGS="-pthread"
PTHREAD_LDADD="-lpthread"
;;
*-*-solaris*)
PTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE -D_POSIX_PTHREAD_SEMANTICS"
PTHREAD_LDADD="-lpthread -lposix4"
;;
*-*-sysv5*)
PTHREAD_CFLAGS="-D_REENTRANT -Kthread"
PTHREAD_LDADD=""
;;
*-*-irix*)
PTHREAD_CFLAGS="-D_SGI_MP_SOURCE -D_POSIX_C_SOURCE=199506L -D_POSIX_THREAD_SAFE_FUNCTIONS"
PTHREAD_LDADD="-lpthread"
;;
*-*-aix*)
PTHREAD_CFLAGS="-D_REENTRANT -mthreads"
PTHREAD_LDADD="-lpthread"
;;
*-*-hpux11*)
PTHREAD_CFLAGS="-D_REENTRANT"
PTHREAD_LDADD="-L/usr/lib -lpthread"
;;
*-*-qnx*)
PTHREAD_CFLAGS=""
PTHREAD_LDADD=""
;;
*)
# PTHREAD_CFLAGS="-D_REENTRANT"
# PTHREAD_LDADD="-lpthread"
PTHREAD_CFLAGS="-pthread"
PTHREAD_LDADD="-pthread"
;;
esac
PTHREADS_CHECK
if test "$pthreads_working" = "yes"; then
AC_MSG_RESULT([ POSIX Threads found])
else
AC_MSG_ERROR([POSIX Threads not found])
fi
dnl ac_save_libs="$LIBS"
dnl ac_save_cflags="$CFLAGS"
dnl LIBS="$LIBS $PTHREAD_LFLAGS $PTHREAD_LDADD"
dnl CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
dnl
dnl AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[dnl
dnl pthread_attr_t type;
dnl pthread_attr_init(&type);
dnl ]])],[AC_MSG_RESULT(yes)],[dnl AC_MSG_ERROR(POSIX thread support not found)
dnl ])
dnl
dnl CFLAGS="$ac_save_cflags"
dnl LIBS="$ac_save_libs"