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='' |
---|
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 | |
---|
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 | etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'` |
---|
103 | mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'` |
---|
104 | datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'` |
---|
105 | config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'` |
---|
106 | plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'` |
---|
107 | includedir=`eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g'` |
---|
108 | libevent=`eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g'` |
---|
109 | |
---|
110 | pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'` |
---|
111 | ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'` |
---|
112 | pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'` |
---|
113 | |
---|
114 | protocols_mods="" |
---|
115 | |
---|
116 | cat<<EOF>Makefile.settings |
---|
117 | ## BitlBee settings, generated by configure |
---|
118 | PREFIX=$prefix |
---|
119 | BINDIR=$bindir |
---|
120 | ETCDIR=$etcdir |
---|
121 | MANDIR=$mandir |
---|
122 | DATADIR=$datadir |
---|
123 | PLUGINDIR=$plugindir |
---|
124 | CONFIG=$config |
---|
125 | INCLUDEDIR=$includedir |
---|
126 | PCDIR=$pcdir |
---|
127 | |
---|
128 | TARGET=$target |
---|
129 | ARCH=$arch |
---|
130 | CPU=$cpu |
---|
131 | |
---|
132 | DESTDIR= |
---|
133 | LFLAGS= |
---|
134 | EFLAGS= |
---|
135 | EOF |
---|
136 | |
---|
137 | srcdir=$(cd $(dirname $0);pwd) |
---|
138 | currdir=$(pwd) |
---|
139 | if [ "$srcdir" != "$currdir" ]; then |
---|
140 | echo |
---|
141 | echo "configure script run from a different directory. Will create some symlinks..." |
---|
142 | if [ ! -e Makefile -o -L Makefile ]; then |
---|
143 | COPYDIRS="doc lib protocols tests utils" |
---|
144 | mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d) |
---|
145 | find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null |
---|
146 | dst="$PWD" |
---|
147 | cd "$srcdir" |
---|
148 | for i in $(find . -name Makefile -type f); do |
---|
149 | ln -s "$PWD${i#.}" "$dst/$i"; |
---|
150 | done |
---|
151 | cd "$dst" |
---|
152 | rm -rf .bzr |
---|
153 | fi |
---|
154 | |
---|
155 | echo "SRCDIR=$srcdir/" >> Makefile.settings |
---|
156 | CFLAGS="$CFLAGS -I${dst}" |
---|
157 | else |
---|
158 | srcdir=$PWD |
---|
159 | fi |
---|
160 | |
---|
161 | cat<<EOF>config.h |
---|
162 | /* BitlBee settings, generated by configure |
---|
163 | |
---|
164 | Do *NOT* use any of these defines in your code without thinking twice, most |
---|
165 | of them can/will be overridden at run-time */ |
---|
166 | |
---|
167 | #define CONFIG "$config" |
---|
168 | #define ETCDIR "$etcdir" |
---|
169 | #define VARDIR "$datadir" |
---|
170 | #define PLUGINDIR "$plugindir" |
---|
171 | #define PIDFILE "$pidfile" |
---|
172 | #define IPCSOCKET "$ipcsocket" |
---|
173 | #define ARCH "$arch" |
---|
174 | #define CPU "$cpu" |
---|
175 | EOF |
---|
176 | |
---|
177 | |
---|
178 | |
---|
179 | if [ -n "$target" ]; then |
---|
180 | PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig |
---|
181 | export PKG_CONFIG_LIBDIR |
---|
182 | PATH=/usr/$target/bin:$PATH |
---|
183 | CC=$target-cc |
---|
184 | LD=$target-ld |
---|
185 | systemlibdirs="/usr/$target/lib" |
---|
186 | fi |
---|
187 | |
---|
188 | |
---|
189 | if [ "$debug" = "1" ]; then |
---|
190 | [ -z "$CFLAGS" ] && CFLAGS=-g |
---|
191 | echo 'DEBUG=1' >> Makefile.settings |
---|
192 | CFLAGS="$CFLAGS -DDEBUG" |
---|
193 | else |
---|
194 | [ -z "$CFLAGS" ] && CFLAGS="-O2 -fno-strict-aliasing" |
---|
195 | fi |
---|
196 | |
---|
197 | echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings |
---|
198 | echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings |
---|
199 | |
---|
200 | echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings |
---|
201 | |
---|
202 | if [ -n "$CC" ]; then |
---|
203 | CC=$CC |
---|
204 | elif type gcc > /dev/null 2> /dev/null; then |
---|
205 | CC=gcc |
---|
206 | elif type cc > /dev/null 2> /dev/null; then |
---|
207 | CC=cc |
---|
208 | else |
---|
209 | echo 'Cannot find a C compiler, aborting.' |
---|
210 | exit 1; |
---|
211 | fi |
---|
212 | |
---|
213 | echo "CC=$CC" >> Makefile.settings; |
---|
214 | if echo $CC | grep -qw gcc; then |
---|
215 | # Apparently -Wall is gcc-specific? |
---|
216 | echo CFLAGS+=-Wall >> Makefile.settings |
---|
217 | fi |
---|
218 | |
---|
219 | if [ -z "$LD" ]; then |
---|
220 | if type ld > /dev/null 2> /dev/null; then |
---|
221 | LD=ld |
---|
222 | else |
---|
223 | echo 'Cannot find ld, aborting.' |
---|
224 | exit 1; |
---|
225 | fi |
---|
226 | fi |
---|
227 | |
---|
228 | echo "LD=$LD" >> Makefile.settings |
---|
229 | |
---|
230 | if [ -z "$PKG_CONFIG" ]; then |
---|
231 | PKG_CONFIG=pkg-config |
---|
232 | fi |
---|
233 | |
---|
234 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then |
---|
235 | if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then |
---|
236 | cat<<EOF>>Makefile.settings |
---|
237 | EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0` |
---|
238 | CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0` |
---|
239 | EOF |
---|
240 | else |
---|
241 | echo |
---|
242 | echo 'Found glib2 '`$PKG_CONFIG glib-2.0 --modversion`', but version '$GLIB_MIN_VERSION' or newer is required.' |
---|
243 | exit 1 |
---|
244 | fi |
---|
245 | else |
---|
246 | echo |
---|
247 | echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)' |
---|
248 | exit 1 |
---|
249 | fi |
---|
250 | |
---|
251 | if [ "$events" = "libevent" ]; then |
---|
252 | if ! [ -f "${libevent}include/event.h" ]; then |
---|
253 | echo |
---|
254 | echo 'Warning: Could not find event.h, you might have to install it and/or specify' |
---|
255 | echo 'its location using the --libevent= argument. (Example: If event.h is in' |
---|
256 | echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)' |
---|
257 | fi |
---|
258 | |
---|
259 | echo '#define EVENTS_LIBEVENT' >> config.h |
---|
260 | cat <<EOF>>Makefile.settings |
---|
261 | EFLAGS+=-levent -L${libevent}lib |
---|
262 | CFLAGS+=-I${libevent}include |
---|
263 | EOF |
---|
264 | elif [ "$events" = "glib" ]; then |
---|
265 | ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...): |
---|
266 | echo '#define EVENTS_GLIB' >> config.h |
---|
267 | else |
---|
268 | echo |
---|
269 | echo 'ERROR: Unknown event handler specified.' |
---|
270 | exit 1 |
---|
271 | fi |
---|
272 | echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings |
---|
273 | |
---|
274 | detect_gnutls() |
---|
275 | { |
---|
276 | if $PKG_CONFIG --exists gnutls; then |
---|
277 | cat <<EOF>>Makefile.settings |
---|
278 | EFLAGS+=`$PKG_CONFIG --libs gnutls` `libgcrypt-config --libs` |
---|
279 | CFLAGS+=`$PKG_CONFIG --cflags gnutls` `libgcrypt-config --cflags` |
---|
280 | EOF |
---|
281 | ssl=gnutls |
---|
282 | ret=1 |
---|
283 | elif libgnutls-config --version > /dev/null 2> /dev/null; then |
---|
284 | cat <<EOF>>Makefile.settings |
---|
285 | EFLAGS+=`libgnutls-config --libs` `libgcrypt-config --libs` |
---|
286 | CFLAGS+=`libgnutls-config --cflags` `libgcrypt-config --cflags` |
---|
287 | EOF |
---|
288 | |
---|
289 | ssl=gnutls |
---|
290 | ret=1; |
---|
291 | else |
---|
292 | ret=0; |
---|
293 | fi; |
---|
294 | } |
---|
295 | |
---|
296 | detect_nss() |
---|
297 | { |
---|
298 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then |
---|
299 | cat<<EOF>>Makefile.settings |
---|
300 | EFLAGS+=`$PKG_CONFIG --libs nss` |
---|
301 | CFLAGS+=`$PKG_CONFIG --cflags nss` |
---|
302 | EOF |
---|
303 | |
---|
304 | ssl=nss |
---|
305 | ret=1; |
---|
306 | else |
---|
307 | ret=0; |
---|
308 | fi; |
---|
309 | } |
---|
310 | |
---|
311 | detect_ldap() |
---|
312 | { |
---|
313 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
314 | if $CC -o $TMPFILE -shared -lldap 2>/dev/null >/dev/null; then |
---|
315 | cat<<EOF>>Makefile.settings |
---|
316 | EFLAGS+=-lldap |
---|
317 | CFLAGS+= |
---|
318 | EOF |
---|
319 | ldap=1 |
---|
320 | rm -f $TMPFILE |
---|
321 | ret=1 |
---|
322 | else |
---|
323 | ldap=0 |
---|
324 | ret=0 |
---|
325 | fi |
---|
326 | } |
---|
327 | |
---|
328 | RESOLV_TESTCODE=' |
---|
329 | #include <arpa/nameser.h> |
---|
330 | #include <resolv.h> |
---|
331 | |
---|
332 | int main() |
---|
333 | { |
---|
334 | ns_initparse( NULL, 0, NULL ); |
---|
335 | ns_parserr( NULL, ns_s_an, 0, NULL ); |
---|
336 | } |
---|
337 | ' |
---|
338 | |
---|
339 | detect_resolv_dynamic() |
---|
340 | { |
---|
341 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
342 | ret=1 |
---|
343 | echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -lresolv >/dev/null 2>/dev/null |
---|
344 | if [ "$?" = "0" ]; then |
---|
345 | echo 'EFLAGS+=-lresolv' >> 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 | if [ "$ldap" = "auto" ]; then |
---|
455 | detect_ldap |
---|
456 | fi |
---|
457 | |
---|
458 | if [ "$ldap" = 0 ]; then |
---|
459 | echo "#undef WITH_LDAP" >> config.h |
---|
460 | elif [ "$ldap" = 1 ]; then |
---|
461 | echo |
---|
462 | echo 'LDAP support is a work in progress and does NOT work AT ALL right now.' |
---|
463 | echo |
---|
464 | exit 1 |
---|
465 | |
---|
466 | echo "#define WITH_LDAP 1" >> config.h |
---|
467 | STORAGES="$STORAGES ldap" |
---|
468 | fi |
---|
469 | |
---|
470 | for i in $STORAGES; do |
---|
471 | STORAGE_OBJS="$STORAGE_OBJS storage_$i.o" |
---|
472 | done |
---|
473 | echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings |
---|
474 | |
---|
475 | if [ "$strip" = 0 ]; then |
---|
476 | echo "STRIP=\# skip strip" >> Makefile.settings; |
---|
477 | else |
---|
478 | if [ "$debug" = 1 ]; then |
---|
479 | echo |
---|
480 | echo 'Stripping binaries does not make sense when debugging. Stripping disabled.' |
---|
481 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
482 | strip=0; |
---|
483 | elif [ -n "$STRIP" ]; then |
---|
484 | echo "STRIP=$STRIP" >> Makefile.settings; |
---|
485 | elif type strip > /dev/null 2> /dev/null; then |
---|
486 | echo "STRIP=strip" >> Makefile.settings; |
---|
487 | else |
---|
488 | echo |
---|
489 | echo 'No strip utility found, cannot remove unnecessary parts from executable.' |
---|
490 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
491 | strip=0; |
---|
492 | fi; |
---|
493 | fi |
---|
494 | |
---|
495 | if [ -z "$systemdsystemunitdir" ]; then |
---|
496 | if $PKG_CONFIG --exists systemd; then |
---|
497 | systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd` |
---|
498 | fi |
---|
499 | fi |
---|
500 | if [ -n "$systemdsystemunitdir" ]; then |
---|
501 | if [ "$systemdsystemunitdir" != "no" ]; then |
---|
502 | echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings |
---|
503 | fi |
---|
504 | fi |
---|
505 | |
---|
506 | if [ "$gcov" = "1" ]; then |
---|
507 | echo "CFLAGS+=--coverage" >> Makefile.settings |
---|
508 | echo "EFLAGS+=--coverage" >> Makefile.settings |
---|
509 | fi |
---|
510 | |
---|
511 | if [ "$plugins" = 0 ]; then |
---|
512 | echo '#undef WITH_PLUGINS' >> config.h |
---|
513 | else |
---|
514 | echo '#define WITH_PLUGINS' >> config.h |
---|
515 | fi |
---|
516 | |
---|
517 | otrprefix="" |
---|
518 | for i in / /usr /usr/local; do |
---|
519 | if [ -f ${i}/lib/libotr.a ]; then |
---|
520 | otrprefix=${i} |
---|
521 | break |
---|
522 | fi |
---|
523 | done |
---|
524 | if [ "$otr" = "auto" ]; then |
---|
525 | if [ -n "$otrprefix" ]; then |
---|
526 | otr=1 |
---|
527 | else |
---|
528 | otr=0 |
---|
529 | fi |
---|
530 | fi |
---|
531 | if [ "$otr" = 1 ]; then |
---|
532 | # BI == built-in |
---|
533 | echo '#define OTR_BI' >> config.h |
---|
534 | echo "EFLAGS+=-L${otrprefix}/lib -lotr" >> Makefile.settings |
---|
535 | echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings |
---|
536 | echo 'OTR_BI=otr.o' >> Makefile.settings |
---|
537 | elif [ "$otr" = "plugin" ]; then |
---|
538 | echo '#define OTR_PI' >> config.h |
---|
539 | echo "OTRFLAGS=-L${otrprefix}/lib -lotr" >> Makefile.settings |
---|
540 | echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings |
---|
541 | echo 'OTR_PI=otr.so' >> Makefile.settings |
---|
542 | fi |
---|
543 | |
---|
544 | if [ "$skype" = "1" -o "$skype" = "plugin" ]; then |
---|
545 | echo 'SKYPE_PI=skype.so' >> Makefile.settings |
---|
546 | protocols_mods="$protocol_mods skype(plugin)" |
---|
547 | fi |
---|
548 | |
---|
549 | if [ ! -e doc/user-guide/help.txt ] && ! type xmlto > /dev/null 2> /dev/null; then |
---|
550 | echo |
---|
551 | echo 'WARNING: Building from an unreleased source tree without prebuilt helpfile.' |
---|
552 | echo 'Install xmlto if you want online help to work.' |
---|
553 | fi |
---|
554 | |
---|
555 | echo |
---|
556 | if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then |
---|
557 | nick=`bzr nick` |
---|
558 | if [ -n "$nick" -a "$nick" != "bitlbee" ]; then |
---|
559 | nick="-$nick" |
---|
560 | else |
---|
561 | nick="" |
---|
562 | fi |
---|
563 | rev=`bzr revno` |
---|
564 | echo 'Using bzr revision #'$rev' as version number' |
---|
565 | BITLBEE_VERSION=\"bzr$nick-$rev\" |
---|
566 | fi |
---|
567 | |
---|
568 | if [ -n "$BITLBEE_VERSION" ]; then |
---|
569 | echo 'Spoofing version number: '$BITLBEE_VERSION |
---|
570 | echo '#undef BITLBEE_VERSION' >> config.h |
---|
571 | echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h |
---|
572 | echo |
---|
573 | fi |
---|
574 | |
---|
575 | if ! make helloworld > /dev/null 2>&1; then |
---|
576 | echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles." |
---|
577 | echo "BitlBee needs GNU make to build properly. On most systems GNU make is available" |
---|
578 | echo "under the name 'gmake'." |
---|
579 | echo |
---|
580 | if gmake helloworld > /dev/null 2>&1; then |
---|
581 | echo "gmake seems to be available on your machine, great." |
---|
582 | echo |
---|
583 | else |
---|
584 | echo "gmake is not installed (or not working). Please try to install it." |
---|
585 | echo |
---|
586 | fi |
---|
587 | fi |
---|
588 | |
---|
589 | cat <<EOF>bitlbee.pc |
---|
590 | prefix=$prefix |
---|
591 | includedir=$includedir |
---|
592 | |
---|
593 | Name: bitlbee |
---|
594 | Description: IRC to IM gateway |
---|
595 | Requires: glib-2.0 |
---|
596 | Version: $BITLBEE_VERSION |
---|
597 | Libs: |
---|
598 | Cflags: -I\${includedir} |
---|
599 | |
---|
600 | EOF |
---|
601 | |
---|
602 | protocols='' |
---|
603 | protoobjs='' |
---|
604 | |
---|
605 | if [ "$purple" = 0 ]; then |
---|
606 | echo '#undef WITH_PURPLE' >> config.h |
---|
607 | else |
---|
608 | if ! $PKG_CONFIG purple; then |
---|
609 | echo |
---|
610 | echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)' |
---|
611 | exit 1 |
---|
612 | fi |
---|
613 | echo '#define WITH_PURPLE' >> config.h |
---|
614 | cat<<EOF>>Makefile.settings |
---|
615 | EFLAGS += $($PKG_CONFIG purple --libs) |
---|
616 | PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags) |
---|
617 | EOF |
---|
618 | protocols=$protocols'purple ' |
---|
619 | protoobjs=$protoobjs'purple_mod.o ' |
---|
620 | |
---|
621 | # Having both libpurple and native IM modules in one binary may |
---|
622 | # do strange things. Let's not do that. |
---|
623 | msn=0 |
---|
624 | jabber=0 |
---|
625 | oscar=0 |
---|
626 | yahoo=0 |
---|
627 | |
---|
628 | if [ "$events" = "libevent" ]; then |
---|
629 | echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling' |
---|
630 | echo 'outside libpurple, talking to GLib directly. At least for now the combination' |
---|
631 | echo 'libpurple + libevent is *not* recommended!' |
---|
632 | echo |
---|
633 | fi |
---|
634 | fi |
---|
635 | |
---|
636 | case "$CC" in |
---|
637 | *gcc* ) |
---|
638 | echo CFLAGS+=-MD -MF .depend/\$@.d >> Makefile.settings |
---|
639 | for i in . lib protocols protocols/*/; do |
---|
640 | mkdir -p $i/.depend |
---|
641 | done |
---|
642 | esac |
---|
643 | |
---|
644 | if [ "$msn" = 0 ]; then |
---|
645 | echo '#undef WITH_MSN' >> config.h |
---|
646 | else |
---|
647 | echo '#define WITH_MSN' >> config.h |
---|
648 | protocols=$protocols'msn ' |
---|
649 | protoobjs=$protoobjs'msn_mod.o ' |
---|
650 | fi |
---|
651 | |
---|
652 | if [ "$jabber" = 0 ]; then |
---|
653 | echo '#undef WITH_JABBER' >> config.h |
---|
654 | else |
---|
655 | echo '#define WITH_JABBER' >> config.h |
---|
656 | protocols=$protocols'jabber ' |
---|
657 | protoobjs=$protoobjs'jabber_mod.o ' |
---|
658 | fi |
---|
659 | |
---|
660 | if [ "$oscar" = 0 ]; then |
---|
661 | echo '#undef WITH_OSCAR' >> config.h |
---|
662 | else |
---|
663 | echo '#define WITH_OSCAR' >> config.h |
---|
664 | protocols=$protocols'oscar ' |
---|
665 | protoobjs=$protoobjs'oscar_mod.o ' |
---|
666 | fi |
---|
667 | |
---|
668 | if [ "$yahoo" = 0 ]; then |
---|
669 | echo '#undef WITH_YAHOO' >> config.h |
---|
670 | else |
---|
671 | echo '#define WITH_YAHOO' >> config.h |
---|
672 | protocols=$protocols'yahoo ' |
---|
673 | protoobjs=$protoobjs'yahoo_mod.o ' |
---|
674 | fi |
---|
675 | |
---|
676 | if [ "$twitter" = 0 ]; then |
---|
677 | echo '#undef WITH_TWITTER' >> config.h |
---|
678 | else |
---|
679 | echo '#define WITH_TWITTER' >> config.h |
---|
680 | protocols=$protocols'twitter ' |
---|
681 | protoobjs=$protoobjs'twitter_mod.o ' |
---|
682 | fi |
---|
683 | |
---|
684 | if [ "$protocols" = "PROTOCOLS = " ]; then |
---|
685 | echo "Warning: You haven't selected any communication protocol to compile!" |
---|
686 | echo " BitlBee will run, but you will be unable to connect to IM servers!" |
---|
687 | fi |
---|
688 | |
---|
689 | echo "PROTOCOLS = $protocols" >> Makefile.settings |
---|
690 | echo "PROTOOBJS = $protoobjs" >> Makefile.settings |
---|
691 | |
---|
692 | echo Architecture: $arch |
---|
693 | case "$arch" in |
---|
694 | Linux ) |
---|
695 | ;; |
---|
696 | GNU/* ) |
---|
697 | ;; |
---|
698 | *BSD ) |
---|
699 | ;; |
---|
700 | Darwin ) |
---|
701 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
702 | ;; |
---|
703 | IRIX ) |
---|
704 | ;; |
---|
705 | SunOS ) |
---|
706 | echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings |
---|
707 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
708 | echo '#define NO_FD_PASSING' >> config.h |
---|
709 | ;; |
---|
710 | AIX ) |
---|
711 | echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings |
---|
712 | ;; |
---|
713 | CYGWIN* ) |
---|
714 | echo 'Cygwin is not officially supported.' |
---|
715 | ;; |
---|
716 | Windows ) |
---|
717 | ;; |
---|
718 | * ) |
---|
719 | echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' |
---|
720 | echo 'Please report any problems at http://bugs.bitlbee.org/.' |
---|
721 | ;; |
---|
722 | esac |
---|
723 | |
---|
724 | if [ -n "$target" ]; then |
---|
725 | echo "Cross-compiling for: $target" |
---|
726 | fi |
---|
727 | |
---|
728 | echo |
---|
729 | echo 'Configuration done:' |
---|
730 | |
---|
731 | if [ "$debug" = "1" ]; then |
---|
732 | echo ' Debugging enabled.' |
---|
733 | else |
---|
734 | echo ' Debugging disabled.' |
---|
735 | fi |
---|
736 | |
---|
737 | if [ "$strip" = "1" ]; then |
---|
738 | echo ' Binary stripping enabled.' |
---|
739 | else |
---|
740 | echo ' Binary stripping disabled.' |
---|
741 | fi |
---|
742 | |
---|
743 | if [ "$otr" = "1" ]; then |
---|
744 | echo ' Off-the-Record (OTR) Messaging enabled.' |
---|
745 | elif [ "$otr" = "plugin" ]; then |
---|
746 | echo ' Off-the-Record (OTR) Messaging enabled (as a plugin).' |
---|
747 | else |
---|
748 | echo ' Off-the-Record (OTR) Messaging disabled.' |
---|
749 | fi |
---|
750 | |
---|
751 | if [ -n "$systemdsystemunitdir" ]; then |
---|
752 | echo ' systemd enabled.' |
---|
753 | else |
---|
754 | echo ' systemd disabled.' |
---|
755 | fi |
---|
756 | |
---|
757 | echo ' Using event handler: '$events |
---|
758 | echo ' Using SSL library: '$ssl |
---|
759 | #echo ' Building with these storage backends: '$STORAGES |
---|
760 | |
---|
761 | if [ -n "$protocols" ]; then |
---|
762 | echo ' Building with these protocols:' $protocols$protocols_mods |
---|
763 | case "$protocols" in |
---|
764 | *purple*) |
---|
765 | echo " Note that BitlBee-libpurple is supported on a best-effort basis. It's" |
---|
766 | echo " not *fully* compatible with normal BitlBee. Don't use it unless you" |
---|
767 | echo " absolutely need it (i.e. support for a certain protocol or feature)." |
---|
768 | esac |
---|
769 | else |
---|
770 | echo ' Building without IM-protocol support. We wish you a lot of fun...' |
---|
771 | fi |
---|