20
20
AC_PREREQ(2.59)dnl Minimum Autoconf version required.
21
AC_INIT([drizzle],[RELEASE_VERSION],[http://bugs.launchpad.net/drizzle])
21
dnl Version from the AC_INIT call below is overridden later
22
dnl So don't update it here
23
AC_INIT([drizzle],[7],[http://bugs.launchpad.net/drizzle])
22
24
AC_CONFIG_SRCDIR([drizzled/drizzled.cc])
23
25
AC_CONFIG_AUX_DIR(config)
24
26
AC_CONFIG_HEADERS([config.h])
25
27
AC_CONFIG_MACRO_DIR([m4])
27
29
PANDORA_CANONICAL_TARGET(less-warnings, warnings-always-on, use-gnulib, require-cxx, force-gcc42)
29
# Version with no dots
30
AC_DEFINE([DRIZZLE_VERSION_ID],RELEASE_ID,
31
[Version ID that can be easily used for numeric comparison])
33
33
# The port that was assigned by IANA.
34
34
DRIZZLE_TCP_PORT_DEFAULT=4427
42
42
AC_MSG_ERROR("Drizzle requires gperf to build."))
44
44
AC_CHECK_PROGS(YACC, ['bison -y'])
45
AS_IF([test "x$YACC" = "x" -a "$building_from_bzr" = "yes"],[
45
AS_IF([test "x$YACC" = "x" -a "$ac_cv_building_from_bzr" = "yes"],[
46
46
AC_MSG_ERROR(["bison is required for Drizzle to build from a bzr branch"])
50
AM_GNU_GETTEXT(external, need-formatstring-macros)
51
if test "x$MSGMERGE" = "x" -o "x$MSGMERGE" = "x:"
53
AM_PATH_PROG_WITH_TEST(GMSGMERGE, gmsgmerge,
54
[$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
55
MSGMERGE="${GMSGMERGE}"
57
AM_CONDITIONAL([BUILD_GETTEXT],[test "x$MSGMERGE" != "x" -a "x$MSGMERGE" != "x:"])
60
52
dnl We need to turn on our CXXFLAGS to make sure it shows up correctly
61
53
save_CXXFLAGS="${CXXFLAGS}"
330
322
AC_SUBST(LIBDL_LIBS)
333
AC_ARG_WITH([atomic-ops],
334
[AS_HELP_STRING([--with-atomic-ops=rwlocks|smp|up],
335
[Implement atomic operations using pthread rwlocks or atomic CPU
336
instructions for multi-processor or uniprocessor
337
configuration. By default gcc built-in sync functions are used,
338
if available and 'smp' configuration otherwise.])],
339
[with_atomic_ops="$withval"],
340
[with_atomic_ops=smp])
342
case "$with_atomic_ops" in
343
"up") AC_DEFINE([MY_ATOMIC_MODE_DUMMY], [1],
344
[Assume single-CPU mode, no concurrency]) ;;
345
"rwlocks") AC_DEFINE([MY_ATOMIC_MODE_RWLOCKS], [1],
346
[Use pthread rwlocks for atomic ops]) ;;
349
[whether the compiler provides atomic builtins],
350
[ac_cv_gcc_atomic_builtins],
352
[AC_LANG_PROGRAM([],[[
353
int foo= -10; int bar= 10;
354
if (!__sync_fetch_and_add(&foo, bar) || foo)
356
bar= __sync_lock_test_and_set(&foo, bar);
357
if (bar || foo != 10)
359
bar= __sync_val_compare_and_swap(&bar, foo, 15);
364
[ac_cv_gcc_atomic_builtins=yes],
365
[ac_cv_gcc_atomic_builtins=no])])
367
if test "x$ac_cv_gcc_atomic_builtins" = "xyes"; then
368
AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1,
369
[Define to 1 if compiler provides atomic builtins.])
372
*) AC_MSG_ERROR(["$with_atomic_ops" is not a valid value for --with-atomic-ops]) ;;
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.])
376
350
AC_ARG_WITH([comment],
473
447
localtime_r log log2 gethrtime gmtime_r \
475
449
mkstemp mlockall poll pread pthread_attr_create mmap mmap64 \
476
pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
477
pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
478
pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
479
pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
480
451
realpath rename rwlock_init setupterm \
522
493
void *pthread_getspecific(pthread_key_t key);
523
494
pthread_getspecific((pthread_key_t) NULL);
525
[mysql_cv_getspecific_args=POSIX],
526
[mysql_cv_getspecific_args=other])])
527
if test "$mysql_cv_getspecific_args" = "other"
496
[pandora_cv_getspecific_args=POSIX],
497
[pandora_cv_getspecific_args=other])])
498
if test "$pandora_cv_getspecific_args" = "other"
529
500
AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
530
501
[For some non posix threads])
533
504
# Check definition of pthread_mutex_init
534
AC_CACHE_CHECK([args to pthread_mutex_init], [mysql_cv_mutex_init_args],
505
AC_CACHE_CHECK([args to pthread_mutex_init], [pandora_cv_mutex_init_args],
535
506
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
536
507
#ifndef _REENTRANT
537
508
#define _REENTRANT
543
514
pthread_mutexattr_t attr;
544
515
pthread_mutex_t mp;
545
516
pthread_mutex_init(&mp,&attr); ]])],
546
[mysql_cv_mutex_init_args=POSIX],
547
[mysql_cv_mutex_init_args=other])])
548
if test "$mysql_cv_mutex_init_args" = "other"
517
[pandora_cv_mutex_init_args=POSIX],
518
[pandora_cv_mutex_init_args=other])])
519
if test "$pandora_cv_mutex_init_args" = "other"
550
521
AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
551
522
[For some non posix threads])
555
526
#---START: Used in for client configure
556
527
# Check definition of readdir_r
557
AC_CACHE_CHECK([args to readdir_r], [mysql_cv_readdir_r],
528
AC_CACHE_CHECK([args to readdir_r], [pandora_cv_readdir_r],
558
529
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
559
530
#ifndef _REENTRANT
560
531
#define _REENTRANT
565
536
#include <pthread.h>
566
537
#include <dirent.h>]], [[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
567
538
readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ]])],
568
[mysql_cv_readdir_r=POSIX],
569
[mysql_cv_readdir_r=other])])
570
if test "$mysql_cv_readdir_r" = "POSIX"
539
[pandora_cv_readdir_r=POSIX],
540
[pandora_cv_readdir_r=other])])
541
if test "$pandora_cv_readdir_r" = "POSIX"
572
543
AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
575
546
# Check definition of posix sigwait()
576
AC_CACHE_CHECK([style of sigwait], [mysql_cv_sigwait],
547
AC_CACHE_CHECK([style of sigwait], [pandora_cv_sigwait],
577
548
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
578
549
#ifndef _REENTRANT
579
550
#define _REENTRANT
590
561
sigwait(&set,&sig);
593
[mysql_cv_sigwait=POSIX],
594
[mysql_cv_sigwait=other])])
595
if test "$mysql_cv_sigwait" = "POSIX"
564
[pandora_cv_sigwait=POSIX],
565
[pandora_cv_sigwait=other])])
566
if test "$pandora_cv_sigwait" = "POSIX"
597
568
AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
600
if test "$mysql_cv_sigwait" != "POSIX"
571
if test "$pandora_cv_sigwait" != "POSIX"
602
unset mysql_cv_sigwait
573
unset pandora_cv_sigwait
603
574
# Check definition of posix sigwait()
604
AC_CACHE_CHECK([style of sigwait], [mysql_cv_sigwait],
575
AC_CACHE_CHECK([style of sigwait], [pandora_cv_sigwait],
605
576
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
606
577
#ifndef _REENTRANT
607
578
#define _REENTRANT
619
[mysql_cv_sigwait=NONPOSIX],
620
[mysql_cv_sigwait=other])])
621
if test "$mysql_cv_sigwait" = "NONPOSIX"
590
[pandora_cv_sigwait=NONPOSIX],
591
[pandora_cv_sigwait=other])])
592
if test "$pandora_cv_sigwait" = "NONPOSIX"
623
594
AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
639
610
pthread_attr_t thr_attr;
640
611
pthread_attr_setscope(&thr_attr,0);
642
[mysql_cv_pthread_attr_setscope=yes],
643
[mysql_cv_pthread_attr_setscope=no])])
644
if test "$mysql_cv_pthread_attr_setscope" = "yes"
613
[pandora_cv_pthread_attr_setscope=yes],
614
[pandora_cv_pthread_attr_setscope=no])])
615
if test "$pandora_cv_pthread_attr_setscope" = "yes"
646
617
AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
649
620
AC_LANG_PUSH([C++])
650
621
AC_CHECK_HEADERS(cxxabi.h)
651
AC_CACHE_CHECK([checking for abi::__cxa_demangle], mysql_cv_cxa_demangle,
622
AC_CACHE_CHECK([checking for abi::__cxa_demangle], pandora_cv_cxa_demangle,
652
623
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cxxabi.h>]], [[
653
624
char *foo= 0; int bar= 0;
654
625
foo= abi::__cxa_demangle(foo, foo, 0, &bar);
655
]])],[mysql_cv_cxa_demangle=yes],[mysql_cv_cxa_demangle=no])])
626
]])],[pandora_cv_cxa_demangle=yes],[pandora_cv_cxa_demangle=no])])
658
if test "x$mysql_cv_cxa_demangle" = xyes; then
629
if test "x$pandora_cv_cxa_demangle" = xyes; then
659
630
AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1,
660
631
[Define to 1 if you have the `abi::__cxa_demangle' function.])