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";
98 LUA_INCDIR=/usr/include/lua5.1;
100 CFLAGS="$CFLAGS -D_GNU_SOURCE"
102 if [ "$OSTYPE" = "macosx" ]
103 then LUA_INCDIR=/usr/local/include;
105 LUA_LIBDIR=/usr/local/lib
107 LDFLAGS="-bundle -undefined dynamic_lookup"
109 if [ "$OSTYPE" = "linux" ]
110 then LUA_INCDIR=/usr/local/include;
112 LUA_LIBDIR=/usr/local/lib
115 CFLAGS="$CFLAGS -D_GNU_SOURCE"
118 if [ "$OSTYPE" = "freebsd" -o "$OSTYPE" = "openbsd" ]
119 then LUA_INCDIR="/usr/local/include/lua51"
121 CFLAGS="-Wall -fPIC -I/usr/local/include"
122 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
128 if [ "$OSTYPE" = "openbsd" ]
129 then LUA_INCDIR="/usr/local/include";
147 --with-lua-include=*)
152 LUA_LIBDIR="$value" LUA_LIBDIR_SET=yes
179 echo "Error: Unknown flag: $1"
186 if [ "$PREFIX_SET" = "yes" -a ! "$SYSCONFDIR_SET" = "yes" ]
188 if [ "$PREFIX" = "/usr" ]
189 then SYSCONFDIR=/etc/prosody
190 else SYSCONFDIR=$PREFIX/etc/prosody
194 if [ "$PREFIX_SET" = "yes" -a ! "$DATADIR_SET" = "yes" ]
196 if [ "$PREFIX" = "/usr" ]
197 then DATADIR=/var/lib/prosody
198 else DATADIR=$PREFIX/var/lib/prosody
204 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
205 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
214 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
215 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
217 if [ "$found" = "yes" ]
225 if [ "$LUA_SUFFIX_SET" != "yes" ]
227 for suffix in "5.1" "51" ""
230 if [ "$LUA_DIR_SET" = "yes" ]
232 if [ -e "$LUA_DIR/bin/lua$suffix" ]
237 find_lua=`find_program lua$suffix`
241 echo "Lua interpreter found: $find_lua/lua$suffix..."
247 if ! [ "$LUA_DIR_SET" = "yes" ]
249 echo -n "Looking for Lua... "
252 find_lua=`find_program lua$LUA_SUFFIX`
253 echo "lua$LUA_SUFFIX found in \$PATH: $find_lua"
257 LUA_DIR=`dirname $find_lua`
258 LUA_BINDIR="$find_lua"
260 echo "lua$LUA_SUFFIX not found in \$PATH."
261 echo "You may want to use the flags --with-lua and/or --lua-suffix. See --help."
266 if ! [ "$LUA_INCDIR_SET" = "yes" ]
268 LUA_INCDIR="$LUA_DIR/include"
271 if ! [ "$LUA_LIBDIR_SET" = "yes" ]
273 LUA_LIBDIR="$LUA_DIR/lib"
276 if [ "$LUA_DIR_SET" = "yes" ]
278 LUA_BINDIR="$LUA_DIR/bin"
281 if [ "$IDN_LIBRARY" = "icu" ]
283 IDNA_LIBS="$ICU_FLAGS"
284 CFLAGS="$CFLAGS -DUSE_STRINGPREP_ICU"
286 if [ "$IDN_LIBRARY" = "idn" ]
288 IDNA_LIBS="-l$IDN_LIB"
291 echo -n "Checking Lua includes... "
292 lua_h="$LUA_INCDIR/lua.h"
295 echo "lua.h found in $lua_h"
297 echo "lua.h not found (looked in $lua_h)"
298 echo "You may want to use the flag --with-lua-include. See --help."
308 found=`find_program "$1"`
311 echo "$1 found at $found"
317 echo "Could not find a $explanation. Tried: $tried."
318 echo "Make sure one of them is installed and available in your PATH."
324 echo "Writing configuration..."
327 cat <<EOF > config.unix
328 # This file was automatically generated by the configure script.
329 # Run "./configure --help" for details.
332 SYSCONFDIR=$SYSCONFDIR
334 LUA_SUFFIX=$LUA_SUFFIX
336 LUA_INCDIR=$LUA_INCDIR
337 LUA_LIBDIR=$LUA_LIBDIR
338 LUA_BINDIR=$LUA_BINDIR
339 REQUIRE_CONFIG=$REQUIRE_CONFIG
342 OPENSSL_LIB=$OPENSSL_LIB
352 echo "Installation prefix: $PREFIX"
353 echo "Prosody configuration directory: $SYSCONFDIR"
354 echo "Using Lua from: $LUA_DIR"
356 make clean > /dev/null 2> /dev/null
359 echo "Done. You can now run 'make' to build."