Comparison

configure @ 7619:f5016c8985d7

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Fri, 19 Aug 2016 22:49:36 +0200
parent 7618:5a09c1166d89
child 7632:2b14e2121700
comparison
equal deleted inserted replaced
7606:f40f1d9b7872 7619:f5016c8985d7
1 #!/bin/sh 1 #!/bin/sh
2 2
3 # Defaults 3 # Defaults
4 4
5 PREFIX=/usr/local 5 PREFIX="/usr/local"
6 SYSCONFDIR="$PREFIX/etc/prosody" 6 SYSCONFDIR="$PREFIX/etc/prosody"
7 LIBDIR="$PREFIX/lib" 7 LIBDIR="$PREFIX/lib"
8 DATADIR="$PREFIX/var/lib/prosody" 8 DATADIR="$PREFIX/var/lib/prosody"
9 LUA_SUFFIX="" 9 LUA_SUFFIX=""
10 LUA_DIR="/usr" 10 LUA_DIR="/usr"
11 LUA_BINDIR="/usr/bin" 11 LUA_BINDIR="/usr/bin"
12 LUA_INCDIR="/usr/include" 12 LUA_INCDIR="/usr/include"
13 LUA_LIBDIR="/usr/lib" 13 LUA_LIBDIR="/usr/lib"
14 IDN_LIB=idn 14 IDN_LIB="idn"
15 ICU_FLAGS="-licui18n -licudata -licuuc" 15 ICU_FLAGS="-licui18n -licudata -licuuc"
16 OPENSSL_LIB=crypto 16 OPENSSL_LIB="crypto"
17 CC=gcc 17 CC="gcc"
18 LD=gcc 18 LD="gcc"
19 RUNWITH=lua 19 RUNWITH="lua"
20 EXCERTS=yes 20 EXCERTS="yes"
21 PRNG= 21 PRNG=
22 PRNGLIBS= 22 PRNGLIBS=
23 23
24 CFLAGS="-fPIC -Wall" 24 CFLAGS="-fPIC -Wall -pedantic -std=c89"
25 LDFLAGS="-shared" 25 LDFLAGS="-shared"
26 26
27 IDN_LIBRARY=idn 27 IDN_LIBRARY="idn"
28 # Help 28 # Help
29 29
30 show_help() { 30 show_help() {
31 cat <<EOF 31 cat <<EOF
32 Configure Prosody prior to building. 32 Configure Prosody prior to building.
104 ;; 104 ;;
105 --ostype=*) 105 --ostype=*)
106 OSTYPE="$value" 106 OSTYPE="$value"
107 OSTYPE_SET=yes 107 OSTYPE_SET=yes
108 if [ "$OSTYPE" = "debian" ]; then 108 if [ "$OSTYPE" = "debian" ]; then
109 LUA_SUFFIX="5.1"; 109 if [ "$LUA_SUFFIX_SET" != "yes" ]; then
110 LUA_SUFFIX_SET=yes 110 LUA_SUFFIX="5.1";
111 RUNWITH="lua5.1" 111 LUA_SUFFIX_SET=yes
112 LUA_INCDIR=/usr/include/lua5.1; 112 fi
113 LUA_INCDIR_SET=yes 113 RUNWITH="lua$LUA_SUFFIX"
114 CFLAGS="$CFLAGS -D_GNU_SOURCE" 114 LUA_INCDIR="/usr/include/lua$LUA_SUFFIX"
115 fi 115 LUA_INCDIR_SET=yes
116 if [ "$OSTYPE" = "macosx" ]; then 116 CFLAGS="$CFLAGS -ggdb -D_GNU_SOURCE"
117 LUA_INCDIR=/usr/local/include; 117 fi
118 LUA_INCDIR_SET=yes 118 if [ "$OSTYPE" = "macosx" ]; then
119 LUA_LIBDIR=/usr/local/lib 119 LUA_INCDIR=/usr/local/include;
120 LUA_LIBDIR_SET=yes 120 LUA_INCDIR_SET=yes
121 CFLAGS="$CFLAGS -mmacosx-version-min=10.3" 121 LUA_LIBDIR=/usr/local/lib
122 LDFLAGS="-bundle -undefined dynamic_lookup" 122 LUA_LIBDIR_SET=yes
123 fi 123 CFLAGS="$CFLAGS -mmacosx-version-min=10.3"
124 LDFLAGS="-bundle -undefined dynamic_lookup"
125 fi
124 if [ "$OSTYPE" = "linux" ]; then 126 if [ "$OSTYPE" = "linux" ]; then
125 LUA_INCDIR=/usr/local/include; 127 LUA_INCDIR=/usr/local/include;
126 LUA_INCDIR_SET=yes 128 LUA_INCDIR_SET=yes
127 LUA_LIBDIR=/usr/local/lib 129 LUA_LIBDIR=/usr/local/lib
128 LUA_LIBDIR_SET=yes 130 LUA_LIBDIR_SET=yes
129 CFLAGS="-Wall -fPIC -D_GNU_SOURCE" 131 CFLAGS="$CFLAGS -ggdb -D_GNU_SOURCE"
130 LDFLAGS="-shared"
131 fi 132 fi
132 if [ "$OSTYPE" = "freebsd" -o "$OSTYPE" = "openbsd" ]; then 133 if [ "$OSTYPE" = "freebsd" -o "$OSTYPE" = "openbsd" ]; then
133 LUA_INCDIR="/usr/local/include/lua51" 134 LUA_INCDIR="/usr/local/include/lua51"
134 LUA_INCDIR_SET=yes 135 LUA_INCDIR_SET=yes
135 CFLAGS="-Wall -fPIC -I/usr/local/include" 136 CFLAGS="-Wall -fPIC -I/usr/local/include"
136 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared" 137 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
137 LUA_SUFFIX="-5.1" 138 LUA_SUFFIX="-5.1"
138 LUA_SUFFIX_SET=yes 139 LUA_SUFFIX_SET=yes
139 LUA_DIR=/usr/local 140 LUA_DIR=/usr/local
140 LUA_DIR_SET=yes 141 LUA_DIR_SET=yes
141 CC=cc 142 CC=cc
142 LD=ld 143 LD=ld
143 fi 144 fi
144 if [ "$OSTYPE" = "openbsd" ]; then 145 if [ "$OSTYPE" = "openbsd" ]; then
145 LUA_INCDIR="/usr/local/include"; 146 LUA_INCDIR="/usr/local/include";
147 LUA_INCDIR_SET="yes"
148 fi
149 if [ "$OSTYPE" = "pkg-config" ]; then
150 if [ "$LUA_SUFFIX_SET" != "yes" ]; then
151 LUA_SUFFIX="5.1";
152 LUA_SUFFIX_SET=yes
153 fi
154 LUA_CF="$(pkg-config --cflags-only-I lua$LUA_SUFFIX)"
155 LUA_CF="${LUA_CF#*-I}"
156 LUA_CF="${LUA_CF%% *}"
157 if [ "$LUA_CF" != "" ]; then
158 LUA_INCDIR="$LUA_CF"
159 LUA_INCDIR_SET=yes
160 fi
161 CFLAGS="$CFLAGS -D_GNU_SOURCE"
146 fi 162 fi
147 ;; 163 ;;
148 --libdir=*) 164 --libdir=*)
149 LIBDIR="$value" 165 LIBDIR="$value"
150 LIBDIR_SET=yes 166 LIBDIR_SET=yes
151 ;; 167 ;;
152 --datadir=*) 168 --datadir=*)
153 DATADIR="$value" 169 DATADIR="$value"
154 DATADIR_SET=yes 170 DATADIR_SET=yes
155 ;; 171 ;;
156 --require-config) 172 --require-config)
157 REQUIRE_CONFIG=yes 173 REQUIRE_CONFIG=yes
158 ;; 174 ;;
159 --lua-suffix=*) 175 --lua-suffix=*)
172 LUA_LIBDIR="$value" LUA_LIBDIR_SET=yes 188 LUA_LIBDIR="$value" LUA_LIBDIR_SET=yes
173 ;; 189 ;;
174 --with-idn=*) 190 --with-idn=*)
175 IDN_LIB="$value" 191 IDN_LIB="$value"
176 ;; 192 ;;
177 --idn-library=*) 193 --idn-library=*)
178 IDN_LIBRARY="$value" 194 IDN_LIBRARY="$value"
179 ;; 195 ;;
180 --with-ssl=*) 196 --with-ssl=*)
181 OPENSSL_LIB="$value" 197 OPENSSL_LIB="$value"
182 ;; 198 ;;
183 --with-random=getrandom) 199 --with-random=getrandom)
184 PRNG=GETRANDOM 200 PRNG=GETRANDOM
205 --runwith=*) 221 --runwith=*)
206 RUNWITH="$value" 222 RUNWITH="$value"
207 ;; 223 ;;
208 --no-example-certs) 224 --no-example-certs)
209 EXCERTS= 225 EXCERTS=
226 ;;
227 --compiler-wrapper=*)
228 CC="$value $CC"
229 LD="$value $LD"
210 ;; 230 ;;
211 *) 231 *)
212 echo "Error: Unknown flag: $1" 232 echo "Error: Unknown flag: $1"
213 exit 1 233 exit 1
214 ;; 234 ;;
316 LUA_BINDIR="$LUA_DIR/bin" 336 LUA_BINDIR="$LUA_DIR/bin"
317 fi 337 fi
318 338
319 if [ "$IDN_LIBRARY" = "icu" ] 339 if [ "$IDN_LIBRARY" = "icu" ]
320 then 340 then
321 IDNA_LIBS="$ICU_FLAGS" 341 IDNA_LIBS="$ICU_FLAGS"
322 CFLAGS="$CFLAGS -DUSE_STRINGPREP_ICU" 342 CFLAGS="$CFLAGS -DUSE_STRINGPREP_ICU"
323 fi 343 fi
324 if [ "$IDN_LIBRARY" = "idn" ] 344 if [ "$IDN_LIBRARY" = "idn" ]
325 then 345 then
326 IDNA_LIBS="-l$IDN_LIB" 346 IDNA_LIBS="-l$IDN_LIB"
327 fi 347 fi
328 348
329 OPENSSL_LIBS="-l$OPENSSL_LIB" 349 OPENSSL_LIBS="-l$OPENSSL_LIB"
330 350
331 echo -n "Checking Lua includes... " 351 echo -n "Checking Lua includes... "
336 else 356 else
337 echo "lua.h not found (looked in $lua_h)" 357 echo "lua.h not found (looked in $lua_h)"
338 echo "You may want to use the flag --with-lua-include. See --help." 358 echo "You may want to use the flag --with-lua-include. See --help."
339 exit 1 359 exit 1
340 fi 360 fi
341
342 find_helper() {
343 explanation="$1"
344 shift
345 tried="$*"
346 while [ "$1" ]
347 do
348 found=`find_program "$1"`
349 if [ "$found" ]
350 then
351 echo "$1 found at $found"
352 HELPER=$1
353 return
354 fi
355 shift
356 done
357 echo "Could not find a $explanation. Tried: $tried."
358 echo "Make sure one of them is installed and available in your PATH."
359 exit 1
360 }
361 361
362 # Write config 362 # Write config
363 363
364 echo "Writing configuration..." 364 echo "Writing configuration..."
365 echo 365 echo