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