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