forked from sphinxsearch/sphinx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
778 lines (655 loc) · 22.2 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
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([sphinx], [2.2.8], [shodan(at)sphinxsearch.com])
dnl --------------------------------------------------------------------------
SPHINX_CONFIGURE_PART([checking build environment])
AC_CONFIG_AUX_DIR([config])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AM_MAINTAINER_MODE
AC_CONFIG_SRCDIR([src/searchd.cpp])
AC_CONFIG_HEADER([config/config.h])
# hack to locate expat/iconv in /usr/local on BSD systems
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
LIBS="$LIBS -L/usr/local/lib"
dnl --------------------------------------------------------------------------
# enable silent (without compiler/linker commands) build by default
AM_SILENT_RULES([yes])
SPHINX_CONFIGURE_PART([checking for compiler programs])
AC_ARG_WITH([debug],
AC_HELP_STRING([--with-debug], [compile slower debug version (default is disabled)]),
[ac_cv_use_debug=$withval], [ac_cv_use_debug=no]
)
AC_ARG_WITH([assert],
AC_HELP_STRING([--with-assert], [compile optimized build but with debugging assertions (default is disabled)]),
[ac_cv_use_assert=$withval], [ac_cv_use_assert=no]
)
AC_MSG_CHECKING([whether to compile debug version])
if test x$ac_cv_use_debug != xno; then
SPHINX_CFLAGS="-fno-rtti -Wall -g -D_FILE_OFFSET_BITS=64"
SPHINX_INJECT_FLAGS="-D_FILE_OFFSET_BITS=64"
AC_MSG_RESULT([yes])
else
if test x$ac_cv_use_assert != xno; then
SPHINX_CFLAGS="-fno-rtti -Wall -g -D_FILE_OFFSET_BITS=64 -O2"
SPHINX_INJECT_FLAGS="-D_FILE_OFFSET_BITS=64"
AC_MSG_RESULT([asserts only])
else
SPHINX_CFLAGS="-fno-rtti -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG"
SPHINX_INJECT_FLAGS="-D_FILE_OFFSET_BITS=64 -DNDEBUG"
AC_MSG_RESULT([no])
fi
fi
dnl set flags for C compiler if there are no user overrides
dnl inject required defines if there are
if test x$ac_env_CFLAGS_set != xset; then
CFLAGS=$SPHINX_CFLAGS
else
CFLAGS="$CFLAGS $SPHINX_INJECT_FLAGS"
fi
dnl set flags for C++ compiler if there are no user overrides
dnl inject required defines if there are
if test x$ac_env_CXXFLAGS_set != xset; then
CXXFLAGS=$SPHINX_CFLAGS
else
CXXFLAGS="$CXXFLAGS $SPHINX_INJECT_FLAGS"
fi
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#ifdef __GNUC__
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)
int main() {}
#else
syntax error
#endif
#endif
])], [], [AC_MSG_ERROR([Gcc version error. Minspec is 3.4])])
AC_DEFINE_UNQUOTED([COMPILER],"$CC `$CC -dumpversion`",[Define to be the name of the compiler.])
AC_DEFINE_UNQUOTED([OS_UNAME],"`uname -a`",[Full name OS])
AC_DEFINE_UNQUOTED([CONFIGURE_FLAGS],"$ac_configure_args",[Flags used to configure me])
dnl --------------------------------------------------------------------------
SPHINX_CONFIGURE_PART([checking for header files])
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([fcntl.h limits.h netdb.h netinet/in.h stdlib.h string.h sys/file.h sys/socket.h sys/time.h unistd.h pthread.h execinfo.h sys/epoll.h])
AC_CHECK_HEADER(expat.h,[have_expat_h=yes],[have_expat_h=no])
AC_CHECK_HEADER(iconv.h,[have_iconv_h=yes],[have_iconv_h=no])
AC_CHECK_HEADER(zlib.h,[have_zlib_h=yes],[have_zlib_h=no])
AC_CHECK_HEADER(sql.h,[have_sql_h=yes],[have_sql_h=no])
AC_CHECK_HEADER(syslog.h,[have_syslog_h=yes],[have_syslog_h=no])
dnl --------------------------------------------------------------------------
SPHINX_CONFIGURE_PART([checking for types])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
dnl --------------------------------------------------------------------------
SPHINX_CONFIGURE_PART([checking for library functions])
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_SEARCH_LIBS([setsockopt],[socket])
AC_SEARCH_LIBS([gethostbyname],[nsl socket resolv])
AC_SEARCH_LIBS([inflate],[z],[have_lz=yes],[have_lz=no])
AC_SEARCH_LIBS([logf],[m])
AC_CHECK_FUNCS([dup2 gethostbyname gettimeofday memmove memset select socket strcasecmp strchr strerror strncasecmp strnlen strstr strtol logf pread poll])
AC_CHECK_FUNCS([backtrace backtrace_symbols])
# Neither defined or undefined. So, check.
if test "z$ac_cv_func_epoll" != "zno" && test "z$ac_cv_func_epoll" != "zyes" ; then
AC_CHECK_FUNCS(epoll_ctl, [ac_cv_func_epoll=yes], )
fi
if test "x$ac_cv_func_epoll" = "xyes" && test "x$ac_cv_header_sys_epoll_h" = "xyes" ; then
AC_DEFINE(HAVE_EPOLL, 1,
[Define if your system supports the epoll system calls])
AC_LIBOBJ(epoll)
fi
# most systems require the program be linked with librt library to use
# the function clock_gettime
my_save_LIBS="$LIBS"
LIBS=""
AC_CHECK_LIB(rt,clock_gettime)
LIBRT=$LIBS
LIBS="$my_save_LIBS"
AC_SUBST(LIBRT)
LIBS="$LIBS $LIBRT"
AC_CHECK_FUNCS(clock_gettime)
SPHINX_CHECK_DEFINE(LOCK_EX,sys/file.h)
SPHINX_CHECK_DEFINE(F_SETLKW,fcntl.h)
# check for dlopen
# FIXME! technically, only needed in searchd
# but as UDF manager is curently in libsphinx, we link everything
AC_SEARCH_LIBS([dlopen],[dl dld],[],[])
AC_CHECK_FUNCS(dlopen dlerror)
# check for interlocked increment and decrement in linux
dnl helper that runs a test program and checks for success
interlocked_prog="
int interlocked_routine ( )
{
volatile int ia=0;
__sync_fetch_and_add( &ia, 1 ); // atomic increment
__sync_fetch_and_sub( &ia, 1 ); // atomic decrement
}
int main ()
{
int m = interlocked_routine();
return 0;
}
"
# check the availability of needed function
AC_CACHE_CHECK([for interlocked builtins], [sphinx_cv_interlocked],
[
AC_TRY_RUN($interlocked_prog, [sphinx_cv_interlocked=yes], [sphinx_cv_interlocked=no], [
AC_COMPILE_IFELSE([AC_LANG_SOURCE($interlocked_prog)], [sphinx_cv_interlocked=yes], [sphinx_cv_interlocked=no])
])
])
# final check
if test x$sphinx_cv_interlocked = xyes; then
AC_DEFINE(HAVE_SYNC_FETCH,1,[Whether we have internal atomic functions])
fi
dnl --------------------------------------------------------------------------
SPHINX_CONFIGURE_PART([configuring Sphinx])
dnl -----------
dnl Whether we use runtime dlopen for loading dynamic external libs like mysql, posgres, etc.
dnl instead of hard linking on build.
AC_MSG_CHECKING([whether to use dynamic linking for DB drivers])
sph_usedl=no
AC_ARG_ENABLE([dl],
AC_HELP_STRING([--enable-dl], [dynamically load DB drivers (like MySQL, Postgres, etc) rather than statically linking with them]),
[ac_cv_use_dl_libs=$enableval])
if test x$ac_cv_use_dl_libs == xyes ; then
if test x$ac_cv_func_dlopen == xyes ; then
AC_MSG_RESULT([yes])
sph_usedl=yes
else
AC_MSG_RESULT([not possible (no dlopen)])
fi
else
AC_MSG_RESULT([no])
fi
dnl ---
# check for pthreads
dnl helper that runs a test program and checks for success
pthread_prog="
#include <pthread.h>
#include <stddef.h>
void * thread_routine ( void * data )
{
return data;
}
int main ()
{
pthread_t thd;
pthread_mutexattr_t mattr;
pthread_once_t once_init = PTHREAD_ONCE_INIT;
int data = 1;
pthread_mutexattr_init ( &mattr );
return pthread_create ( &thd, NULL, thread_routine, &data );
}
"
AC_DEFUN([PTHREADS_TRY_RUNCOMPILE],[
if test x$cross_compiling = xno ; then
AC_TRY_RUN($pthread_prog, [pthreads_try_run=yes], [pthreads_try_run=no], [pthreads_try_run=no])
if test x$pthreads_try_run = xyes ; then
$1
fi
else
AC_COMPILE_IFELSE([AC_LANG_SOURCE($pthread_prog)], [pthreads_try_compile=yes], [pthreads_try_compile=no], [pthreads_try_compile=no])
if test x$pthreads_try_compile = xyes ; then
$1
fi
fi
])
AC_DEFUN([PTHREADS_TRY_RUNLINK],[
if test x$cross_compiling = xno ; then
AC_TRY_RUN($pthread_prog, [pthreads_try_run=yes], [pthreads_try_run=no], [pthreads_try_run=no])
if test x$pthreads_try_run = xyes ; then
$1
fi
else
AC_LINK_IFELSE([AC_LANG_SOURCE($pthread_prog)], [pthreads_try_link=yes], [pthreads_try_link=no], [pthreads_try_link=no])
if test x$pthreads_try_link = xyes ; then
$1
fi
fi
])
# check for needed cflags
AC_CACHE_CHECK([for CFLAGS needed for pthreads], [sphinx_cv_pthreads_cflags],
[
save_cflags=$CFLAGS
for flag in none -kthread -pthread -pthreads -mt -mthreads -Kthread -threads; do
CFLAGS=$save_cflags
test "x$flag" != "xnone" && CFLAGS="$CFLAGS $flag"
PTHREADS_TRY_RUNCOMPILE([
sphinx_cv_pthreads_cflags="$flag"
break
])
done
CFLAGS=$save_cflags
])
if test -n "$sphinx_cv_pthreads_cflags"; then
have_pthreads=yes
if test "x$sphinx_cv_pthreads_cflags" != "xnone"; then
CPPFLAGS="$CPPFLAGS $sphinx_cv_pthreads_cflags"
fi
fi
# check for needed libs
AC_CACHE_CHECK([for LIBS needed for pthreads], [sphinx_cv_pthreads_libs], [
save_libs=$LIBS
for lib in -lpthread -lpthreads -lc_r; do
LIBS="$save_libs $lib"
PTHREADS_TRY_RUNLINK([
sphinx_cv_pthreads_libs=$lib
break
])
done
LIBS=$save_libs
])
if test -n "$sphinx_cv_pthreads_libs"; then
have_pthreads=yes
LIBS="$LIBS $sphinx_cv_pthreads_libs"
fi
# final check
AC_MSG_CHECKING([for pthreads])
if test x$have_pthreads = xyes; then
if test x$cross_compiling = xno; then
AC_MSG_RESULT([found])
else
AC_MSG_RESULT([assumed as found (cross-compiling)])
fi
else
AC_MSG_ERROR([no working pthreads library found])
fi
AC_CHECK_FUNCS([pthread_mutex_timedlock])
dnl ---
# check if we should compile with MySQL support
AC_ARG_WITH([mysql],
AC_HELP_STRING([--with-mysql], [compile with MySQL support (default is enabled)]),
[ac_cv_use_mysql=$withval], [ac_cv_use_mysql=yes]
)
# check if we should statically link the mysql library
AC_ARG_WITH([static-mysql],
AC_HELP_STRING([--with-static-mysql], [link statically with MySQL library (default is no)]),
[ac_cv_use_static_mysql=$withval], [ac_cv_use_static_mysql=no]
)
AC_MSG_CHECKING([whether to compile with MySQL support])
if test x$ac_cv_use_static_mysql != xno -o x$ac_cv_use_mysql != xno
then
dl_mysql=0
if test x$ac_cv_use_static_mysql != xno ; then
AC_MSG_RESULT([static])
AC_CHECK_MYSQL([$ac_cv_use_static_mysql])
MYSQL_LIBS=`echo $MYSQL_LIBS | sed -e "sX-lmysqlclientX\$MYSQL_PKGLIBDIR/libmysqlclient.aXg"`
else
if test x$sph_usedl == xyes ; then
AC_MSG_RESULT([runtime dynamic])
AC_CHECK_MYSQL([$ac_cv_use_mysql])
MYSQL_LIBS=""
dl_mysql=1
else
AC_MSG_RESULT([dynamic])
AC_CHECK_MYSQL([$ac_cv_use_mysql])
fi
fi
AC_DEFINE(USE_MYSQL,1,[Define to 1 if you want to compile with MySQL support])
AC_DEFINE_UNQUOTED(DL_MYSQL,$dl_mysql,[Define to 1 if you want runtime load mysql using dlopen])
AC_SUBST([MYSQL_LIBS])
AC_SUBST([MYSQL_CFLAGS])
else
AC_MSG_RESULT([no])
fi
AM_CONDITIONAL(USE_MYSQL, test x$ac_cv_use_mysql != xno -o x$ac_cv_use_static_mysql != xno )
dnl ---
AC_ARG_WITH([syslog],
AC_HELP_STRING([--with-syslog], [compile with possibility to use syslog for logging (default is yes)]),
[ac_cv_use_syslog=$withval], [ac_cv_use_syslog=yes]
)
AC_MSG_CHECKING([for Syslog])
if test [ $ac_cv_use_syslog != no ]; then
if test [ $have_syslog_h = yes ]; then
AC_DEFINE([USE_SYSLOG],1,[define to use POSIX Syslog for logging])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
else
AC_MSG_RESULT([disabled])
fi
# check if we should compile with PostgreSQL support
AC_ARG_WITH([pgsql],
AC_HELP_STRING([--with-pgsql], [compile with PostgreSQL support (default is disabled)]),
[ac_cv_use_pgsql=$withval], [ac_cv_use_pgsql=no]
)
# check if we should statically link the PostgreSQL library
AC_ARG_WITH([static-pgsql],
AC_HELP_STRING([--with-static-pgsql], [link statically with PostgreSQL library (default is no)]),
[ac_cv_use_static_pgsql=$withval], [ac_cv_use_static_pgsql=no]
)
AC_MSG_CHECKING([whether to compile with PostgreSQL support])
if test x$ac_cv_use_static_pgsql != xno -o x$ac_cv_use_pgsql != xno
then
dl_pgsql=0
if test x$ac_cv_use_static_pgsql != xno ; then
AC_MSG_RESULT([static])
AC_CHECK_PGSQL([$ac_cv_use_static_pgsql])
PGSQL_LIBS=`echo $PGSQL_LIBS | sed -e "sX-lpqX$PGSQL_PKGLIBDIR/libpq.aXg"`
else
if test x$sph_usedl == xyes ; then
AC_MSG_RESULT([runtime dynamic])
AC_CHECK_PGSQL([ac_cv_use_pgsql])
PGSQL_LIBS=""
dl_pgsql=1
else
AC_MSG_RESULT([dynamic])
AC_CHECK_PGSQL([ac_cv_use_pgsql])
fi
fi
AC_DEFINE(USE_PGSQL,1,[Define to 1 if you want to compile with PostgreSQL support])
AC_DEFINE_UNQUOTED(DL_PGSQL,$dl_pgsql,[Define to 1 if runtime load PosgreSQL using dlopen])
AC_SUBST([PGSQL_LIBS])
AC_SUBST([PGSQL_CFLAGS])
else
AC_MSG_RESULT([no])
fi
AM_CONDITIONAL(USE_PGSQL, test x$ac_cv_use_pgsql != xno -o x$ac_cv_use_satic_pgsql != xno )
# add macports include directory
if (echo $MYSQL_LIBS | grep -q -- -L/opt/local/lib); then
MYSQL_CFLAGS="$MYSQL_CFLAGS -I/opt/local/include"
fi
# get rid of possible garbage (like on mac os x)
MYSQL_CFLAGS=`echo $MYSQL_CFLAGS | sed -e 's/-O[[0123sz]]//g'`
MYSQL_CFLAGS=`echo $MYSQL_CFLAGS | sed -e 's/\-DNDEBUG//g'`
dnl ---
AC_MSG_CHECKING([whether to use 64-bit document/word IDs])
sph_enable_id64=yes
AC_ARG_ENABLE([id64],
[ --enable-id64 use 64-bit document and word IDs (default is yes)],
[sph_enable_id64=$enableval])
if test x$sph_enable_id64 != xno; then
AC_DEFINE(USE_64BIT, 1, [64-bit document and word IDs])
AC_MSG_RESULT([yes])
else
AC_DEFINE(USE_64BIT, 0, [64-bit document and word IDs])
AC_MSG_RESULT([no])
fi
dnl ---
AC_ARG_WITH([libstemmer],
AC_HELP_STRING([--with-libstemmer], [compile with libstemmer support (default is disabled)]),
[ac_cv_use_libstemmer=$withval], [ac_cv_use_libstemmer=no]
)
AC_MSG_CHECKING([whether to compile with libstemmer support])
if test x$ac_cv_use_libstemmer != xno; then
ac_cv_use_internal_libstemmer=no
AC_CHECK_LIBSTEMMER([$ac_cv_use_libstemmer])
if test x$ac_cv_use_internal_libstemmer != xno ; then
AC_MSG_RESULT([yes, static internal])
else
AC_MSG_RESULT([yes, external])
fi
AC_DEFINE(USE_LIBSTEMMER, 1, [libstemmer support])
AC_SUBST([LIBSTEMMER_LIBS])
AC_SUBST([LIBSTEMMER_CFLAGS])
else
AC_MSG_RESULT([no])
AC_DEFINE(USE_LIBSTEMMER, 0, [libstemmer support])
fi
AM_CONDITIONAL(USE_LIBSTEMMER, test x$ac_cv_use_libstemmer != xno)
AM_CONDITIONAL(USE_INTERNAL_LIBSTEMMER, test x$ac_cv_use_internal_libstemmer != xno)
dnl ---
# we can now set preprocessor flags for both C and C++ compilers
CPPFLAGS="$CPPFLAGS $MYSQL_CFLAGS $PGSQL_CFLAGS $LIBSTEMMER_CFLAGS"
AC_ARG_WITH([libexpat],
AC_HELP_STRING([--with-libexpat], [compile with expat XML library suppport (default is autodetect)]),
[ac_cv_use_expat=$withval], [ac_cv_use_expat=yes]
)
dnl ---
AC_ARG_WITH([re2],
AC_HELP_STRING([--with-re2], [compile with RE2 library support (default is disabled)]),
[ac_cv_use_re2=$withval], [ac_cv_use_re2=no]
)
AC_MSG_CHECKING([whether to compile with RE2 library support])
AC_ARG_WITH([re2-includes],
AC_HELP_STRING([--with-re2-includes], [path to RE2 header files]),
[ac_cv_re2_includes=$withval], [ac_cv_re2_includes=no]
)
AC_ARG_WITH([re2-libs],
AC_HELP_STRING([--with-re2-libs], [path to RE2 libraries]),
[ac_cv_re2_libs=$withval], [ac_cv_re2_libs=no]
)
# First check if user supplied --with-re2-libs and --with-re2-includes
if test x$ac_cv_re2_libs != xno && test x$ac_cv_re2_includes != xno; then
ac_cv_use_re2=yes
fi
if test x$ac_cv_use_re2 != xno; then
AC_CHECK_RE2
AC_MSG_RESULT([yes, $LIBRE2_CFLAGS])
AC_DEFINE(USE_RE2, 1, [RE2 library support])
AC_SUBST([LIBRE2_LIBS])
AC_SUBST([LIBRE2_CFLAGS])
AC_SUBST([LIBRE2_PATH])
else
AC_MSG_RESULT([no])
AC_DEFINE(USE_RE2, 0, [RE2 library support])
fi
AM_CONDITIONAL(USE_RE2, test x$ac_cv_use_re2 != xno)
dnl ---
# we can now set preprocessor flags for both C and C++ compilers
CPPFLAGS="$CPPFLAGS $MYSQL_CFLAGS $PGSQL_CFLAGS $LIBRE2_CFLAGS"
AC_ARG_WITH([rlp],
AC_HELP_STRING([--with-rlp], [compile with RLP library support (default is disabled)]),
[ac_cv_use_rlp=$withval], [ac_cv_use_rlp=no]
)
AC_MSG_CHECKING([whether to compile with RLP library support])
if test x$ac_cv_use_rlp != xno; then
if test -d rlp && test -f rlp/rlp/include/bt_rlp_c.h; then
AC_MSG_RESULT([yes])
AC_DEFINE(USE_RLP, 1, [RLP library support])
else
AC_MSG_ERROR([missing RLP sources from librlp])
fi
else
AC_MSG_RESULT([no])
AC_DEFINE(USE_RLP, 0, [RLP library support])
fi
AM_CONDITIONAL(USE_RLP, test x$ac_cv_use_rlp != xno)
dnl ---
got_expat=0
dl_expat=0
AC_MSG_CHECKING([for libexpat])
if test x$ac_cv_use_expat = xyes -a x$have_expat_h = xyes; then
FOOLIBS="$LIBS"
AC_SEARCH_LIBS([XML_Parse],[expat],[got_expat=1])
if test $got_expat -eq 1; then
if test x$sph_usedl == xyes ; then
AC_MSG_RESULT([runtime dynamic])
LIBS="$FOOLIBS"
dl_expat=1
else
AC_MSG_RESULT([found])
fi
AC_DEFINE([USE_LIBEXPAT],1,[define to use expat XML library])
AC_DEFINE_UNQUOTED(DL_EXPAT,$dl_expat,[Define to 1 if you want runtime load libexpat using dlopen])
else
AC_MSG_RESULT([not found])
AC_MSG_WARN([xmlpipe2 will NOT be available])
fi
else
AC_MSG_RESULT([disabled])
fi
dnl ---
AC_ARG_WITH([iconv],
AC_HELP_STRING([--with-iconv], [compile with iconv support (default is autodetect)]),
[ac_cv_use_iconv=$withval], [ac_cv_use_iconv=yes]
)
AC_MSG_CHECKING([for libiconv])
if test x$ac_cv_use_iconv != xno -a x$have_iconv_h = xyes; then
AC_SEARCH_LIBS([iconv],[iconv],[have_libiconv=yes],[have_libiconv=no])
if test x$have_libiconv = xyes; then
AC_MSG_RESULT([found])
AC_DEFINE([USE_LIBICONV],1,[define to use iconv library])
AC_MSG_CHECKING([for iconv() arg types])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <iconv.h>
#include <stdio.h>]],
[const char * inbuf;
iconv_t cd;
iconv ( cd, &inbuf, NULL, NULL, NULL );
])],
[iconv_inbuf_const=yes],
[iconv_inbuf_const=no])
AC_LANG_POP([C++])
if test x$iconv_inbuf_const = xyes; then
AC_DEFINE([ICONV_INBUF_CONST],1,[whether 2nd arg to iconv() is const ptr])
AC_MSG_RESULT([const char **])
else
AC_DEFINE([ICONV_INBUF_CONST],0,[whether 2nd arg to iconv() is const ptr])
AC_MSG_RESULT([char **])
fi
else
if test $got_expat -eq 1; then
AC_MSG_RESULT([not found])
AC_MSG_WARN([xmlpipe2 will only support default encodings (latin-1, utf-8)])
else
AC_MSG_RESULT([not required and not found])
fi
fi
else
AC_MSG_RESULT([disabled])
if test $got_expat -eq 1; then
AC_MSG_WARN([xmlpipe2 will only support default encodings (latin-1, utf-8)])
fi
fi
dnl ---
if test x$have_zlib_h = xyes -a x$have_lz = xyes; then
AC_DEFINE([USE_ZLIB],1,[define to use Zlib])
fi
dnl ---
AC_ARG_WITH([unixodbc],
AC_HELP_STRING([--with-unixodbc], [compile with UnixODBC support (default is autodetect)]),
[ac_cv_use_unixodbc=$withval], [ac_cv_use_unixodbc=yes]
)
dl_odbc=0
AC_MSG_CHECKING([for UnixODBC])
if test x$ac_cv_use_unixodbc = xyes; then
have_libodbc=no
FOOLIBS="$LIBS"
if test x$have_sql_h = xyes; then
AC_SEARCH_LIBS([SQLDriverConnect],[odbc iodbc],[have_libodbc=yes])
fi
if test x$have_libodbc = xyes; then
if test x$sph_usedl == xyes ; then
AC_MSG_RESULT([runtime dynamic])
LIBS="$FOOLIBS"
dl_odbc=1
else
AC_MSG_RESULT([found])
fi
AC_DEFINE([USE_ODBC],1,[define to use ODBC library])
AC_DEFINE_UNQUOTED(DL_UNIXODBC,$dl_odbc,[Define to 1 if you want runtime load odbc/iodbc using dlopen])
else
AC_MSG_RESULT([not found])
AC_MSG_WARN([ODBC source support will NOT be available])
fi
else
AC_MSG_RESULT([disabled])
fi
dnl ---
AC_MSG_CHECKING([whether to enable c++ memory routines override])
sph_enable_mem_override=yes
AC_ARG_ENABLE([mem-override],
AC_HELP_STRING([--enable-mem-override], [enable to override std C++ mem routines in production build (default is yes); disabling may help in some rare cases like statically linking MySQL on Mac OS X Lion]),
[sph_enable_mem_override=$enableval])
if test x$sph_enable_mem_override = xyes; then
AC_MSG_RESULT([yes])
else
AC_DEFINE(SPH_DONT_OVERRIDE_MEMROUTINES, 1, [Disable overriding of c++ memory routines])
AC_MSG_RESULT([no])
fi
dnl ---
AC_ARG_WITH([syslog],
AC_HELP_STRING([--with-syslog], [compile with possibility to use syslog for logging (default is yes)]),
[ac_cv_use_syslog=$withval], [ac_cv_use_syslog=yes]
)
AC_MSG_CHECKING([for Syslog])
if test x$ac_cv_use_syslog != xno; then
if test x$have_syslog_h = xyes; then
AC_DEFINE([USE_SYSLOG],1,[define to use POSIX Syslog for logging])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
else
AC_MSG_RESULT([disabled])
fi
dnl ---
AC_CACHE_CHECK([for unaligned RAM access],[sphinx_cv_unaligned_ram_access],[
AC_LANG_PUSH([C++])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <stdlib.h>
#include <string.h>]],
[[char * sBuf = new char [ 8*sizeof(int) ];
for ( int i=0; i<8*sizeof(int); i++ )
sBuf[i] = i;
// check for crashes (SPARC)
volatile int iRes = 0;
for ( int i=0; i<(int)sizeof(int); i++ )
{
int * pPtr = (int*)( sBuf+i );
iRes += *pPtr;
}
// check for correct values (ARM)
iRes = *(int*)( sBuf+1 );
if (!( iRes==0x01020304 || iRes==0x04030201 ))
return 1;
// all seems ok
return 0;]])],
[sphinx_cv_unaligned_ram_access=yes],
[sphinx_cv_unaligned_ram_access=no],
[AC_MSG_RESULT([unknown (cross-compiling), assume no])
sphinx_cv_unaligned_ram_access=no])
])
if test x$sphinx_cv_unaligned_ram_access = xyes ; then
AC_DEFINE([UNALIGNED_RAM_ACCESS],1,[whether unaligned RAM access is possible])
else
AC_DEFINE([UNALIGNED_RAM_ACCESS],0)
fi
# check endianness
AC_C_BIGENDIAN(
AC_DEFINE(USE_LITTLE_ENDIAN, 0, [big-endian]),
AC_DEFINE(USE_LITTLE_ENDIAN, 1, [little-endian]),
AC_MSG_ERROR(unknown endianess not supported),
AC_MSG_ERROR(universal endianess not supported)
)
dnl --------------------------------------------------------------------------
SPHINX_CONFIGURE_PART([generating configuration files])
if test "x$prefix" = "xNONE"; then
my_op_prefix="/var"
else
my_op_prefix="$localstatedir"
fi
CONFDIR=`eval echo "${my_op_prefix}"`
AC_SUBST(CONFDIR)
AC_CONFIG_FILES([Makefile src/Makefile libstemmer_c/Makefile doc/Makefile sphinx.conf.dist:sphinx.conf.in \
sphinx-min.conf.dist:sphinx-min.conf.in])
AC_OUTPUT
dnl --------------------------------------------------------------------------
SPHINX_CONFIGURE_PART([configuration done])
echo "You can now run 'make install' to build and install Sphinx binaries."
echo "On a multi-core machine, try 'make -j4 install' to speed up the build."
echo
echo "Updates, articles, help forum, and commercial support, consulting, training,"
echo "and development services are available at http://sphinxsearch.com/"
echo
echo "Thank you for choosing Sphinx!"
echo