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 --with-lua-include=DIR You can also specify Lua's includes dir.
45 Default is \$LUA_DIR/include
46 --with-lua-lib=DIR You can also specify Lua's libraries dir.
47 Default is \$LUA_DIR/lib
48 --with-idn=LIB The name of the IDN library to link with.
50 --idn-library=(idn|icu) Select library to use for IDNA functionality.
51 idn: use GNU libidn (default)
53 --with-ssl=LIB The name of the SSL to link with.
54 Default is $OPENSSL_LIB
55 --cflags=FLAGS Flags to pass to the compiler
57 --ldflags=FLAGS Flags to pass to the linker
59 --c-compiler=CC The C compiler to use when building modules.
61 --linker=CC The linker to use when building modules.
63 --require-config Will cause Prosody to refuse to run when
64 it fails to find a configuration file
71 value="`echo $1 | sed 's/[^=]*=\(.*\)/\1/'`"
72 if echo "$value" | grep -q "~"
75 echo '*WARNING*: the "~" sign is not expanded in flags.'
76 echo 'If you mean the home directory, use $HOME instead.'
95 if [ "$OSTYPE" = "debian" ]
96 then LUA_SUFFIX="5.1";
99 LUA_INCDIR=/usr/include/lua5.1;
101 CFLAGS="$CFLAGS -D_GNU_SOURCE"
103 if [ "$OSTYPE" = "macosx" ]
104 then LUA_INCDIR=/usr/local/include;
106 LUA_LIBDIR=/usr/local/lib
108 LDFLAGS="-bundle -undefined dynamic_lookup"
110 if [ "$OSTYPE" = "linux" ]
111 then LUA_INCDIR=/usr/local/include;
113 LUA_LIBDIR=/usr/local/lib
116 CFLAGS="$CFLAGS -D_GNU_SOURCE"
119 if [ "$OSTYPE" = "freebsd" -o "$OSTYPE" = "openbsd" ]
120 then LUA_INCDIR="/usr/local/include/lua51"
122 CFLAGS="-Wall -fPIC -I/usr/local/include"
123 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
129 if [ "$OSTYPE" = "openbsd" ]
130 then LUA_INCDIR="/usr/local/include";
148 --with-lua-include=*)
153 LUA_LIBDIR="$value" LUA_LIBDIR_SET=yes
180 echo "Error: Unknown flag: $1"
187 if [ "$PREFIX_SET" = "yes" -a ! "$SYSCONFDIR_SET" = "yes" ]
189 if [ "$PREFIX" = "/usr" ]
190 then SYSCONFDIR=/etc/prosody
191 else SYSCONFDIR=$PREFIX/etc/prosody
195 if [ "$PREFIX_SET" = "yes" -a ! "$DATADIR_SET" = "yes" ]
197 if [ "$PREFIX" = "/usr" ]
198 then DATADIR=/var/lib/prosody
199 else DATADIR=$PREFIX/var/lib/prosody
205 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
206 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
215 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
216 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
218 if [ "$found" = "yes" ]
226 if [ "$LUA_SUFFIX_SET" != "yes" ]
228 for suffix in "5.1" "51" ""
231 if [ "$LUA_DIR_SET" = "yes" ]
233 if [ -e "$LUA_DIR/bin/lua$suffix" ]
238 find_lua=`find_program lua$suffix`
242 echo "Lua interpreter found: $find_lua/lua$suffix..."
248 if ! [ "$LUA_DIR_SET" = "yes" ]
250 echo -n "Looking for Lua... "
253 find_lua=`find_program lua$LUA_SUFFIX`
254 echo "lua$LUA_SUFFIX found in \$PATH: $find_lua"
258 LUA_DIR=`dirname $find_lua`
259 LUA_BINDIR="$find_lua"
261 echo "lua$LUA_SUFFIX not found in \$PATH."
262 echo "You may want to use the flags --with-lua and/or --lua-suffix. See --help."
267 if ! [ "$LUA_INCDIR_SET" = "yes" ]
269 LUA_INCDIR="$LUA_DIR/include"
272 if ! [ "$LUA_LIBDIR_SET" = "yes" ]
274 LUA_LIBDIR="$LUA_DIR/lib"
277 if [ "$LUA_DIR_SET" = "yes" ]
279 LUA_BINDIR="$LUA_DIR/bin"
282 if [ "$IDN_LIBRARY" = "icu" ]
284 IDNA_LIBS="$ICU_FLAGS"
285 CFLAGS="$CFLAGS -DUSE_STRINGPREP_ICU"
287 if [ "$IDN_LIBRARY" = "idn" ]
289 IDNA_LIBS="-l$IDN_LIB"
292 echo -n "Checking Lua includes... "
293 lua_h="$LUA_INCDIR/lua.h"
296 echo "lua.h found in $lua_h"
298 echo "lua.h not found (looked in $lua_h)"
299 echo "You may want to use the flag --with-lua-include. See --help."
309 found=`find_program "$1"`
312 echo "$1 found at $found"
318 echo "Could not find a $explanation. Tried: $tried."
319 echo "Make sure one of them is installed and available in your PATH."
325 echo "Writing configuration..."
328 cat <<EOF > config.unix
329 # This file was automatically generated by the configure script.
330 # Run "./configure --help" for details.
333 SYSCONFDIR=$SYSCONFDIR
335 LUA_SUFFIX=$LUA_SUFFIX
337 LUA_INCDIR=$LUA_INCDIR
338 LUA_LIBDIR=$LUA_LIBDIR
339 LUA_BINDIR=$LUA_BINDIR
340 REQUIRE_CONFIG=$REQUIRE_CONFIG
343 OPENSSL_LIB=$OPENSSL_LIB
353 echo "Installation prefix: $PREFIX"
354 echo "Prosody configuration directory: $SYSCONFDIR"
355 echo "Using Lua from: $LUA_DIR"
357 make clean > /dev/null 2> /dev/null
360 echo "Done. You can now run 'make' to build."