Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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