6 SYSCONFDIR="$PREFIX/etc/prosody"
7 DATADIR="$PREFIX/var/lib/prosody"
11 LUA_INCDIR="/usr/include"
14 ICU_FLAGS="-licui18n -licudata -licuuc"
30 Configure Prosody prior to building.
33 --ostype=OS Use one of the OS presets.
34 May be one of: debian, macosx, linux, freebsd
35 --prefix=DIR Prefix where Prosody should be installed.
37 --sysconfdir=DIR Location where the config file should be installed.
38 Default is \$PREFIX/etc/prosody
39 --datadir=DIR Location where the server data should be stored.
40 Default is \$PREFIX/var/lib/prosody
41 --lua-suffix=SUFFIX Versioning suffix to use in Lua filenames.
42 Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...)
43 --with-lua=PREFIX Use Lua from given prefix.
45 --runwith=BINARY What Lua binary to set as runtime environment.
47 --with-lua-include=DIR You can also specify Lua's includes dir.
48 Default is \$LUA_DIR/include
49 --with-lua-lib=DIR You can also specify Lua's libraries dir.
50 Default is \$LUA_DIR/lib
51 --with-idn=LIB The name of the IDN library to link with.
53 --idn-library=(idn|icu) Select library to use for IDNA functionality.
54 idn: use GNU libidn (default)
56 --with-ssl=LIB The name of the SSL to link with.
57 Default is $OPENSSL_LIB
58 --cflags=FLAGS Flags to pass to the compiler
60 --ldflags=FLAGS Flags to pass to the linker
62 --c-compiler=CC The C compiler to use when building modules.
64 --linker=CC The linker to use when building modules.
66 --require-config Will cause Prosody to refuse to run when
67 it fails to find a configuration file
68 --no-example-certs Disables generation of example certificates.
75 value="`echo $1 | sed 's/[^=]*=\(.*\)/\1/'`"
76 if echo "$value" | grep -q "~"
79 echo '*WARNING*: the "~" sign is not expanded in flags.'
80 echo 'If you mean the home directory, use $HOME instead.'
99 if [ "$OSTYPE" = "debian" ]
100 then LUA_SUFFIX="5.1";
103 LUA_INCDIR=/usr/include/lua5.1;
105 CFLAGS="$CFLAGS -D_GNU_SOURCE"
107 if [ "$OSTYPE" = "macosx" ]
108 then LUA_INCDIR=/usr/local/include;
110 LUA_LIBDIR=/usr/local/lib
112 LDFLAGS="-bundle -undefined dynamic_lookup"
114 if [ "$OSTYPE" = "linux" ]
115 then LUA_INCDIR=/usr/local/include;
117 LUA_LIBDIR=/usr/local/lib
120 CFLAGS="$CFLAGS -D_GNU_SOURCE"
123 if [ "$OSTYPE" = "freebsd" -o "$OSTYPE" = "openbsd" ]
124 then LUA_INCDIR="/usr/local/include/lua51"
126 CFLAGS="-Wall -fPIC -I/usr/local/include"
127 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
133 if [ "$OSTYPE" = "openbsd" ]
134 then LUA_INCDIR="/usr/local/include";
152 --with-lua-include=*)
157 LUA_LIBDIR="$value" LUA_LIBDIR_SET=yes
187 echo "Error: Unknown flag: $1"
194 if [ "$PREFIX_SET" = "yes" -a ! "$SYSCONFDIR_SET" = "yes" ]
196 if [ "$PREFIX" = "/usr" ]
197 then SYSCONFDIR=/etc/prosody
198 else SYSCONFDIR=$PREFIX/etc/prosody
202 if [ "$PREFIX_SET" = "yes" -a ! "$DATADIR_SET" = "yes" ]
204 if [ "$PREFIX" = "/usr" ]
205 then DATADIR=/var/lib/prosody
206 else DATADIR=$PREFIX/var/lib/prosody
212 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
213 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
222 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
223 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
225 if [ "$found" = "yes" ]
233 if [ "$LUA_SUFFIX_SET" != "yes" ]
235 for suffix in "5.1" "51" ""
238 if [ "$LUA_DIR_SET" = "yes" ]
240 if [ -e "$LUA_DIR/bin/lua$suffix" ]
245 find_lua=`find_program lua$suffix`
249 echo "Lua interpreter found: $find_lua/lua$suffix..."
255 if ! [ "$LUA_DIR_SET" = "yes" ]
257 echo -n "Looking for Lua... "
260 find_lua=`find_program lua$LUA_SUFFIX`
261 echo "lua$LUA_SUFFIX found in \$PATH: $find_lua"
265 LUA_DIR=`dirname $find_lua`
266 LUA_BINDIR="$find_lua"
268 echo "lua$LUA_SUFFIX not found in \$PATH."
269 echo "You may want to use the flags --with-lua and/or --lua-suffix. See --help."
274 if ! [ "$LUA_INCDIR_SET" = "yes" ]
276 LUA_INCDIR="$LUA_DIR/include"
279 if ! [ "$LUA_LIBDIR_SET" = "yes" ]
281 LUA_LIBDIR="$LUA_DIR/lib"
284 if [ "$LUA_DIR_SET" = "yes" ]
286 LUA_BINDIR="$LUA_DIR/bin"
289 if [ "$IDN_LIBRARY" = "icu" ]
291 IDNA_LIBS="$ICU_FLAGS"
292 CFLAGS="$CFLAGS -DUSE_STRINGPREP_ICU"
294 if [ "$IDN_LIBRARY" = "idn" ]
296 IDNA_LIBS="-l$IDN_LIB"
299 echo -n "Checking Lua includes... "
300 lua_h="$LUA_INCDIR/lua.h"
303 echo "lua.h found in $lua_h"
305 echo "lua.h not found (looked in $lua_h)"
306 echo "You may want to use the flag --with-lua-include. See --help."
316 found=`find_program "$1"`
319 echo "$1 found at $found"
325 echo "Could not find a $explanation. Tried: $tried."
326 echo "Make sure one of them is installed and available in your PATH."
332 echo "Writing configuration..."
335 cat <<EOF > config.unix
336 # This file was automatically generated by the configure script.
337 # Run "./configure --help" for details.
340 SYSCONFDIR=$SYSCONFDIR
342 LUA_SUFFIX=$LUA_SUFFIX
344 LUA_INCDIR=$LUA_INCDIR
345 LUA_LIBDIR=$LUA_LIBDIR
346 LUA_BINDIR=$LUA_BINDIR
347 REQUIRE_CONFIG=$REQUIRE_CONFIG
350 OPENSSL_LIB=$OPENSSL_LIB
361 echo "Installation prefix: $PREFIX"
362 echo "Prosody configuration directory: $SYSCONFDIR"
363 echo "Using Lua from: $LUA_DIR"
365 make clean > /dev/null 2> /dev/null
368 echo "Done. You can now run 'make' to build."