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