6 SYSCONFDIR="$PREFIX/etc/prosody"
8 DATADIR="$PREFIX/var/lib/prosody"
12 LUA_INCDIR="/usr/include"
15 ICU_FLAGS="-licui18n -licudata -licuuc"
31 Configure Prosody prior to building.
34 --ostype=OS Use one of the OS presets.
35 May be one of: debian, macosx, linux, freebsd
36 --prefix=DIR Prefix where Prosody should be installed.
38 --sysconfdir=DIR Location where the config file should be installed.
39 Default is \$PREFIX/etc/prosody
40 --libdir=DIR Location where the server files should be stored.
41 Default is \$PREFIX/lib
42 --datadir=DIR Location where the server data should be stored.
43 Default is \$PREFIX/var/lib/prosody
44 --lua-suffix=SUFFIX Versioning suffix to use in Lua filenames.
45 Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...)
46 --with-lua=PREFIX Use Lua from given prefix.
48 --runwith=BINARY What Lua binary to set as runtime environment.
50 --with-lua-include=DIR You can also specify Lua's includes dir.
51 Default is \$LUA_DIR/include
52 --with-lua-lib=DIR You can also specify Lua's libraries dir.
53 Default is \$LUA_DIR/lib
54 --with-idn=LIB The name of the IDN library to link with.
56 --idn-library=(idn|icu) Select library to use for IDNA functionality.
57 idn: use GNU libidn (default)
59 --with-ssl=LIB The name of the SSL to link with.
60 Default is $OPENSSL_LIB
61 --cflags=FLAGS Flags to pass to the compiler
63 --ldflags=FLAGS Flags to pass to the linker
65 --c-compiler=CC The C compiler to use when building modules.
67 --linker=CC The linker to use when building modules.
69 --require-config Will cause Prosody to refuse to run when
70 it fails to find a configuration file
71 --no-example-certs Disables generation of example certificates.
78 value="`echo $1 | sed 's/[^=]*=\(.*\)/\1/'`"
79 if echo "$value" | grep -q "~"
82 echo '*WARNING*: the "~" sign is not expanded in flags.'
83 echo 'If you mean the home directory, use $HOME instead.'
102 if [ "$OSTYPE" = "debian" ]
103 then LUA_SUFFIX="5.1";
106 LUA_INCDIR=/usr/include/lua5.1;
108 CFLAGS="$CFLAGS -D_GNU_SOURCE"
110 if [ "$OSTYPE" = "macosx" ]
111 then LUA_INCDIR=/usr/local/include;
113 LUA_LIBDIR=/usr/local/lib
115 LDFLAGS="-bundle -undefined dynamic_lookup"
117 if [ "$OSTYPE" = "linux" ]
118 then LUA_INCDIR=/usr/local/include;
120 LUA_LIBDIR=/usr/local/lib
123 CFLAGS="$CFLAGS -D_GNU_SOURCE"
126 if [ "$OSTYPE" = "freebsd" -o "$OSTYPE" = "openbsd" ]
127 then LUA_INCDIR="/usr/local/include/lua51"
129 CFLAGS="-Wall -fPIC -I/usr/local/include"
130 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
136 if [ "$OSTYPE" = "openbsd" ]
137 then LUA_INCDIR="/usr/local/include";
159 --with-lua-include=*)
164 LUA_LIBDIR="$value" LUA_LIBDIR_SET=yes
194 echo "Error: Unknown flag: $1"
201 if [ "$PREFIX_SET" = "yes" -a ! "$SYSCONFDIR_SET" = "yes" ]
203 if [ "$PREFIX" = "/usr" ]
204 then SYSCONFDIR=/etc/prosody
205 else SYSCONFDIR=$PREFIX/etc/prosody
209 if [ "$PREFIX_SET" = "yes" -a ! "$DATADIR_SET" = "yes" ]
211 if [ "$PREFIX" = "/usr" ]
212 then DATADIR=/var/lib/prosody
213 else DATADIR=$PREFIX/var/lib/prosody
217 if [ "$PREFIX_SET" = "yes" -a ! "$LIBDIR_SET" = "yes" ]
224 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
225 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
234 item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
235 path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
237 if [ "$found" = "yes" ]
245 if [ "$LUA_SUFFIX_SET" != "yes" ]
247 for suffix in "5.1" "51" ""
250 if [ "$LUA_DIR_SET" = "yes" ]
252 if [ -e "$LUA_DIR/bin/lua$suffix" ]
257 find_lua=`find_program lua$suffix`
261 echo "Lua interpreter found: $find_lua/lua$suffix..."
267 if ! [ "$LUA_DIR_SET" = "yes" ]
269 echo -n "Looking for Lua... "
272 find_lua=`find_program lua$LUA_SUFFIX`
273 echo "lua$LUA_SUFFIX found in \$PATH: $find_lua"
277 LUA_DIR=`dirname $find_lua`
278 LUA_BINDIR="$find_lua"
280 echo "lua$LUA_SUFFIX not found in \$PATH."
281 echo "You may want to use the flags --with-lua and/or --lua-suffix. See --help."
286 if ! [ "$LUA_INCDIR_SET" = "yes" ]
288 LUA_INCDIR="$LUA_DIR/include"
291 if ! [ "$LUA_LIBDIR_SET" = "yes" ]
293 LUA_LIBDIR="$LUA_DIR/lib"
296 if [ "$LUA_DIR_SET" = "yes" ]
298 LUA_BINDIR="$LUA_DIR/bin"
301 if [ "$IDN_LIBRARY" = "icu" ]
303 IDNA_LIBS="$ICU_FLAGS"
304 CFLAGS="$CFLAGS -DUSE_STRINGPREP_ICU"
306 if [ "$IDN_LIBRARY" = "idn" ]
308 IDNA_LIBS="-l$IDN_LIB"
311 echo -n "Checking Lua includes... "
312 lua_h="$LUA_INCDIR/lua.h"
315 echo "lua.h found in $lua_h"
317 echo "lua.h not found (looked in $lua_h)"
318 echo "You may want to use the flag --with-lua-include. See --help."
328 found=`find_program "$1"`
331 echo "$1 found at $found"
337 echo "Could not find a $explanation. Tried: $tried."
338 echo "Make sure one of them is installed and available in your PATH."
344 echo "Writing configuration..."
347 cat <<EOF > config.unix
348 # This file was automatically generated by the configure script.
349 # Run "./configure --help" for details.
352 SYSCONFDIR=$SYSCONFDIR
355 LUA_SUFFIX=$LUA_SUFFIX
357 LUA_INCDIR=$LUA_INCDIR
358 LUA_LIBDIR=$LUA_LIBDIR
359 LUA_BINDIR=$LUA_BINDIR
360 REQUIRE_CONFIG=$REQUIRE_CONFIG
363 OPENSSL_LIB=$OPENSSL_LIB
374 echo "Installation prefix: $PREFIX"
375 echo "Prosody configuration directory: $SYSCONFDIR"
376 echo "Using Lua from: $LUA_DIR"
378 make clean > /dev/null 2> /dev/null
381 echo "Done. You can now run 'make' to build."