Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 301 lines (244 sloc) 9.123 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
13 m4_include([m4/ac_check_icu.m4])
14
2f56905 @nslater corrected use of package tarname in instalation directories
nslater authored
15 AC_INIT([LOCAL_PACKAGE_NAME], [LOCAL_VERSION], [], [LOCAL_PACKAGE_TARNAME])
544a38d @cmlenz Imported trunk.
cmlenz authored
16
17 AC_PREREQ([2.59])
18
d32c0e8 @nslater updated configure to look for CHANGES
nslater authored
19 AC_CONFIG_SRCDIR([CHANGES])
544a38d @cmlenz Imported trunk.
cmlenz authored
20 AC_CONFIG_AUX_DIR([build-aux])
21
22 AM_CONFIG_HEADER([config.h])
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
34 AC_MSG_CHECKING([for pthread_create in -lpthread])
35
36 original_LIBS="$LIBS"
37 LIBS="-lpthread $original_LIBS"
38
39 AC_TRY_LINK([#include<pthread.h>],
40 [pthread_create((void *)0, (void *)0, (void *)0, (void *)0)],
41 [pthread=yes], [pthread=no])
42
43 if test x${pthread} = xyes; then
44 AC_MSG_RESULT([yes])
45 else
46 LIBS="$original_LIBS"
47 AC_MSG_RESULT([no])
48 fi
49
50 AC_ARG_WITH([erlang], [AC_HELP_STRING([--with-erlang=PATH],
51 [set PATH to the Erlang include directory])], [
52 ERLANG_FLAGS="-I$withval"
53 ], [
54 ERLANG_FLAGS="-I${libdir}/erlang/usr/include"
55 ERLANG_FLAGS="$ERLANG_FLAGS -I/usr/lib/erlang/usr/include"
56 ERLANG_FLAGS="$ERLANG_FLAGS -I/usr/local/lib/erlang/usr/include"
57 ERLANG_FLAGS="$ERLANG_FLAGS -I/opt/local/lib/erlang/usr/include"
58 ])
59
60 AC_ARG_WITH([js-include], [AC_HELP_STRING([--with-js-include=PATH],
61 [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
62 JS_INCLUDE="$withval"
63 JS_FLAGS="-I$JS_INCLUDE"
544a38d @cmlenz Imported trunk.
cmlenz authored
64 ], [
864ea28 @nslater portability changes for freebsd
nslater authored
65 JS_FLAGS="-I/usr/include"
66 JS_FLAGS="$JS_FLAGS -I/usr/include/js"
67 JS_FLAGS="$JS_FLAGS -I/usr/include/mozjs"
68 JS_FLAGS="$JS_FLAGS -I/usr/local/include"
69 JS_FLAGS="$JS_FLAGS -I/opt/local/include"
70 JS_FLAGS="$JS_FLAGS -I/usr/local/include/js"
71 JS_FLAGS="$JS_FLAGS -I/opt/local/include/js"
544a38d @cmlenz Imported trunk.
cmlenz authored
72 ])
73
74 AC_ARG_WITH([js-lib], [AC_HELP_STRING([--with-js-lib=PATH],
75 [set PATH to the SpiderMonkey library directory])],
76 [JS_LIB_FLAGS="-L$withval"], [])
77
9e9230c @davisp Added code coverage report generation target.
davisp authored
78 AC_ARG_VAR([ERLC_FLAGS], [general flags to prepend to ERLC_FLAGS])
ffad329 @nslater added NIGHTLY and FLAGS env variables
nslater authored
79 AC_ARG_VAR([FLAGS], [general flags to prepend to LDFLAGS and CPPFLAGS])
80
4838c35 @janl Fix copy und paste error.
janl authored
81 LIB_FLAGS="$JS_LIB_FLAGS -L/usr/local/lib -L/opt/local/lib"
544a38d @cmlenz Imported trunk.
cmlenz authored
82 LIBS="$LIB_FLAGS $LIBS"
864ea28 @nslater portability changes for freebsd
nslater authored
83 # XP_UNIX required for jsapi.h and has been tested to work on Linux and Darwin.
84 FLAGS="$LIB_FLAGS $ERLANG_FLAGS $JS_FLAGS -DXP_UNIX $FLAGS"
544a38d @cmlenz Imported trunk.
cmlenz authored
85 CPPFLAGS="$FLAGS $CPPFLAGS"
864ea28 @nslater portability changes for freebsd
nslater authored
86 # manually linking libm is requred for FreeBSD 7.0
87 LDFLAGS="$FLAGS -lm $LDFLAGS"
544a38d @cmlenz Imported trunk.
cmlenz authored
88
afb9467 @janl add compile-time conditionals to support the upcoming Spidermonkey 1.8, ...
janl authored
89 AC_CHECK_LIB([mozjs], [JS_NewContext], [], [
90 AC_CHECK_LIB([js], [JS_NewContext], [], [
544a38d @cmlenz Imported trunk.
cmlenz authored
91 AC_MSG_ERROR([Could not find the js library.
92
93 Is the Mozilla SpiderMonkey library installed?])])])
94
95 AC_CHECK_HEADER([jsapi.h], [], [
aa4a652 @janl search for jsapi.h in in $includedir and $includedir/js as a fallback, p...
janl authored
96 AC_CHECK_HEADER([js/jsapi.h],
97 [
98 CPPFLAGS="$CPPFLAGS -I$JS_INCLUDE/js"
99 ],
100 [
101 AC_MSG_ERROR([Could not find the jsapi header.
102
103 Are the Mozilla SpiderMonkey headers installed?])
104 ])])
544a38d @cmlenz Imported trunk.
cmlenz authored
105
538cfb0 @davisp Proper fix because JS_VERSION cannot distinguish between 1.8.0 and 1.8.1
davisp authored
106 AC_LANG_PUSH(C)
107 AC_LINK_IFELSE(
108 [AC_LANG_PROGRAM(
109 [[]],
110 [[JS_SetOperationCallback(0, 0);]]
111 )],
112 AC_DEFINE([USE_JS_SETOPCB], [], [Use new JS_SetOperationCallback])
113 )
114 AC_LANG_POP(C)
115
544a38d @cmlenz Imported trunk.
cmlenz authored
116 AC_CHECK_ICU([3])
117
118 ICU_LOCAL_CFLAGS=`$ICU_CONFIG --cppflags-searchpath`
119 ICU_LOCAL_LDFLAGS=`$ICU_CONFIG --ldflags-searchpath`
120
121 AC_SUBST(ICU_CONFIG)
122 AC_SUBST(ICU_LOCAL_CFLAGS)
123 AC_SUBST(ICU_LOCAL_LDFLAGS)
124
51f186c @nslater added M4 quoting around value
nslater authored
125 AC_CHECK_CURL([7.15.5])
126 AC_SUBST(CURL_CFLAGS)
127 AC_SUBST(CURL_LIBS)
07bfbdd @janl Add checks for libcurl to ./configure. Picked version 7.16.0 as lowest r...
janl authored
128
5d22213 @janl Only link against -lcrypt on Linux & BSD systems.
janl authored
129 case "$(uname -s)" in
f9f5d67 @janl Silence warning on Linux by properly exporting `crypt()`.
janl authored
130 Linux)
131 LIBS="$LIBS -lcrypt"
132 CPPFLAGS="-D_XOPEN_SOURCE $CPPFLAGS"
133 ;;
134 FreeBSD)
5d22213 @janl Only link against -lcrypt on Linux & BSD systems.
janl authored
135 LIBS="$LIBS -lcrypt"
cee8134 @janl Fix for building on OpenBSD. Link couchpass against -lcrypto instead of ...
janl authored
136 ;;
137 OpenBSD)
138 LIBS="$LIBS -lcrypto"
5d22213 @janl Only link against -lcrypt on Linux & BSD systems.
janl authored
139 ;;
140 esac
141
544a38d @cmlenz Imported trunk.
cmlenz authored
142 AC_PATH_PROG([ERL], [erl])
143
144 if test x${ERL} = x; then
145 AC_MSG_ERROR([Could not find the `erl' executable. Is Erlang installed?])
146 fi
147
55e61d3 @nslater tweeked version checking for erlang
nslater authored
148 erlang_version_error="The installed Erlang version is less than 5.6.0 (R12B)."
ec24327 @nslater correct Erlang version checking
nslater authored
149
edfc78c @nslater corrected dollar escapes
nslater authored
150 version="`${ERL} -version 2>&1 | ${SED} "s/[[^0-9]]/ /g"`"
ec24327 @nslater correct Erlang version checking
nslater authored
151
edfc78c @nslater corrected dollar escapes
nslater authored
152 if test `echo $version | ${AWK} "{print \\$1}"` -lt 5; then
ec24327 @nslater correct Erlang version checking
nslater authored
153 AC_MSG_ERROR([$erlang_version_error])
154 fi
155
55e61d3 @nslater tweeked version checking for erlang
nslater authored
156 if test `echo $version | ${AWK} "{print \\$2}"` -lt 6; then
ec24327 @nslater correct Erlang version checking
nslater authored
157 AC_MSG_ERROR([$erlang_version_error])
e30a423 @nslater configure now checks for installed Erlang version
nslater authored
158 fi
159
544a38d @cmlenz Imported trunk.
cmlenz authored
160 AC_PATH_PROG([ERLC], [erlc])
161
162 if test x${ERLC} = x; then
163 AC_MSG_ERROR([Could not find the `erlc' executable. Is Erlang installed?])
164 fi
165
166 AC_CHECK_HEADER([erl_driver.h], [], [
167 AC_MSG_ERROR([Could not find the `erl_driver.h' header.
168
169 Are the Erlang headers installed? Use the `--with-erlang' option to specify the
170 path to the Erlang include directory.])])
171
172 AC_PATH_PROG([HELP2MAN_EXECUTABLE], [help2man])
173 if test x${HELP2MAN_EXECUTABLE} = x; then
174 AC_MSG_WARN([You will be unable to regenerate any man pages.])
175 fi
176
177 use_init=yes
178 use_launchd=yes
179
180 AC_ARG_ENABLE([init], [AC_HELP_STRING([--disable-init],
181 [don't install init script where applicable])], [
182 use_init=$enableval
183 ], [])
184
185 AC_ARG_ENABLE([launchd], [AC_HELP_STRING([--disable-launchd],
186 [don't install launchd configuration where applicable])], [
187 use_launchd=$enableval
188 ], [])
189
190 init_enabled=false
191 launchd_enabled=false
192
193 if test "$use_init" = "yes"; then
194 AC_MSG_CHECKING(location of init directory)
195 if test -d /etc/rc.d; then
196 init_enabled=true
197 AC_SUBST([initdir], ['${sysconfdir}/rc.d'])
198 AC_MSG_RESULT(${initdir})
199 else
200 if test -d /etc/init.d; then
201 init_enabled=true
202 AC_SUBST([initdir], ['${sysconfdir}/init.d'])
203 AC_MSG_RESULT(${initdir})
204 else
205 AC_MSG_RESULT(not found)
206 fi
207 fi
208 fi
209
210 if test "$use_launchd" = "yes"; then
211 AC_MSG_CHECKING(location of launchd directory)
212 if test -d /Library/LaunchDaemons; then
213 init_enabled=false
214 launchd_enabled=true
215 AC_SUBST([launchddir], ['${prefix}/Library/LaunchDaemons'])
216 AC_MSG_RESULT(${launchddir})
217 else
218 AC_MSG_RESULT(not found)
219 fi
220 fi
221
8139da1 @janl fix ./configure --help output, ERL[C]_EXECUTABLE are now ERL[C]
janl authored
222 AC_ARG_VAR([ERL], [path to the `erl' executable])
223 AC_ARG_VAR([ERLC], [path to the `erlc' executable])
544a38d @cmlenz Imported trunk.
cmlenz authored
224 AC_ARG_VAR([HELP2MAN_EXECUTABLE], [path to the `help2man' program])
225
226 if test -n "$HELP2MAN_EXECUTABLE"; then
227 help2man_enabled=true
228 else
229 if test -f "$srcdir/bin/couchdb.1" -a -f "$srcdir/bin/couchjs.1"; then
230 help2man_enabled=true
231 else
232 help2man_enabled=false
233 fi
234 fi
235
236 AM_CONDITIONAL([INIT], [test x${init_enabled} = xtrue])
237 AM_CONDITIONAL([LAUNCHD], [test x${launchd_enabled} = xtrue])
238 AM_CONDITIONAL([HELP2MAN], [test x${help2man_enabled} = xtrue])
239
240 AC_SUBST([package_author_name], ["LOCAL_PACKAGE_AUTHOR_NAME"])
241 AC_SUBST([package_author_address], ["LOCAL_PACKAGE_AUTHOR_ADDRESS"])
242 AC_SUBST([package_identifier], ["LOCAL_PACKAGE_IDENTIFIER"])
2f56905 @nslater corrected use of package tarname in instalation directories
nslater authored
243 AC_SUBST([package_tarname], ["LOCAL_PACKAGE_TARNAME"])
544a38d @cmlenz Imported trunk.
cmlenz authored
244 AC_SUBST([package_name], ["LOCAL_PACKAGE_NAME"])
245
246 AC_SUBST([version], ["LOCAL_VERSION"])
247 AC_SUBST([version_major], ["LOCAL_VERSION_MAJOR"])
248 AC_SUBST([version_minor], ["LOCAL_VERSION_MINOR"])
249 AC_SUBST([version_revision], ["LOCAL_VERSION_REVISION"])
250 AC_SUBST([version_stage], ["LOCAL_VERSION_STAGE"])
251 AC_SUBST([version_release], ["LOCAL_VERSION_RELEASE"])
252
521213d @nslater updated source to use apache infrastructure addresses
nslater authored
253 AC_SUBST([bug_uri], ["LOCAL_BUG_URI"])
544a38d @cmlenz Imported trunk.
cmlenz authored
254
b74e668 @nslater renamed directory variables, stage one
nslater authored
255 AC_SUBST([localconfdir], [${sysconfdir}/${package_identifier}])
256 AC_SUBST([localdatadir], [${datadir}/${package_identifier}])
257 AC_SUBST([localdocdir], [${datadir}/doc/${package_identifier}])
258 AC_SUBST([locallibdir], [${libdir}/${package_identifier}])
259 AC_SUBST([localstatelibdir], [${localstatedir}/lib/${package_identifier}])
260 AC_SUBST([localstatelogdir], [${localstatedir}/log/${package_identifier}])
1370dea @nslater reworked the pid file
nslater authored
261 AC_SUBST([localstaterundir], [${localstatedir}/run/${package_identifier}])
b74e668 @nslater renamed directory variables, stage one
nslater authored
262 AC_SUBST([locallibbindir], [${locallibdir}/bin])
263 AC_SUBST([localerlanglibdir], [${locallibdir}/erlang/lib])
544a38d @cmlenz Imported trunk.
cmlenz authored
264
50afadc @janl Fix build on OpenBSD: 'fix for older autotools that don't define "abs_to...
janl authored
265 # fix for older autotools that don't define "abs_top_YYY" by default
266 AC_SUBST(abs_top_srcdir)
267 AC_SUBST(abs_top_builddir)
268
544a38d @cmlenz Imported trunk.
cmlenz authored
269 AC_REVISION([LOCAL_VERSION])
270
271 AC_CONFIG_FILES([Makefile])
272 AC_CONFIG_FILES([bin/couchjs.tpl])
273 AC_CONFIG_FILES([bin/couchdb.tpl])
274 AC_CONFIG_FILES([bin/Makefile])
d33da1d @nslater removed non-standard use of .dist configuration files
nslater authored
275 AC_CONFIG_FILES([etc/couchdb/Makefile])
2bc4be3 @janl Merge runtimeconfig branch back into trunk
janl authored
276 AC_CONFIG_FILES([etc/couchdb/default.ini.tpl])
544a38d @cmlenz Imported trunk.
cmlenz authored
277 AC_CONFIG_FILES([etc/default/Makefile])
278 AC_CONFIG_FILES([etc/init/couchdb.tpl])
279 AC_CONFIG_FILES([etc/init/Makefile])
280 AC_CONFIG_FILES([etc/launchd/org.apache.couchdb.plist.tpl])
281 AC_CONFIG_FILES([etc/launchd/Makefile])
282 AC_CONFIG_FILES([etc/logrotate.d/couchdb.tpl])
283 AC_CONFIG_FILES([etc/logrotate.d/Makefile])
284 AC_CONFIG_FILES([etc/Makefile])
285 AC_CONFIG_FILES([share/Makefile])
286 AC_CONFIG_FILES([src/couchdb/couch.app.tpl])
287 AC_CONFIG_FILES([src/couchdb/Makefile])
9faded7 @nslater added missing file
nslater authored
288 AC_CONFIG_FILES([src/couchdb/priv/Makefile])
ace6dfe @jchris Replacement of inets with ibrowse. Fixes COUCHDB-179 and enhances replic...
jchris authored
289 AC_CONFIG_FILES([src/ibrowse/Makefile])
39de307 @cmlenz Merged mochiweb branch back into trunk.
cmlenz authored
290 AC_CONFIG_FILES([src/mochiweb/Makefile])
2bc4be3 @janl Merge runtimeconfig branch back into trunk
janl authored
291 AC_CONFIG_FILES([test/Makefile])
efe07f9 @janl Add `make dev` target. Use `./utils/run` to launch CouchDB from the sour...
janl authored
292 AC_CONFIG_FILES([utils/Makefile])
544a38d @cmlenz Imported trunk.
cmlenz authored
293 AC_CONFIG_FILES([var/Makefile])
294
295 AC_OUTPUT
296
297 echo
2bc4be3 @janl Merge runtimeconfig branch back into trunk
janl authored
298 echo "You have configured Apache CouchDB, time to relax."
544a38d @cmlenz Imported trunk.
cmlenz authored
299 echo
4edf64e @nslater improved message
nslater authored
300 echo "Run \`make && sudo make install' to install."
Something went wrong with that request. Please try again.