6 SYSCONFDIR="$PREFIX/etc/prosody"
7 DATADIR="$PREFIX/var/lib/prosody"
11 LUA_INCDIR="/usr/include"
14 ICU_FLAGS="-licui18n -licudata -licuuc"
28 Configure Prosody prior to building.
31 --ostype=OS Use one of the OS presets.
32 May be one of: debian, macosx, linux, freebsd
33 --prefix=DIR Prefix where Prosody should be installed.
35 --sysconfdir=DIR Location where the config file should be installed.
36 Default is \$PREFIX/etc/prosody
37 --datadir=DIR Location where the server data should be stored.
38 Default is \$PREFIX/var/lib/prosody
39 --lua-suffix=SUFFIX Versioning suffix to use in Lua filenames.
40 Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...)
41 --with-lua=PREFIX Use Lua from given prefix.
43 --with-lua-include=DIR You can also specify Lua's includes dir.
44 Default is \$LUA_DIR/include
45 --with-lua-lib=DIR You can also specify Lua's libraries dir.
46 Default is \$LUA_DIR/lib
47 --with-idn=LIB The name of the IDN library to link with.
49 --idn-library=(idn|icu) Select library to use for IDNA functionality.
50 idn: use GNU libidn (default)
52 --with-ssl=LIB The name of the SSL to link with.
53 Default is $OPENSSL_LIB
54 --cflags=FLAGS Flags to pass to the compiler
56 --ldflags=FLAGS Flags to pass to the linker
58 --c-compiler=CC The C compiler to use when building modules.
60 --linker=CC The linker to use when building modules.
62 --require-config Will cause Prosody to refuse to run when
63 it fails to find a configuration file
70 value="`echo $1 | sed 's/[^=]*=\(.*\)/\1/'`"
71 if echo "$value" | grep -q "~"
74 echo '*WARNING*: the "~" sign is not expanded in flags.'
75 echo 'If you mean the home directory, use $HOME instead.'
94 if [ "$OSTYPE" = "debian" ]
95 then LUA_SUFFIX="5.1";
97 LUA_INCDIR=/usr/include/lua5.1;
100 if [ "$OSTYPE" = "macosx" ]
101 then LUA_INCDIR=/usr/local/include;
103 LUA_LIBDIR=/usr/local/lib
105 LDFLAGS="-bundle -undefined dynamic_lookup"
107 if [ "$OSTYPE" = "linux" ]
108 then LUA_INCDIR=/usr/local/include;
110 LUA_LIBDIR=/usr/local/lib
115 if [ "$OSTYPE" = "freebsd" -o "$OSTYPE" = "openbsd" ]
116 then LUA_INCDIR="/usr/local/include/lua51"
118 CFLAGS="-Wall -fPIC -I/usr/local/include"
119 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
125 if [ "$OSTYPE" = "openbsd" ]
126 then LUA_INCDIR="/usr/local/include";
144 --with-lua-include=*)
149 LUA_LIBDIR="$value" LUA_LIBDIR_SET=yes
173 echo "Error: Unknown flag: $1"
180 if [ "$PREFIX_SET" = "yes" -a ! "$SYSCONFDIR_SET" = "yes" ]
182 if [ "$PREFIX" = "/usr" ]
183 then SYSCONFDIR=/etc/prosody
184 else SYSCONFDIR=$PREFIX/etc/prosody
188 if [ "$PREFIX_SET" = "yes" -a ! "$DATADIR_SET" = "yes" ]
190 if [ "$PREFIX" = "/usr" ]
191 then DATADIR=/var/lib/prosody
192 else DATADIR=$PREFIX/var/lib/prosody
198 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
199 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
208 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
209 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
211 if [ "$found" = "yes" ]
219 if [ "$LUA_SUFFIX_SET" != "yes" ]
221 for suffix in "5.1" "51" ""
224 if [ "$LUA_DIR_SET" = "yes" ]
226 if [ -e "$LUA_DIR/bin/lua$suffix" ]
231 find_lua=`find_program lua$suffix`
235 echo "Lua interpreter found: $find_lua/lua$suffix..."
241 if ! [ "$LUA_DIR_SET" = "yes" ]
243 echo -n "Looking for Lua... "
246 find_lua=`find_program lua$LUA_SUFFIX`
247 echo "lua$LUA_SUFFIX found in \$PATH: $find_lua"
251 LUA_DIR=`dirname $find_lua`
252 LUA_BINDIR="$find_lua"
254 echo "lua$LUA_SUFFIX not found in \$PATH."
255 echo "You may want to use the flags --with-lua and/or --lua-suffix. See --help."
260 if ! [ "$LUA_INCDIR_SET" = "yes" ]
262 LUA_INCDIR="$LUA_DIR/include"
265 if ! [ "$LUA_LIBDIR_SET" = "yes" ]
267 LUA_LIBDIR="$LUA_DIR/lib"
270 if [ "$LUA_DIR_SET" = "yes" ]
272 LUA_BINDIR="$LUA_DIR/bin"
275 if [ "$IDN_LIBRARY" = "icu" ]
277 IDNA_LIBS="$ICU_FLAGS"
278 CFLAGS="$CFLAGS -DUSE_STRINGPREP_ICU"
280 if [ "$IDN_LIBRARY" = "idn" ]
282 IDNA_LIBS="-l$IDN_LIB"
285 echo -n "Checking Lua includes... "
286 lua_h="$LUA_INCDIR/lua.h"
289 echo "lua.h found in $lua_h"
291 echo "lua.h not found (looked in $lua_h)"
292 echo "You may want to use the flag --with-lua-include. See --help."
302 found=`find_program "$1"`
305 echo "$1 found at $found"
311 echo "Could not find a $explanation. Tried: $tried."
312 echo "Make sure one of them is installed and available in your PATH."
318 echo "Writing configuration..."
321 cat <<EOF > config.unix
322 # This file was automatically generated by the configure script.
323 # Run "./configure --help" for details.
326 SYSCONFDIR=$SYSCONFDIR
328 LUA_SUFFIX=$LUA_SUFFIX
330 LUA_INCDIR=$LUA_INCDIR
331 LUA_LIBDIR=$LUA_LIBDIR
332 LUA_BINDIR=$LUA_BINDIR
333 REQUIRE_CONFIG=$REQUIRE_CONFIG
336 OPENSSL_LIB=$OPENSSL_LIB
345 echo "Installation prefix: $PREFIX"
346 echo "Prosody configuration directory: $SYSCONFDIR"
347 echo "Using Lua from: $LUA_DIR"
349 make clean > /dev/null 2> /dev/null
352 echo "Done. You can now run 'make' to build."