6 SYSCONFDIR="$PREFIX/etc/prosody"
7 DATADIR="$PREFIX/var/lib/prosody"
11 LUA_INCDIR="/usr/include"
14 ICU_FLAGS="-licui18n -licudata -licuuc"
30 Configure Prosody prior to building.
33 --ostype=OS Use one of the OS presets.
34 May be one of: debian, macosx, linux, freebsd
35 --prefix=DIR Prefix where Prosody should be installed.
37 --sysconfdir=DIR Location where the config file should be installed.
38 Default is \$PREFIX/etc/prosody
39 --datadir=DIR Location where the server data should be stored.
40 Default is \$PREFIX/var/lib/prosody
41 --lua-suffix=SUFFIX Versioning suffix to use in Lua filenames.
42 Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...)
43 --with-lua=PREFIX Use Lua from given prefix.
45 --runwith=BINARY What Lua binary to set as runtime environment.
47 --with-lua-include=DIR You can also specify Lua's includes dir.
48 Default is \$LUA_DIR/include
49 --with-lua-lib=DIR You can also specify Lua's libraries dir.
50 Default is \$LUA_DIR/lib
51 --with-idn=LIB The name of the IDN library to link with.
53 --idn-library=(idn|icu) Select library to use for IDNA functionality.
54 idn: use GNU libidn (default)
56 --with-ssl=LIB The name of the SSL to link with.
57 Default is $OPENSSL_LIB
58 --cflags=FLAGS Flags to pass to the compiler
60 --ldflags=FLAGS Flags to pass to the linker
62 --c-compiler=CC The C compiler to use when building modules.
64 --linker=CC The linker to use when building modules.
66 --require-config Will cause Prosody to refuse to run when
67 it fails to find a configuration file
68 --no-example-certs Disables generation of example certificates.
75 value="`echo $1 | sed 's/[^=]*=\(.*\)/\1/'`"
76 if echo "$value" | grep -q "~"
79 echo '*WARNING*: the "~" sign is not expanded in flags.'
80 echo 'If you mean the home directory, use $HOME instead.'
99 if [ "$OSTYPE" = "debian" ]; then
103 LUA_INCDIR=/usr/include/lua5.1;
105 CFLAGS="$CFLAGS -D_GNU_SOURCE"
107 if [ "$OSTYPE" = "macosx" ]; then
108 LUA_INCDIR=/usr/local/include;
110 LUA_LIBDIR=/usr/local/lib
112 LDFLAGS="-bundle -undefined dynamic_lookup"
114 if [ "$OSTYPE" = "linux" ]; then
115 LUA_INCDIR=/usr/local/include;
117 LUA_LIBDIR=/usr/local/lib
119 CFLAGS="-Wall -fPIC -D_GNU_SOURCE"
122 if [ "$OSTYPE" = "freebsd" -o "$OSTYPE" = "openbsd" ]; then
123 LUA_INCDIR="/usr/local/include/lua51"
125 CFLAGS="-Wall -fPIC -I/usr/local/include"
126 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
132 if [ "$OSTYPE" = "openbsd" ]; then
133 LUA_INCDIR="/usr/local/include";
151 --with-lua-include=*)
156 LUA_LIBDIR="$value" LUA_LIBDIR_SET=yes
186 echo "Error: Unknown flag: $1"
193 if [ "$PREFIX_SET" = "yes" -a ! "$SYSCONFDIR_SET" = "yes" ]
195 if [ "$PREFIX" = "/usr" ]
196 then SYSCONFDIR=/etc/prosody
197 else SYSCONFDIR=$PREFIX/etc/prosody
201 if [ "$PREFIX_SET" = "yes" -a ! "$DATADIR_SET" = "yes" ]
203 if [ "$PREFIX" = "/usr" ]
204 then DATADIR=/var/lib/prosody
205 else DATADIR=$PREFIX/var/lib/prosody
211 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
212 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
221 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
222 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
224 if [ "$found" = "yes" ]
232 if [ "$LUA_SUFFIX_SET" != "yes" ]
234 for suffix in "5.1" "51" ""
237 if [ "$LUA_DIR_SET" = "yes" ]
239 if [ -e "$LUA_DIR/bin/lua$suffix" ]
244 find_lua=`find_program lua$suffix`
248 echo "Lua interpreter found: $find_lua/lua$suffix..."
254 if ! [ "$LUA_DIR_SET" = "yes" ]
256 echo -n "Looking for Lua... "
259 find_lua=`find_program lua$LUA_SUFFIX`
260 echo "lua$LUA_SUFFIX found in \$PATH: $find_lua"
264 LUA_DIR=`dirname $find_lua`
265 LUA_BINDIR="$find_lua"
267 echo "lua$LUA_SUFFIX not found in \$PATH."
268 echo "You may want to use the flags --with-lua and/or --lua-suffix. See --help."
273 if ! [ "$LUA_INCDIR_SET" = "yes" ]
275 LUA_INCDIR="$LUA_DIR/include"
278 if ! [ "$LUA_LIBDIR_SET" = "yes" ]
280 LUA_LIBDIR="$LUA_DIR/lib"
283 if [ "$LUA_DIR_SET" = "yes" ]
285 LUA_BINDIR="$LUA_DIR/bin"
288 if [ "$IDN_LIBRARY" = "icu" ]
290 IDNA_LIBS="$ICU_FLAGS"
291 CFLAGS="$CFLAGS -DUSE_STRINGPREP_ICU"
293 if [ "$IDN_LIBRARY" = "idn" ]
295 IDNA_LIBS="-l$IDN_LIB"
298 echo -n "Checking Lua includes... "
299 lua_h="$LUA_INCDIR/lua.h"
302 echo "lua.h found in $lua_h"
304 echo "lua.h not found (looked in $lua_h)"
305 echo "You may want to use the flag --with-lua-include. See --help."
315 found=`find_program "$1"`
318 echo "$1 found at $found"
324 echo "Could not find a $explanation. Tried: $tried."
325 echo "Make sure one of them is installed and available in your PATH."
331 echo "Writing configuration..."
334 cat <<EOF > config.unix
335 # This file was automatically generated by the configure script.
336 # Run "./configure --help" for details.
339 SYSCONFDIR=$SYSCONFDIR
341 LUA_SUFFIX=$LUA_SUFFIX
343 LUA_INCDIR=$LUA_INCDIR
344 LUA_LIBDIR=$LUA_LIBDIR
345 LUA_BINDIR=$LUA_BINDIR
346 REQUIRE_CONFIG=$REQUIRE_CONFIG
349 OPENSSL_LIB=$OPENSSL_LIB
360 echo "Installation prefix: $PREFIX"
361 echo "Prosody configuration directory: $SYSCONFDIR"
362 echo "Using Lua from: $LUA_DIR"
364 make clean > /dev/null 2> /dev/null
367 echo "Done. You can now run 'make' to build."