6 SYSCONFDIR="$PREFIX/etc/prosody"
7 DATADIR="$PREFIX/var/lib/prosody"
11 LUA_INCDIR="/usr/include"
16 CFLAGS="-shared -fPIC"
22 Configure Prosody prior to building.
25 --ostype=OS Use one of the OS presets.
26 May be one of: debian, macosx
27 --prefix=DIR Prefix where Prosody should be installed.
29 --sysconfdir=DIR Location where the config file should be installed.
30 Default is \$PREFIX/etc/prosody
31 --datadir=DIR Location where the server data should be stored.
32 Default is \$PREFIX/var/lib/prosody
33 --lua-suffix=SUFFIX Versioning suffix to use in Lua filenames.
34 Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...)
35 --with-lua=PREFIX Use Lua from given prefix.
37 --with-lua-include=DIR You can also specify Lua's includes dir.
38 Default is \$LUA_DIR/include
39 --with-lua-lib=DIR You can also specify Lua's libraries dir.
40 Default is \$LUA_DIR/lib
41 --with-idn=LIB The name of the IDN library to link with.
43 --with-ssl=LIB The name of the SSL to link with.
44 Default is $OPENSSL_LIB
45 --cflags=FLAGS Flags to pass to the compiler
47 --require-config Will cause Prosody to refuse to run when
48 it fails to find a configuration file
55 value="`echo $1 | sed 's/.*=\(.*\)/\1/'`"
56 if echo "$value" | grep -q "~"
59 echo '*WARNING*: the "~" sign is not expanded in flags.'
60 echo 'If you mean the home directory, use $HOME instead.'
96 LUA_LIBDIR="$value" LUA_LIBDIR_SET=yes
108 echo "Error: Unknown flag: $1"
115 if [ "$OSTYPE_SET" = "yes" ]
117 if [ "$OSTYPE" = "debian" ]
118 then LUA_SUFFIX="5.1";
120 LUA_INCDIR=/usr/include/lua5.1;
123 if [ "$OSTYPE" = "macosx" ]
124 then LUA_INCDIR=/usr/local/include;
125 LUA_LIBDIR=/usr/local/lib
126 CFLAGS="-bundle -Wl,-undefined,dynamic_lookup"
130 if [ "$PREFIX_SET" = "yes" -a ! "$SYSCONFDIR_SET" = "yes" ]
132 if [ "$PREFIX" = "/usr" ]
133 then SYSCONFDIR=/etc/prosody
134 else SYSCONFDIR=$PREFIX/etc/prosody
138 if [ "$PREFIX_SET" = "yes" -a ! "$DATADIR_SET" = "yes" ]
140 if [ "$PREFIX" = "/usr" ]
141 then DATADIR=/var/lib/prosody
142 else DATADIR=$PREFIX/var/lib/prosody
148 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
149 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
158 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
159 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
161 if [ "$found" = "yes" ]
169 if [ "$LUA_SUFFIX_SET" != "yes" ]
171 for suffix in "5.1" "51" ""
174 if [ "$LUA_DIR_SET" = "yes" ]
176 if [ -e "$LUA_DIR/bin/lua$suffix" ]
181 find_lua=`find_program lua$suffix`
185 echo "Lua interpreter found: $find_lua/lua$suffix..."
191 if ! [ "$LUA_DIR_SET" = "yes" ]
193 echo -n "Looking for Lua... "
196 find_lua=`find_program lua$LUA_SUFFIX`
197 echo "lua$LUA_SUFFIX found in \$PATH: $find_lua"
201 LUA_DIR=`dirname $find_lua`
202 LUA_BINDIR="$find_lua"
204 echo "lua$LUA_SUFFIX not found in \$PATH."
205 echo "You may want to use the flags --with-lua and/or --lua-suffix. See --help."
210 if ! [ "$LUA_INCDIR_SET" = "yes" ]
212 LUA_INCDIR="$LUA_DIR/include"
215 if ! [ "$LUA_LIBDIR_SET" = "yes" ]
217 LUA_LIBDIR="$LUA_DIR/lib"
220 if [ "$LUA_DIR_SET" = "yes" ]
222 LUA_BINDIR="$LUA_DIR/bin"
225 echo -n "Checking Lua includes... "
226 lua_h="$LUA_INCDIR/lua.h"
229 echo "lua.h found in $lua_h"
231 echo "lua.h not found (looked in $lua_h)"
232 echo "You may want to use the flag --with-lua-include. See --help."
242 found=`find_program "$1"`
245 echo "$1 found at $found"
251 echo "Could not find a $explanation. Tried: $tried."
252 echo "Make sure one of them is installed and available in your PATH."
258 echo "Writing configuration..."
261 cat <<EOF > config.unix
262 # This file was automatically generated by the configure script.
263 # Run "./configure --help" for details.
266 SYSCONFDIR=$SYSCONFDIR
268 LUA_SUFFIX=$LUA_SUFFIX
270 LUA_INCDIR=$LUA_INCDIR
271 LUA_LIBDIR=$LUA_LIBDIR
272 LUA_BINDIR=$LUA_BINDIR
273 REQUIRE_CONFIG=$REQUIRE_CONFIG
275 OPENSSL_LIB=$OPENSSL_LIB
280 echo "Installation prefix: $PREFIX"
281 echo "Prosody configuration directory: $SYSCONFDIR"
282 echo "Using Lua from: $LUA_DIR"
284 make clean > /dev/null 2> /dev/null
287 echo "Done. You can now run 'make' to build."