6 SYSCONFDIR="$PREFIX/etc/prosody"
7 DATADIR="$PREFIX/var/lib/prosody"
11 LUA_INCDIR="/usr/include"
14 ICU_FLAGS="-licui18n -licudata -licuuc"
29 Configure Prosody prior to building.
32 --ostype=OS Use one of the OS presets.
33 May be one of: debian, macosx, linux, freebsd
34 --prefix=DIR Prefix where Prosody should be installed.
36 --sysconfdir=DIR Location where the config file should be installed.
37 Default is \$PREFIX/etc/prosody
38 --datadir=DIR Location where the server data should be stored.
39 Default is \$PREFIX/var/lib/prosody
40 --lua-suffix=SUFFIX Versioning suffix to use in Lua filenames.
41 Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...)
42 --with-lua=PREFIX Use Lua from given prefix.
44 --runwith=BINARY What Lua binary to set as runtime environment.
46 --with-lua-include=DIR You can also specify Lua's includes dir.
47 Default is \$LUA_DIR/include
48 --with-lua-lib=DIR You can also specify Lua's libraries dir.
49 Default is \$LUA_DIR/lib
50 --with-idn=LIB The name of the IDN library to link with.
52 --idn-library=(idn|icu) Select library to use for IDNA functionality.
53 idn: use GNU libidn (default)
55 --with-ssl=LIB The name of the SSL to link with.
56 Default is $OPENSSL_LIB
57 --cflags=FLAGS Flags to pass to the compiler
59 --ldflags=FLAGS Flags to pass to the linker
61 --c-compiler=CC The C compiler to use when building modules.
63 --linker=CC The linker to use when building modules.
65 --require-config Will cause Prosody to refuse to run when
66 it fails to find a configuration file
73 value="`echo $1 | sed 's/[^=]*=\(.*\)/\1/'`"
74 if echo "$value" | grep -q "~"
77 echo '*WARNING*: the "~" sign is not expanded in flags.'
78 echo 'If you mean the home directory, use $HOME instead.'
97 if [ "$OSTYPE" = "debian" ]
98 then LUA_SUFFIX="5.1";
101 LUA_INCDIR=/usr/include/lua5.1;
103 CFLAGS="$CFLAGS -D_GNU_SOURCE"
105 if [ "$OSTYPE" = "macosx" ]
106 then LUA_INCDIR=/usr/local/include;
108 LUA_LIBDIR=/usr/local/lib
110 LDFLAGS="-bundle -undefined dynamic_lookup"
112 if [ "$OSTYPE" = "linux" ]
113 then LUA_INCDIR=/usr/local/include;
115 LUA_LIBDIR=/usr/local/lib
118 CFLAGS="$CFLAGS -D_GNU_SOURCE"
121 if [ "$OSTYPE" = "freebsd" -o "$OSTYPE" = "openbsd" ]
122 then LUA_INCDIR="/usr/local/include/lua51"
124 CFLAGS="-Wall -fPIC -I/usr/local/include"
125 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
131 if [ "$OSTYPE" = "openbsd" ]
132 then LUA_INCDIR="/usr/local/include";
150 --with-lua-include=*)
155 LUA_LIBDIR="$value" LUA_LIBDIR_SET=yes
182 echo "Error: Unknown flag: $1"
189 if [ "$PREFIX_SET" = "yes" -a ! "$SYSCONFDIR_SET" = "yes" ]
191 if [ "$PREFIX" = "/usr" ]
192 then SYSCONFDIR=/etc/prosody
193 else SYSCONFDIR=$PREFIX/etc/prosody
197 if [ "$PREFIX_SET" = "yes" -a ! "$DATADIR_SET" = "yes" ]
199 if [ "$PREFIX" = "/usr" ]
200 then DATADIR=/var/lib/prosody
201 else DATADIR=$PREFIX/var/lib/prosody
207 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
208 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
217 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
218 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
220 if [ "$found" = "yes" ]
228 if [ "$LUA_SUFFIX_SET" != "yes" ]
230 for suffix in "5.1" "51" ""
233 if [ "$LUA_DIR_SET" = "yes" ]
235 if [ -e "$LUA_DIR/bin/lua$suffix" ]
240 find_lua=`find_program lua$suffix`
244 echo "Lua interpreter found: $find_lua/lua$suffix..."
250 if ! [ "$LUA_DIR_SET" = "yes" ]
252 echo -n "Looking for Lua... "
255 find_lua=`find_program lua$LUA_SUFFIX`
256 echo "lua$LUA_SUFFIX found in \$PATH: $find_lua"
260 LUA_DIR=`dirname $find_lua`
261 LUA_BINDIR="$find_lua"
263 echo "lua$LUA_SUFFIX not found in \$PATH."
264 echo "You may want to use the flags --with-lua and/or --lua-suffix. See --help."
269 if ! [ "$LUA_INCDIR_SET" = "yes" ]
271 LUA_INCDIR="$LUA_DIR/include"
274 if ! [ "$LUA_LIBDIR_SET" = "yes" ]
276 LUA_LIBDIR="$LUA_DIR/lib"
279 if [ "$LUA_DIR_SET" = "yes" ]
281 LUA_BINDIR="$LUA_DIR/bin"
284 if [ "$IDN_LIBRARY" = "icu" ]
286 IDNA_LIBS="$ICU_FLAGS"
287 CFLAGS="$CFLAGS -DUSE_STRINGPREP_ICU"
289 if [ "$IDN_LIBRARY" = "idn" ]
291 IDNA_LIBS="-l$IDN_LIB"
294 echo -n "Checking Lua includes... "
295 lua_h="$LUA_INCDIR/lua.h"
298 echo "lua.h found in $lua_h"
300 echo "lua.h not found (looked in $lua_h)"
301 echo "You may want to use the flag --with-lua-include. See --help."
311 found=`find_program "$1"`
314 echo "$1 found at $found"
320 echo "Could not find a $explanation. Tried: $tried."
321 echo "Make sure one of them is installed and available in your PATH."
327 echo "Writing configuration..."
330 cat <<EOF > config.unix
331 # This file was automatically generated by the configure script.
332 # Run "./configure --help" for details.
335 SYSCONFDIR=$SYSCONFDIR
337 LUA_SUFFIX=$LUA_SUFFIX
339 LUA_INCDIR=$LUA_INCDIR
340 LUA_LIBDIR=$LUA_LIBDIR
341 LUA_BINDIR=$LUA_BINDIR
342 REQUIRE_CONFIG=$REQUIRE_CONFIG
345 OPENSSL_LIB=$OPENSSL_LIB
355 echo "Installation prefix: $PREFIX"
356 echo "Prosody configuration directory: $SYSCONFDIR"
357 echo "Using Lua from: $LUA_DIR"
359 make clean > /dev/null 2> /dev/null
362 echo "Done. You can now run 'make' to build."