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 | else |
---|
174 | echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)' |
---|
175 | exit 1; |
---|
176 | fi |
---|
177 | |
---|
178 | detect_gnutls() |
---|
179 | { |
---|
180 | if libgnutls-config --version > /dev/null 2> /dev/null; then |
---|
181 | cat <<EOF>>Makefile.settings |
---|
182 | EFLAGS+=`libgnutls-config --libs` |
---|
183 | CFLAGS+=`libgnutls-config --cflags` |
---|
184 | EOF |
---|
185 | |
---|
186 | ssl=gnutls |
---|
187 | ret=1; |
---|
188 | else |
---|
189 | ret=0; |
---|
190 | fi; |
---|
191 | } |
---|
192 | |
---|
193 | detect_nss() |
---|
194 | { |
---|
195 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG mozilla-nss; then |
---|
196 | cat<<EOF>>Makefile.settings |
---|
197 | EFLAGS+=`$PKG_CONFIG --libs mozilla-nss` |
---|
198 | CFLAGS+=`$PKG_CONFIG --cflags mozilla-nss` |
---|
199 | EOF |
---|
200 | |
---|
201 | ssl=nss |
---|
202 | ret=1; |
---|
203 | else |
---|
204 | ret=0; |
---|
205 | fi; |
---|
206 | } |
---|
207 | |
---|
208 | detect_ldap() |
---|
209 | { |
---|
210 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG ldb; then |
---|
211 | cat<<EOF>>Makefile.settings |
---|
212 | EFLAGS+=`$PKG_CONFIG --libs ldb` |
---|
213 | CFLAGS+=`$PKG_CONFIG --cflags ldb` |
---|
214 | EOF |
---|
215 | ldap=1 |
---|
216 | ret=1 |
---|
217 | else |
---|
218 | ret=0 |
---|
219 | fi |
---|
220 | } |
---|
221 | |
---|
222 | if [ "$msn" = 1 -o "$jabber" = 1 ]; then |
---|
223 | if [ "$ssl" = "auto" ]; then |
---|
224 | detect_gnutls |
---|
225 | if [ "$ret" = "0" ]; then |
---|
226 | detect_nss |
---|
227 | fi; |
---|
228 | elif [ "$ssl" = "gnutls" ]; then |
---|
229 | detect_gnutls; |
---|
230 | elif [ "$ssl" = "nss" ]; then |
---|
231 | detect_nss; |
---|
232 | elif [ "$ssl" = "openssl" ]; then |
---|
233 | echo |
---|
234 | echo 'No detection code exists for OpenSSL. Make sure that you have a complete' |
---|
235 | echo 'install of OpenSSL (including devel/header files) before reporting' |
---|
236 | echo 'compilation problems.' |
---|
237 | echo |
---|
238 | echo 'Also, keep in mind that the OpenSSL is, according to some people, not' |
---|
239 | echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better' |
---|
240 | echo 'supported by us. However, on many BSD machines, OpenSSL can be considered' |
---|
241 | echo 'part of the operating system, which makes it GPL-compatible.' |
---|
242 | echo |
---|
243 | echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2' |
---|
244 | echo ' http://www.gnome.org/~markmc/openssl-and-the-gpl.html' |
---|
245 | echo |
---|
246 | echo 'Please note that distributing a BitlBee binary which links to OpenSSL is' |
---|
247 | echo 'probably illegal. If you want to create and distribute a binary BitlBee' |
---|
248 | echo 'package, you really should use GnuTLS or NSS instead.' |
---|
249 | echo |
---|
250 | echo 'Also, the OpenSSL license requires us to say this:' |
---|
251 | echo ' * "This product includes software developed by the OpenSSL Project' |
---|
252 | echo ' * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"' |
---|
253 | |
---|
254 | echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings |
---|
255 | |
---|
256 | ret=1; |
---|
257 | elif [ "$ssl" = "bogus" ]; then |
---|
258 | echo |
---|
259 | echo 'Using bogus SSL code. This will not make the MSN module work, but it will' |
---|
260 | echo 'allow you to use the Jabber module - although without working SSL support.' |
---|
261 | |
---|
262 | ret=1; |
---|
263 | else |
---|
264 | echo |
---|
265 | echo 'ERROR: Unknown SSL library specified.' |
---|
266 | exit 1; |
---|
267 | fi |
---|
268 | |
---|
269 | if [ "$ret" = "0" ]; then |
---|
270 | echo |
---|
271 | echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).' |
---|
272 | echo ' This is necessary for MSN and full Jabber support. To continue,' |
---|
273 | echo ' install a suitable SSL library or disable MSN support (--msn=0).' |
---|
274 | echo ' If you want Jabber without SSL support you can try --ssl=bogus.' |
---|
275 | |
---|
276 | exit 1; |
---|
277 | fi; |
---|
278 | |
---|
279 | echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings |
---|
280 | fi |
---|
281 | |
---|
282 | if [ "$ldap" = "auto" ]; then |
---|
283 | detect_ldap |
---|
284 | fi |
---|
285 | |
---|
286 | if [ "$ldap" = 0 ]; then |
---|
287 | echo "LDAP_OBJ=\# no ldap" >> Makefile.settings |
---|
288 | echo "#undef LDAP" >> config.h |
---|
289 | elif [ "$ldap" = 1 ]; then |
---|
290 | echo "#define LDAP 1" >> config.h |
---|
291 | echo "LDAP_OBJ=storage_ldap.o" >> Makefile.settings |
---|
292 | fi |
---|
293 | |
---|
294 | if [ "$strip" = 0 ]; then |
---|
295 | echo "STRIP=\# skip strip" >> Makefile.settings; |
---|
296 | else |
---|
297 | if [ "$debug" = 1 ]; then |
---|
298 | echo |
---|
299 | echo 'Stripping binaries does not make sense when debugging. Stripping disabled.' |
---|
300 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
301 | strip=0; |
---|
302 | elif [ -n "$STRIP" ]; then |
---|
303 | echo "STRIP=$STRIP" >> Makefile.settings; |
---|
304 | elif type strip > /dev/null 2> /dev/null; then |
---|
305 | echo "STRIP=strip" >> Makefile.settings; |
---|
306 | elif /bin/test -x /usr/ccs/bin/strip; then |
---|
307 | echo "STRIP=/usr/ccs/bin/strip" >> Makefile.settings; |
---|
308 | else |
---|
309 | echo |
---|
310 | echo 'No strip utility found, cannot remove unnecessary parts from executable.' |
---|
311 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
312 | strip=0; |
---|
313 | fi; |
---|
314 | fi |
---|
315 | |
---|
316 | echo |
---|
317 | if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then |
---|
318 | nick=`bzr nick` |
---|
319 | if [ -n "$nick" -a "$nick" != "bitlbee" ]; then |
---|
320 | nick="-$nick" |
---|
321 | else |
---|
322 | nick="" |
---|
323 | fi |
---|
324 | rev=`bzr revno` |
---|
325 | echo 'Using bzr revision #'$rev' as version number' |
---|
326 | BITLBEE_VERSION=\"bzr$nick-$rev\" |
---|
327 | fi |
---|
328 | |
---|
329 | if [ -n "$BITLBEE_VERSION" ]; then |
---|
330 | echo 'Spoofing version number: '$BITLBEE_VERSION |
---|
331 | echo '#undef BITLBEE_VERSION' >> config.h |
---|
332 | echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h |
---|
333 | echo |
---|
334 | fi |
---|
335 | |
---|
336 | cat <<EOF>bitlbee.pc |
---|
337 | prefix=$prefix |
---|
338 | includedir=$includedir |
---|
339 | |
---|
340 | Name: bitlbee |
---|
341 | Description: IRC to IM gateway |
---|
342 | Requires: glib-2.0 |
---|
343 | Version: $BITLBEE_VERSION |
---|
344 | Libs: |
---|
345 | Cflags: -I\${includedir} |
---|
346 | |
---|
347 | EOF |
---|
348 | |
---|
349 | protocols='' |
---|
350 | protoobjs='' |
---|
351 | |
---|
352 | if [ "$msn" = 0 ]; then |
---|
353 | echo '#undef WITH_MSN' >> config.h |
---|
354 | else |
---|
355 | echo '#define WITH_MSN' >> config.h |
---|
356 | protocols=$protocols'msn ' |
---|
357 | protoobjs=$protoobjs'msn_mod.o ' |
---|
358 | fi |
---|
359 | |
---|
360 | if [ "$jabber" = 0 ]; then |
---|
361 | echo '#undef WITH_JABBER' >> config.h |
---|
362 | else |
---|
363 | echo '#define WITH_JABBER' >> config.h |
---|
364 | protocols=$protocols'jabber ' |
---|
365 | protoobjs=$protoobjs'jabber_mod.o ' |
---|
366 | fi |
---|
367 | |
---|
368 | if [ "$oscar" = 0 ]; then |
---|
369 | echo '#undef WITH_OSCAR' >> config.h |
---|
370 | else |
---|
371 | echo '#define WITH_OSCAR' >> config.h |
---|
372 | protocols=$protocols'oscar ' |
---|
373 | protoobjs=$protoobjs'oscar_mod.o ' |
---|
374 | fi |
---|
375 | |
---|
376 | if [ "$yahoo" = 0 ]; then |
---|
377 | echo '#undef WITH_YAHOO' >> config.h |
---|
378 | else |
---|
379 | echo '#define WITH_YAHOO' >> config.h |
---|
380 | protocols=$protocols'yahoo ' |
---|
381 | protoobjs=$protoobjs'yahoo_mod.o ' |
---|
382 | fi |
---|
383 | |
---|
384 | if [ "$protocols" = "PROTOCOLS = " ]; then |
---|
385 | echo "WARNING: You haven't selected any communication protocol to compile!" |
---|
386 | echo " Bitlbee will run, but you will be unable to connect to IM servers!" |
---|
387 | fi |
---|
388 | |
---|
389 | echo "PROTOCOLS = $protocols" >> Makefile.settings |
---|
390 | echo "PROTOOBJS = $protoobjs" >> Makefile.settings |
---|
391 | |
---|
392 | echo Architecture: $arch |
---|
393 | case "$arch" in |
---|
394 | Linux ) |
---|
395 | ;; |
---|
396 | GNU/* ) |
---|
397 | ;; |
---|
398 | *BSD ) |
---|
399 | ;; |
---|
400 | Darwin ) |
---|
401 | ;; |
---|
402 | IRIX ) |
---|
403 | ;; |
---|
404 | SunOS ) |
---|
405 | echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings |
---|
406 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
407 | ;; |
---|
408 | CYGWIN* ) |
---|
409 | echo 'Cygwin is not officially supported.' |
---|
410 | ;; |
---|
411 | * ) |
---|
412 | echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' |
---|
413 | echo 'Please report any problems at http://bugs.bitlbee.org/.' |
---|
414 | ;; |
---|
415 | esac |
---|
416 | |
---|
417 | echo |
---|
418 | echo 'Configuration done:' |
---|
419 | |
---|
420 | if [ "$debug" = "1" ]; then |
---|
421 | echo ' Debugging enabled.'; |
---|
422 | else |
---|
423 | echo ' Debugging disabled.'; |
---|
424 | fi |
---|
425 | |
---|
426 | if [ "$strip" = "1" ]; then |
---|
427 | echo ' Binary stripping enabled.'; |
---|
428 | else |
---|
429 | echo ' Binary stripping disabled.'; |
---|
430 | fi |
---|
431 | |
---|
432 | if [ "$msn" = "1" ]; then |
---|
433 | echo ' Using SSL library: '$ssl; |
---|
434 | fi |
---|
435 | |
---|
436 | #if [ "$flood" = "0" ]; then |
---|
437 | # echo ' Flood protection disabled.'; |
---|
438 | #else |
---|
439 | # echo ' Flood protection enabled.'; |
---|
440 | #fi |
---|
441 | |
---|
442 | if [ -n "$protocols" ]; then |
---|
443 | echo ' Building with these protocols:' $protocols; |
---|
444 | else |
---|
445 | echo ' Building without IM-protocol support. We wish you a lot of fun...'; |
---|
446 | fi |
---|
447 | |
---|
448 | if [ "$ldap" = "0" ]; then |
---|
449 | echo " LDAP storage backend disabled." |
---|
450 | else |
---|
451 | echo " LDAP storage backend enabled." |
---|
452 | fi |
---|