summaryrefslogtreecommitdiff
path: root/build_posix/configure.ac.in
blob: 3c07bd3cb29eeb01a178c5aa4e943cf54dbb31fe (plain)
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
PACKAGE=wiredtiger
AC_PREREQ(2.63)
AC_INIT(WiredTiger, m4_normalize(m4_include([build_posix/aclocal/version.m4])),
	[support@wiredtiger.com])

m4_include([build_posix/aclocal/version-set.m4])

AC_CONFIG_AUX_DIR([build_posix/gnu-support])
AC_CONFIG_MACRO_DIR([build_posix/aclocal])
AC_CONFIG_SRCDIR([RELEASE])

AM_INIT_AUTOMAKE([1.11 foreign parallel-tests subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])])
AM_OPTIONS

# If CFLAGS was not set on entry and we are not debugging, default to -O3
wt_test_CFLAGS=${CFLAGS+set}
if test "$wt_test_CFLAGS" != set && test "$wt_cv_enable_debug" != "yes"; then
	CFLAGS="-O3"
fi

define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
LT_PREREQ(2.2.6)
LT_INIT([pic-only])
AC_SUBST([LIBTOOL_DEPS])

AC_PROG_CC(cc gcc)
# AC_PROG_CXX(c++ g++)

# Add debugging flags if requested and not already in CFLAGS
if test "$wt_cv_enable_debug" = "yes"; then
	case "$CFLAGS" in
		*-g*)	;;
		*)	AM_CFLAGS="$AM_CFLAGS -g" ;;
	esac
fi

if test "$GCC" = "yes"; then
	# The Solaris gcc compiler gets the additional -pthreads flag.
	if test "`uname -s`" = "SunOS"; then
		AM_CFLAGS="$AM_CFLAGS -pthreads"
	fi
else
	# The Solaris native compiler gets the additional -mt flag.
	if test "`uname -s`" = "SunOS"; then
		AM_CFLAGS="$AM_CFLAGS -mt"
	fi
fi

AM_CONDITIONAL([DEBUG], [test "$wt_cv_enable_debug" = "yes"])

# Java and Python APIs
if test "$wt_cv_enable_java" = "yes" -o "$wt_cv_enable_python" = "yes"; then
	AX_PKG_SWIG(2.0.4, [],
	    [AC_MSG_WARN([SWIG is required to rebuild Java or Python APIs.])])
fi

if test "$wt_cv_enable_java" = "yes"; then
	JAVAC=${JAVAC-javac}
	AX_PROG_JAVAC
	AX_PROG_JAR
	AX_JNI_INCLUDE_DIR
	if test "$wt_cv_enable_debug" = "yes"; then
		AX_CHECK_JUNIT
	fi
	for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS ; do
		JNI_CPPFLAGS="$JNI_CPPFLAGS -I$JNI_INCLUDE_DIR"
	done
	AC_SUBST(JNI_CPPFLAGS)
fi

if test "$wt_cv_enable_python" = "yes"; then
	AM_PATH_PYTHON([2.6])
	if test -n "$with_python_prefix" ; then
		PYTHON_INSTALL_ARG="-d $with_python_prefix"
	fi
	AC_SUBST(PYTHON_INSTALL_ARG)
fi

AM_TYPES

AC_PROG_INSTALL

AC_CHECK_HEADERS([pthread_np.h])
AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(rt, sched_yield)

AC_CHECK_FUNCS([\
	clock_gettime fcntl ftruncate gettimeofday posix_fadvise\
	posix_fallocate posix_madvise posix_memalign strtouq sync_file_range])

# OS X wrongly reports that it has fdatasync
AS_CASE([$host_os], [darwin*], [], [AC_CHECK_FUNCS([fdatasync])])

AC_SYS_LARGEFILE

AC_MSG_CHECKING([if the adaptive mutex type is available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],[[
	pthread_mutexattr_t attr;
	pthread_mutexattr_init(&attr);
	pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);]])],
    [AC_MSG_RESULT([yes])
     AC_DEFINE([HAVE_MUTEX_ADAPTIVE], [1],
        [Define if adaptive mutexes are supported.])],
    [AC_MSG_RESULT([no])])

AC_C_BIGENDIAN

# Linux requires _GNU_SOURCE to be defined and buffers aligned to 4KB
# boundaries for O_DIRECT to work.
BUFFER_ALIGNMENT=0
if test "$ac_cv_func_posix_memalign" = "yes" ; then
	case "$host_os" in
	linux*)	AM_CFLAGS="$AM_CFLAGS -D_GNU_SOURCE"
		BUFFER_ALIGNMENT=4096
		;;
	esac
fi
AC_DEFINE_UNQUOTED(WT_BUFFER_ALIGNMENT_DEFAULT, $BUFFER_ALIGNMENT,
	[Default alignment of bufffers used for I/O])

AC_SUBST(AM_CFLAGS)

# test/format requires an installed Berkeley DB release tree.
AC_MSG_CHECKING([if --with-berkeleydb=DIR option specified])
AC_ARG_WITH(berkeleydb,
    [AS_HELP_STRING([--with-berkeleydb=DIR],
	[Specify installed library directory of Berkeley DB])],
    [with_berkeleydb="$withval"], [with_berkeleydb="NO_BERKELEY_DB_LIBRARY"])
AC_MSG_RESULT($with_berkeleydb)
AM_CONDITIONAL([HAVE_BERKELEY_DB], [test -d $with_berkeleydb])
AC_SUBST(BERKELEY_DB_PATH, [$with_berkeleydb])

# test/format optionally supports the MEMRATA KVS library.
memrata_dir=`ls -d "$ac_pwd/memrata" 2>/dev/null | head -1`
if ! test -d "$memrata_dir" ; then
	memrata_dir="NO_MEMRATA_LIBRARY_FOUND"
fi
AM_CONDITIONAL([HAVE_MEMRATA], [test -d $memrata_dir])
AC_SUBST(MEMRATA_PATH, [$memrata_dir])

# Warn that diagnostic builds should not be used in production
if test "$wt_cv_enable_diagnostic" = "yes"; then
	AC_MSG_WARN(
	    [DIAGNOSTIC BUILDS ARE NOT RECOMMENDED FOR PRODUCTION DEPLOYMENT.])
fi

# Output files
AC_CONFIG_HEADERS([wiredtiger_config.h:build_posix/config.hin])

# BEGIN check existence -- maintained by reconf and Make.subdirs
# END check existence

AC_CONFIG_FILES([
	Makefile
	wiredtiger.h:src/include/wiredtiger.in
	wiredtiger.pc:build_posix/wiredtiger.pc.in
])
AC_OUTPUT