1 | #!/bin/sh |
---|
2 | |
---|
3 | ############################## |
---|
4 | ## Configurer for BitlBee ## |
---|
5 | ## ## |
---|
6 | ## Copyright 2004 Lintux ## |
---|
7 | ## Copyright 2002 Lucumo ## |
---|
8 | ############################## |
---|
9 | |
---|
10 | prefix='/usr/local/' |
---|
11 | bindir='$prefix/bin/' |
---|
12 | sbindir='$prefix/sbin/' |
---|
13 | etcdir='$prefix/etc/bitlbee/' |
---|
14 | mandir='$prefix/share/man/' |
---|
15 | datadir='$prefix/share/bitlbee/' |
---|
16 | config='/var/lib/bitlbee/' |
---|
17 | plugindir='$prefix/lib/bitlbee/' |
---|
18 | includedir='$prefix/include/bitlbee/' |
---|
19 | systemdsystemunitdir='' |
---|
20 | libevent='/usr/' |
---|
21 | pidfile='/var/run/bitlbee.pid' |
---|
22 | ipcsocket='' |
---|
23 | pcdir='$prefix/lib/pkgconfig' |
---|
24 | systemlibdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib" |
---|
25 | |
---|
26 | # Set these to default-on to let it be overriden by either the user or purple |
---|
27 | # |
---|
28 | # If the user sets one of these to 1, purple won't disable them. |
---|
29 | # Otherwise, if it's still default-on, it gets included in normal builds, |
---|
30 | # but not purple ones. |
---|
31 | msn="default-on" |
---|
32 | jabber="default-on" |
---|
33 | oscar="default-on" |
---|
34 | yahoo="default-on" |
---|
35 | |
---|
36 | twitter=1 |
---|
37 | purple=0 |
---|
38 | |
---|
39 | debug=0 |
---|
40 | strip=1 |
---|
41 | gcov=0 |
---|
42 | plugins=1 |
---|
43 | otr=0 |
---|
44 | skype=0 |
---|
45 | |
---|
46 | events=glib |
---|
47 | ssl=auto |
---|
48 | |
---|
49 | pie=1 |
---|
50 | |
---|
51 | arch=`uname -s` |
---|
52 | cpu=`uname -m` |
---|
53 | |
---|
54 | GLIB_MIN_VERSION=2.14 |
---|
55 | |
---|
56 | echo BitlBee configure |
---|
57 | |
---|
58 | while [ -n "$1" ]; do |
---|
59 | e="`expr "X$1" : 'X--\(.*=.*\)'`" |
---|
60 | if [ -z "$e" ]; then |
---|
61 | cat<<EOF |
---|
62 | |
---|
63 | Usage: $0 [OPTIONS] |
---|
64 | |
---|
65 | Option Description Default |
---|
66 | |
---|
67 | --prefix=... Directories to put files in $prefix |
---|
68 | --bindir=... $bindir |
---|
69 | --sbindir=... $sbindir |
---|
70 | --etcdir=... $etcdir |
---|
71 | --mandir=... $mandir |
---|
72 | --datadir=... $datadir |
---|
73 | --plugindir=... $plugindir |
---|
74 | --systemdsystemunitdir=... $systemdsystemunitdir |
---|
75 | --pidfile=... $pidfile |
---|
76 | --config=... $config |
---|
77 | |
---|
78 | --msn=0/1 Disable/enable MSN part $msn |
---|
79 | --jabber=0/1 Disable/enable Jabber part $jabber |
---|
80 | --oscar=0/1 Disable/enable Oscar part (ICQ, AIM) $oscar |
---|
81 | --yahoo=0/1 Disable/enable Yahoo part $yahoo |
---|
82 | --twitter=0/1 Disable/enable Twitter part $twitter |
---|
83 | |
---|
84 | --purple=0/1 Disable/enable libpurple support $purple |
---|
85 | (automatically disables other protocol modules) |
---|
86 | |
---|
87 | --debug=0/1 Disable/enable debugging $debug |
---|
88 | --strip=0/1 Disable/enable binary stripping $strip |
---|
89 | --pie=0/1 Build position independent executable $pie |
---|
90 | --gcov=0/1 Disable/enable test coverage reporting $gcov |
---|
91 | --plugins=0/1 Disable/enable plugins support $plugins |
---|
92 | --otr=0/1/auto/plugin |
---|
93 | Disable/enable OTR encryption support $otr |
---|
94 | --skype=0/1/plugin |
---|
95 | Disable/enable Skype support $skype |
---|
96 | |
---|
97 | --events=... Event handler (glib, libevent) $events |
---|
98 | --ssl=... SSL library to use (gnutls, nss, openssl, auto) |
---|
99 | $ssl |
---|
100 | |
---|
101 | |
---|
102 | --target=... Cross compilation target same as host |
---|
103 | EOF |
---|
104 | exit; |
---|
105 | fi |
---|
106 | eval "$e" |
---|
107 | shift; |
---|
108 | done |
---|
109 | |
---|
110 | # Expand $prefix and get rid of double slashes |
---|
111 | bindir=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'` |
---|
112 | sbindir=`eval echo "$sbindir/" | sed 's/\/\{1,\}/\//g'` |
---|
113 | etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'` |
---|
114 | mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'` |
---|
115 | datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'` |
---|
116 | config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'` |
---|
117 | plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'` |
---|
118 | includedir=`eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g'` |
---|
119 | libevent=`eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g'` |
---|
120 | |
---|
121 | pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'` |
---|
122 | ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'` |
---|
123 | pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'` |
---|
124 | |
---|
125 | protocols_mods="" |
---|
126 | |
---|
127 | cat <<EOF >Makefile.settings |
---|
128 | ## BitlBee settings, generated by configure |
---|
129 | PREFIX=$prefix |
---|
130 | BINDIR=$bindir |
---|
131 | SBINDIR=$sbindir |
---|
132 | ETCDIR=$etcdir |
---|
133 | MANDIR=$mandir |
---|
134 | DATADIR=$datadir |
---|
135 | PLUGINDIR=$plugindir |
---|
136 | CONFIG=$config |
---|
137 | INCLUDEDIR=$includedir |
---|
138 | PCDIR=$pcdir |
---|
139 | |
---|
140 | TARGET=$target |
---|
141 | ARCH=$arch |
---|
142 | CPU=$cpu |
---|
143 | |
---|
144 | INSTALL=install -p |
---|
145 | |
---|
146 | DESTDIR= |
---|
147 | LFLAGS= |
---|
148 | EFLAGS=-lm |
---|
149 | EOF |
---|
150 | |
---|
151 | srcdir=$(cd $(dirname $0);pwd) |
---|
152 | currdir=$(pwd) |
---|
153 | if [ "$srcdir" != "$currdir" ]; then |
---|
154 | echo |
---|
155 | echo "configure script run from a different directory. Will create some symlinks..." |
---|
156 | if [ ! -e Makefile -o -L Makefile ]; then |
---|
157 | COPYDIRS="doc lib protocols tests utils" |
---|
158 | mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d) |
---|
159 | find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null |
---|
160 | dst="$PWD" |
---|
161 | cd "$srcdir" |
---|
162 | for i in $(find . -name Makefile -type f); do |
---|
163 | ln -s "$PWD${i#.}" "$dst/$i"; |
---|
164 | done |
---|
165 | cd "$dst" |
---|
166 | rm -rf .bzr |
---|
167 | fi |
---|
168 | |
---|
169 | echo "_SRCDIR_=$srcdir/" >> Makefile.settings |
---|
170 | CFLAGS="$CFLAGS -I${dst}" |
---|
171 | else |
---|
172 | srcdir=$PWD |
---|
173 | fi |
---|
174 | |
---|
175 | cat<<EOF >config.h |
---|
176 | /* BitlBee settings, generated by configure |
---|
177 | |
---|
178 | Do *NOT* use any of these defines in your code without thinking twice, most |
---|
179 | of them can/will be overridden at run-time */ |
---|
180 | |
---|
181 | #define CONFIG "$config" |
---|
182 | #define ETCDIR "$etcdir" |
---|
183 | #define VARDIR "$datadir" |
---|
184 | #define PLUGINDIR "$plugindir" |
---|
185 | #define PIDFILE "$pidfile" |
---|
186 | #define IPCSOCKET "$ipcsocket" |
---|
187 | #define ARCH "$arch" |
---|
188 | #define CPU "$cpu" |
---|
189 | EOF |
---|
190 | |
---|
191 | |
---|
192 | |
---|
193 | if [ -n "$target" ]; then |
---|
194 | PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig |
---|
195 | export PKG_CONFIG_LIBDIR |
---|
196 | PATH=/usr/$target/bin:$PATH |
---|
197 | CC=$target-cc |
---|
198 | LD=$target-ld |
---|
199 | systemlibdirs="/usr/$target/lib" |
---|
200 | fi |
---|
201 | |
---|
202 | |
---|
203 | if [ "$debug" = "1" ]; then |
---|
204 | echo 'DEBUG=1' >> Makefile.settings |
---|
205 | CFLAGS="$CFLAGS -g -DDEBUG" |
---|
206 | else |
---|
207 | [ -z "$CFLAGS" ] && CFLAGS="-O2 -fno-strict-aliasing" |
---|
208 | fi |
---|
209 | |
---|
210 | if [ "$pie" = "1" ]; then |
---|
211 | echo 'CFLAGS_BITLBEE=-fPIE' >> Makefile.settings |
---|
212 | echo 'LDFLAGS_BITLBEE=-pie' >> Makefile.settings |
---|
213 | fi |
---|
214 | |
---|
215 | echo LDFLAGS=$LDFLAGS >> Makefile.settings |
---|
216 | |
---|
217 | echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings |
---|
218 | echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings |
---|
219 | |
---|
220 | echo CFLAGS+=-DHAVE_CONFIG_H -D_GNU_SOURCE >> Makefile.settings |
---|
221 | |
---|
222 | if [ -n "$CC" ]; then |
---|
223 | CC=$CC |
---|
224 | elif type gcc > /dev/null 2> /dev/null; then |
---|
225 | CC=gcc |
---|
226 | elif type cc > /dev/null 2> /dev/null; then |
---|
227 | CC=cc |
---|
228 | else |
---|
229 | echo 'Cannot find a C compiler, aborting.' |
---|
230 | exit 1; |
---|
231 | fi |
---|
232 | |
---|
233 | echo "CC=$CC" >> Makefile.settings; |
---|
234 | if echo $CC | grep -qw gcc; then |
---|
235 | # Apparently -Wall is gcc-specific? |
---|
236 | echo CFLAGS+=-Wall >> Makefile.settings |
---|
237 | fi |
---|
238 | |
---|
239 | if [ -z "$LD" ]; then |
---|
240 | if type ld > /dev/null 2> /dev/null; then |
---|
241 | LD=ld |
---|
242 | else |
---|
243 | echo 'Cannot find ld, aborting.' |
---|
244 | exit 1; |
---|
245 | fi |
---|
246 | fi |
---|
247 | |
---|
248 | echo "LD=$LD" >> Makefile.settings |
---|
249 | |
---|
250 | if [ -z "$PKG_CONFIG" ]; then |
---|
251 | PKG_CONFIG=pkg-config |
---|
252 | fi |
---|
253 | |
---|
254 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then |
---|
255 | if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then |
---|
256 | cat<<EOF >>Makefile.settings |
---|
257 | EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0` |
---|
258 | CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0` |
---|
259 | EOF |
---|
260 | else |
---|
261 | echo |
---|
262 | echo 'Found glib2 '`$PKG_CONFIG glib-2.0 --modversion`', but version '$GLIB_MIN_VERSION' or newer is required.' |
---|
263 | exit 1 |
---|
264 | fi |
---|
265 | else |
---|
266 | echo |
---|
267 | echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)' |
---|
268 | exit 1 |
---|
269 | fi |
---|
270 | |
---|
271 | if [ "$events" = "libevent" ]; then |
---|
272 | if ! [ -f "${libevent}include/event.h" ]; then |
---|
273 | echo |
---|
274 | echo 'Warning: Could not find event.h, you might have to install it and/or specify' |
---|
275 | echo 'its location using the --libevent= argument. (Example: If event.h is in' |
---|
276 | echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)' |
---|
277 | fi |
---|
278 | |
---|
279 | echo '#define EVENTS_LIBEVENT' >> config.h |
---|
280 | cat <<EOF >>Makefile.settings |
---|
281 | EFLAGS+=-levent -L${libevent}lib |
---|
282 | CFLAGS+=-I${libevent}include |
---|
283 | EOF |
---|
284 | elif [ "$events" = "glib" ]; then |
---|
285 | ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...): |
---|
286 | echo '#define EVENTS_GLIB' >> config.h |
---|
287 | else |
---|
288 | echo |
---|
289 | echo 'ERROR: Unknown event handler specified.' |
---|
290 | exit 1 |
---|
291 | fi |
---|
292 | echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings |
---|
293 | |
---|
294 | detect_gnutls() |
---|
295 | { |
---|
296 | if $PKG_CONFIG --exists gnutls; then |
---|
297 | cat <<EOF >>Makefile.settings |
---|
298 | EFLAGS+=`$PKG_CONFIG --libs gnutls` `libgcrypt-config --libs` |
---|
299 | CFLAGS+=`$PKG_CONFIG --cflags gnutls` `libgcrypt-config --cflags` |
---|
300 | EOF |
---|
301 | ssl=gnutls |
---|
302 | if ! pkg-config gnutls --atleast-version=2.8; then |
---|
303 | echo |
---|
304 | echo 'Warning: With GnuTLS versions <2.8, certificate expire dates are not verified.' |
---|
305 | fi |
---|
306 | ret=1 |
---|
307 | elif libgnutls-config --version > /dev/null 2> /dev/null; then |
---|
308 | cat <<EOF >>Makefile.settings |
---|
309 | EFLAGS+=`libgnutls-config --libs` `libgcrypt-config --libs` |
---|
310 | CFLAGS+=`libgnutls-config --cflags` `libgcrypt-config --cflags` |
---|
311 | EOF |
---|
312 | |
---|
313 | ssl=gnutls |
---|
314 | ret=1; |
---|
315 | else |
---|
316 | ret=0; |
---|
317 | fi; |
---|
318 | } |
---|
319 | |
---|
320 | detect_nss() |
---|
321 | { |
---|
322 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then |
---|
323 | cat<<EOF >>Makefile.settings |
---|
324 | EFLAGS+=`$PKG_CONFIG --libs nss` |
---|
325 | CFLAGS+=`$PKG_CONFIG --cflags nss` |
---|
326 | EOF |
---|
327 | |
---|
328 | ssl=nss |
---|
329 | ret=1; |
---|
330 | else |
---|
331 | ret=0; |
---|
332 | fi; |
---|
333 | } |
---|
334 | |
---|
335 | RESOLV_TESTCODE=' |
---|
336 | #include <sys/types.h> |
---|
337 | #include <netinet/in.h> |
---|
338 | #include <arpa/nameser.h> |
---|
339 | #include <resolv.h> |
---|
340 | |
---|
341 | int main() |
---|
342 | { |
---|
343 | |
---|
344 | res_query( NULL, 0, 0, NULL, 0); |
---|
345 | dn_expand( NULL, NULL, NULL, NULL, 0); |
---|
346 | dn_skipname( NULL, NULL); |
---|
347 | } |
---|
348 | ' |
---|
349 | RESOLV_NS_TESTCODE=' |
---|
350 | #include <sys/types.h> |
---|
351 | #include <netinet/in.h> |
---|
352 | #include <arpa/nameser.h> |
---|
353 | #include <resolv.h> |
---|
354 | |
---|
355 | int main() |
---|
356 | { |
---|
357 | ns_initparse( NULL, 0, NULL ); |
---|
358 | ns_parserr( NULL, ns_s_an, 0, NULL ); |
---|
359 | } |
---|
360 | ' |
---|
361 | RESOLV_NS_TYPES_TESTCODE=' |
---|
362 | #include <sys/types.h> |
---|
363 | #include <netinet/in.h> |
---|
364 | #include <arpa/nameser.h> |
---|
365 | |
---|
366 | int main() |
---|
367 | { |
---|
368 | ns_msg nsh; |
---|
369 | ns_rr rr; |
---|
370 | |
---|
371 | /* Not all platforms we want to work on have |
---|
372 | ns_* routines, so use this to make sure |
---|
373 | the compiler uses it.*/ |
---|
374 | return (int)(sizeof(nsh) + sizeof(rr)); |
---|
375 | } |
---|
376 | ' |
---|
377 | |
---|
378 | detect_resolv_dynamic() |
---|
379 | { |
---|
380 | case "$arch" in |
---|
381 | OpenBSD ) |
---|
382 | # In FreeBSD res_*/dn_* routines are present in libc.so |
---|
383 | LIBRESOLV=;; |
---|
384 | FreeBSD ) |
---|
385 | # In FreeBSD res_*/dn_* routines are present in libc.so |
---|
386 | LIBRESOLV=;; |
---|
387 | CYGWIN* ) |
---|
388 | # In Cygwin res_*/dn_* routines are present in libc.so |
---|
389 | LIBRESOLV=;; |
---|
390 | * ) |
---|
391 | LIBRESOLV=-lresolv;; |
---|
392 | esac |
---|
393 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
394 | ret=1 |
---|
395 | echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null |
---|
396 | if [ "$?" = "0" ]; then |
---|
397 | echo "EFLAGS+=$LIBRESOLV" >> Makefile.settings |
---|
398 | ret=0 |
---|
399 | fi |
---|
400 | |
---|
401 | rm -f $TMPFILE |
---|
402 | return $ret |
---|
403 | } |
---|
404 | |
---|
405 | detect_resolv_static() |
---|
406 | { |
---|
407 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
408 | ret=1 |
---|
409 | for i in $systemlibdirs; do |
---|
410 | if [ -f $i/libresolv.a ]; then |
---|
411 | echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null |
---|
412 | if [ "$?" = "0" ]; then |
---|
413 | echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings |
---|
414 | ret=0 |
---|
415 | fi |
---|
416 | fi |
---|
417 | done |
---|
418 | |
---|
419 | rm -f $TMPFILE |
---|
420 | return $ret |
---|
421 | } |
---|
422 | |
---|
423 | detect_resolv_ns_dynamic() |
---|
424 | { |
---|
425 | case "$arch" in |
---|
426 | FreeBSD ) |
---|
427 | # In FreeBSD ns_ routines are present in libc.so |
---|
428 | LIBRESOLV=;; |
---|
429 | * ) |
---|
430 | LIBRESOLV=-lresolv;; |
---|
431 | esac |
---|
432 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
433 | ret=1 |
---|
434 | echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null |
---|
435 | if [ "$?" = "0" ]; then |
---|
436 | ret=0 |
---|
437 | fi |
---|
438 | |
---|
439 | rm -f $TMPFILE |
---|
440 | return $ret |
---|
441 | } |
---|
442 | |
---|
443 | detect_resolv_ns_static() |
---|
444 | { |
---|
445 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
446 | ret=1 |
---|
447 | for i in $systemlibdirs; do |
---|
448 | if [ -f $i/libresolv.a ]; then |
---|
449 | echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null |
---|
450 | if [ "$?" = "0" ]; then |
---|
451 | ret=0 |
---|
452 | fi |
---|
453 | fi |
---|
454 | done |
---|
455 | |
---|
456 | rm -f $TMPFILE |
---|
457 | return $ret |
---|
458 | } |
---|
459 | |
---|
460 | detect_nameser_has_ns_types() |
---|
461 | { |
---|
462 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
463 | ret=1 |
---|
464 | # since we aren't actually linking with ns_* routines |
---|
465 | # we can just compile the test code |
---|
466 | echo "$RESOLV_NS_TYPES_TESTCODE" | $CC -o $TMPFILE -x c - >/dev/null 2>/dev/null |
---|
467 | if [ "$?" = "0" ]; then |
---|
468 | ret=0 |
---|
469 | fi |
---|
470 | |
---|
471 | rm -f $TMPFILE |
---|
472 | return $ret |
---|
473 | } |
---|
474 | |
---|
475 | if [ "$ssl" = "auto" ]; then |
---|
476 | detect_gnutls |
---|
477 | if [ "$ret" = "0" ]; then |
---|
478 | # Disable NSS for now as it's known to not work very well ATM. |
---|
479 | #detect_nss |
---|
480 | : |
---|
481 | fi |
---|
482 | elif [ "$ssl" = "gnutls" ]; then |
---|
483 | detect_gnutls |
---|
484 | elif [ "$ssl" = "nss" ]; then |
---|
485 | detect_nss |
---|
486 | elif [ "$ssl" = "sspi" ]; then |
---|
487 | echo |
---|
488 | elif [ "$ssl" = "openssl" ]; then |
---|
489 | echo |
---|
490 | echo 'No detection code exists for OpenSSL. Make sure that you have a complete' |
---|
491 | echo 'installation of OpenSSL (including devel/header files) before reporting' |
---|
492 | echo 'compilation problems.' |
---|
493 | echo |
---|
494 | echo 'Also, keep in mind that the OpenSSL is, according to some people, not' |
---|
495 | echo 'completely GPL-compatible. Using GnuTLS is recommended and better supported' |
---|
496 | echo 'by us. However, on many BSD machines, OpenSSL can be considered part of the' |
---|
497 | echo 'operating system, which makes it GPL-compatible.' |
---|
498 | echo |
---|
499 | echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2' |
---|
500 | echo ' http://www.gnome.org/~markmc/openssl-and-the-gpl.html' |
---|
501 | echo |
---|
502 | echo 'Please note that distributing a BitlBee binary which links to OpenSSL is' |
---|
503 | echo 'probably illegal. If you want to create and distribute a binary BitlBee' |
---|
504 | echo 'package, you really should use GnuTLS instead.' |
---|
505 | echo |
---|
506 | echo 'Also, the OpenSSL license requires us to say this:' |
---|
507 | echo ' * "This product includes software developed by the OpenSSL Project' |
---|
508 | echo ' * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"' |
---|
509 | |
---|
510 | echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings |
---|
511 | |
---|
512 | ret=1 |
---|
513 | else |
---|
514 | echo |
---|
515 | echo 'ERROR: Unknown SSL library specified.' |
---|
516 | exit 1 |
---|
517 | fi |
---|
518 | |
---|
519 | if [ "$ret" = "0" ]; then |
---|
520 | echo |
---|
521 | echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).' |
---|
522 | echo ' Please note that this script doesn'\''t have detection code for OpenSSL,' |
---|
523 | echo ' so if you want to use that, you have to select it by hand.' |
---|
524 | |
---|
525 | exit 1 |
---|
526 | fi; |
---|
527 | |
---|
528 | echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings |
---|
529 | |
---|
530 | if detect_nameser_has_ns_types; then |
---|
531 | echo '#define NAMESER_HAS_NS_TYPES' >> config.h |
---|
532 | fi |
---|
533 | if detect_resolv_dynamic || detect_resolv_static; then |
---|
534 | echo '#define HAVE_RESOLV_A' >> config.h |
---|
535 | if detect_resolv_ns_dynamic || detect_resolv_ns_static; then |
---|
536 | echo '#define HAVE_RESOLV_A_WITH_NS' >> config.h |
---|
537 | fi |
---|
538 | else |
---|
539 | echo 'Insufficient resolv routines. Jabber server must be set explicitly' |
---|
540 | fi |
---|
541 | |
---|
542 | |
---|
543 | STORAGES="xml" |
---|
544 | |
---|
545 | for i in $STORAGES; do |
---|
546 | STORAGE_OBJS="$STORAGE_OBJS storage_$i.o" |
---|
547 | done |
---|
548 | echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings |
---|
549 | |
---|
550 | if [ "$strip" = 0 ]; then |
---|
551 | echo "STRIP=\# skip strip" >> Makefile.settings; |
---|
552 | else |
---|
553 | if [ "$debug" = 1 ]; then |
---|
554 | echo |
---|
555 | echo 'Stripping binaries does not make sense when debugging. Stripping disabled.' |
---|
556 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
557 | strip=0; |
---|
558 | elif [ -n "$STRIP" ]; then |
---|
559 | echo "STRIP=$STRIP" >> Makefile.settings; |
---|
560 | elif type strip > /dev/null 2> /dev/null; then |
---|
561 | echo "STRIP=strip" >> Makefile.settings; |
---|
562 | else |
---|
563 | echo |
---|
564 | echo 'No strip utility found, cannot remove unnecessary parts from executable.' |
---|
565 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
566 | strip=0; |
---|
567 | fi; |
---|
568 | fi |
---|
569 | |
---|
570 | if [ -z "$systemdsystemunitdir" ]; then |
---|
571 | if $PKG_CONFIG --exists systemd; then |
---|
572 | systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd` |
---|
573 | fi |
---|
574 | fi |
---|
575 | if [ -n "$systemdsystemunitdir" ]; then |
---|
576 | if [ "$systemdsystemunitdir" != "no" ]; then |
---|
577 | echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings |
---|
578 | fi |
---|
579 | fi |
---|
580 | |
---|
581 | if [ "$gcov" = "1" ]; then |
---|
582 | echo "CFLAGS+=--coverage" >> Makefile.settings |
---|
583 | echo "EFLAGS+=--coverage" >> Makefile.settings |
---|
584 | fi |
---|
585 | |
---|
586 | if [ "$plugins" = 0 ]; then |
---|
587 | plugindir="" |
---|
588 | echo '#undef WITH_PLUGINS' >> config.h |
---|
589 | else |
---|
590 | echo '#define WITH_PLUGINS' >> config.h |
---|
591 | fi |
---|
592 | |
---|
593 | otrprefix="" |
---|
594 | for i in / /usr /usr/local; do |
---|
595 | if [ -f ${i}/lib/libotr.a ]; then |
---|
596 | otrprefix=${i} |
---|
597 | break |
---|
598 | fi |
---|
599 | done |
---|
600 | if [ "$otr" = "auto" ]; then |
---|
601 | if [ -n "$otrprefix" ]; then |
---|
602 | otr=1 |
---|
603 | else |
---|
604 | otr=0 |
---|
605 | fi |
---|
606 | fi |
---|
607 | if [ "$otr" = 1 ]; then |
---|
608 | # BI == built-in |
---|
609 | echo '#define OTR_BI' >> config.h |
---|
610 | echo "EFLAGS+=-L${otrprefix}/lib -lotr" >> Makefile.settings |
---|
611 | echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings |
---|
612 | echo 'OTR_BI=otr.o' >> Makefile.settings |
---|
613 | elif [ "$otr" = "plugin" ]; then |
---|
614 | echo '#define OTR_PI' >> config.h |
---|
615 | echo "OTRFLAGS=-L${otrprefix}/lib -lotr" >> Makefile.settings |
---|
616 | echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings |
---|
617 | echo 'OTR_PI=otr.so' >> Makefile.settings |
---|
618 | fi |
---|
619 | if [ "$otr" != 0 ] && ! pkg-config libotr --atleast-version=4.0; then |
---|
620 | echo |
---|
621 | echo 'WARNING: Your libotr seems to be old. BitlBee now needs at least libotr 4.0.' |
---|
622 | # Not hard-failing because the code above doesn't use pkg-config, so who knows |
---|
623 | # what's true at this point... |
---|
624 | fi |
---|
625 | |
---|
626 | if [ "$skype" = "1" -o "$skype" = "plugin" ]; then |
---|
627 | if [ "$arch" = "Darwin" ]; then |
---|
628 | echo "SKYPEFLAGS=-dynamiclib -undefined dynamic_lookup" >> Makefile.settings |
---|
629 | else |
---|
630 | echo "SKYPEFLAGS=-fPIC -shared" >> Makefile.settings |
---|
631 | fi |
---|
632 | echo 'SKYPE_PI=skype.so' >> Makefile.settings |
---|
633 | protocols_mods="$protocol_mods skype(plugin)" |
---|
634 | fi |
---|
635 | |
---|
636 | if [ ! -e doc/user-guide/help.txt ] && ! type xmlto > /dev/null 2> /dev/null; then |
---|
637 | echo |
---|
638 | echo 'WARNING: Building from an unreleased source tree without prebuilt helpfile.' |
---|
639 | echo 'Install xmlto if you want online help to work.' |
---|
640 | fi |
---|
641 | |
---|
642 | REAL_BITLBEE_VERSION=`grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/'` |
---|
643 | echo |
---|
644 | if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then |
---|
645 | nick=`bzr nick` |
---|
646 | if [ -n "$nick" -a "$nick" != "bitlbee" ]; then |
---|
647 | nick="-$nick" |
---|
648 | else |
---|
649 | nick="" |
---|
650 | fi |
---|
651 | rev=`bzr revno` |
---|
652 | echo 'Using bzr revision #'$rev' as version number' |
---|
653 | BITLBEE_VERSION=$REAL_BITLBEE_VERSION-bzr$nick-$rev |
---|
654 | fi |
---|
655 | |
---|
656 | if [ -n "$BITLBEE_VERSION" ]; then |
---|
657 | echo 'Spoofing version number: '$BITLBEE_VERSION |
---|
658 | echo '#undef BITLBEE_VERSION' >> config.h |
---|
659 | echo '#define BITLBEE_VERSION "'$BITLBEE_VERSION'"' >> config.h |
---|
660 | echo |
---|
661 | else |
---|
662 | # for pkg-config |
---|
663 | BITLBEE_VERSION=$REAL_BITLBEE_VERSION |
---|
664 | fi |
---|
665 | |
---|
666 | if ! make helloworld > /dev/null 2>&1; then |
---|
667 | echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles." |
---|
668 | echo "BitlBee needs GNU make to build properly. On most systems GNU make is available" |
---|
669 | echo "under the name 'gmake'." |
---|
670 | echo |
---|
671 | if gmake helloworld > /dev/null 2>&1; then |
---|
672 | echo "gmake seems to be available on your machine, great." |
---|
673 | echo |
---|
674 | else |
---|
675 | echo "gmake is not installed (or not working). Please try to install it." |
---|
676 | echo |
---|
677 | fi |
---|
678 | fi |
---|
679 | |
---|
680 | cat <<EOF >bitlbee.pc |
---|
681 | prefix=$prefix |
---|
682 | includedir=$includedir |
---|
683 | plugindir=$plugindir |
---|
684 | |
---|
685 | Name: bitlbee |
---|
686 | Description: IRC to IM gateway |
---|
687 | Requires: glib-2.0 |
---|
688 | Version: $BITLBEE_VERSION |
---|
689 | Libs: |
---|
690 | Cflags: -I\${includedir} |
---|
691 | |
---|
692 | EOF |
---|
693 | |
---|
694 | protocols='' |
---|
695 | protoobjs='' |
---|
696 | |
---|
697 | if [ "$purple" = 0 ]; then |
---|
698 | echo '#undef WITH_PURPLE' >> config.h |
---|
699 | else |
---|
700 | if ! $PKG_CONFIG purple; then |
---|
701 | echo |
---|
702 | echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)' |
---|
703 | exit 1 |
---|
704 | fi |
---|
705 | echo '#define WITH_PURPLE' >> config.h |
---|
706 | cat<<EOF >>Makefile.settings |
---|
707 | EFLAGS += $($PKG_CONFIG purple --libs) |
---|
708 | PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags) |
---|
709 | EOF |
---|
710 | protocols=$protocols'purple ' |
---|
711 | protoobjs=$protoobjs'purple_mod.o ' |
---|
712 | |
---|
713 | # only disable these if the user didn't enable them explicitly |
---|
714 | [ "$msn" = "default-on" ] && msn=0 |
---|
715 | [ "$jabber" = "default-on" ] && jabber=0 |
---|
716 | [ "$oscar" = "default-on" ] && oscar=0 |
---|
717 | [ "$yahoo" = "default-on" ] && yahoo=0 |
---|
718 | |
---|
719 | echo '#undef PACKAGE' >> config.h |
---|
720 | echo '#define PACKAGE "BitlBee-LIBPURPLE"' >> config.h |
---|
721 | |
---|
722 | if [ "$events" = "libevent" ]; then |
---|
723 | echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling' |
---|
724 | echo 'outside libpurple, talking to GLib directly. At least for now the combination' |
---|
725 | echo 'libpurple + libevent is *not* recommended!' |
---|
726 | echo |
---|
727 | fi |
---|
728 | fi |
---|
729 | |
---|
730 | case "$CC" in |
---|
731 | *gcc* ) |
---|
732 | echo CFLAGS+=-MMD -MF .depend/\$@.d >> Makefile.settings |
---|
733 | for i in . lib tests protocols protocols/*/; do |
---|
734 | mkdir -p $i/.depend |
---|
735 | done |
---|
736 | esac |
---|
737 | |
---|
738 | if [ "$msn" = 0 ]; then |
---|
739 | echo '#undef WITH_MSN' >> config.h |
---|
740 | else |
---|
741 | echo '#define WITH_MSN' >> config.h |
---|
742 | protocols=$protocols'msn ' |
---|
743 | protoobjs=$protoobjs'msn_mod.o ' |
---|
744 | fi |
---|
745 | |
---|
746 | if [ "$jabber" = 0 ]; then |
---|
747 | echo '#undef WITH_JABBER' >> config.h |
---|
748 | else |
---|
749 | echo '#define WITH_JABBER' >> config.h |
---|
750 | protocols=$protocols'jabber ' |
---|
751 | protoobjs=$protoobjs'jabber_mod.o ' |
---|
752 | fi |
---|
753 | |
---|
754 | if [ "$oscar" = 0 ]; then |
---|
755 | echo '#undef WITH_OSCAR' >> config.h |
---|
756 | else |
---|
757 | echo '#define WITH_OSCAR' >> config.h |
---|
758 | protocols=$protocols'oscar ' |
---|
759 | protoobjs=$protoobjs'oscar_mod.o ' |
---|
760 | fi |
---|
761 | |
---|
762 | if [ "$yahoo" = 0 ]; then |
---|
763 | echo '#undef WITH_YAHOO' >> config.h |
---|
764 | else |
---|
765 | echo '#define WITH_YAHOO' >> config.h |
---|
766 | protocols=$protocols'yahoo ' |
---|
767 | protoobjs=$protoobjs'yahoo_mod.o ' |
---|
768 | fi |
---|
769 | |
---|
770 | if [ "$twitter" = 0 ]; then |
---|
771 | echo '#undef WITH_TWITTER' >> config.h |
---|
772 | else |
---|
773 | echo '#define WITH_TWITTER' >> config.h |
---|
774 | protocols=$protocols'twitter ' |
---|
775 | protoobjs=$protoobjs'twitter_mod.o ' |
---|
776 | fi |
---|
777 | |
---|
778 | if [ "$protocols" = "PROTOCOLS = " ]; then |
---|
779 | echo "Warning: You haven't selected any communication protocol to compile!" |
---|
780 | echo " BitlBee will run, but you will be unable to connect to IM servers!" |
---|
781 | fi |
---|
782 | |
---|
783 | echo "PROTOCOLS = $protocols" >> Makefile.settings |
---|
784 | echo "PROTOOBJS = $protoobjs" >> Makefile.settings |
---|
785 | |
---|
786 | echo Architecture: $arch |
---|
787 | case "$arch" in |
---|
788 | Linux ) |
---|
789 | ;; |
---|
790 | GNU/* ) |
---|
791 | ;; |
---|
792 | *BSD ) |
---|
793 | ;; |
---|
794 | Darwin ) |
---|
795 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
796 | ;; |
---|
797 | IRIX ) |
---|
798 | ;; |
---|
799 | SunOS ) |
---|
800 | echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings |
---|
801 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
802 | echo '#define NO_FD_PASSING' >> config.h |
---|
803 | ;; |
---|
804 | AIX ) |
---|
805 | echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings |
---|
806 | ;; |
---|
807 | CYGWIN* ) |
---|
808 | echo 'Cygwin is not officially supported.' |
---|
809 | ;; |
---|
810 | Windows ) |
---|
811 | ;; |
---|
812 | * ) |
---|
813 | echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' |
---|
814 | echo 'Please report any problems at http://bugs.bitlbee.org/.' |
---|
815 | ;; |
---|
816 | esac |
---|
817 | |
---|
818 | if [ -n "$target" ]; then |
---|
819 | echo "Cross-compiling for: $target" |
---|
820 | fi |
---|
821 | |
---|
822 | echo |
---|
823 | echo 'Configuration done:' |
---|
824 | |
---|
825 | if [ "$debug" = "1" ]; then |
---|
826 | echo ' Debugging enabled.' |
---|
827 | else |
---|
828 | echo ' Debugging disabled.' |
---|
829 | fi |
---|
830 | |
---|
831 | if [ "$pie" = "1" ]; then |
---|
832 | echo ' Building PIE executable' |
---|
833 | else |
---|
834 | echo ' Building non-PIE executable' |
---|
835 | fi |
---|
836 | |
---|
837 | if [ "$strip" = "1" ]; then |
---|
838 | echo ' Binary stripping enabled.' |
---|
839 | else |
---|
840 | echo ' Binary stripping disabled.' |
---|
841 | fi |
---|
842 | |
---|
843 | if [ "$otr" = "1" ]; then |
---|
844 | echo ' Off-the-Record (OTR) Messaging enabled.' |
---|
845 | elif [ "$otr" = "plugin" ]; then |
---|
846 | echo ' Off-the-Record (OTR) Messaging enabled (as a plugin).' |
---|
847 | else |
---|
848 | echo ' Off-the-Record (OTR) Messaging disabled.' |
---|
849 | fi |
---|
850 | |
---|
851 | if [ -n "$systemdsystemunitdir" ]; then |
---|
852 | echo ' systemd enabled.' |
---|
853 | else |
---|
854 | echo ' systemd disabled.' |
---|
855 | fi |
---|
856 | |
---|
857 | echo ' Using event handler: '$events |
---|
858 | echo ' Using SSL library: '$ssl |
---|
859 | #echo ' Building with these storage backends: '$STORAGES |
---|
860 | |
---|
861 | if [ -n "$protocols" ]; then |
---|
862 | echo ' Building with these protocols:' $protocols$protocols_mods |
---|
863 | case "$protocols" in |
---|
864 | *purple*) |
---|
865 | echo " Note that BitlBee-libpurple is supported on a best-effort basis. It's" |
---|
866 | echo " not *fully* compatible with normal BitlBee. Don't use it unless you" |
---|
867 | echo " absolutely need it (i.e. support for a certain protocol or feature)." |
---|
868 | esac |
---|
869 | else |
---|
870 | echo ' Building without IM-protocol support. We wish you a lot of fun...' |
---|
871 | fi |
---|