6 SYSCONFDIR="$PREFIX/etc/prosody"
8 DATADIR="$PREFIX/var/lib/prosody"
12 LUA_INCDIR="/usr/include"
15 ICU_FLAGS="-licui18n -licudata -licuuc"
33 Configure Prosody prior to building.
36 --ostype=OS Use one of the OS presets.
37 May be one of: debian, macosx, linux, freebsd, openbsd
38 --prefix=DIR Prefix where Prosody should be installed.
40 --sysconfdir=DIR Location where the config file should be installed.
41 Default is \$PREFIX/etc/prosody
42 --libdir=DIR Location where the server files should be stored.
43 Default is \$PREFIX/lib
44 --datadir=DIR Location where the server data should be stored.
45 Default is \$PREFIX/var/lib/prosody
46 --lua-suffix=SUFFIX Versioning suffix to use in Lua filenames.
47 Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...)
48 --with-lua=PREFIX Use Lua from given prefix.
50 --runwith=BINARY What Lua binary to set as runtime environment.
52 --with-lua-include=DIR You can also specify Lua's includes dir.
53 Default is \$LUA_DIR/include
54 --with-lua-lib=DIR You can also specify Lua's libraries dir.
55 Default is \$LUA_DIR/lib
56 --with-idn=LIB The name of the IDN library to link with.
58 --idn-library=(idn|icu) Select library to use for IDNA functionality.
59 idn: use GNU libidn (default)
61 --with-ssl=LIB The name of the SSL to link with.
62 Default is $OPENSSL_LIB
63 --with-random=METHOD CSPRNG backend to use. One of
64 getrandom: Linux kernel
65 arc4random: OpenBSD kernel
66 openssl: OpenSSL RAND method
67 Default is to use /dev/urandom
68 --cflags=FLAGS Flags to pass to the compiler
70 --ldflags=FLAGS Flags to pass to the linker
72 --c-compiler=CC The C compiler to use when building modules.
74 --linker=CC The linker to use when building modules.
76 --require-config Will cause Prosody to refuse to run when
77 it fails to find a configuration file
78 --no-example-certs Disables generation of example certificates.
85 value="`echo $1 | sed 's/[^=]*=\(.*\)/\1/'`"
86 if echo "$value" | grep -q "~"
89 echo '*WARNING*: the "~" sign is not expanded in flags.'
90 echo 'If you mean the home directory, use $HOME instead.'
109 if [ "$OSTYPE" = "debian" ]; then
113 LUA_INCDIR=/usr/include/lua5.1;
115 CFLAGS="$CFLAGS -D_GNU_SOURCE"
117 if [ "$OSTYPE" = "macosx" ]; then
118 LUA_INCDIR=/usr/local/include;
120 LUA_LIBDIR=/usr/local/lib
122 CFLAGS="$CFLAGS -mmacosx-version-min=10.3"
123 LDFLAGS="-bundle -undefined dynamic_lookup"
125 if [ "$OSTYPE" = "linux" ]; then
126 LUA_INCDIR=/usr/local/include;
128 LUA_LIBDIR=/usr/local/lib
130 CFLAGS="-Wall -fPIC -D_GNU_SOURCE"
133 if [ "$OSTYPE" = "freebsd" -o "$OSTYPE" = "openbsd" ]; then
134 LUA_INCDIR="/usr/local/include/lua51"
136 CFLAGS="-Wall -fPIC -I/usr/local/include"
137 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
145 if [ "$OSTYPE" = "openbsd" ]; then
146 LUA_INCDIR="/usr/local/include";
168 --with-lua-include=*)
173 LUA_LIBDIR="$value" LUA_LIBDIR_SET=yes
184 --with-random=getrandom)
187 --with-random=openssl)
191 --with-random=arc4random)
213 echo "Error: Unknown flag: $1"
220 if [ "$PREFIX_SET" = "yes" -a ! "$SYSCONFDIR_SET" = "yes" ]
222 if [ "$PREFIX" = "/usr" ]
223 then SYSCONFDIR=/etc/prosody
224 else SYSCONFDIR=$PREFIX/etc/prosody
228 if [ "$PREFIX_SET" = "yes" -a ! "$DATADIR_SET" = "yes" ]
230 if [ "$PREFIX" = "/usr" ]
231 then DATADIR=/var/lib/prosody
232 else DATADIR=$PREFIX/var/lib/prosody
236 if [ "$PREFIX_SET" = "yes" -a ! "$LIBDIR_SET" = "yes" ]
243 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
244 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
253 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
254 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
256 if [ "$found" = "yes" ]
264 if [ "$LUA_SUFFIX_SET" != "yes" ]
266 for suffix in "5.1" "51" ""
269 if [ "$LUA_DIR_SET" = "yes" ]
271 if [ -f "$LUA_DIR/bin/lua$suffix" ]
276 find_lua=`find_program lua$suffix`
280 echo "Lua interpreter found: $find_lua/lua$suffix..."
286 if [ "$LUA_DIR_SET" != "yes" ]
288 echo -n "Looking for Lua... "
291 find_lua=`find_program lua$LUA_SUFFIX`
292 echo "lua$LUA_SUFFIX found in \$PATH: $find_lua"
296 LUA_DIR=`dirname $find_lua`
297 LUA_BINDIR="$find_lua"
299 echo "lua$LUA_SUFFIX not found in \$PATH."
300 echo "You may want to use the flags --with-lua and/or --lua-suffix. See --help."
305 if [ "$LUA_INCDIR_SET" != "yes" ]
307 LUA_INCDIR="$LUA_DIR/include"
310 if [ "$LUA_LIBDIR_SET" != "yes" ]
312 LUA_LIBDIR="$LUA_DIR/lib"
315 if [ "$LUA_DIR_SET" = "yes" ]
317 LUA_BINDIR="$LUA_DIR/bin"
320 if [ "$IDN_LIBRARY" = "icu" ]
322 IDNA_LIBS="$ICU_FLAGS"
323 CFLAGS="$CFLAGS -DUSE_STRINGPREP_ICU"
325 if [ "$IDN_LIBRARY" = "idn" ]
327 IDNA_LIBS="-l$IDN_LIB"
330 OPENSSL_LIBS="-l$OPENSSL_LIB"
332 echo -n "Checking Lua includes... "
333 lua_h="$LUA_INCDIR/lua.h"
336 echo "lua.h found in $lua_h"
338 echo "lua.h not found (looked in $lua_h)"
339 echo "You may want to use the flag --with-lua-include. See --help."
349 found=`find_program "$1"`
352 echo "$1 found at $found"
358 echo "Could not find a $explanation. Tried: $tried."
359 echo "Make sure one of them is installed and available in your PATH."
365 echo "Writing configuration..."
368 cat <<EOF > config.unix
369 # This file was automatically generated by the configure script.
370 # Run "./configure --help" for details.
373 SYSCONFDIR=$SYSCONFDIR
376 LUA_SUFFIX=$LUA_SUFFIX
378 LUA_INCDIR=$LUA_INCDIR
379 LUA_LIBDIR=$LUA_LIBDIR
380 LUA_BINDIR=$LUA_BINDIR
381 REQUIRE_CONFIG=$REQUIRE_CONFIG
384 OPENSSL_LIBS=$OPENSSL_LIBS
393 RANDOM_LIBS=$PRNGLIBS
398 echo "Installation prefix: $PREFIX"
399 echo "Prosody configuration directory: $SYSCONFDIR"
400 echo "Using Lua from: $LUA_DIR"
402 make clean > /dev/null 2> /dev/null
405 echo "Done. You can now run 'make' to build."