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";
119 LUA_INCDIR=/usr/include/lua5.1;
121 if [ "$OSTYPE" = "macosx" ]
122 then LUA_INCDIR=/usr/local/include;
123 LUA_LIBDIR=/usr/local/lib
124 CFLAGS="-bundle -Wl,-undefined,dynamic_lookup"
128 if [ "$PREFIX_SET" = "yes" -a ! "$SYSCONFDIR_SET" = "yes" ]
130 if [ "$PREFIX" = "/usr" ]
131 then SYSCONFDIR=/etc/prosody
132 else SYSCONFDIR=$PREFIX/etc/prosody
136 if [ "$PREFIX_SET" = "yes" -a ! "$DATADIR_SET" = "yes" ]
138 if [ "$PREFIX" = "/usr" ]
139 then DATADIR=/var/lib/prosody
140 else DATADIR=$PREFIX/var/lib/prosody
146 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
147 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
156 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
157 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
159 if [ "$found" = "yes" ]
167 if [ "$LUA_SUFFIX_SET" != "yes" ]
169 for suffix in "5.1" "51" ""
172 if [ "$LUA_DIR_SET" = "yes" ]
174 if [ -e "$LUA_DIR/bin/lua$suffix" ]
179 find_lua=`find_program lua$suffix`
183 echo "Lua interpreter found: $find_lua/lua$suffix..."
189 if ! [ "$LUA_DIR_SET" = "yes" ]
191 echo -n "Looking for Lua... "
194 find_lua=`find_program lua$LUA_SUFFIX`
195 echo "lua$LUA_SUFFIX found in \$PATH: $find_lua"
199 LUA_DIR=`dirname $find_lua`
200 LUA_BINDIR="$find_lua"
202 echo "lua$LUA_SUFFIX not found in \$PATH."
203 echo "You may want to use the flags --with-lua and/or --lua-suffix. See --help."
208 if ! [ "$LUA_INCDIR_SET" = "yes" ]
210 LUA_INCDIR="$LUA_DIR/include"
213 if ! [ "$LUA_LIBDIR_SET" = "yes" ]
215 LUA_LIBDIR="$LUA_DIR/lib"
218 if [ "$LUA_DIR_SET" = "yes" ]
220 LUA_BINDIR="$LUA_DIR/bin"
223 echo -n "Checking Lua includes... "
224 lua_h="$LUA_INCDIR/lua.h"
227 echo "lua.h found in $lua_h"
229 echo "lua.h not found (looked in $lua_h)"
230 echo "You may want to use the flag --with-lua-include. See --help."
240 found=`find_program "$1"`
243 echo "$1 found at $found"
249 echo "Could not find a $explanation. Tried: $tried."
250 echo "Make sure one of them is installed and available in your PATH."
256 echo "Writing configuration..."
259 cat <<EOF > config.unix
260 # This file was automatically generated by the configure script.
261 # Run "./configure --help" for details.
264 SYSCONFDIR=$SYSCONFDIR
266 LUA_SUFFIX=$LUA_SUFFIX
268 LUA_INCDIR=$LUA_INCDIR
269 LUA_LIBDIR=$LUA_LIBDIR
270 LUA_BINDIR=$LUA_BINDIR
271 REQUIRE_CONFIG=$REQUIRE_CONFIG
273 OPENSSL_LIB=$OPENSSL_LIB
278 echo "Installation prefix: $PREFIX"
279 echo "Prosody configuration directory: $SYSCONFDIR"
280 echo "Using Lua from: $LUA_DIR"
282 make clean > /dev/null 2> /dev/null
285 echo "Done. You can now run 'make' to build."