Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 254 lines (202 sloc) 8.03 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
89a403e @nslater changed COPYING to LICENCE as per the ASF standards
nslater authored
24 AM_INIT_AUTOMAKE([1.6.3 foreign check-news -Wno-portability])
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])], [
62 JS_INCLUDE_FLAGS="-I$withval"
63 ], [
64 JS_INCLUDE_FLAGS="-I/usr/include/js"
65 JS_INCLUDE_FLAGS="$JS_INCLUDE_FLAGS -I/usr/include/mozjs"
66 JS_INCLUDE_FLAGS="$JS_INCLUDE_FLAGS -I/usr/local/include/js"
67 JS_INCLUDE_FLAGS="$JS_INCLUDE_FLAGS -I/opt/local/include/js"
68 ])
69
70 AC_ARG_WITH([js-lib], [AC_HELP_STRING([--with-js-lib=PATH],
71 [set PATH to the SpiderMonkey library directory])],
72 [JS_LIB_FLAGS="-L$withval"], [])
73
74 # XP_UNIX required for jsapi.h and has been tested to work on Linux and Darwin.
75 LIB_FLAGS="-L/usr/local/lib -L/opt/local/lib $JS_LIB_FLAGS"
76 LIBS="$LIB_FLAGS $LIBS"
77 FLAGS="$LIB_FLAGS $ERLANG_FLAGS $JS_INCLUDE_FLAGS -DXP_UNIX $FLAGS"
78 CPPFLAGS="$FLAGS $CPPFLAGS"
79 LDFLAGS="$FLAGS $LDFLAGS"
80
81 AC_CHECK_LIB([js], [JS_NewContext], [], [
82 AC_CHECK_LIB([mozjs], [JS_NewContext], [], [
83 AC_MSG_ERROR([Could not find the js library.
84
85 Is the Mozilla SpiderMonkey library installed?])])])
86
87 AC_CHECK_HEADER([jsapi.h], [], [
88 AC_MSG_ERROR([Could not find the jsapi header.
89
90 Are Mozilla SpiderMonkey headers installed?])])
91
92 AC_CHECK_ICU([3])
93
94 ICU_LOCAL_CFLAGS=`$ICU_CONFIG --cppflags-searchpath`
95 ICU_LOCAL_LDFLAGS=`$ICU_CONFIG --ldflags-searchpath`
96
97 AC_SUBST(ICU_CONFIG)
98 AC_SUBST(ICU_LOCAL_CFLAGS)
99 AC_SUBST(ICU_LOCAL_LDFLAGS)
100
101 AC_PATH_PROG([ERL], [erl])
102
103 if test x${ERL} = x; then
104 AC_MSG_ERROR([Could not find the `erl' executable. Is Erlang installed?])
105 fi
106
ec24327 @nslater correct Erlang version checking
nslater authored
107 erlang_version_error="The installed Erlang version is less than 5.5.0 (R11B)."
108
edfc78c @nslater corrected dollar escapes
nslater authored
109 version="`${ERL} -version 2>&1 | ${SED} "s/[[^0-9]]/ /g"`"
ec24327 @nslater correct Erlang version checking
nslater authored
110
edfc78c @nslater corrected dollar escapes
nslater authored
111 if test `echo $version | ${AWK} "{print \\$1}"` -lt 5; then
ec24327 @nslater correct Erlang version checking
nslater authored
112 AC_MSG_ERROR([$erlang_version_error])
113 fi
114
edfc78c @nslater corrected dollar escapes
nslater authored
115 if test `echo $version | ${AWK} "{print \\$2}"` -lt 5; then
ec24327 @nslater correct Erlang version checking
nslater authored
116 AC_MSG_ERROR([$erlang_version_error])
e30a423 @nslater configure now checks for installed Erlang version
nslater authored
117 fi
118
544a38d @cmlenz Imported trunk.
cmlenz authored
119 AC_PATH_PROG([ERLC], [erlc])
120
121 if test x${ERLC} = x; then
122 AC_MSG_ERROR([Could not find the `erlc' executable. Is Erlang installed?])
123 fi
124
125 AC_CHECK_HEADER([erl_driver.h], [], [
126 AC_MSG_ERROR([Could not find the `erl_driver.h' header.
127
128 Are the Erlang headers installed? Use the `--with-erlang' option to specify the
129 path to the Erlang include directory.])])
130
131 AC_PATH_PROG([HELP2MAN_EXECUTABLE], [help2man])
132 if test x${HELP2MAN_EXECUTABLE} = x; then
133 AC_MSG_WARN([You will be unable to regenerate any man pages.])
134 fi
135
136 use_init=yes
137 use_launchd=yes
138
139 AC_ARG_ENABLE([init], [AC_HELP_STRING([--disable-init],
140 [don't install init script where applicable])], [
141 use_init=$enableval
142 ], [])
143
144 AC_ARG_ENABLE([launchd], [AC_HELP_STRING([--disable-launchd],
145 [don't install launchd configuration where applicable])], [
146 use_launchd=$enableval
147 ], [])
148
149 init_enabled=false
150 launchd_enabled=false
151
152 if test "$use_init" = "yes"; then
153 AC_MSG_CHECKING(location of init directory)
154 if test -d /etc/rc.d; then
155 init_enabled=true
156 AC_SUBST([initdir], ['${sysconfdir}/rc.d'])
157 AC_MSG_RESULT(${initdir})
158 else
159 if test -d /etc/init.d; then
160 init_enabled=true
161 AC_SUBST([initdir], ['${sysconfdir}/init.d'])
162 AC_MSG_RESULT(${initdir})
163 else
164 AC_MSG_RESULT(not found)
165 fi
166 fi
167 fi
168
169 if test "$use_launchd" = "yes"; then
170 AC_MSG_CHECKING(location of launchd directory)
171 if test -d /Library/LaunchDaemons; then
172 init_enabled=false
173 launchd_enabled=true
174 AC_SUBST([launchddir], ['${prefix}/Library/LaunchDaemons'])
175 AC_MSG_RESULT(${launchddir})
176 else
177 AC_MSG_RESULT(not found)
178 fi
179 fi
180
181 AC_ARG_VAR([ERL_EXECUTABLE], [path to the `erl' executable])
182 AC_ARG_VAR([ERLC_EXECUTABLE], [path to the `erlc' executable])
183 AC_ARG_VAR([HELP2MAN_EXECUTABLE], [path to the `help2man' program])
184
185 if test -n "$HELP2MAN_EXECUTABLE"; then
186 help2man_enabled=true
187 else
188 if test -f "$srcdir/bin/couchdb.1" -a -f "$srcdir/bin/couchjs.1"; then
189 help2man_enabled=true
190 else
191 help2man_enabled=false
192 fi
193 fi
194
195 AM_CONDITIONAL([INIT], [test x${init_enabled} = xtrue])
196 AM_CONDITIONAL([LAUNCHD], [test x${launchd_enabled} = xtrue])
197 AM_CONDITIONAL([HELP2MAN], [test x${help2man_enabled} = xtrue])
198
199 AC_SUBST([package_author_name], ["LOCAL_PACKAGE_AUTHOR_NAME"])
200 AC_SUBST([package_author_address], ["LOCAL_PACKAGE_AUTHOR_ADDRESS"])
201 AC_SUBST([package_identifier], ["LOCAL_PACKAGE_IDENTIFIER"])
2f56905 @nslater corrected use of package tarname in instalation directories
nslater authored
202 AC_SUBST([package_tarname], ["LOCAL_PACKAGE_TARNAME"])
544a38d @cmlenz Imported trunk.
cmlenz authored
203 AC_SUBST([package_name], ["LOCAL_PACKAGE_NAME"])
204
205 AC_SUBST([version], ["LOCAL_VERSION"])
206 AC_SUBST([version_major], ["LOCAL_VERSION_MAJOR"])
207 AC_SUBST([version_minor], ["LOCAL_VERSION_MINOR"])
208 AC_SUBST([version_revision], ["LOCAL_VERSION_REVISION"])
209 AC_SUBST([version_stage], ["LOCAL_VERSION_STAGE"])
210 AC_SUBST([version_release], ["LOCAL_VERSION_RELEASE"])
211
521213d @nslater updated source to use apache infrastructure addresses
nslater authored
212 AC_SUBST([bug_uri], ["LOCAL_BUG_URI"])
544a38d @cmlenz Imported trunk.
cmlenz authored
213
2f56905 @nslater corrected use of package tarname in instalation directories
nslater authored
214 AC_SUBST([pkgconfdir], [${sysconfdir}/${package_identifier}])
215 AC_SUBST([pkgdatadir], [${datadir}/${package_identifier}])
216 AC_SUBST([pkgdocdir], [${datadir}/doc/${package_identifier}])
217 AC_SUBST([pkglibdir], [${libdir}/${package_identifier}])
218 AC_SUBST([pkgstatelibdir], [${localstatedir}/lib/${package_identifier}])
219 AC_SUBST([pkgstatelogdir], [${localstatedir}/log/${package_identifier}])
544a38d @cmlenz Imported trunk.
cmlenz authored
220 AC_SUBST([libbindir], [${pkglibdir}/bin])
221 AC_SUBST([erlangbindir], [${pkglibdir}/erlang/bin])
222 AC_SUBST([erlanglibdir], [${pkglibdir}/erlang/lib])
223
224 AC_REVISION([LOCAL_VERSION])
225
226 AC_CONFIG_FILES([Makefile])
227 AC_CONFIG_FILES([bin/couchjs.tpl])
228 AC_CONFIG_FILES([bin/couchdb.tpl])
229 AC_CONFIG_FILES([bin/Makefile])
d33da1d @nslater removed non-standard use of .dist configuration files
nslater authored
230 AC_CONFIG_FILES([etc/couchdb/Makefile])
231 AC_CONFIG_FILES([etc/couchdb/couch.ini.tpl])
544a38d @cmlenz Imported trunk.
cmlenz authored
232 AC_CONFIG_FILES([etc/default/couchdb.tpl])
233 AC_CONFIG_FILES([etc/default/Makefile])
234 AC_CONFIG_FILES([etc/init/couchdb.tpl])
235 AC_CONFIG_FILES([etc/init/Makefile])
236 AC_CONFIG_FILES([etc/launchd/org.apache.couchdb.plist.tpl])
237 AC_CONFIG_FILES([etc/launchd/Makefile])
238 AC_CONFIG_FILES([etc/logrotate.d/couchdb.tpl])
239 AC_CONFIG_FILES([etc/logrotate.d/Makefile])
240 AC_CONFIG_FILES([etc/Makefile])
241 AC_CONFIG_FILES([share/Makefile])
242 AC_CONFIG_FILES([src/couchdb/couch.app.tpl])
243 AC_CONFIG_FILES([src/couchdb/Makefile])
39de307 @cmlenz Merged mochiweb branch back into trunk.
cmlenz authored
244 AC_CONFIG_FILES([src/mochiweb/Makefile])
544a38d @cmlenz Imported trunk.
cmlenz authored
245 AC_CONFIG_FILES([src/Makefile])
246 AC_CONFIG_FILES([var/Makefile])
247
248 AC_OUTPUT
249
250 echo
251 echo "You have configured Apache CouchDB. Time to relax."
252 echo
253 echo "Run \`make && make install' to install."
Something went wrong with that request. Please try again.