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