6 SYSCONFDIR="$PREFIX/etc/prosody"
7 DATADIR="$PREFIX/var/lib/prosody"
11 LUA_INCDIR="/usr/include"
14 ICU_FLAGS="-licui18n -licudata -licuuc"
27 Configure Prosody prior to building.
30 --ostype=OS Use one of the OS presets.
31 May be one of: debian, macosx, linux, freebsd
32 --prefix=DIR Prefix where Prosody should be installed.
34 --sysconfdir=DIR Location where the config file should be installed.
35 Default is \$PREFIX/etc/prosody
36 --datadir=DIR Location where the server data should be stored.
37 Default is \$PREFIX/var/lib/prosody
38 --lua-suffix=SUFFIX Versioning suffix to use in Lua filenames.
39 Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...)
40 --with-lua=PREFIX Use Lua from given prefix.
42 --with-lua-include=DIR You can also specify Lua's includes dir.
43 Default is \$LUA_DIR/include
44 --with-lua-lib=DIR You can also specify Lua's libraries dir.
45 Default is \$LUA_DIR/lib
46 --with-idn=LIB The name of the IDN library to link with.
48 --idn-library=(idn|icu) Select library to use for IDNA functionality.
49 idn: use GNU libidn (default)
51 --with-ssl=LIB The name of the SSL to link with.
52 Default is $OPENSSL_LIB
53 --cflags=FLAGS Flags to pass to the compiler
55 --ldflags=FLAGS Flags to pass to the linker
57 --c-compiler=CC The C compiler to use when building modules.
59 --linker=CC The linker to use when building modules.
61 --require-config Will cause Prosody to refuse to run when
62 it fails to find a configuration file
69 value="`echo $1 | sed 's/[^=]*=\(.*\)/\1/'`"
70 if echo "$value" | grep -q "~"
73 echo '*WARNING*: the "~" sign is not expanded in flags.'
74 echo 'If you mean the home directory, use $HOME instead.'
93 if [ "$OSTYPE" = "debian" ]
94 then LUA_SUFFIX="5.1";
96 LUA_INCDIR=/usr/include/lua5.1;
99 if [ "$OSTYPE" = "macosx" ]
100 then LUA_INCDIR=/usr/local/include;
102 LUA_LIBDIR=/usr/local/lib
104 LDFLAGS="-bundle -undefined dynamic_lookup"
106 if [ "$OSTYPE" = "linux" ]
107 then LUA_INCDIR=/usr/local/include;
109 LUA_LIBDIR=/usr/local/lib
114 if [ "$OSTYPE" = "freebsd" ]
115 then LUA_INCDIR="/usr/local/include/lua51"
117 CFLAGS="-Wall -fPIC -I/usr/local/include"
118 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
140 --with-lua-include=*)
145 LUA_LIBDIR="$value" LUA_LIBDIR_SET=yes
169 echo "Error: Unknown flag: $1"
176 if [ "$PREFIX_SET" = "yes" -a ! "$SYSCONFDIR_SET" = "yes" ]
178 if [ "$PREFIX" = "/usr" ]
179 then SYSCONFDIR=/etc/prosody
180 else SYSCONFDIR=$PREFIX/etc/prosody
184 if [ "$PREFIX_SET" = "yes" -a ! "$DATADIR_SET" = "yes" ]
186 if [ "$PREFIX" = "/usr" ]
187 then DATADIR=/var/lib/prosody
188 else DATADIR=$PREFIX/var/lib/prosody
194 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
195 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
204 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
205 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
207 if [ "$found" = "yes" ]
215 if [ "$LUA_SUFFIX_SET" != "yes" ]
217 for suffix in "5.1" "51" ""
220 if [ "$LUA_DIR_SET" = "yes" ]
222 if [ -e "$LUA_DIR/bin/lua$suffix" ]
227 find_lua=`find_program lua$suffix`
231 echo "Lua interpreter found: $find_lua/lua$suffix..."
237 if ! [ "$LUA_DIR_SET" = "yes" ]
239 echo -n "Looking for Lua... "
242 find_lua=`find_program lua$LUA_SUFFIX`
243 echo "lua$LUA_SUFFIX found in \$PATH: $find_lua"
247 LUA_DIR=`dirname $find_lua`
248 LUA_BINDIR="$find_lua"
250 echo "lua$LUA_SUFFIX not found in \$PATH."
251 echo "You may want to use the flags --with-lua and/or --lua-suffix. See --help."
256 if ! [ "$LUA_INCDIR_SET" = "yes" ]
258 LUA_INCDIR="$LUA_DIR/include"
261 if ! [ "$LUA_LIBDIR_SET" = "yes" ]
263 LUA_LIBDIR="$LUA_DIR/lib"
266 if [ "$LUA_DIR_SET" = "yes" ]
268 LUA_BINDIR="$LUA_DIR/bin"
271 if [ "$IDN_LIBRARY" = "icu" ]
273 IDNA_LIBS="$ICU_FLAGS"
274 CFLAGS="$CFLAGS -DUSE_STRINGPREP_ICU"
276 if [ "$IDN_LIBRARY" = "idn" ]
278 IDNA_LIBS="-l$IDN_LIB"
280 echo "Must use idn or icu as argument for --idn-library!"
284 LDFLAGS="$LDFLAGS -llua"
286 echo -n "Checking Lua includes... "
287 lua_h="$LUA_INCDIR/lua.h"
290 echo "lua.h found in $lua_h"
292 echo "lua.h not found (looked in $lua_h)"
293 echo "You may want to use the flag --with-lua-include. See --help."
303 found=`find_program "$1"`
306 echo "$1 found at $found"
312 echo "Could not find a $explanation. Tried: $tried."
313 echo "Make sure one of them is installed and available in your PATH."
319 echo "Writing configuration..."
322 cat <<EOF > config.unix
323 # This file was automatically generated by the configure script.
324 # Run "./configure --help" for details.
327 SYSCONFDIR=$SYSCONFDIR
329 LUA_SUFFIX=$LUA_SUFFIX
331 LUA_INCDIR=$LUA_INCDIR
332 LUA_LIBDIR=$LUA_LIBDIR
333 LUA_BINDIR=$LUA_BINDIR
334 REQUIRE_CONFIG=$REQUIRE_CONFIG
337 OPENSSL_LIB=$OPENSSL_LIB
346 echo "Installation prefix: $PREFIX"
347 echo "Prosody configuration directory: $SYSCONFDIR"
348 echo "Using Lua from: $LUA_DIR"
350 make clean > /dev/null 2> /dev/null
353 echo "Done. You can now run 'make' to build."