50
43
PANDORA_WITH_GETTEXT
52
dnl We need to turn on our CXXFLAGS to make sure it shows up correctly
53
save_CXXFLAGS="${CXXFLAGS}"
54
CXXFLAGS="${CXXFLAGS} ${AM_CXXFLAGS}"
56
CXXFLAGS="${save_CXXFLAGS}"
61
PANDORA_REQUIRE_PTHREAD
63
46
PANDORA_REQUIRE_LIBPROTOBUF
64
47
PANDORA_PROTOBUF_REQUIRE_VERSION([2.1.0])
65
48
PANDORA_REQUIRE_PROTOC
67
#--------------------------------------------------------------------
69
#--------------------------------------------------------------------
71
dnl Do this by hand. Need to check for uuid/uuid.h, but uuid may or may
72
dnl not be a lib is weird.
74
AC_CHECK_HEADERS(uuid/uuid.h)
75
if test "x$ac_cv_header_uuid_uuid_h" = "xno"
77
AC_MSG_ERROR([Couldn't find uuid/uuid.h. On Debian this can be found in uuid-dev. On Redhat this can be found in e2fsprogs-devel.])
79
AC_LIB_HAVE_LINKFLAGS(uuid,,
81
#include <uuid/uuid.h>
91
#--------------------------------------------------------------------
92
# Check for tcmalloc/mtmalloc
93
#--------------------------------------------------------------------
95
PANDORA_HAVE_BETTER_MALLOC
96
LIBS="${LIBS} ${BETTER_MALLOC_LIBS}"
98
#--------------------------------------------------------------------
99
# Check for libdrizzle
100
#--------------------------------------------------------------------
51
PANDORA_REQUIRE_PTHREAD
52
PANDORA_REQUIRE_LIBUUID
103
53
PANDORA_REQUIRE_LIBDRIZZLE
55
PANDORA_REQUIRE_LIBPCRE
56
PANDORA_REQUIRE_LIBREADLINE
107
#--------------------------------------------------------------------
109
#--------------------------------------------------------------------
111
AC_LIB_HAVE_LINKFLAGS(z,,
116
AS_IF([test x$ac_cv_libz = xno],
117
AC_MSG_ERROR([libz is required for Drizzle. On Debian this can be found in zlib1g-dev. On RedHat this can be found in zlib-devel.]))
119
#--------------------------------------------------------------------
120
# Check for libreadline or compatible (libedit on Mac OS X)
121
#--------------------------------------------------------------------
126
AS_IF([test "x$vl_cv_lib_readline" = "xno"],
127
AC_MSG_ERROR([libreadline is required for Drizzle. On Debian this can be found in libreadline5-dev. On RedHat this can be found in readline-devel.]))
128
READLINE_LIBS="${LIBS}"
130
AC_SUBST(READLINE_LIBS)
132
DRIZZLE_CHECK_NEW_RL_INTERFACE
134
#--------------------------------------------------------------------
136
#--------------------------------------------------------------------
138
AC_LIB_HAVE_LINKFLAGS(pcre,,
144
AS_IF([test "x$ac_cv_libpcre" = "xno"],
151
AC_LIB_HAVE_LINKFLAGS(pcre,,
152
[#include <pcre/pcre.h>],
157
AS_IF([test "x$ac_cv_libpcre" = "xno"],
159
AC_MSG_ERROR([libpcre is required for Drizzle. On Debian this can be found in libpcre3-dev. On RedHat this can be found in pcre-devel.])
161
AC_DEFINE(PCRE_HEADER,[<pcre/pcre.h>],[Location of pcre header])
164
AC_DEFINE(PCRE_HEADER,[<pcre.h>],[Location of pcre header])
168
AC_PATH_PROG(PERL, perl, no)
60
PANDORA_USE_BETTER_MALLOC
171
65
AC_ARG_WITH([server-suffix],
254
144
AC_MSG_RESULT([no])
257
#--------------------------------------------------------------------
258
# Check for system header files
259
#--------------------------------------------------------------------
265
AC_CHECK_HEADERS(fcntl.h float.h fpu_control.h ieeefp.h)
266
AC_CHECK_HEADERS(limits.h pwd.h select.h linux/config.h)
267
AC_CHECK_HEADERS(sys/fpu.h utime.h sys/utime.h )
268
AC_CHECK_HEADERS(synch.h sys/mman.h sys/socket.h)
269
AC_CHECK_HEADERS([curses.h term.h],[],[],
270
[[#ifdef HAVE_CURSES_H
274
AC_CHECK_HEADERS(termio.h termios.h sched.h alloca.h)
275
AC_CHECK_HEADERS(sys/prctl.h ieeefp.h)
276
AC_CHECK_HEADERS(execinfo.h)
278
#--------------------------------------------------------------------
279
# Check for system libraries. Adds the library to $LIBS
280
# and defines HAVE_LIBM etc
281
#--------------------------------------------------------------------
283
AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
285
AC_CHECK_FUNC(setsockopt, [], [AC_CHECK_LIB(socket, setsockopt)])
286
AC_CHECK_FUNC(yp_get_default_domain, [],
287
[AC_CHECK_LIB(nsl, yp_get_default_domain)])
288
AC_CHECK_FUNC(p2open, [], [AC_CHECK_LIB(gen, p2open)])
289
# This may get things to compile even if bind-8 is installed
290
AC_CHECK_FUNC(bind, [], [AC_CHECK_LIB(bind, bind)])
291
# Check if crypt() exists in libc or libcrypt, sets LIBS if needed
292
AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
294
# Check rt for aio_read
295
AC_CHECK_LIB(rt, aio_read)
297
# For the sched_yield() function on Solaris
298
AC_CHECK_FUNC(sched_yield, [],
299
[AC_CHECK_LIB(posix4, [sched_yield],
300
[AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield function]) LIBS="$LIBS -lposix4"])])
302
if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
304
AC_CHECK_FUNC(gtty, [], [AC_CHECK_LIB(compat, gtty)])
307
AC_CHECK_TYPES([fp_except], [], [], [
308
#include <sys/types.h>
314
AC_CHECK_LIB(dl,dlopen)
315
AC_CHECK_FUNCS(dlopen)
316
if test "$ac_cv_func_dlopen" != "yes"
318
AC_MSG_ERROR([Drizzle requires dlopen])
326
[whether the compiler provides atomic builtins],
327
[ac_cv_gcc_atomic_builtins],
329
[AC_LANG_PROGRAM([],[[
330
int foo= -10; int bar= 10;
331
if (!__sync_fetch_and_add(&foo, bar) || foo)
333
bar= __sync_lock_test_and_set(&foo, bar);
334
if (bar || foo != 10)
336
bar= __sync_val_compare_and_swap(&bar, foo, 15);
341
[ac_cv_gcc_atomic_builtins=yes],
342
[ac_cv_gcc_atomic_builtins=no])])
344
AS_IF([test "x$ac_cv_gcc_atomic_builtins" = "xyes"],[
345
AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1,
346
[Define to 1 if compiler provides atomic builtins.])
350
147
AC_ARG_WITH([comment],
351
148
[AS_HELP_STRING([--with-comment],
352
149
[Comment about compilation environment. @<:@default=off@:>@])],
353
150
[with_comment=$withval],
354
151
[with_comment=no])
355
if test "$with_comment" != "no"
152
AS_IF([test "$with_comment" != "no"],[
357
153
COMPILATION_COMMENT=$with_comment
359
155
COMPILATION_COMMENT="Source distribution (${PANDORA_RELEASE_COMMENT})"
361
157
AC_DEFINE_UNQUOTED([COMPILATION_COMMENT],["$COMPILATION_COMMENT"],
362
158
[Comment about compilation environment])
364
dnl Checks for typedefs, structures, and compiler characteristics.
367
# off_t is not a builtin type
368
AC_CHECK_SIZEOF(off_t, 4)
369
if test "$ac_cv_sizeof_off_t" -eq 0
371
AC_MSG_ERROR("Drizzle needs a off_t type.")
373
AC_CHECK_SIZEOF(size_t)
374
AC_DEFINE_UNQUOTED([SIZEOF_SIZE_T],[$ac_cv_sizeof_size_t],[Size of size_t as computed by sizeof()])
375
AC_CHECK_SIZEOF(long long)
376
AC_DEFINE_UNQUOTED(SIZEOF_LONG_LONG,[$ac_cv_sizeof_long_long],[Size of long long as computed by sizeof()])
379
dnl check if time_t is unsigned
384
DRIZZLE_STACK_DIRECTION
386
AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
387
AC_CHECK_TYPES([uint, ulong])
389
DRIZZLE_PTHREAD_YIELD
392
dnl Checks for header files.
393
AC_CHECK_HEADERS(malloc.h)
395
dnl Checks for library functions.
398
AC_CHECK_FUNCS(issetugid)
400
# Already-done: stdlib.h string.h unistd.h termios.h
401
AC_CHECK_HEADERS(stdarg.h dirent.h locale.h ndir.h sys/dir.h \
402
sys/ndir.h sys/select.h \
403
sys/mman.h termcap.h termio.h asm/termbits.h grp.h \
406
# Already-done: strcasecmp
407
AC_CHECK_FUNCS(lstat select)
410
DRIZZLE_HAVE_TIOCGWINSZ
411
DRIZZLE_HAVE_TIOCSTAT
161
AC_ARG_WITH([max-indexes],
162
AS_HELP_STRING([--with-max-indexes=N],
163
[Sets the maximum number of indexes per table, default 64]),
164
[max_indexes="$withval"],
166
AC_MSG_CHECKING([max indexes per table])
167
AC_DEFINE_UNQUOTED([MAX_INDEXES], [$max_indexes],
168
[Maximum number of indexes per table])
169
AC_MSG_RESULT([$max_indexes])
413
172
#########################################################################
415
dnl Checks for library functions.
420
AC_CHECK_FUNCS(fcntl)
421
if test "x$ac_cv_func_fcntl" != "xyes"
423
AC_MSG_ERROR("Drizzle requires fcntl.")
427
AC_CACHE_CHECK([working fdatasync],[ac_cv_func_fdatasync],[
429
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
434
[ac_cv_func_fdatasync=yes],
435
[ac_cv_func_fdatasync=no])
438
AS_IF([test "x${ac_cv_func_fdatasync}" = "xyes"],
439
[AC_DEFINE([HAVE_FDATASYNC],[1],[If the system has a working fdatasync])])
444
fpresetsticky fpsetmask fsync \
445
getpassphrase getpwnam \
446
getpwuid getrlimit getrusage index initgroups isnan \
447
localtime_r log log2 gethrtime gmtime_r \
449
mkstemp mlockall poll pread pthread_attr_create mmap mmap64 \
451
realpath rename rwlock_init setupterm \
456
backtrace backtrace_symbols backtrace_symbols_fd)
459
# Test whether madvise() is declared in C++ code -- it is not on some
460
# systems, such as Solaris
461
AC_CHECK_DECLS([madvise], [], [], [AC_INCLUDES_DEFAULT[
463
#include <sys/types.h>
464
#include <sys/mman.h>
470
AM_CONDITIONAL(BUILD_THR_RWLOCK,[test "$ac_cv_func_rwlock_init" -a "$ac_cv_funn_pthread_rwlock_rdlock"])
473
# Sanity check: We chould not have any fseeko symbol unless
474
# large_file_support=yes
475
AC_CHECK_FUNC(fseeko,
476
[if test "$large_file_support" = no -a "x$TARGET_LINUX" = "xtrue";
478
AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!")
482
# Check definition of pthread_getspecific
483
AC_CACHE_CHECK([args to pthread_getspecific], [pandora_cv_getspecific_args],
484
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
485
#if !defined(_REENTRANT)
488
#ifndef _POSIX_PTHREAD_SEMANTICS
489
#define _POSIX_PTHREAD_SEMANTICS
493
void *pthread_getspecific(pthread_key_t key);
494
pthread_getspecific((pthread_key_t) NULL);
496
[pandora_cv_getspecific_args=POSIX],
497
[pandora_cv_getspecific_args=other])])
498
if test "$pandora_cv_getspecific_args" = "other"
500
AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
501
[For some non posix threads])
504
# Check definition of pthread_mutex_init
505
AC_CACHE_CHECK([args to pthread_mutex_init], [pandora_cv_mutex_init_args],
506
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
510
#ifndef _POSIX_PTHREAD_SEMANTICS
511
#define _POSIX_PTHREAD_SEMANTICS
513
#include <pthread.h> ]], [[
514
pthread_mutexattr_t attr;
516
pthread_mutex_init(&mp,&attr); ]])],
517
[pandora_cv_mutex_init_args=POSIX],
518
[pandora_cv_mutex_init_args=other])])
519
if test "$pandora_cv_mutex_init_args" = "other"
521
AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
522
[For some non posix threads])
526
#---START: Used in for client configure
527
# Check definition of readdir_r
528
AC_CACHE_CHECK([args to readdir_r], [pandora_cv_readdir_r],
529
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
533
#ifndef _POSIX_PTHREAD_SEMANTICS
534
#define _POSIX_PTHREAD_SEMANTICS
537
#include <dirent.h>]], [[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
538
readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ]])],
539
[pandora_cv_readdir_r=POSIX],
540
[pandora_cv_readdir_r=other])])
541
if test "$pandora_cv_readdir_r" = "POSIX"
543
AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
546
# Check definition of posix sigwait()
547
AC_CACHE_CHECK([style of sigwait], [pandora_cv_sigwait],
548
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
552
#ifndef _POSIX_PTHREAD_SEMANTICS
553
#define _POSIX_PTHREAD_SEMANTICS
564
[pandora_cv_sigwait=POSIX],
565
[pandora_cv_sigwait=other])])
566
if test "$pandora_cv_sigwait" = "POSIX"
568
AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
571
if test "$pandora_cv_sigwait" != "POSIX"
573
unset pandora_cv_sigwait
574
# Check definition of posix sigwait()
575
AC_CACHE_CHECK([style of sigwait], [pandora_cv_sigwait],
576
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
580
#ifndef _POSIX_PTHREAD_SEMANTICS
581
#define _POSIX_PTHREAD_SEMANTICS
590
[pandora_cv_sigwait=NONPOSIX],
591
[pandora_cv_sigwait=other])])
592
if test "$pandora_cv_sigwait" = "NONPOSIX"
594
AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
599
# Check if pthread_attr_setscope() exists
600
AC_CACHE_CHECK([for pthread_attr_setscope], [pandora_cv_pthread_attr_setscope],
601
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
605
#ifndef _POSIX_PTHREAD_SEMANTICS
606
#define _POSIX_PTHREAD_SEMANTICS
610
pthread_attr_t thr_attr;
611
pthread_attr_setscope(&thr_attr,0);
613
[pandora_cv_pthread_attr_setscope=yes],
614
[pandora_cv_pthread_attr_setscope=no])])
615
if test "$pandora_cv_pthread_attr_setscope" = "yes"
617
AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
621
AC_CHECK_HEADERS(cxxabi.h)
622
AC_CACHE_CHECK([checking for abi::__cxa_demangle], pandora_cv_cxa_demangle,
623
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cxxabi.h>]], [[
624
char *foo= 0; int bar= 0;
625
foo= abi::__cxa_demangle(foo, foo, 0, &bar);
626
]])],[pandora_cv_cxa_demangle=yes],[pandora_cv_cxa_demangle=no])])
629
if test "x$pandora_cv_cxa_demangle" = xyes; then
630
AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1,
631
[Define to 1 if you have the `abi::__cxa_demangle' function.])
634
#--------------------------------------------------------------------
635
# Check for requested features
636
#--------------------------------------------------------------------
638
DRIZZLE_CHECK_MAX_INDEXES
640
175
dnl Has to be done late, as the plugin may need to check for existence of
641
176
dnl functions tested above