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 | pidfile='/var/run/bitlbee.pid' |
---|
17 | ipcsocket='/var/run/bitlbee' |
---|
18 | plugindir='$prefix/lib/bitlbee' |
---|
19 | pcdir='$prefix/lib/pkgconfig' |
---|
20 | includedir='$prefix/include/bitlbee' |
---|
21 | |
---|
22 | msn=1 |
---|
23 | jabber=1 |
---|
24 | oscar=1 |
---|
25 | yahoo=1 |
---|
26 | |
---|
27 | debug=0 |
---|
28 | strip=1 |
---|
29 | ipv6=1 |
---|
30 | ldap=auto |
---|
31 | ssl=auto |
---|
32 | |
---|
33 | arch=`uname -s` |
---|
34 | cpu=`uname -m` |
---|
35 | |
---|
36 | echo BitlBee configure |
---|
37 | |
---|
38 | while [ -n "$1" ]; do |
---|
39 | e="`expr "X$1" : 'X--\(.*=.*\)'`" |
---|
40 | if [ -z "$e" ]; then |
---|
41 | cat<<EOF |
---|
42 | |
---|
43 | Usage: $0 [OPTIONS] |
---|
44 | |
---|
45 | Option Description Default |
---|
46 | |
---|
47 | --prefix=... Directories to put files in $prefix |
---|
48 | --bindir=... $bindir |
---|
49 | --etcdir=... $etcdir |
---|
50 | --mandir=... $mandir |
---|
51 | --datadir=... $datadir |
---|
52 | --plugindir=... $plugindir |
---|
53 | --pidfile=... $pidfile |
---|
54 | --config=... $config |
---|
55 | --ipcsocket=... $ipcsocket |
---|
56 | |
---|
57 | --msn=0/1 Disable/enable MSN part $msn |
---|
58 | --jabber=0/1 Disable/enable Jabber part $jabber |
---|
59 | --oscar=0/1 Disable/enable Oscar part (ICQ, AIM) $oscar |
---|
60 | --yahoo=0/1 Disable/enable Yahoo part $yahoo |
---|
61 | |
---|
62 | --debug=0/1 Disable/enable debugging $debug |
---|
63 | --strip=0/1 Disable/enable binary stripping $strip |
---|
64 | |
---|
65 | --ipv6=0/1 IPv6 socket support $ipv6 |
---|
66 | |
---|
67 | --ldap=0/1/auto LDAP support $ldap |
---|
68 | |
---|
69 | --ssl=... SSL library to use (gnutls, nss, openssl, bogus, auto) |
---|
70 | $ssl |
---|
71 | EOF |
---|
72 | exit; |
---|
73 | fi |
---|
74 | eval "$e" |
---|
75 | shift; |
---|
76 | done |
---|
77 | |
---|
78 | # Expand $prefix and get rid of double slashes |
---|
79 | bindir=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'` |
---|
80 | etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'` |
---|
81 | mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'` |
---|
82 | datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'` |
---|
83 | config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'` |
---|
84 | plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'` |
---|
85 | pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'` |
---|
86 | ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'` |
---|
87 | includedir=`eval echo "$includedir" | sed 's/\/\{1,\}/\//g'` |
---|
88 | pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'` |
---|
89 | |
---|
90 | cat<<EOF>Makefile.settings |
---|
91 | ## BitlBee settings, generated by configure |
---|
92 | PREFIX=$prefix |
---|
93 | BINDIR=$bindir |
---|
94 | ETCDIR=$etcdir |
---|
95 | MANDIR=$mandir |
---|
96 | DATADIR=$datadir |
---|
97 | PLUGINDIR=$plugindir |
---|
98 | CONFIG=$config |
---|
99 | IPCSOCKET=$ipcsocket |
---|
100 | INCLUDEDIR=$includedir |
---|
101 | PCDIR=$pcdir |
---|
102 | |
---|
103 | ARCH=$arch |
---|
104 | CPU=$cpu |
---|
105 | OUTFILE=bitlbee |
---|
106 | |
---|
107 | DESTDIR= |
---|
108 | LFLAGS= |
---|
109 | EFLAGS= |
---|
110 | EOF |
---|
111 | |
---|
112 | cat<<EOF>config.h |
---|
113 | /* BitlBee settings, generated by configure |
---|
114 | |
---|
115 | Do *NOT* use any of these defines in your code without thinking twice, most |
---|
116 | of them can/will be overridden at run-time */ |
---|
117 | |
---|
118 | #define CONFIG "$config" |
---|
119 | #define ETCDIR "$etcdir" |
---|
120 | #define VARDIR "$datadir" |
---|
121 | #define PLUGINDIR "$plugindir" |
---|
122 | #define PIDFILE "$pidfile" |
---|
123 | #define IPCSOCKET "$ipcsocket" |
---|
124 | #define ARCH "$arch" |
---|
125 | #define CPU "$cpu" |
---|
126 | EOF |
---|
127 | |
---|
128 | if [ "$ipv6" = "1" ]; then |
---|
129 | echo '#define IPV6' >> config.h |
---|
130 | fi |
---|
131 | |
---|
132 | if [ "$debug" = "1" ]; then |
---|
133 | echo 'CFLAGS=-g' >> Makefile.settings |
---|
134 | echo 'DEBUG=1' >> Makefile.settings |
---|
135 | echo '#define DEBUG' >> config.h |
---|
136 | else |
---|
137 | echo 'CFLAGS=-O3' >> Makefile.settings |
---|
138 | fi |
---|
139 | |
---|
140 | echo CFLAGS+=-I`pwd` -I`pwd`/protocols -I. >> Makefile.settings |
---|
141 | |
---|
142 | echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings |
---|
143 | |
---|
144 | if [ -n "$CC" ]; then |
---|
145 | echo "CC=$CC" >> Makefile.settings; |
---|
146 | elif type gcc > /dev/null 2> /dev/null; then |
---|
147 | echo "CC=gcc" >> Makefile.settings; |
---|
148 | elif type cc > /dev/null 2> /dev/null; then |
---|
149 | echo "CC=cc" >> Makefile.settings; |
---|
150 | else |
---|
151 | echo 'Cannot find a C compiler, aborting.' |
---|
152 | exit 1; |
---|
153 | fi |
---|
154 | |
---|
155 | if [ -n "$LD" ]; then |
---|
156 | echo "LD=$LD" >> Makefile.settings; |
---|
157 | elif type ld > /dev/null 2> /dev/null; then |
---|
158 | echo "LD=ld" >> Makefile.settings; |
---|
159 | else |
---|
160 | echo 'Cannot find ld, aborting.' |
---|
161 | exit 1; |
---|
162 | fi |
---|
163 | |
---|
164 | if [ -z "$PKG_CONFIG" ]; then |
---|
165 | PKG_CONFIG=pkg-config |
---|
166 | fi |
---|
167 | |
---|
168 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then |
---|
169 | cat<<EOF>>Makefile.settings |
---|
170 | EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0` |
---|
171 | CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0` |
---|
172 | EOF |
---|
173 | echo '#define GLIB2' >> config.h |
---|
174 | elif type glib-config > /dev/null 2> /dev/null; then |
---|
175 | cat<<EOF>>Makefile.settings |
---|
176 | EFLAGS+=`glib-config --libs` |
---|
177 | CFLAGS+=`glib-config --cflags` |
---|
178 | EOF |
---|
179 | echo '#define GLIB1' >> config.h |
---|
180 | else |
---|
181 | echo 'Cannot find glib development libraries, aborting. (Install libglib-dev?)' |
---|
182 | exit 1; |
---|
183 | fi |
---|
184 | |
---|
185 | if [ -r /usr/include/iconv.h ]; then |
---|
186 | :; |
---|
187 | elif [ -r /usr/local/include/iconv.h ]; then |
---|
188 | echo CFLAGS+=-I/usr/local/include >> Makefile.settings; |
---|
189 | else |
---|
190 | echo |
---|
191 | echo 'Warning: Could not find iconv.h, you might have to install it and/or modify' |
---|
192 | echo 'Makefile.settings to tell where this file is.'; |
---|
193 | fi |
---|
194 | |
---|
195 | |
---|
196 | detect_gnutls() |
---|
197 | { |
---|
198 | if libgnutls-config --version > /dev/null 2> /dev/null; then |
---|
199 | cat <<EOF>>Makefile.settings |
---|
200 | EFLAGS+=`libgnutls-config --libs` |
---|
201 | CFLAGS+=`libgnutls-config --cflags` |
---|
202 | EOF |
---|
203 | |
---|
204 | ssl=gnutls |
---|
205 | ret=1; |
---|
206 | else |
---|
207 | ret=0; |
---|
208 | fi; |
---|
209 | } |
---|
210 | |
---|
211 | detect_nss() |
---|
212 | { |
---|
213 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG mozilla-nss; then |
---|
214 | cat<<EOF>>Makefile.settings |
---|
215 | EFLAGS+=`$PKG_CONFIG --libs mozilla-nss` |
---|
216 | CFLAGS+=`$PKG_CONFIG --cflags mozilla-nss` |
---|
217 | EOF |
---|
218 | |
---|
219 | ssl=nss |
---|
220 | ret=1; |
---|
221 | else |
---|
222 | ret=0; |
---|
223 | fi; |
---|
224 | } |
---|
225 | |
---|
226 | detect_ldap() |
---|
227 | { |
---|
228 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG ldb; then |
---|
229 | cat<<EOF>>Makefile.settings |
---|
230 | EFLAGS+=`$PKG_CONFIG --libs ldb` |
---|
231 | CFLAGS+=`$PKG_CONFIG --cflags ldb` |
---|
232 | EOF |
---|
233 | ldap=1 |
---|
234 | ret=1 |
---|
235 | else |
---|
236 | ret=0 |
---|
237 | fi |
---|
238 | } |
---|
239 | |
---|
240 | if [ "$msn" = 1 -o "$jabber" = 1 ]; then |
---|
241 | if [ "$ssl" = "auto" ]; then |
---|
242 | detect_gnutls |
---|
243 | if [ "$ret" = "0" ]; then |
---|
244 | detect_nss |
---|
245 | fi; |
---|
246 | elif [ "$ssl" = "gnutls" ]; then |
---|
247 | detect_gnutls; |
---|
248 | elif [ "$ssl" = "nss" ]; then |
---|
249 | detect_nss; |
---|
250 | elif [ "$ssl" = "openssl" ]; then |
---|
251 | echo |
---|
252 | echo 'No detection code exists for OpenSSL. Make sure that you have a complete' |
---|
253 | echo 'install of OpenSSL (including devel/header files) before reporting' |
---|
254 | echo 'compilation problems.' |
---|
255 | echo |
---|
256 | echo 'Also, keep in mind that the OpenSSL is, according to some people, not' |
---|
257 | echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better' |
---|
258 | echo 'supported by us. However, on many BSD machines, OpenSSL can be considered' |
---|
259 | echo 'part of the operating system, which makes it GPL-compatible.' |
---|
260 | echo |
---|
261 | echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2' |
---|
262 | echo ' http://www.gnome.org/~markmc/openssl-and-the-gpl.html' |
---|
263 | echo |
---|
264 | echo 'Please note that distributing a BitlBee binary which links to OpenSSL is' |
---|
265 | echo 'probably illegal. If you want to create and distribute a binary BitlBee' |
---|
266 | echo 'package, you really should use GnuTLS or NSS instead.' |
---|
267 | echo |
---|
268 | echo 'Also, the OpenSSL license requires us to say this:' |
---|
269 | echo ' * "This product includes software developed by the OpenSSL Project' |
---|
270 | echo ' * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"' |
---|
271 | |
---|
272 | echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings |
---|
273 | |
---|
274 | ret=1; |
---|
275 | elif [ "$ssl" = "bogus" ]; then |
---|
276 | echo |
---|
277 | echo 'Using bogus SSL code. This will not make the MSN module work, but it will' |
---|
278 | echo 'allow you to use the Jabber module - although without working SSL support.' |
---|
279 | |
---|
280 | ret=1; |
---|
281 | else |
---|
282 | echo |
---|
283 | echo 'ERROR: Unknown SSL library specified.' |
---|
284 | exit 1; |
---|
285 | fi |
---|
286 | |
---|
287 | if [ "$ret" = "0" ]; then |
---|
288 | echo |
---|
289 | echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).' |
---|
290 | echo ' This is necessary for MSN and full Jabber support. To continue,' |
---|
291 | echo ' install a suitable SSL library or disable MSN support (--msn=0).' |
---|
292 | echo ' If you want Jabber without SSL support you can try --ssl=bogus.' |
---|
293 | |
---|
294 | exit 1; |
---|
295 | fi; |
---|
296 | |
---|
297 | echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings |
---|
298 | fi |
---|
299 | |
---|
300 | if [ "$ldap" = "auto" ]; then |
---|
301 | detect_ldap |
---|
302 | fi |
---|
303 | |
---|
304 | if [ "$ldap" = 0 ]; then |
---|
305 | echo "LDAP_OBJ=\# no ldap" >> Makefile.settings |
---|
306 | echo "#undef LDAP" >> config.h |
---|
307 | elif [ "$ldap" = 1 ]; then |
---|
308 | echo "#define LDAP 1" >> config.h |
---|
309 | echo "LDAP_OBJ=storage_ldap.o" >> Makefile.settings |
---|
310 | fi |
---|
311 | |
---|
312 | if [ "$strip" = 0 ]; then |
---|
313 | echo "STRIP=\# skip strip" >> Makefile.settings; |
---|
314 | else |
---|
315 | if [ "$debug" = 1 ]; then |
---|
316 | echo |
---|
317 | echo 'Stripping binaries does not make sense when debugging. Stripping disabled.' |
---|
318 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
319 | strip=0; |
---|
320 | elif [ -n "$STRIP" ]; then |
---|
321 | echo "STRIP=$STRIP" >> Makefile.settings; |
---|
322 | elif type strip > /dev/null 2> /dev/null; then |
---|
323 | echo "STRIP=strip" >> Makefile.settings; |
---|
324 | elif /bin/test -x /usr/ccs/bin/strip; then |
---|
325 | echo "STRIP=/usr/ccs/bin/strip" >> Makefile.settings; |
---|
326 | else |
---|
327 | echo |
---|
328 | echo 'No strip utility found, cannot remove unnecessary parts from executable.' |
---|
329 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
330 | strip=0; |
---|
331 | fi; |
---|
332 | fi |
---|
333 | |
---|
334 | echo |
---|
335 | if [ -z "$BITLBEE_VERSION" -a -d .bzr -a -x "`which bzr`" ]; then |
---|
336 | rev=`bzr revno` |
---|
337 | echo 'Using bzr revision #'$rev' as version number' |
---|
338 | BITLBEE_VERSION=\"bzr-$rev\" |
---|
339 | fi |
---|
340 | |
---|
341 | if [ -n "$BITLBEE_VERSION" ]; then |
---|
342 | echo 'Spoofing version number: '$BITLBEE_VERSION |
---|
343 | echo '#undef BITLBEE_VERSION' >> config.h |
---|
344 | echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h |
---|
345 | echo |
---|
346 | fi |
---|
347 | |
---|
348 | cat <<EOF>bitlbee.pc |
---|
349 | prefix=$prefix |
---|
350 | includedir=$includedir |
---|
351 | |
---|
352 | Name: bitlbee |
---|
353 | Description: IRC to IM gateway |
---|
354 | Requires: glib-2.0 |
---|
355 | Version: $BITLBEE_VERSION |
---|
356 | Libs: |
---|
357 | Cflags: -I\${includedir} |
---|
358 | |
---|
359 | EOF |
---|
360 | |
---|
361 | protocols='' |
---|
362 | protoobjs='' |
---|
363 | |
---|
364 | if [ "$msn" = 0 ]; then |
---|
365 | echo '#undef WITH_MSN' >> config.h |
---|
366 | else |
---|
367 | echo '#define WITH_MSN' >> config.h |
---|
368 | protocols=$protocols'msn ' |
---|
369 | protoobjs=$protoobjs'msn_mod.o ' |
---|
370 | fi |
---|
371 | |
---|
372 | if [ "$jabber" = 0 ]; then |
---|
373 | echo '#undef WITH_JABBER' >> config.h |
---|
374 | else |
---|
375 | echo '#define WITH_JABBER' >> config.h |
---|
376 | protocols=$protocols'jabber ' |
---|
377 | protoobjs=$protoobjs'jabber_mod.o ' |
---|
378 | fi |
---|
379 | |
---|
380 | if [ "$oscar" = 0 ]; then |
---|
381 | echo '#undef WITH_OSCAR' >> config.h |
---|
382 | else |
---|
383 | echo '#define WITH_OSCAR' >> config.h |
---|
384 | protocols=$protocols'oscar ' |
---|
385 | protoobjs=$protoobjs'oscar_mod.o ' |
---|
386 | fi |
---|
387 | |
---|
388 | if [ "$yahoo" = 0 ]; then |
---|
389 | echo '#undef WITH_YAHOO' >> config.h |
---|
390 | else |
---|
391 | echo '#define WITH_YAHOO' >> config.h |
---|
392 | protocols=$protocols'yahoo ' |
---|
393 | protoobjs=$protoobjs'yahoo_mod.o ' |
---|
394 | fi |
---|
395 | |
---|
396 | if [ "$protocols" = "PROTOCOLS = " ]; then |
---|
397 | echo "WARNING: You haven't selected any communication protocol to compile!" |
---|
398 | echo " Bitlbee will run, but you will be unable to connect to IM servers!" |
---|
399 | fi |
---|
400 | |
---|
401 | echo "PROTOCOLS = $protocols" >> Makefile.settings |
---|
402 | echo "PROTOOBJS = $protoobjs" >> Makefile.settings |
---|
403 | |
---|
404 | echo Architecture: $arch |
---|
405 | case "$arch" in |
---|
406 | Linux ) |
---|
407 | ;; |
---|
408 | GNU/* ) |
---|
409 | ;; |
---|
410 | *BSD ) |
---|
411 | echo 'EFLAGS+=-liconv' >> Makefile.settings; |
---|
412 | ;; |
---|
413 | SunOS ) |
---|
414 | echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings |
---|
415 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
416 | echo 'EFLAGS+=-liconv' >> Makefile.settings; |
---|
417 | ;; |
---|
418 | Darwin ) |
---|
419 | echo 'EFLAGS+=-liconv' >> Makefile.settings; |
---|
420 | ;; |
---|
421 | IRIX ) |
---|
422 | ;; |
---|
423 | CYGWIN* ) |
---|
424 | echo 'Cygwin is not officially supported.' |
---|
425 | ;; |
---|
426 | * ) |
---|
427 | echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' |
---|
428 | echo 'Please report any problems at http://bugs.bitlbee.org/.' |
---|
429 | ;; |
---|
430 | esac |
---|
431 | |
---|
432 | echo |
---|
433 | echo 'Configuration done:' |
---|
434 | |
---|
435 | if [ "$debug" = "1" ]; then |
---|
436 | echo ' Debugging enabled.'; |
---|
437 | else |
---|
438 | echo ' Debugging disabled.'; |
---|
439 | fi |
---|
440 | |
---|
441 | if [ "$strip" = "1" ]; then |
---|
442 | echo ' Binary stripping enabled.'; |
---|
443 | else |
---|
444 | echo ' Binary stripping disabled.'; |
---|
445 | fi |
---|
446 | |
---|
447 | if [ "$msn" = "1" ]; then |
---|
448 | echo ' Using SSL library: '$ssl; |
---|
449 | fi |
---|
450 | |
---|
451 | #if [ "$flood" = "0" ]; then |
---|
452 | # echo ' Flood protection disabled.'; |
---|
453 | #else |
---|
454 | # echo ' Flood protection enabled.'; |
---|
455 | #fi |
---|
456 | |
---|
457 | if [ -n "$protocols" ]; then |
---|
458 | echo ' Building with these protocols:' $protocols; |
---|
459 | else |
---|
460 | echo ' Building without IM-protocol support. We wish you a lot of fun...'; |
---|
461 | fi |
---|
462 | |
---|
463 | if [ "$ldap" = "0" ]; then |
---|
464 | echo " LDAP storage backend disabled." |
---|
465 | else |
---|
466 | echo " LDAP storage backend enabled." |
---|
467 | fi |
---|