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