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