Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 582 lines (494 sloc) 18.976 kb
544a38d @cmlenz Imported trunk.
cmlenz authored
1 dnl Licensed under the Apache License, Version 2.0 (the "License"); you may not
2 dnl use this file except in compliance with the License. dnl You may obtain a
3 dnl copy of the License at
4 dnl
5 dnl http://www.apache.org/licenses/LICENSE-2.0
6 dnl
7 dnl Unless required by applicable law or agreed to in writing, software
8 dnl distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 dnl WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 dnl License for the specific language governing permissions and limitations
11 dnl under the License.
12
2f56905 @nslater corrected use of package tarname in instalation directories
nslater authored
13 AC_INIT([LOCAL_PACKAGE_NAME], [LOCAL_VERSION], [], [LOCAL_PACKAGE_TARNAME])
544a38d @cmlenz Imported trunk.
cmlenz authored
14
15 AC_PREREQ([2.59])
16
d32c0e8 @nslater updated configure to look for CHANGES
nslater authored
17 AC_CONFIG_SRCDIR([CHANGES])
544a38d @cmlenz Imported trunk.
cmlenz authored
18 AC_CONFIG_AUX_DIR([build-aux])
9807cda @janl If aclocal needs to be called during a build, its options are taken
janl authored
19 AC_CONFIG_MACRO_DIR([m4])
544a38d @cmlenz Imported trunk.
cmlenz authored
20
21 AM_CONFIG_HEADER([config.h])
e2e8554 @fdmanana Add configurable file compression (snappy, deflate or none)
fdmanana authored
22 AC_CONFIG_HEADERS([src/snappy/google-snappy/config.h])
544a38d @cmlenz Imported trunk.
cmlenz authored
23
034b9c6 @nslater removed check-news check completely
nslater authored
24 AM_INIT_AUTOMAKE([1.6.3 foreign])
544a38d @cmlenz Imported trunk.
cmlenz authored
25
26 AC_GNU_SOURCE
27 AC_ENABLE_SHARED
28 AC_DISABLE_STATIC
29
30 AC_PROG_CC
31 AC_PROG_LIBTOOL
32 AC_PROG_LN_S
33
f66dfa7 @tilgovi include pkg-config macros
tilgovi authored
34 PKG_PROG_PKG_CONFIG
35
e2e8554 @fdmanana Add configurable file compression (snappy, deflate or none)
fdmanana authored
36 dnl Config for google snappy
37 m4_define([snappy_major], [1])
38 m4_define([snappy_minor], [0])
0cd6405 @fdmanana Upgrade snappy to version 1.0.3
fdmanana authored
39 m4_define([snappy_patchlevel], [3])
e2e8554 @fdmanana Add configurable file compression (snappy, deflate or none)
fdmanana authored
40
41 AC_PROG_CXX
42 AC_LANG([C++])
43 AC_C_BIGENDIAN
44 AC_CHECK_HEADERS([stdint.h stddef.h sys/mman.h sys/resource.h])
45 AC_CHECK_FUNC([mmap])
46
47 AC_MSG_CHECKING([if the compiler supports __builtin_expect])
48
49 AC_TRY_COMPILE(, [
50 return __builtin_expect(1, 1) ? 1 : 0
51 ], [
52 snappy_have_builtin_expect=yes
53 AC_MSG_RESULT([yes])
54 ], [
55 snappy_have_builtin_expect=no
56 AC_MSG_RESULT([no])
57 ])
58 if test x$snappy_have_builtin_expect = xyes ; then
59 AC_DEFINE([HAVE_BUILTIN_EXPECT], [1], [Define to 1 if the compiler supports __builtin_expect.])
60 fi
61
62 AC_MSG_CHECKING([if the compiler supports __builtin_ctzll])
63
64 AC_TRY_COMPILE(, [
65 return (__builtin_ctzll(0x100000000LL) == 32) ? 1 : 0
66 ], [
67 snappy_have_builtin_ctz=yes
68 AC_MSG_RESULT([yes])
69 ], [
70 snappy_have_builtin_ctz=no
71 AC_MSG_RESULT([no])
72 ])
73 if test x$snappy_have_builtin_ctz = xyes ; then
74 AC_DEFINE([HAVE_BUILTIN_CTZ], [1], [Define to 1 if the compiler supports __builtin_ctz and friends.])
75 fi
76
77 if test "$ac_cv_header_stdint_h" = "yes"; then
78 AC_SUBST([ac_cv_have_stdint_h], [1])
79 else
80 AC_SUBST([ac_cv_have_stdint_h], [0])
81 fi
82 if test "$ac_cv_header_stddef_h" = "yes"; then
83 AC_SUBST([ac_cv_have_stddef_h], [1])
84 else
85 AC_SUBST([ac_cv_have_stddef_h], [0])
86 fi
87
88 SNAPPY_MAJOR="snappy_major"
89 SNAPPY_MINOR="snappy_minor"
90 SNAPPY_PATCHLEVEL="snappy_patchlevel"
91
92 AC_SUBST([SNAPPY_MAJOR])
93 AC_SUBST([SNAPPY_MINOR])
94 AC_SUBST([SNAPPY_PATCHLEVEL])
95 dnl End of google snappy specific config
96
544a38d @cmlenz Imported trunk.
cmlenz authored
97 AC_MSG_CHECKING([for pthread_create in -lpthread])
98
99 original_LIBS="$LIBS"
100 LIBS="-lpthread $original_LIBS"
101
102 AC_TRY_LINK([#include<pthread.h>],
103 [pthread_create((void *)0, (void *)0, (void *)0, (void *)0)],
104 [pthread=yes], [pthread=no])
105
106 if test x${pthread} = xyes; then
107 AC_MSG_RESULT([yes])
108 else
109 LIBS="$original_LIBS"
110 AC_MSG_RESULT([no])
111 fi
112
113 AC_ARG_WITH([erlang], [AC_HELP_STRING([--with-erlang=PATH],
114 [set PATH to the Erlang include directory])], [
115 ERLANG_FLAGS="-I$withval"
116 ], [
117 ERLANG_FLAGS="-I${libdir}/erlang/usr/include"
118 ERLANG_FLAGS="$ERLANG_FLAGS -I/usr/lib/erlang/usr/include"
119 ERLANG_FLAGS="$ERLANG_FLAGS -I/usr/local/lib/erlang/usr/include"
120 ERLANG_FLAGS="$ERLANG_FLAGS -I/opt/local/lib/erlang/usr/include"
121 ])
3456b4e @tilgovi prevent excessive linking of mozjs - COUCHDB-1033
tilgovi authored
122 AC_SUBST(ERLANG_FLAGS)
544a38d @cmlenz Imported trunk.
cmlenz authored
123
7b0f330 @tilgovi Fix COUCHDB-1078 - Port couchjs to newest libmozjs
tilgovi authored
124 PKG_CHECK_MODULES([JS], [mozjs185], [
125 JS_LIB_DIR="$(${PKG_CONFIG} --variable=libdir mozjs185)"
126 ], [
127 PKG_CHECK_MODULES([JS], [mozilla-js >= 1.7], [
128 JS_LIB_DIR="$(${PKG_CONFIG} --variable=sdkdir mozilla-js)/lib"
12b4c57 @tilgovi link couchjs w mozjs (COUCHDB-562)
tilgovi authored
129 ], [
7b0f330 @tilgovi Fix COUCHDB-1078 - Port couchjs to newest libmozjs
tilgovi authored
130 JS_LIB_DIR="${libdir}"
131 JS_CFLAGS="-I/usr/include"
132 JS_CFLAGS="$JS_CFLAGS -I/usr/include/js"
133 JS_CFLAGS="$JS_CFLAGS -I/usr/include/mozjs"
134 JS_CFLAGS="$JS_CFLAGS -I/usr/local/include/js"
135 JS_CFLAGS="$JS_CFLAGS -I/opt/local/include/js"
136 ])
12b4c57 @tilgovi link couchjs w mozjs (COUCHDB-562)
tilgovi authored
137 ])
138
544a38d @cmlenz Imported trunk.
cmlenz authored
139 AC_ARG_WITH([js-include], [AC_HELP_STRING([--with-js-include=PATH],
140 [set PATH to the SpiderMonkey include directory])], [
aa4a652 @janl search for jsapi.h in in $includedir and $includedir/js as a fallback, p...
janl authored
141 JS_INCLUDE="$withval"
12b4c57 @tilgovi link couchjs w mozjs (COUCHDB-562)
tilgovi authored
142 JS_CFLAGS="-I$JS_INCLUDE"
143 ], [])
544a38d @cmlenz Imported trunk.
cmlenz authored
144
145 AC_ARG_WITH([js-lib], [AC_HELP_STRING([--with-js-lib=PATH],
146 [set PATH to the SpiderMonkey library directory])],
ad18ea6 have 'make dist' build a windows installer on windows
Mark Hammond authored
147 [
148 JS_LIB_DIR=$withval
12b4c57 @tilgovi link couchjs w mozjs (COUCHDB-562)
tilgovi authored
149 JS_LIBS="-L$withval"
150 ], [])
544a38d @cmlenz Imported trunk.
cmlenz authored
151
9e9230c @davisp Added code coverage report generation target.
davisp authored
152 AC_ARG_VAR([ERLC_FLAGS], [general flags to prepend to ERLC_FLAGS])
ffad329 @nslater added NIGHTLY and FLAGS env variables
nslater authored
153 AC_ARG_VAR([FLAGS], [general flags to prepend to LDFLAGS and CPPFLAGS])
8f4c70f @tilgovi more portability for build search paths
tilgovi authored
154 AS_CASE([$(uname -s)],
155 [CYGWIN*], [] ,
156 [*], [
157 CPPFLAGS="$CPPFLAGS -I/opt/local/include"
158 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
159 CPPFLAGS="$CPPFLAGS -I/usr/include"
160 LDFLAGS="$LDFLAGS -L/opt/local/lib"
161 LDFLAGS="$LDFLAGS -L/usr/local/lib"
162 ])
163 CPPFLAGS="$CPPFLAGS $FLAGS"
164 LDFLAGS="$LDFLAGS $FLAGS"
ffad329 @nslater added NIGHTLY and FLAGS env variables
nslater authored
165
3456b4e @tilgovi prevent excessive linking of mozjs - COUCHDB-1033
tilgovi authored
166 # The erlang cc.sh/ld.sh scripts will convert a -O option
167 # into the same optimization flags erlang itself uses.
168 CFLAGS="-O2 $CFLAGS"
169
8f4c70f @tilgovi more portability for build search paths
tilgovi authored
170 LIBS="$LIBS $LDFLAGS"
39a629b @davisp Applying markh's Windows build patch.
davisp authored
171
8f4c70f @tilgovi more portability for build search paths
tilgovi authored
172 AS_CASE([$(uname -s)],
173 [CYGWIN*], [
174 JS_CFLAGS="-DXP_WIN $JS_CFLAGS"
175 IS_WINDOWS="TRUE"
176 ] ,
177 [*], [
178 # XP_UNIX required for jsapi.h and has been tested to work on Linux and Darwin.
179 JS_CFLAGS="-DXP_UNIX $JS_CFLAGS"
180 ])
39a629b @davisp Applying markh's Windows build patch.
davisp authored
181
182 AM_CONDITIONAL([WINDOWS], [test x$IS_WINDOWS = xTRUE])
544a38d @cmlenz Imported trunk.
cmlenz authored
183
3456b4e @tilgovi prevent excessive linking of mozjs - COUCHDB-1033
tilgovi authored
184 OLD_LIBS="$LIBS"
185 LIBS="$JS_LIBS $LIBS"
7b0f330 @tilgovi Fix COUCHDB-1078 - Port couchjs to newest libmozjs
tilgovi authored
186 AC_CHECK_LIB([mozjs185], [JS_NewContext], [JS_LIB_BASE=mozjs185], [
187 AC_CHECK_LIB([mozjs], [JS_NewContext], [JS_LIB_BASE=mozjs], [
188 AC_CHECK_LIB([js], [JS_NewContext], [JS_LIB_BASE=js], [
189 AC_CHECK_LIB([js3250], [JS_NewContext], [JS_LIB_BASE=js3250], [
190 AC_CHECK_LIB([js32], [JS_NewContext], [JS_LIB_BASE=js32], [
191 AC_MSG_ERROR([Could not find the js library.
192
193 Is the Mozilla SpiderMonkey library installed?])])])])])])
194
195 AC_CHECK_LIB([$JS_LIB_BASE], [JS_FreezeObject],
196 AC_DEFINE([HAVE_JS_FREEZE_OBJECT], [1],
197 [Define whether we have JS_FreezeObject]))
198
199 AC_CHECK_LIB([$JS_LIB_BASE], [JS_NewGlobalObject],
200 AC_DEFINE([HAVE_JS_NEW_GLOBAL_OBJECT], [1],
201 [Define whether we have JS_NewGlobalObject]))
202
203 AC_CHECK_LIB([$JS_LIB_BASE], [JS_GetStringCharsAndLength],
204 AC_DEFINE([HAVE_JS_GET_STRING_CHARS_AND_LENGTH], [1],
205 [Define whether we have JS_GetStringCharsAndLength]))
206
207 AC_CHECK_LIB([$JS_LIB_BASE], [JS_NewCompartmentAndGlobalObject],
208 AC_DEFINE([HAVE_COMPARTMENTS], [1],
209 [Define whether we have JS_NewCompartmentAndGlobalObject]))
210
211 AC_CHECK_LIB([$JS_LIB_BASE], [JS_StrictPropertyStub],
212 AC_DEFINE([HAVE_JS_STRICT_PROPERTY_STUB], [1],
213 [Define whether we have JS_StrictPropertyStub]))
214
215 AC_CHECK_LIB([$JS_LIB_BASE], [JS_DestroyScript],
216 AC_DEFINE([HAVE_SCRIPT_TYPE], [1],
217 [Define whether scripts have a special JSScript type]))
3456b4e @tilgovi prevent excessive linking of mozjs - COUCHDB-1033
tilgovi authored
218 LIBS="$OLD_LIBS"
544a38d @cmlenz Imported trunk.
cmlenz authored
219
ad18ea6 have 'make dist' build a windows installer on windows
Mark Hammond authored
220 if test x${IS_WINDOWS} = xTRUE; then
221 if test -f "$JS_LIB_DIR/$JS_LIB_BASE.dll"; then
222 # seamonkey 1.7- build layout on Windows
223 JS_LIB_BINARY="$JS_LIB_DIR/$JS_LIB_BASE.dll"
224 else
225 # seamonkey 1.8+ build layout on Windows
226 if test -f "$JS_LIB_DIR/../bin/$JS_LIB_BASE.dll"; then
227 JS_LIB_BINARY="$JS_LIB_DIR/../bin/$JS_LIB_BASE.dll"
228 else
229 AC_MSG_ERROR([Could not find $JS_LIB_BASE.dll.])
230 fi
231 fi
232 AC_SUBST(JS_LIB_BINARY)
233
234 # On windows we need to know the path to the openssl binaries.
235 AC_ARG_WITH([openssl-bin-dir], [AC_HELP_STRING([--with-openssl-bin-dir=PATH],
236 [path to the open ssl binaries for distribution on Windows])], [
237 openssl_bin_dir=`cygpath -m "$withval"`
238 AC_SUBST(openssl_bin_dir)
239 ], [])
240
241 # Windows uses Inno setup - look for its compiler.
242 AC_PATH_PROG([INNO_COMPILER_EXECUTABLE], [iscc])
243 if test x${INNO_COMPILER_EXECUTABLE} = x; then
244 AC_MSG_WARN([You will be unable to build the Windows installer.])
245 fi
246
247 # We need the msvc redistributables for this platform too
248 # (in theory we could just install the assembly locally - but
249 # there are at least 4 directories with binaries, meaning 4 copies;
250 # so using the redist .exe means it ends up installed globally...)
251 AC_ARG_WITH([msvc-redist-dir], [AC_HELP_STRING([--with-msvc-redist-dir=PATH],
252 [path to the msvc redistributables for the Windows platform])], [
253 msvc_redist_dir=`cygpath -m "$withval"`
254 msvc_redist_name="vcredist_x86.exe"
255 AC_SUBST(msvc_redist_dir)
256 AC_SUBST(msvc_redist_name)
257 ], [])
258 if test ! -f ${msvc_redist_dir}/${msvc_redist_name}; then
259 AC_MSG_WARN([The MSVC redistributable seems to be missing; expect the installer to fail.])
260 fi
261 fi
262
12b4c57 @tilgovi link couchjs w mozjs (COUCHDB-562)
tilgovi authored
263 JS_LIBS="-l$JS_LIB_BASE $JS_LIBS"
264 AC_SUBST(JS_LIBS)
ad18ea6 have 'make dist' build a windows installer on windows
Mark Hammond authored
265
3456b4e @tilgovi prevent excessive linking of mozjs - COUCHDB-1033
tilgovi authored
266 OLD_CPPFLAGS="$CPPFLAGS"
267 CPPFLAGS="$JS_CFLAGS $CPPFLAGS"
544a38d @cmlenz Imported trunk.
cmlenz authored
268 AC_CHECK_HEADER([jsapi.h], [], [
aa4a652 @janl search for jsapi.h in in $includedir and $includedir/js as a fallback, p...
janl authored
269 AC_CHECK_HEADER([js/jsapi.h],
270 [
271 CPPFLAGS="$CPPFLAGS -I$JS_INCLUDE/js"
272 ],
273 [
274 AC_MSG_ERROR([Could not find the jsapi header.
275
276 Are the Mozilla SpiderMonkey headers installed?])
277 ])])
3456b4e @tilgovi prevent excessive linking of mozjs - COUCHDB-1033
tilgovi authored
278 CPPFLAGS="$OLD_CPPFLAGS"
544a38d @cmlenz Imported trunk.
cmlenz authored
279
538cfb0 @davisp Proper fix because JS_VERSION cannot distinguish between 1.8.0 and 1.8.1
davisp authored
280 AC_LANG_PUSH(C)
3456b4e @tilgovi prevent excessive linking of mozjs - COUCHDB-1033
tilgovi authored
281 OLDCFLAGS="$CFLAGS"
7b0f330 @tilgovi Fix COUCHDB-1078 - Port couchjs to newest libmozjs
tilgovi authored
282 CFLAGS="-Werror-implicit-function-declaration $JS_CFLAGS $OLDCFLAGS"
fd72a9b @davisp Rookie mistake. Needed to force a compiler error to determine the differ...
davisp authored
283 AC_COMPILE_IFELSE(
538cfb0 @davisp Proper fix because JS_VERSION cannot distinguish between 1.8.0 and 1.8.1
davisp authored
284 [AC_LANG_PROGRAM(
fd72a9b @davisp Rookie mistake. Needed to force a compiler error to determine the differ...
davisp authored
285 [[#include <jsapi.h>]],
538cfb0 @davisp Proper fix because JS_VERSION cannot distinguish between 1.8.0 and 1.8.1
davisp authored
286 [[JS_SetOperationCallback(0, 0);]]
287 )],
288 AC_DEFINE([USE_JS_SETOPCB], [], [Use new JS_SetOperationCallback])
289 )
7b0f330 @tilgovi Fix COUCHDB-1078 - Port couchjs to newest libmozjs
tilgovi authored
290 CFLAGS="$JS_CFLAGS $OLDCFLAGS"
291 AC_COMPILE_IFELSE(
292 [AC_LANG_PROGRAM(
293 [[#include <jsapi.h>]],
294 [[static JSFunctionSpec fs;
295 fs.extra = 0;]]
296 )],
297 AC_DEFINE([JS_FS_HAS_EXTRA], [1], [JSFunctionSpec has an extra member])
298 )
299 CFLAGS="$JS_CFLAGS $OLDCFLAGS -Werror"
300 AC_COMPILE_IFELSE(
301 [AC_LANG_PROGRAM(
302 [[#include <jsapi.h>
303 static JSBool op(JSContext* cx, JSObject* obj, jsid id, jsval* vp) {}]],
304 [[static JSPropertySpec spec;
305 spec.getter = op;]]
306 )],
307 AC_DEFINE([JS_PROPERTY_OP_HAS_ID_AS_JSID], [1],
308 [The type of "id" in the prototype for JSPropertyOp is a jsid])
309 )
fd72a9b @davisp Rookie mistake. Needed to force a compiler error to determine the differ...
davisp authored
310 CFLAGS="$OLD_CFLAGS"
538cfb0 @davisp Proper fix because JS_VERSION cannot distinguish between 1.8.0 and 1.8.1
davisp authored
311 AC_LANG_POP(C)
312
39a629b @davisp Applying markh's Windows build patch.
davisp authored
313 AC_ARG_WITH([win32-icu-binaries], [AC_HELP_STRING([--with-win32-icu-binaries=PATH],
314 [set PATH to the Win32 native ICU binaries directory])], [
6ceefeb @tilgovi let icu decide how to link itself
tilgovi authored
315 ICU_CFLAGS="-I$withval/include"
316 ICU_LIBS="-L$withval/lib -licuuc -licudt -licuin"
317 ICU_BIN=$withval/bin
39a629b @davisp Applying markh's Windows build patch.
davisp authored
318 ], [
3c30452 @janl Require ICU 3.4.1. Closes COUCHDB-175.
janl authored
319 AC_CHECK_ICU([3.4.1])
6ceefeb @tilgovi let icu decide how to link itself
tilgovi authored
320 ICU_BIN=
39a629b @davisp Applying markh's Windows build patch.
davisp authored
321 ])
544a38d @cmlenz Imported trunk.
cmlenz authored
322
6ceefeb @tilgovi let icu decide how to link itself
tilgovi authored
323 AC_SUBST(ICU_CFLAGS)
324 AC_SUBST(ICU_LIBS)
325 AC_SUBST(ICU_BIN)
39a629b @davisp Applying markh's Windows build patch.
davisp authored
326
df7ac13 @davisp CouchDB no longer requires cURL to build.
davisp authored
327 use_curl=yes
39a629b @davisp Applying markh's Windows build patch.
davisp authored
328 AC_ARG_WITH([win32-curl], [AC_HELP_STRING([--with-win32-curl=PATH],
329 [set PATH to the Win32 native curl directory])], [
330 # default build on windows is a static lib, and that's what we want too
331 CURL_CFLAGS="-I$withval/include -DCURL_STATICLIB"
8f4c70f @tilgovi more portability for build search paths
tilgovi authored
332 CURL_LIBS="-L$withval/lib -llibcurl -lWs2_32 -lkernel32 -luser32 -ladvapi32 -lWldap32"
333 # OpenSSL libraries may be pulled in via libcurl if it was built with SSL
334 # these are libeay32 ssleay32 instead of crypto ssl on unix
39a629b @davisp Applying markh's Windows build patch.
davisp authored
335 ], [
df7ac13 @davisp CouchDB no longer requires cURL to build.
davisp authored
336 AC_CHECK_CURL([7.18.0],
337 [AC_DEFINE([HAVE_CURL], [1], ["Provide HTTP support to couchjs"])], [
338 AC_MSG_WARN([You will be unable to run some JavaScript unit tests.])
339 use_curl=no
a9e159d @davisp Avoid -lcurl when libcurl is not found.
davisp authored
340 CURL_LIBS=
df7ac13 @davisp CouchDB no longer requires cURL to build.
davisp authored
341 ])
39a629b @davisp Applying markh's Windows build patch.
davisp authored
342 ])
544a38d @cmlenz Imported trunk.
cmlenz authored
343
51f186c @nslater added M4 quoting around value
nslater authored
344 AC_SUBST(CURL_CFLAGS)
345 AC_SUBST(CURL_LIBS)
07bfbdd @janl Add checks for libcurl to ./configure. Picked version 7.16.0 as lowest r...
janl authored
346
5d22213 @janl Only link against -lcrypt on Linux & BSD systems.
janl authored
347 case "$(uname -s)" in
f9f5d67 @janl Silence warning on Linux by properly exporting `crypt()`.
janl authored
348 Linux)
349 LIBS="$LIBS -lcrypt"
350 CPPFLAGS="-D_XOPEN_SOURCE $CPPFLAGS"
351 ;;
352 FreeBSD)
5d22213 @janl Only link against -lcrypt on Linux & BSD systems.
janl authored
353 LIBS="$LIBS -lcrypt"
cee8134 @janl Fix for building on OpenBSD. Link couchpass against -lcrypto instead of ...
janl authored
354 ;;
355 OpenBSD)
356 LIBS="$LIBS -lcrypto"
5d22213 @janl Only link against -lcrypt on Linux & BSD systems.
janl authored
357 ;;
358 esac
359
544a38d @cmlenz Imported trunk.
cmlenz authored
360 AC_PATH_PROG([ERL], [erl])
361
362 if test x${ERL} = x; then
363 AC_MSG_ERROR([Could not find the `erl' executable. Is Erlang installed?])
364 fi
365
3975b87 @davisp Update our Erlang VM requirement to 5.6.5 (R12B5). Also fixes the remain...
davisp authored
366 erlang_version_error="The installed Erlang version is less than 5.6.5 (R12B05)."
ec24327 @nslater correct Erlang version checking
nslater authored
367
cd461f2 @nslater apply fix for COUCHDB-975, thanks Timothy Smith
nslater authored
368 version="`${ERL} -version 2>&1 | ${SED} 's/[[^0-9]]/ /g'`"
ec24327 @nslater correct Erlang version checking
nslater authored
369
edfc78c @nslater corrected dollar escapes
nslater authored
370 if test `echo $version | ${AWK} "{print \\$1}"` -lt 5; then
ec24327 @nslater correct Erlang version checking
nslater authored
371 AC_MSG_ERROR([$erlang_version_error])
372 fi
373
55e61d3 @nslater tweeked version checking for erlang
nslater authored
374 if test `echo $version | ${AWK} "{print \\$2}"` -lt 6; then
ec24327 @nslater correct Erlang version checking
nslater authored
375 AC_MSG_ERROR([$erlang_version_error])
e30a423 @nslater configure now checks for installed Erlang version
nslater authored
376 fi
377
3975b87 @davisp Update our Erlang VM requirement to 5.6.5 (R12B5). Also fixes the remain...
davisp authored
378 if test `echo $version | ${AWK} "{print \\$2}"` -eq 6; then
379 if test `echo $version | ${AWK} "{print \\$3}"` -lt 5; then
380 AC_MSG_ERROR([$erlang_version_error])
381 fi
382 fi
383
3925e85 @fdmanana Added ejson application
fdmanana authored
384 otp_release="`${ERL} -noshell -eval 'io:put_chars(erlang:system_info(otp_release)).' -s erlang halt`"
385 AC_SUBST(otp_release)
386 AM_CONDITIONAL([USE_OTP_NIFS], [test x$otp_release \> xR13B03])
87254bb @fdmanana Add NIF version for the less_json function
fdmanana authored
387 AM_CONDITIONAL([USE_EJSON_COMPARE_NIF], [test x$otp_release \> xR13B04])
3925e85 @fdmanana Added ejson application
fdmanana authored
388
cd214b2 @janl Check if Erlang has been compiled with crypto support at ./configure
janl authored
389 has_crypto=`${ERL} -eval "case application:load(crypto) of ok -> ok; _ -> exit(no_crypto) end." -noshell -s init stop`
390
391 if test -n "$has_crypto"; then
392 AC_MSG_ERROR([Could not find the Erlang crypto library. Has Erlang been compiled with OpenSSL support?])
393 fi
394
544a38d @cmlenz Imported trunk.
cmlenz authored
395 AC_PATH_PROG([ERLC], [erlc])
396
397 if test x${ERLC} = x; then
398 AC_MSG_ERROR([Could not find the `erlc' executable. Is Erlang installed?])
399 fi
400
3456b4e @tilgovi prevent excessive linking of mozjs - COUCHDB-1033
tilgovi authored
401 OLD_CPPFLAGS="$CPPFLAGS"
402 CPPFLAGS="$ERLANG_FLAGS $CPPFLAGS"
544a38d @cmlenz Imported trunk.
cmlenz authored
403 AC_CHECK_HEADER([erl_driver.h], [], [
404 AC_MSG_ERROR([Could not find the `erl_driver.h' header.
405
406 Are the Erlang headers installed? Use the `--with-erlang' option to specify the
407 path to the Erlang include directory.])])
3456b4e @tilgovi prevent excessive linking of mozjs - COUCHDB-1033
tilgovi authored
408 CPPFLAGS="$OLD_CPPFLAGS"
544a38d @cmlenz Imported trunk.
cmlenz authored
409
410 AC_PATH_PROG([HELP2MAN_EXECUTABLE], [help2man])
411 if test x${HELP2MAN_EXECUTABLE} = x; then
412 AC_MSG_WARN([You will be unable to regenerate any man pages.])
413 fi
414
415 use_init=yes
416 use_launchd=yes
90f9f46 @janl Merge branch 'optional-nm' into trunk
janl authored
417 native_mochijson_enabled=no
544a38d @cmlenz Imported trunk.
cmlenz authored
418
419 AC_ARG_ENABLE([init], [AC_HELP_STRING([--disable-init],
420 [don't install init script where applicable])], [
421 use_init=$enableval
422 ], [])
423
424 AC_ARG_ENABLE([launchd], [AC_HELP_STRING([--disable-launchd],
425 [don't install launchd configuration where applicable])], [
426 use_launchd=$enableval
427 ], [])
428
90f9f46 @janl Merge branch 'optional-nm' into trunk
janl authored
429 AC_ARG_ENABLE([native-mochijson], [AC_HELP_STRING([--enable-native-mochijson],
430 [compile mochijson to native code (EXPERIMENTAL)])], [
431 native_mochijson_enabled=$enableval
432 ], [])
433
544a38d @cmlenz Imported trunk.
cmlenz authored
434 init_enabled=false
435 launchd_enabled=false
436
437 if test "$use_init" = "yes"; then
438 AC_MSG_CHECKING(location of init directory)
439 if test -d /etc/rc.d; then
440 init_enabled=true
441 AC_SUBST([initdir], ['${sysconfdir}/rc.d'])
442 AC_MSG_RESULT(${initdir})
443 else
444 if test -d /etc/init.d; then
445 init_enabled=true
446 AC_SUBST([initdir], ['${sysconfdir}/init.d'])
447 AC_MSG_RESULT(${initdir})
448 else
449 AC_MSG_RESULT(not found)
450 fi
451 fi
452 fi
453
454 if test "$use_launchd" = "yes"; then
455 AC_MSG_CHECKING(location of launchd directory)
456 if test -d /Library/LaunchDaemons; then
457 init_enabled=false
458 launchd_enabled=true
459 AC_SUBST([launchddir], ['${prefix}/Library/LaunchDaemons'])
460 AC_MSG_RESULT(${launchddir})
461 else
462 AC_MSG_RESULT(not found)
463 fi
464 fi
465
8139da1 @janl fix ./configure --help output, ERL[C]_EXECUTABLE are now ERL[C]
janl authored
466 AC_ARG_VAR([ERL], [path to the `erl' executable])
467 AC_ARG_VAR([ERLC], [path to the `erlc' executable])
544a38d @cmlenz Imported trunk.
cmlenz authored
468 AC_ARG_VAR([HELP2MAN_EXECUTABLE], [path to the `help2man' program])
469
470 if test -n "$HELP2MAN_EXECUTABLE"; then
471 help2man_enabled=true
472 else
473 if test -f "$srcdir/bin/couchdb.1" -a -f "$srcdir/bin/couchjs.1"; then
474 help2man_enabled=true
475 else
476 help2man_enabled=false
477 fi
478 fi
479
480 AM_CONDITIONAL([INIT], [test x${init_enabled} = xtrue])
481 AM_CONDITIONAL([LAUNCHD], [test x${launchd_enabled} = xtrue])
482 AM_CONDITIONAL([HELP2MAN], [test x${help2man_enabled} = xtrue])
90f9f46 @janl Merge branch 'optional-nm' into trunk
janl authored
483 AM_CONDITIONAL([USE_NATIVE_MOCHIJSON], [test x${native_mochijson_enabled} = xyes])
df7ac13 @davisp CouchDB no longer requires cURL to build.
davisp authored
484 AM_CONDITIONAL([USE_CURL], [test x${use_curl} = xyes])
544a38d @cmlenz Imported trunk.
cmlenz authored
485
486 AC_SUBST([package_author_name], ["LOCAL_PACKAGE_AUTHOR_NAME"])
487 AC_SUBST([package_author_address], ["LOCAL_PACKAGE_AUTHOR_ADDRESS"])
488 AC_SUBST([package_identifier], ["LOCAL_PACKAGE_IDENTIFIER"])
2f56905 @nslater corrected use of package tarname in instalation directories
nslater authored
489 AC_SUBST([package_tarname], ["LOCAL_PACKAGE_TARNAME"])
544a38d @cmlenz Imported trunk.
cmlenz authored
490 AC_SUBST([package_name], ["LOCAL_PACKAGE_NAME"])
491
492 AC_SUBST([version], ["LOCAL_VERSION"])
493 AC_SUBST([version_major], ["LOCAL_VERSION_MAJOR"])
494 AC_SUBST([version_minor], ["LOCAL_VERSION_MINOR"])
495 AC_SUBST([version_revision], ["LOCAL_VERSION_REVISION"])
496 AC_SUBST([version_stage], ["LOCAL_VERSION_STAGE"])
497 AC_SUBST([version_release], ["LOCAL_VERSION_RELEASE"])
498
521213d @nslater updated source to use apache infrastructure addresses
nslater authored
499 AC_SUBST([bug_uri], ["LOCAL_BUG_URI"])
544a38d @cmlenz Imported trunk.
cmlenz authored
500
b74e668 @nslater renamed directory variables, stage one
nslater authored
501 AC_SUBST([localconfdir], [${sysconfdir}/${package_identifier}])
502 AC_SUBST([localdatadir], [${datadir}/${package_identifier}])
503 AC_SUBST([localdocdir], [${datadir}/doc/${package_identifier}])
504 AC_SUBST([locallibdir], [${libdir}/${package_identifier}])
505 AC_SUBST([localstatelibdir], [${localstatedir}/lib/${package_identifier}])
506 AC_SUBST([localstatelogdir], [${localstatedir}/log/${package_identifier}])
1370dea @nslater reworked the pid file
nslater authored
507 AC_SUBST([localstaterundir], [${localstatedir}/run/${package_identifier}])
39a629b @davisp Applying markh's Windows build patch.
davisp authored
508
509 # On Windows we install directly into our erlang distribution.
510 if test x${IS_WINDOWS} = xTRUE; then
511 AC_SUBST([locallibbindir], [${prefix}/bin])
512 AC_SUBST([localerlanglibdir], [${libdir}])
513 else
514 AC_SUBST([locallibbindir], [${locallibdir}/bin])
515 AC_SUBST([localerlanglibdir], [${locallibdir}/erlang/lib])
516 fi
544a38d @cmlenz Imported trunk.
cmlenz authored
517
50afadc @janl Fix build on OpenBSD: 'fix for older autotools that don't define "abs_to...
janl authored
518 # fix for older autotools that don't define "abs_top_YYY" by default
519 AC_SUBST(abs_top_srcdir)
520 AC_SUBST(abs_top_builddir)
521
544a38d @cmlenz Imported trunk.
cmlenz authored
522 AC_REVISION([LOCAL_VERSION])
523
524 AC_CONFIG_FILES([Makefile])
525 AC_CONFIG_FILES([bin/couchjs.tpl])
526 AC_CONFIG_FILES([bin/couchdb.tpl])
39a629b @davisp Applying markh's Windows build patch.
davisp authored
527 AC_CONFIG_FILES([bin/couchdb.bat.tpl])
544a38d @cmlenz Imported trunk.
cmlenz authored
528 AC_CONFIG_FILES([bin/Makefile])
d33da1d @nslater removed non-standard use of .dist configuration files
nslater authored
529 AC_CONFIG_FILES([etc/couchdb/Makefile])
2bc4be3 @janl Merge runtimeconfig branch back into trunk
janl authored
530 AC_CONFIG_FILES([etc/couchdb/default.ini.tpl])
544a38d @cmlenz Imported trunk.
cmlenz authored
531 AC_CONFIG_FILES([etc/default/Makefile])
532 AC_CONFIG_FILES([etc/init/couchdb.tpl])
533 AC_CONFIG_FILES([etc/init/Makefile])
534 AC_CONFIG_FILES([etc/launchd/org.apache.couchdb.plist.tpl])
535 AC_CONFIG_FILES([etc/launchd/Makefile])
536 AC_CONFIG_FILES([etc/logrotate.d/couchdb.tpl])
537 AC_CONFIG_FILES([etc/logrotate.d/Makefile])
79d3861 @nslater added etc/windows to the build, fixes COUCHDB-849
nslater authored
538 AC_CONFIG_FILES([etc/windows/Makefile])
544a38d @cmlenz Imported trunk.
cmlenz authored
539 AC_CONFIG_FILES([etc/Makefile])
540 AC_CONFIG_FILES([share/Makefile])
00964d0 @davisp Port Noah's bugfixes to trunk.
davisp authored
541 AC_CONFIG_FILES([src/Makefile])
544a38d @cmlenz Imported trunk.
cmlenz authored
542 AC_CONFIG_FILES([src/couchdb/couch.app.tpl])
543 AC_CONFIG_FILES([src/couchdb/Makefile])
9faded7 @nslater added missing file
nslater authored
544 AC_CONFIG_FILES([src/couchdb/priv/Makefile])
8e2215e Initial check-in of OAuth and cookie authentication.
Damien F. Katz authored
545 AC_CONFIG_FILES([src/erlang-oauth/Makefile])
e5813d5 @davisp Add ETap to CouchDB's SVN repository.
davisp authored
546 AC_CONFIG_FILES([src/etap/Makefile])
ace6dfe @jchris Replacement of inets with ibrowse. Fixes COUCHDB-179 and enhances replic...
jchris authored
547 AC_CONFIG_FILES([src/ibrowse/Makefile])
39de307 @cmlenz Merged mochiweb branch back into trunk.
cmlenz authored
548 AC_CONFIG_FILES([src/mochiweb/Makefile])
e2e8554 @fdmanana Add configurable file compression (snappy, deflate or none)
fdmanana authored
549 AC_CONFIG_FILES([src/snappy/Makefile])
550 AC_CONFIG_FILES([src/snappy/google-snappy/snappy-stubs-public.h])
3925e85 @fdmanana Added ejson application
fdmanana authored
551 AC_CONFIG_FILES([src/ejson/Makefile])
2bc4be3 @janl Merge runtimeconfig branch back into trunk
janl authored
552 AC_CONFIG_FILES([test/Makefile])
0adab20 @davisp Updated the benchmarks to use the new cURL adapter.
davisp authored
553 AC_CONFIG_FILES([test/bench/Makefile])
e29a192 @davisp Fixes 'make distcheck' to run the test suite.
davisp authored
554 AC_CONFIG_FILES([test/etap/Makefile])
555 AC_CONFIG_FILES([test/etap/test_util.erl])
556 AC_CONFIG_FILES([test/javascript/Makefile])
557 AC_CONFIG_FILES([test/view_server/Makefile])
efe07f9 @janl Add `make dev` target. Use `./utils/run` to launch CouchDB from the sour...
janl authored
558 AC_CONFIG_FILES([utils/Makefile])
544a38d @cmlenz Imported trunk.
cmlenz authored
559 AC_CONFIG_FILES([var/Makefile])
560
561 AC_OUTPUT
562
39a629b @davisp Applying markh's Windows build patch.
davisp authored
563 # *sob* - on Windows libtool fails as 'libname_spec' isn't correct (it
564 # expects GNU style lib names). I can't work out how to configure this
565 # option sanely, so we pass the script through sed to modify it.
566 # Also, the erlang cc.sh script doesn't cope well with the '-link' command
567 # line option libtool provides.
568 # PLEASE, someone help put this out of its misery!!
569 # This hackery is being tracked via COUCHDB-440.
570 if test x${IS_WINDOWS} = xTRUE; then
571 sed -e 's,libname_spec="lib\\$name",libname_spec="\\\$name",' \
572 -e 's,-link,,' \
573 < libtool > libtool.tmp
574 mv libtool.tmp libtool
575 # probably would chmod +x if we weren't on windows...
576 fi
577
544a38d @cmlenz Imported trunk.
cmlenz authored
578 echo
2bc4be3 @janl Merge runtimeconfig branch back into trunk
janl authored
579 echo "You have configured Apache CouchDB, time to relax."
544a38d @cmlenz Imported trunk.
cmlenz authored
580 echo
4edf64e @nslater improved message
nslater authored
581 echo "Run \`make && sudo make install' to install."
Something went wrong with that request. Please try again.