This repository has been archived by the owner on Apr 15, 2022. It is now read-only.
forked from beniz/seeks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
executable file
·849 lines (764 loc) · 27.4 KB
/
configure.in
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
# Process this file with autoconf to produce a configure script.
#
# Copyright (C) 2006-2011 Emmanuel Benazera <ebenazer@seeks-project.info>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_INIT(Seeks, 0.4.1, ebenazer@seeks-project.info)
AC_CONFIG_SRCDIR(Makefile.am)
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
AC_CONFIG_MACRO_DIR([m4])
# Version number.
AC_SUBST(SEEKS_VERSION_MAJOR)
AC_SUBST(SEEKS_VERSION_MINOR)
AC_SUBST(SEEKS_VERSION_POINT)
AC_SUBST(SEEKS_CODE_STATUS)
AC_DEFINE(SEEKS_VERSION_MAJOR,"0","")
AC_DEFINE(SEEKS_VERSION_MINOR,"4","")
AC_DEFINE(SEEKS_VERSION_POINT,"1","")
AC_DEFINE(SEEKS_VERSION,"0.4.1","")
AC_DEFINE(SEEKS_CODE_STATUS,"stable","")
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
# Set the language.
AC_LANG(C++)
# Checks for libraries.
AC_SEARCH_LIBS(accept, socket network)
AC_SEARCH_LIBS(gethostbyname, nsl network)
LT_LIB_DLLOAD
# Checks for header files.
AC_HEADER_STDC
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([access atexit getcwd gethostbyaddr gethostbyaddr_r gethostbyname gethostbyname_r gettimeofday localtime_r gmtime_r inet_ntoa memchr memmove memset poll putenv random regcomp select setlocale snprintf socket strchr strdup strndup strerror strftime strlcat strlcpy strptime strstr strtoul timegm tzset])
#=================================================================
# Support for thread-safe versions of gethostbyaddr, gethostbyname,
#=================================================================
# Next line needed to find the gethost*_r functions on Solaris
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_FUNC(gethostbyaddr_r, [
AC_MSG_CHECKING([signature of gethostbyaddr_r])
AC_TRY_COMPILE([
# include <netdb.h>
], [
struct hostent *h, *hp;
char *a, *b;
int l, bl, t, e;
(void) gethostbyaddr_r(a, l, t, h, b, bl, &hp, &e)
], [
AC_DEFINE(HAVE_GETHOSTBYADDR_R_8_ARGS,1,"")
AC_MSG_RESULT([8 args])
], [
AC_TRY_COMPILE([
# include <netdb.h>
], [
struct hostent *h;
char *a, *b;
int l, bl, t, e;
(void) gethostbyaddr_r(a, l, t, h, b, bl, &e)
], [
AC_DEFINE(HAVE_GETHOSTBYADDR_R_7_ARGS,1,"")
AC_MSG_RESULT([7 args])
], [
AC_TRY_COMPILE([
# include <netdb.h>
], [
struct hostent_data *d;
struct hostent *h;
char a,
int l, t;
(void) gethostbyaddr_r(a, l, t, h, d)
], [
AC_DEFINE(HAVE_GETHOSTBYADDR_R_5_ARGS,1,"")
AC_MSG_RESULT([5 args])
], [
AC_MSG_RESULT(unrecognised)
])
])
])
], [
AC_MSG_RESULT(no)
])
AC_CHECK_FUNC(gethostbyname_r, [
AC_MSG_CHECKING([signature of gethostbyname_r])
AC_TRY_COMPILE([
# include <netdb.h>
], [
struct hostent *h, *r;
char *n, *b;
int bl, e;
(void) gethostbyname_r(n, h, b, bl, &r, &e)
], [
AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARGS,1,"")
AC_MSG_RESULT([6 args])
], [
AC_TRY_COMPILE([
# include <netdb.h>
], [
struct hostent *h;
char *n, *b;
int bl, e;
(void) gethostbyname_r(n, h, b, bl, &e)
], [
AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARGS,1,"")
AC_MSG_RESULT([5 args])
], [
AC_TRY_COMPILE([
# include <netdb.h>
], [
struct hostent_data *d;
struct hostent *h;
char *n,
(void) gethostbyname_r(n, h, d)
], [
AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARGS,1,"")
AC_MSG_RESULT([3 args])
], [
AC_MSG_RESULT(unrecognised)
])
])
])
], [
AC_MSG_RESULT(no)
])
AM_CONDITIONAL(HAVE_BSD,false)
#=================================================================
# Mac OSX specific
#=================================================================
case "$host" in
*-apple-darwin*) SPECIAL_CFLAGS="-Dunix";
AM_CONDITIONAL(HAVE_BSD,true)
AC_DEFINE(ON_OSX,1,"OSX")
;;
esac
#=================================================================
# OpenBSD specific
#=================================================================
case "$host" in
*-openbsd*)
SPECIAL_CFLAGS="$SPECIAL_CFLAGS -Dunix";
AM_CONDITIONAL(HAVE_BSD,true)
AC_DEFINE(ON_OPENBSD,1,"OpenBSD")
;;
esac
#=================================================================
# FreeBSD specific
#=================================================================
case "$host" in
*-freebsd*)
SPECIAL_CFLAGS="$SPECIAL_CFLAGS -Dunix";
AM_CONDITIONAL(HAVE_BSD,true)
;;
esac
#=================================================================
# NetBSD specific
#=================================================================
case "$host" in
*-netbsd*)
SPECIAL_CFLAGS="$SPECIAL_CFLAGS -Dunix";
AM_CONDITIONAL(HAVE_BSD,true)
;;
esac
# Checks for RFC 2553 resolver and socket functions
AC_CHECK_FUNC([getaddrinfo],
[AC_CHECK_FUNC([getnameinfo],
[AC_DEFINE([HAVE_RFC2553], [1],
[Define if RFC 2553 resolver functions like getaddrinfo(3) and
getnameinfo(3) present])
])
])
#==========================================================================
# Setting flags
#==========================================================================
#- debug flag
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[Enable debug output (default is NO)]),
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR(bad_value ${enableval} for
--enable-debug) ;;
esac],[debug=false])
AM_CONDITIONAL(DEBUG,test x$debug = xtrue)
if test x$debug = xtrue; then
AC_DEFINE(HAVE_DEBUG,1,"debug output")
fi
#- perl flag
AC_ARG_ENABLE(perl,
AC_HELP_STRING([--enable-perl],[Enable uses of the Perl interpreter (default is NO)]),
[case "${enableval}" in
yes) perl=true ;;
no) perl=false ;;
*) AC_MSG_ERROR(bad_value ${enableval} for
--enable-perl) ;;
esac],[perl=false])
if test x$perl = xtrue; then
AC_PATH_PROG([PERL],[perl])
AS_IF([test -n "$PERL"],[
AC_DEFINE(HAVE_PERL,1,Perl)
AM_CONDITIONAL(USE_PERL,true)
],[])
else
AM_CONDITIONAL(USE_PERL,false)
fi
#==========================================================================
# Finding pthreads
#==========================================================================
AC_CHECK_LIB(pthread, pthread_join, [PTHREAD_LDADD=-lpthread], [PTHREAD_LDADD=''])
AC_SUBST(PTHREAD_LDADD)
#==========================================================================
# Finding curl
#==========================================================================
# First, check for the curl-config tool
AC_PATH_PROGS(CURL_CONFIG, curl-config, no)
if test x$CURL_CONFIG = xno; then
AC_MSG_ERROR(curl-config not found; verify that libcurl is installed on your system)
fi
CURL_LDADD=`$CURL_CONFIG --libs`
AC_SUBST(CURL_LDADD)
CURL_CFLAGS=`$CURL_CONFIG --cflags`
AC_SUBST(CURL_CFLAGS)
#==========================================================================
# Finding libxml2
#==========================================================================
# First, check for the xml2-config tool
AC_PATH_PROGS(XML2_CONFIG, xml2-config, no)
if test x$XML2_CONFIG = xno; then
AC_MSG_ERROR(xml2-config not found; verify that libxml2 is installed on your system)
fi
XML2_LDADD=`$XML2_CONFIG --libs`
AC_SUBST(XML2_LDADD)
XML2_CFLAGS=`$XML2_CONFIG --cflags`
AC_SUBST(XML2_CFLAGS)
#==========================================================================
# Finding libpcre
#==========================================================================
AC_PATH_PROGS(PCRE_CONFIG, pcre-config, no)
if test x$PCRE_CONFIG = xno; then
AC_MSG_ERROR(pcre-config not found; verify that libpcre is installed on your system)
fi
PCRE_LDADD=`$PCRE_CONFIG --libs`
AC_SUBST(PCRE_LDADD)
PCRE_CFLAGS=`$PCRE_CONFIG --cflags`
AC_SUBST(PCRE_CFLAGS)
#==========================================================================
# Finding docbook2x-man
#==========================================================================
AC_CHECK_PROGS(DOCBOOK,[docbook2x-man db2x_docbook2man])
if test "${DOCBOOK}x" = "x"; then
AM_CONDITIONAL(HAVE_DOCBOOK2X,false)
else
AM_CONDITIONAL(HAVE_DOCBOOK2X,true)
fi
#==========================================================================
# Finding icu
#==========================================================================
AC_ARG_ENABLE(icu,
AC_HELP_STRING([--disable-icu], [Don't use icu to detect and convert non-UTF8 strings (default is NO)]),
[enableval2=$enableval],
[enableval2=yes])
if test $enableval2 = yes; then
# First, check for the icu-config tool
AC_PATH_PROGS(ICU_CONFIG, icu-config, no)
if test x$ICU_CONFIG = xno; then
AM_CONDITIONAL(HAVE_ICU,false)
else
AC_DEFINE(FEATURE_ICU,1,"ICU library is there")
AM_CONDITIONAL(HAVE_ICU,true)
ICU_LDADD=`$ICU_CONFIG --ldflags`
AC_SUBST(ICU_LDADD)
ICU_CFLAGS=`$ICU_CONFIG --cppflags`
AC_SUBST(ICU_CFLAGS)
fi
else
AM_CONDITIONAL(HAVE_ICU,false)
fi
#ICU_LDADD=`$ICU_CONFIG --ldflags`
#AC_SUBST(ICU_LDADD)
#ICU_CFLAGS=`$ICU_CONFIG --cppflags`
#AC_SUBST(ICU_CFLAGS)
#====================================================
# This check is incomplete. For mingw32 zlib is found
# by configure, but not necessarily by the compiler.
#====================================================
AC_ARG_ENABLE(zlib,
AC_HELP_STRING([--disable-zlib], [Don't use zlib to decompress data before filtering (default is NO)]),
[enableval2=$enableval],
[enableval2=yes])
if test $enableval2 = yes; then
AC_CHECK_LIB(z, zlibVersion, [have_zlib="yes"], [have_zlib="no"])
if test $have_zlib = "yes"; then
LIBS="$LIBS -lz"
AC_DEFINE(FEATURE_ZLIB,1,[Define to 1 to use compression through the zlib library.])
else
AC_MSG_WARN([No zlib found.
The proxy will not be able to filter compressed content.
This may become a fatal error in the future.])
fi
fi
#====================================================
# check for TR1 unordered_map and unordered_set headers
#====================================================
AC_CHECK_HEADER([tr1/unordered_map],
[AC_CACHE_CHECK([for TR1 unordered_map and unordered_set],
_cv_stdtr1mapset,
[AC_TRY_COMPILE([#include <tr1/unordered_map>
#include <tr1/unordered_set>],
[std::tr1::unordered_map<double*, char*, std::tr1::hash<double*>, std::equal_to<double*> > test1;
std::tr1::unordered_set<char*, std::tr1::hash<char*>, std::equal_to<char*> > test2;],
_cv_stdtr1mapset=yes,
_cv_stdtr1mapset=no) ] )], [], [ ] )
if test "$_cv_stdtr1mapset" = yes; then
AC_DEFINE(HAVE_TR1_HASH_MAP,1,"Have tr1 hash map")
fi
#====================================================
# HTTP server plugin activation.
#====================================================
AC_ARG_ENABLE(httpserv-plugin,
AC_HELP_STRING([--enable-httpserv-plugin],[Enable the Seeks HTTP server plugin (default is NO)]),
[case "${enableval}" in
yes) httpservplugin=true ;;
no) httpservplugin=false ;;
*) AC_MSG_ERROR(bad_value ${enableval} for
--enable-httpserv-plugin) ;;
esac],[httpservplugin=false])
AM_CONDITIONAL(HAVE_HTTPSERV_PLUGIN,test x$httpservplugin = xtrue)
if test x$httpservplugin = xtrue; then
AC_DEFINE(FEATURE_HTTPSERV_PLUGIN,1,"HTTP server plugin available")
fi
#====================================================
# Image websearch plugin activation.
#====================================================
AC_ARG_ENABLE(image-websearch-plugin,
AC_HELP_STRING([--enable-image-websearch-plugin],[Enable the Seeks image websearch plugin (default is YES)]),
[case "${enableval}" in
yes) imgwebsearch=true ;;
no) imgwebsearch=false ;;
*) AC_MSG_ERROR(bad_value ${enableval} for
--enable-image-websearch-plugin) ;;
esac],[imgwebsearch=true])
AM_CONDITIONAL(HAVE_IMG_WEBSEARCH_PLUGIN,test x$imgwebsearch = xtrue)
if test x$imgwebsearch = xtrue; then
AC_DEFINE(FEATURE_IMG_WEBSEARCH_PLUGIN,1,"Image websearch plugin available")
fi
# Requires OpenCV >= 2.0
# XXX: configure / pkg-config madness: if the PKG_CHECK_MODULES
# is put within the if / else conditional, no other pkg-config
# libraries are detected.
PKG_CHECK_MODULES([opencv],[opencv >= 2.0],opencv2=true,opencv2=false)
AC_ARG_ENABLE(opencv,
AC_HELP_STRING([--disable-opencv],[Don't use opencv (activates image similarity analysis) (default is NO)]),
[enableval2=$enableval],
[enableval2=yes])
if test $enableval2 = yes; then
# PKG_CHECK_MODULES([opencv],[opencv >= 2.0],opencv2=true,opencv2=false)
if test x$opencv2 = xtrue; then
AC_DEFINE(FEATURE_OPENCV2,1,"OpenCV library is there")
fi
AM_CONDITIONAL(HAVE_OPENCV2,test x$opencv2 = xtrue)
else
AC_SUBST(opencv2,false)
AM_CONDITIONAL(HAVE_OPENCV2,false)
fi
#====================================================
# XML/XSL serialization plugin activation.
#====================================================
AC_ARG_ENABLE(xslserializer-plugin,
AC_HELP_STRING([--enable-xslserializer-plugin],[Enable the Seeks XML/XSLT serializer (default is NO)]),
[case "${enableval}" in
yes) xslserializerplugin=true ;;
no) xslserializerplugin=false ;;
*) AC_MSG_ERROR(bad_value ${enableval} for
--enable-xslserializer-plugin) ;;
esac],[xslserializerplugin=false])
AM_CONDITIONAL(HAVE_XSLSERIALIZER_PLUGIN,test x$xslserializerplugin = xtrue)
if test x$xslserializerplugin = xtrue; then
#check for libxslt
# First, check for the xsl-config tool
AC_PATH_PROGS(XSLT_CONFIG, xslt-config, no)
if test x$XSLT_CONFIG = xno; then
AC_MSG_ERROR(xslt-config not found; verify that libxslt is installed on your system)
fi
XSLT_LDADD=`$XSLT_CONFIG --libs`
AC_SUBST(XSLT_LDADD)
XSLT_CFLAGS=`$XSLT_CONFIG --cflags`
AC_SUBST(XSLT_CFLAGS)
AC_DEFINE(FEATURE_XSLSERIALIZER_PLUGIN,1,"XSL serializer plugin available")
fi
#====================================================
# libevent detection.
#====================================================
trylibeventdir=""
AC_ARG_WITH(libevent,
[ --with-libevent=PATH specify path to libevent installation ],
[
if test "x$withval" != "xno" ; then
trylibeventdir=$withval
fi
]
)
AC_CACHE_CHECK([for libevent], ac_cv_libevent_dir, [
saved_LIBS="$LIBS"
saved_LDFLAGS="$LDFLAGS"
saved_CFLAGS="$CFLAGS"
le_found=no
for ledir in $trylibeventdir "" $prefix /usr ; do
LDFLAGS="$saved_LDFLAGS"
LIBS="$saved_LIBS -levent"
# Skip the directory if it isn't there.
if test ! -z "$ledir" -a ! -d "$ledir" ; then
continue;
fi
if test ! -z "$ledir" ; then
if test -d "$ledir/lib" ; then
LDFLAGS="-L$ledir/lib $LDFLAGS"
else
LDFLAGS="-L$ledir $LDFLAGS"
fi
if test -d "$ledir/include" ; then CPPFLAGS="-I$ledir/include $CFLAGS"
else CPPFLAGS="-I$ledir $CFLAGS"
fi
fi
# attempt to compile and link
AC_TRY_LINK([
#include <sys/time.h>
#include <sys/types.h>
#include <event.h>
], [ event_init(); ],
[ libevent_linked=yes ],
[ libevent_linked=no ])
if test $libevent_linked = yes; then
if test ! -z "$ledir" ; then
ac_cv_libevent_dir=$ledir
else
ac_cv_libevent_dir="(system)"
fi
le_found=yes
break
fi
done
LIBS="$saved_LIBS"
LDFLAGS="$saved_LDFLAGS"
CPPFLAGS="$saved_CPPFLAGS"
if test $le_found = no ; then
if test $httpserv-plugin = true ; then
AC_MSG_ERROR([libevent not found!
You can get it here: http://www.monkey.org/~provos/libevent/
If it's already installed, specify its path using --with-libevent=PATH
])
fi
fi
])
#LIBS="$LIBS -levent"
if test "$le_found" = yes; then
if test "$ac_cv_libevent_dir" != "(system)"; then
if test -d "$ac_cv_libevent_dir/lib" ; then
LDFLAGS="-L$ac_cv_libevent_dir/lib $LDFLAGS"
le_libdir="$ac_cv_libevent_dir/lib"
else
LDFLAGS="-L$ac_cv_libevent_dir $LDFLAGS"
le_libdir="$ac_cv_libevent_dir"
fi
if test -d "$ac_cv_libevent_dir/include" ; then
CPPFLAGS="-I$ac_cv_libevent_dir/include $CPPFLAGS"
else
CPPFLAGS="-I$ac_cv_libevent_dir $CPPFLAGS"
fi
fi
fi
AM_CONDITIONAL(HAVE_LIBEVENT,test x$le_found = xtrue)
# check whether libevent-1.x is forced.
AC_ARG_ENABLE(libevent1,
AC_HELP_STRING([--enable-libevent1],[Forces the use of libevent-1.x (default is NO)]),
[case "${enableval}" in
yes) libevent1=true ;;
no) libevent1=false ;;
*) AC_MSG_ERROR(bad_value ${enableval} for
--enable-libevent1) ;;
esac],[libevent1=false])
if test x$libevent1 = xtrue; then
AC_DEFINE(HAVE_LEVENT1,1,"libevent-1.x used to build the HTTP server")
fi
# plugin variables.
AC_SUBST(uricapture,true)
AC_SUBST(querycapture,true)
AC_SUBST(cf,true)
AC_SUBST(udbservice,true)
# deactivate personalization.
AC_ARG_ENABLE(personalization,
AC_HELP_STRING([--enable-personalization],[Enable storage of past queries and results for personalization (default is YES)]),
[case "${enableval}" in
yes) personalization=true ;;
no) personalization=false ;;
*) AC_MSG_ERROR(bad_value ${enableval} for
--enable-personalization) ;;
esac],[personalization=true])
if test $personalization = false ; then
AC_SUBST(uricapture,false)
AC_SUBST(querycapture,false)
AC_SUBST(cf,false)
AC_SUBST(udbservice,false)
fi
if test $personalization = true ; then
# check on protocol buffers.
PKG_CHECK_MODULES([protobuf],[protobuf >= 2.2],protobuf=true,protobuf=false)
if test $protobuf = true ; then
AC_DEFINE(PROTOBUF,1,"Protocol buffers available")
fi
AM_CONDITIONAL(HAVE_PROTOBUF,test x$protobuf = xtrue)
if test $protobuf = false ; then
AC_SUBST(uricapture,false)
AC_SUBST(querycapture,false)
AC_SUBST(cf,false)
AC_SUBST(udbservice,false)
AC_SUBST(personalization,false)
fi
# check on tokyo cabinet.
PKG_CHECK_MODULES([tokyocabinet],[tokyocabinet],tokyocabinet=true,tokyocabinet=false)
if test $tokyocabinet = true ; then
AC_DEFINE(TC,1,"Tokyo Cabinet available")
fi
AM_CONDITIONAL(HAVE_TC,test x$tokyocabinet = xtrue)
# check on tokyo tyrant.
PKG_CHECK_MODULES([tokyotyrant],[tokyotyrant],tokyotyrant=true,tokyotyrant=false)
if test $tokyotyrant = true ; then
AC_DEFINE(TT,1,"Tokyo Tyrant available")
fi
AM_CONDITIONAL(HAVE_TT,test x$tokyotyrant = xtrue)
# deactivate personalization if no support for db.
if test $tokyocabinet = false ; then
if test $tokyotyrant = false ; then
AC_SUBST(uricapture,false)
AC_SUBST(querycapture,false)
AC_SUBST(cf,false)
AC_SUBST(udbservice,false)
AC_SUBST(personalization,false)
fi
fi
else
AM_CONDITIONAL(HAVE_TC,false)
AM_CONDITIONAL(HAVE_TT,false)
AM_CONDITIONAL(HAVE_PROTOBUF,false)
fi # end of personalization is true.
# connection keep alive.
AC_ARG_ENABLE(keepalive,
AC_HELP_STRING([--enable-keepalive],[Enable keeping outgoing connections alive (default is NO)]),
[case "${enableval}" in
yes) keepalive=true ;;
no) keepalive=false ;;
*) AC_MSG_ERROR(bad_value ${enableval} for
--enable-keepalive) ;;
esac],[keepalive=false])
AM_CONDITIONAL(KEEP_ALIVE,test x$keepalive = xtrue)
if test x$keepalive = xtrue; then
AC_DEFINE(FEATURE_CONNECTION_KEEP_ALIVE,1,"Keep outgoing connections alive if possible")
fi
# extended host patterns.
AC_ARG_ENABLE(extended-host-patterns,
AC_HELP_STRING([--enable-extended-host-patterns Allow extended regular expressions in host patterns (default is NO)]),
[if test $enableval = yes; then
AC_DEFINE(FEATURE_EXTENDED_HOST_PATTERNS,1,"Allow extended regular expressions in host patterns")
fi])
# remaining configuration flags.
AC_DEFINE(STATIC_PCRS,1,"using internal pcrs")
AC_DEFINE(FEATURE_STATISTICS,1,"Enables statistics function")
AC_DEFINE(FEATURE_FAST_REDIRECTS,1,"Supports fast redirects")
AC_DEFINE(FEATURE_ACL,1,"Allows the user of an ACL to control access to the proxy by IP address")
AC_DEFINE(FEATURE_TOGGLE,1,"Allow Seeks proxy to be disabled")
# Code testing coverage with lcov
# Because of gcc --coverage shortcomings here is what needs to be done for
# coverage:
#
# ./configure ; make all
# ./configure --enable-lcov --disable-shared
# make all ; make check
#
# And the coverage report can be found in the coverage directory.
# For more information http://redmine.seeks-project.info/issues/159
#
AC_MSG_CHECKING(whether to build with lcov testing)
AC_ARG_ENABLE(lcov, AS_HELP_STRING([--enable-lcov], [Whether to enable lcov testing]),, enable_lcov=no)
if test "x$enable_lcov" = "xyes"; then
if test "$GCC" = "no"; then
AC_MSG_ERROR(not compiling with gcc, which is required for lcov testing)
fi
AC_PATH_PROG([LCOV],[lcov])
AC_PATH_PROG([GENHTML],[genhtml])
LCOV_CFLAGS="-fprofile-arcs -ftest-coverage"
LCOV_LIBS="-lgcov"
AC_SUBST(LCOV_CFLAGS)
AC_SUBST(LCOV_LIBS)
fi
AM_CONDITIONAL(LCOV_ENABLED, test x$enable_lcov = xyes)
AC_MSG_RESULT($enable_lcov)
# GoogleMock currently has hard dependencies upon GoogleTest above and beyond
# running its own test suite, so we both provide our own version in
# a subdirectory and provide some logic to use a custom version or a system
# installed version.
AC_ARG_WITH([gtest],
[AS_HELP_STRING([--with-gtest],
[Specifies how to find the gtest package. If no
arguments are given, the default behavior, a
system installed gtest will be used if present,
and an internal version built otherwise. If a
path is provided, the gtest built or installed at
that prefix will be used.])],
[],
[with_gtest=yes])
AC_ARG_ENABLE([external-gtest],
[AS_HELP_STRING([--disable-external-gtest],
[Disables any detection or use of a system
installed or user provided gtest. Any option to
'--with-gtest' is ignored. (Default is enabled.)])
], [], [enable_external_gtest=yes])
AS_IF([test "x$with_gtest" == "xno"],
[AC_MSG_ERROR([dnl
Support for GoogleTest was explicitly disabled. Currently GoogleMock has a hard
dependency upon GoogleTest to build, please provide a version, or allow
GoogleMock to use any installed version and fall back upon its internal
version.])])
# Setup various GTEST variables. TODO(chandlerc@google.com): When these are
# used below, they should be used such that any pre-existing values always
# trump values we set them to, so that they can be used to selectively override
# details of the detection process.
AC_ARG_VAR([GTEST_CONFIG],
[The exact path of Google Test's 'gtest-config' script.])
AC_ARG_VAR([GTEST_CPPFLAGS],
[C-like preprocessor flags for Google Test.])
AC_ARG_VAR([GTEST_CXXFLAGS],
[C++ compile flags for Google Test.])
AC_ARG_VAR([GTEST_LDFLAGS],
[Linker path and option flags for Google Test.])
AC_ARG_VAR([GTEST_LIBS],
[Library linking flags for Google Test.])
AC_ARG_VAR([GTEST_VERSION],
[The version of Google Test available.])
HAVE_BUILT_GTEST="no"
GTEST_MIN_VERSION="1.4.0"
AS_IF([test "x${enable_external_gtest}" = "xyes"],
[# Begin filling in variables as we are able.
AS_IF([test "x${with_gtest}" != "xyes"],
[AS_IF([test -x "${with_gtest}/scripts/gtest-config"],
[GTEST_CONFIG="${with_gtest}/scripts/gtest-config"],
[GTEST_CONFIG="${with_gtest}/bin/gtest-config"])
AS_IF([test -x "${GTEST_CONFIG}"], [],
[AC_MSG_ERROR([dnl
Unable to locate either a built or installed Google Test at '${with_gtest}'.])
])])
AS_IF([test -x "${GTEST_CONFIG}"], [],
[AC_PATH_PROG([GTEST_CONFIG], [gtest-config])])
AS_IF([test -x "${GTEST_CONFIG}"],
[AC_MSG_CHECKING([for Google Test version >= ${GTEST_MIN_VERSION}])
AS_IF([${GTEST_CONFIG} --min-version=${GTEST_MIN_VERSION}],
[AC_MSG_RESULT([yes])
HAVE_BUILT_GTEST="yes"],
[AC_MSG_RESULT([no])])])])
if test "x$HAVE_BUILT_GTEST" = "xyes" ; then
AS_IF([test "x${HAVE_BUILT_GTEST}" = "xyes"],
[GTEST_CPPFLAGS=`${GTEST_CONFIG} --cppflags`
GTEST_CXXFLAGS=`${GTEST_CONFIG} --cxxflags`
GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
GTEST_LIBS=`${GTEST_CONFIG} --libs`
GTEST_VERSION=`${GTEST_CONFIG} --version`],
[AC_CONFIG_SUBDIRS([gtest])
# GTEST_CONFIG needs to be executable both in a Makefile environmont and
# in a shell script environment, so resolve an absolute path for it here.
GTEST_CONFIG="`pwd -P`/gtest/scripts/gtest-config"
GTEST_CPPFLAGS='-I$(top_srcdir)/gtest/include'
GTEST_CXXFLAGS='-g'
GTEST_LDFLAGS=''
GTEST_LIBS='$(top_builddir)/gtest/lib/libgtest.la'
GTEST_VERSION="${GTEST_MIN_VERSION}"])
fi
if test "x$HAVE_BUILT_GTEST" = "xno" ; then
AC_SUBST(with_gtest,no)
fi
######################################################################
# DOXYGEN SUPPORT
######################################################################
DX_HTML_FEATURE(ON)
DX_CHM_FEATURE(OFF)
DX_CHI_FEATURE(OFF)
DX_MAN_FEATURE(OFF)
DX_RTF_FEATURE(OFF)
DX_XML_FEATURE(OFF)
DX_PDF_FEATURE(OFF)
DX_PS_FEATURE(OFF)
DX_INIT_DOXYGEN([$PACKAGE_NAME],[doc/seeks.dox],[doc/doxygen])
######################################################################
AC_CONFIG_FILES(Makefile doc/Makefile src/Makefile \
src/lsh/Makefile \
src/lsh/tests/Makefile \
src/dht/Makefile \
src/dht/tests/Makefile \
src/proxy/Makefile \
src/proxy/tests/Makefile \
src/plugins/Makefile \
src/plugins/websearch/Makefile \
src/plugins/websearch/tests/Makefile \
src/plugins/websearch_api_compat/Makefile \
src/plugins/img_websearch/Makefile \
src/plugins/img_websearch/tests/Makefile \
src/plugins/httpserv/Makefile \
src/plugins/blocker/Makefile \
src/plugins/no_tracking/Makefile \
src/plugins/uri_capture/Makefile \
src/plugins/uri_capture/tests/Makefile \
src/plugins/query_capture/Makefile \
src/plugins/query_capture/tests/Makefile \
src/plugins/cf/Makefile \
src/plugins/cf/tests/Makefile \
src/plugins/udb_service/Makefile \
src/plugins/udb_service/tests/Makefile \
src/plugins/xsl_serializer/Makefile \
src/plugins/readable/Makefile \
src/plugins/readable/tests/Makefile \
src/cli/Makefile \
src/utils/Makefile \
src/utils/tests/Makefile)
AC_OUTPUT
AC_MSG_NOTICE([Configured to build seeks:
Seeks version: ${VERSION}
Code status: ${cstatus}
Host setup: ${host}
Install prefix: ${prefix}
Compiler: ${CC}
Personalization: ${personalization}
Dependencies:
OpenCV-2.x: ${opencv2}
libevent: ${le_found}
protobuf: ${protobuf}
tokyocabinet: ${tokyocabinet}
tokyotyrant: ${tokyotyrant}
icu: ${ICU_CONFIG}
Testing:
gtest ${with_gtest}
Enabled plugins:
image websearch: ${imgwebsearch}
HTTP server: ${httpservplugin}
query capture: ${querycapture}
URI capture: ${uricapture}
Personalization: ${cf}
User DB service: ${udbservice}
XSL serializer: ${xslserializerplugin}
])