summaryrefslogtreecommitdiff
path: root/build_posix/configure.ac.in
blob: 5949fb0509c73efb0fac8a8ba5f22d55dcae94b3 (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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
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_INFO])

# If CFLAGS/CXXFLAGS were not set on entry, default to "-O3 -g"
: ${CFLAGS=-O3 -g}
: ${CXXFLAGS=-O3 -g}

# We rely on some automake features for testing (like AM_TEST_ENVIRONMENT)
# that didn't work before 1.11.6.
AM_INIT_AUTOMAKE([1.11.6 foreign parallel-tests subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])])

# Configure options.  The AM_OPTIONS and the libtool configuration
# need to stay here.  Moving them below the compiler and other
# configurations causes -Wcast_align warnings and other warnings
# on OS X.
AM_OPTIONS

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++)

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

# 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
	AX_CHECK_JUNIT
	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([x86intrin.h])
AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(rt, sched_yield)

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

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

# Check for posix_memalign explicitly: it is a builtin in some compilers and
# the generic declaration in AC_CHECK_FUNCS is incompatible.
AX_FUNC_POSIX_MEMALIGN

AC_SYS_LARGEFILE

AC_C_BIGENDIAN

# Linux requires _GNU_SOURCE to be defined
case "$host_os" in
linux*)	AM_CFLAGS="$AM_CFLAGS -D_GNU_SOURCE" ;;
esac

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

AC_SUBST(AM_CFLAGS)

# test/format optionally uses a Oracle Berkeley DB release for verification.
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 Levyx/Helium key/value store.
AC_MSG_CHECKING([if --with-helium=DIR option specified])
AC_ARG_WITH(helium,
    [AS_HELP_STRING([--with-helium=DIR],
	[Specify installed library directory of Helium])],
    [with_helium="$withval"], [with_helium="NO_HELIUM_LIBRARY"])
AC_MSG_RESULT($with_helium)
AM_CONDITIONAL([HAVE_HELIUM], [test -d $with_helium])
AC_SUBST(HELIUM_PATH, [$with_helium])

# Sanity check the build
AM_COND_IF([LEVELDB], [
  AM_COND_IF([SNAPPY], [], [
    AC_MSG_ERROR(
      [--enable-leveldb requires --enable-snappy or --with-builtins=snappy.])
  ])
])


# 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

# If we are building in a tree without documentation, check if doxygen is
# available.
if test -f "$srcdir/docs/index.html" ; then
	wt_cv_docs_exist=yes
else
	wt_cv_docs_exist=no
fi

if test "$wt_cv_docs_exist" = "no"; then
	AC_CHECK_PROG([DOXYGEN], [doxygen], [doxygen], [false])
fi

if test "$wt_cv_docs_exist" = "yes" -o "$DOXYGEN" = "doxygen" ; then
	MAN1_PAGES="$srcdir/docs/man/man1/wt.1"
	AC_SUBST(MAN1_PAGES)
	MAN3_PAGES="$srcdir/docs/man/man3/wiredtiger.3"
	AC_SUBST(MAN3_PAGES)
fi

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

# The LevelDB API needs some configuration knowledge
AM_COND_IF([LEVELDB],
    AC_CONFIG_HEADERS([api/leveldb/leveldb_wt_config.h:api/leveldb/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