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