Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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