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" ]; then
101 LUA_INCDIR=/usr/include/lua5.1;
103 CFLAGS="$CFLAGS -D_GNU_SOURCE"
105 if [ "$OSTYPE" = "macosx" ]; then
106 LUA_INCDIR=/usr/local/include;
108 LUA_LIBDIR=/usr/local/lib
110 LDFLAGS="-bundle -undefined dynamic_lookup"
112 if [ "$OSTYPE" = "linux" ]; then
113 LUA_INCDIR=/usr/local/include;
115 LUA_LIBDIR=/usr/local/lib
117 CFLAGS="-Wall -fPIC -D_GNU_SOURCE"
120 if [ "$OSTYPE" = "freebsd" -o "$OSTYPE" = "openbsd" ]; then
121 LUA_INCDIR="/usr/local/include/lua51"
123 CFLAGS="-Wall -fPIC -I/usr/local/include"
124 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
130 if [ "$OSTYPE" = "openbsd" ]; then
131 LUA_INCDIR="/usr/local/include";
149 --with-lua-include=*)
154 LUA_LIBDIR="$value" LUA_LIBDIR_SET=yes
181 echo "Error: Unknown flag: $1"
188 if [ "$PREFIX_SET" = "yes" -a ! "$SYSCONFDIR_SET" = "yes" ]
190 if [ "$PREFIX" = "/usr" ]
191 then SYSCONFDIR=/etc/prosody
192 else SYSCONFDIR=$PREFIX/etc/prosody
196 if [ "$PREFIX_SET" = "yes" -a ! "$DATADIR_SET" = "yes" ]
198 if [ "$PREFIX" = "/usr" ]
199 then DATADIR=/var/lib/prosody
200 else DATADIR=$PREFIX/var/lib/prosody
206 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
207 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
216 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
217 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
219 if [ "$found" = "yes" ]
227 if [ "$LUA_SUFFIX_SET" != "yes" ]
229 for suffix in "5.1" "51" ""
232 if [ "$LUA_DIR_SET" = "yes" ]
234 if [ -e "$LUA_DIR/bin/lua$suffix" ]
239 find_lua=`find_program lua$suffix`
243 echo "Lua interpreter found: $find_lua/lua$suffix..."
249 if ! [ "$LUA_DIR_SET" = "yes" ]
251 echo -n "Looking for Lua... "
254 find_lua=`find_program lua$LUA_SUFFIX`
255 echo "lua$LUA_SUFFIX found in \$PATH: $find_lua"
259 LUA_DIR=`dirname $find_lua`
260 LUA_BINDIR="$find_lua"
262 echo "lua$LUA_SUFFIX not found in \$PATH."
263 echo "You may want to use the flags --with-lua and/or --lua-suffix. See --help."
268 if ! [ "$LUA_INCDIR_SET" = "yes" ]
270 LUA_INCDIR="$LUA_DIR/include"
273 if ! [ "$LUA_LIBDIR_SET" = "yes" ]
275 LUA_LIBDIR="$LUA_DIR/lib"
278 if [ "$LUA_DIR_SET" = "yes" ]
280 LUA_BINDIR="$LUA_DIR/bin"
283 if [ "$IDN_LIBRARY" = "icu" ]
285 IDNA_LIBS="$ICU_FLAGS"
286 CFLAGS="$CFLAGS -DUSE_STRINGPREP_ICU"
288 if [ "$IDN_LIBRARY" = "idn" ]
290 IDNA_LIBS="-l$IDN_LIB"
293 echo -n "Checking Lua includes... "
294 lua_h="$LUA_INCDIR/lua.h"
297 echo "lua.h found in $lua_h"
299 echo "lua.h not found (looked in $lua_h)"
300 echo "You may want to use the flag --with-lua-include. See --help."
310 found=`find_program "$1"`
313 echo "$1 found at $found"
319 echo "Could not find a $explanation. Tried: $tried."
320 echo "Make sure one of them is installed and available in your PATH."
326 echo "Writing configuration..."
329 cat <<EOF > config.unix
330 # This file was automatically generated by the configure script.
331 # Run "./configure --help" for details.
334 SYSCONFDIR=$SYSCONFDIR
336 LUA_SUFFIX=$LUA_SUFFIX
338 LUA_INCDIR=$LUA_INCDIR
339 LUA_LIBDIR=$LUA_LIBDIR
340 LUA_BINDIR=$LUA_BINDIR
341 REQUIRE_CONFIG=$REQUIRE_CONFIG
344 OPENSSL_LIB=$OPENSSL_LIB
354 echo "Installation prefix: $PREFIX"
355 echo "Prosody configuration directory: $SYSCONFDIR"
356 echo "Using Lua from: $LUA_DIR"
358 make clean > /dev/null 2> /dev/null
361 echo "Done. You can now run 'make' to build."