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