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 | ssl=auto |
---|
31 | |
---|
32 | arch=`uname -s` |
---|
33 | cpu=`uname -m` |
---|
34 | |
---|
35 | echo BitlBee configure |
---|
36 | |
---|
37 | while [ -n "$1" ]; do |
---|
38 | e="`expr "X$1" : 'X--\(.*=.*\)'`" |
---|
39 | if [ -z "$e" ]; then |
---|
40 | cat<<EOF |
---|
41 | |
---|
42 | Usage: $0 [OPTIONS] |
---|
43 | |
---|
44 | Option Description Default |
---|
45 | |
---|
46 | --prefix=... Directories to put files in $prefix |
---|
47 | --bindir=... $bindir |
---|
48 | --etcdir=... $etcdir |
---|
49 | --mandir=... $mandir |
---|
50 | --datadir=... $datadir |
---|
51 | --plugindir=... $plugindir |
---|
52 | --pidfile=... $pidfile |
---|
53 | --config=... $config |
---|
54 | --ipcsocket=... $ipcsocket |
---|
55 | |
---|
56 | --msn=0/1 Disable/enable MSN part $msn |
---|
57 | --jabber=0/1 Disable/enable Jabber part $jabber |
---|
58 | --oscar=0/1 Disable/enable Oscar part (ICQ, AIM) $oscar |
---|
59 | --yahoo=0/1 Disable/enable Yahoo part $yahoo |
---|
60 | |
---|
61 | --debug=0/1 Disable/enable debugging $debug |
---|
62 | --strip=0/1 Disable/enable binary stripping $strip |
---|
63 | |
---|
64 | --ipv6=0/1 IPv6 socket support $ipv6 |
---|
65 | |
---|
66 | --ssl=... SSL library to use (gnutls, nss, openssl, bogus, auto) |
---|
67 | $ssl |
---|
68 | EOF |
---|
69 | exit; |
---|
70 | fi |
---|
71 | eval "$e" |
---|
72 | shift; |
---|
73 | done |
---|
74 | |
---|
75 | # Expand $prefix and get rid of double slashes |
---|
76 | bindir=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'` |
---|
77 | etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'` |
---|
78 | mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'` |
---|
79 | datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'` |
---|
80 | config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'` |
---|
81 | plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'` |
---|
82 | pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'` |
---|
83 | ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'` |
---|
84 | includedir=`eval echo "$includedir" | sed 's/\/\{1,\}/\//g'` |
---|
85 | pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'` |
---|
86 | |
---|
87 | cat<<EOF>Makefile.settings |
---|
88 | ## BitlBee settings, generated by configure |
---|
89 | PREFIX=$prefix |
---|
90 | BINDIR=$bindir |
---|
91 | ETCDIR=$etcdir |
---|
92 | MANDIR=$mandir |
---|
93 | DATADIR=$datadir |
---|
94 | PLUGINDIR=$plugindir |
---|
95 | CONFIG=$config |
---|
96 | IPCSOCKET=$ipcsocket |
---|
97 | INCLUDEDIR=$includedir |
---|
98 | PCDIR=$pcdir |
---|
99 | |
---|
100 | ARCH=$arch |
---|
101 | CPU=$cpu |
---|
102 | OUTFILE=bitlbee |
---|
103 | |
---|
104 | DESTDIR= |
---|
105 | LFLAGS= |
---|
106 | EFLAGS= |
---|
107 | EOF |
---|
108 | |
---|
109 | cat<<EOF>config.h |
---|
110 | /* BitlBee settings, generated by configure |
---|
111 | |
---|
112 | Do *NOT* use any of these defines in your code without thinking twice, most |
---|
113 | of them can/will be overridden at run-time */ |
---|
114 | |
---|
115 | #define CONFIG "$config" |
---|
116 | #define ETCDIR "$etcdir" |
---|
117 | #define VARDIR "$datadir" |
---|
118 | #define PLUGINDIR "$plugindir" |
---|
119 | #define PIDFILE "$pidfile" |
---|
120 | #define IPCSOCKET "$ipcsocket" |
---|
121 | #define ARCH "$arch" |
---|
122 | #define CPU "$cpu" |
---|
123 | EOF |
---|
124 | |
---|
125 | if [ "$ipv6" = "1" ]; then |
---|
126 | echo '#define IPV6' >> config.h |
---|
127 | fi |
---|
128 | |
---|
129 | if [ "$debug" = "1" ]; then |
---|
130 | echo 'CFLAGS=-g' >> Makefile.settings |
---|
131 | echo 'DEBUG=1' >> Makefile.settings |
---|
132 | echo '#define DEBUG' >> config.h |
---|
133 | else |
---|
134 | echo 'CFLAGS=-O3' >> Makefile.settings |
---|
135 | fi |
---|
136 | |
---|
137 | echo CFLAGS+=-I`pwd` -I`pwd`/protocols -I. >> Makefile.settings |
---|
138 | |
---|
139 | echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings |
---|
140 | |
---|
141 | if [ -n "$CC" ]; then |
---|
142 | echo "CC=$CC" >> Makefile.settings; |
---|
143 | elif type gcc > /dev/null 2> /dev/null; then |
---|
144 | echo "CC=gcc" >> Makefile.settings; |
---|
145 | elif type cc > /dev/null 2> /dev/null; then |
---|
146 | echo "CC=cc" >> Makefile.settings; |
---|
147 | else |
---|
148 | echo 'Cannot find a C compiler, aborting.' |
---|
149 | exit 1; |
---|
150 | fi |
---|
151 | |
---|
152 | if [ -n "$LD" ]; then |
---|
153 | echo "LD=$LD" >> Makefile.settings; |
---|
154 | elif type ld > /dev/null 2> /dev/null; then |
---|
155 | echo "LD=ld" >> Makefile.settings; |
---|
156 | else |
---|
157 | echo 'Cannot find ld, aborting.' |
---|
158 | exit 1; |
---|
159 | fi |
---|
160 | |
---|
161 | if [ -z "$PKG_CONFIG" ]; then |
---|
162 | PKG_CONFIG=pkg-config |
---|
163 | fi |
---|
164 | |
---|
165 | GLIB=0 |
---|
166 | |
---|
167 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then |
---|
168 | cat<<EOF>>Makefile.settings |
---|
169 | EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0` |
---|
170 | CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0` |
---|
171 | EOF |
---|
172 | echo '#define GLIB2' >> config.h |
---|
173 | GLIB=2 |
---|
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 | GLIB=1 |
---|
181 | else |
---|
182 | echo 'Cannot find glib development libraries, aborting. (Install libglib-dev?)' |
---|
183 | exit 1; |
---|
184 | fi |
---|
185 | |
---|
186 | if [ GLIB = 1 -o -r /usr/include/iconv.h ]; then |
---|
187 | :; |
---|
188 | elif [ -r /usr/local/include/iconv.h ]; then |
---|
189 | echo CFLAGS+=-I/usr/local/include >> Makefile.settings; |
---|
190 | else |
---|
191 | echo |
---|
192 | echo 'Warning: Could not find iconv.h, you might have to install it and/or modify' |
---|
193 | echo 'Makefile.settings to tell where this file is.'; |
---|
194 | fi |
---|
195 | |
---|
196 | |
---|
197 | detect_gnutls() |
---|
198 | { |
---|
199 | if libgnutls-config --version > /dev/null 2> /dev/null; then |
---|
200 | cat <<EOF>>Makefile.settings |
---|
201 | EFLAGS+=`libgnutls-config --libs` |
---|
202 | CFLAGS+=`libgnutls-config --cflags` |
---|
203 | EOF |
---|
204 | |
---|
205 | ssl=gnutls |
---|
206 | ret=1; |
---|
207 | else |
---|
208 | ret=0; |
---|
209 | fi; |
---|
210 | } |
---|
211 | |
---|
212 | detect_nss() |
---|
213 | { |
---|
214 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG mozilla-nss; then |
---|
215 | cat<<EOF>>Makefile.settings |
---|
216 | EFLAGS+=`$PKG_CONFIG --libs mozilla-nss` |
---|
217 | CFLAGS+=`$PKG_CONFIG --cflags mozilla-nss` |
---|
218 | EOF |
---|
219 | |
---|
220 | ssl=nss |
---|
221 | ret=1; |
---|
222 | else |
---|
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 [ "$strip" = 0 ]; then |
---|
288 | echo "STRIP=\# skip strip" >> Makefile.settings; |
---|
289 | else |
---|
290 | if [ "$debug" = 1 ]; then |
---|
291 | echo |
---|
292 | echo 'Stripping binaries does not make sense when debugging. Stripping disabled.' |
---|
293 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
294 | strip=0; |
---|
295 | elif [ -n "$STRIP" ]; then |
---|
296 | echo "STRIP=$STRIP" >> Makefile.settings; |
---|
297 | elif type strip > /dev/null 2> /dev/null; then |
---|
298 | echo "STRIP=strip" >> Makefile.settings; |
---|
299 | elif /bin/test -x /usr/ccs/bin/strip; then |
---|
300 | echo "STRIP=/usr/ccs/bin/strip" >> Makefile.settings; |
---|
301 | else |
---|
302 | echo |
---|
303 | echo 'No strip utility found, cannot remove unnecessary parts from executable.' |
---|
304 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
305 | strip=0; |
---|
306 | fi; |
---|
307 | fi |
---|
308 | |
---|
309 | echo |
---|
310 | if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then |
---|
311 | nick=`bzr nick` |
---|
312 | if [ -n "$nick" -a "$nick" != "bitlbee" ]; then |
---|
313 | nick="-$nick" |
---|
314 | else |
---|
315 | nick="" |
---|
316 | fi |
---|
317 | rev=`bzr revno` |
---|
318 | echo 'Using bzr revision #'$rev' as version number' |
---|
319 | BITLBEE_VERSION=\"bzr$nick-$rev\" |
---|
320 | fi |
---|
321 | |
---|
322 | if [ -n "$BITLBEE_VERSION" ]; then |
---|
323 | echo 'Spoofing version number: '$BITLBEE_VERSION |
---|
324 | echo '#undef BITLBEE_VERSION' >> config.h |
---|
325 | echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h |
---|
326 | echo |
---|
327 | fi |
---|
328 | |
---|
329 | cat <<EOF>bitlbee.pc |
---|
330 | prefix=$prefix |
---|
331 | includedir=$includedir |
---|
332 | |
---|
333 | Name: bitlbee |
---|
334 | Description: IRC to IM gateway |
---|
335 | Requires: glib-2.0 |
---|
336 | Version: $BITLBEE_VERSION |
---|
337 | Libs: |
---|
338 | Cflags: -I\${includedir} |
---|
339 | |
---|
340 | EOF |
---|
341 | |
---|
342 | protocols='' |
---|
343 | protoobjs='' |
---|
344 | |
---|
345 | if [ "$msn" = 0 ]; then |
---|
346 | echo '#undef WITH_MSN' >> config.h |
---|
347 | else |
---|
348 | echo '#define WITH_MSN' >> config.h |
---|
349 | protocols=$protocols'msn ' |
---|
350 | protoobjs=$protoobjs'msn_mod.o ' |
---|
351 | fi |
---|
352 | |
---|
353 | if [ "$jabber" = 0 ]; then |
---|
354 | echo '#undef WITH_JABBER' >> config.h |
---|
355 | else |
---|
356 | echo '#define WITH_JABBER' >> config.h |
---|
357 | protocols=$protocols'jabber ' |
---|
358 | protoobjs=$protoobjs'jabber_mod.o ' |
---|
359 | fi |
---|
360 | |
---|
361 | if [ "$oscar" = 0 ]; then |
---|
362 | echo '#undef WITH_OSCAR' >> config.h |
---|
363 | else |
---|
364 | echo '#define WITH_OSCAR' >> config.h |
---|
365 | protocols=$protocols'oscar ' |
---|
366 | protoobjs=$protoobjs'oscar_mod.o ' |
---|
367 | fi |
---|
368 | |
---|
369 | if [ "$yahoo" = 0 ]; then |
---|
370 | echo '#undef WITH_YAHOO' >> config.h |
---|
371 | else |
---|
372 | echo '#define WITH_YAHOO' >> config.h |
---|
373 | protocols=$protocols'yahoo ' |
---|
374 | protoobjs=$protoobjs'yahoo_mod.o ' |
---|
375 | fi |
---|
376 | |
---|
377 | if [ "$protocols" = "PROTOCOLS = " ]; then |
---|
378 | echo "WARNING: You haven't selected any communication protocol to compile!" |
---|
379 | echo " Bitlbee will run, but you will be unable to connect to IM servers!" |
---|
380 | fi |
---|
381 | |
---|
382 | echo "PROTOCOLS = $protocols" >> Makefile.settings |
---|
383 | echo "PROTOOBJS = $protoobjs" >> Makefile.settings |
---|
384 | |
---|
385 | echo Architecture: $arch |
---|
386 | case "$arch" in |
---|
387 | Linux ) |
---|
388 | ;; |
---|
389 | GNU/* ) |
---|
390 | ;; |
---|
391 | *BSD ) |
---|
392 | echo 'EFLAGS+=-liconv' >> Makefile.settings; |
---|
393 | ;; |
---|
394 | SunOS ) |
---|
395 | echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings |
---|
396 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
397 | echo 'EFLAGS+=-liconv' >> Makefile.settings; |
---|
398 | ;; |
---|
399 | Darwin ) |
---|
400 | echo 'EFLAGS+=-liconv' >> Makefile.settings; |
---|
401 | ;; |
---|
402 | IRIX ) |
---|
403 | ;; |
---|
404 | CYGWIN* ) |
---|
405 | echo 'Cygwin is not officially supported.' |
---|
406 | ;; |
---|
407 | * ) |
---|
408 | echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' |
---|
409 | echo 'Please report any problems at http://bugs.bitlbee.org/.' |
---|
410 | ;; |
---|
411 | esac |
---|
412 | |
---|
413 | echo |
---|
414 | echo 'Configuration done:' |
---|
415 | |
---|
416 | if [ "$debug" = "1" ]; then |
---|
417 | echo ' Debugging enabled.'; |
---|
418 | else |
---|
419 | echo ' Debugging disabled.'; |
---|
420 | fi |
---|
421 | |
---|
422 | if [ "$strip" = "1" ]; then |
---|
423 | echo ' Binary stripping enabled.'; |
---|
424 | else |
---|
425 | echo ' Binary stripping disabled.'; |
---|
426 | fi |
---|
427 | |
---|
428 | if [ "$msn" = "1" ]; then |
---|
429 | echo ' Using SSL library: '$ssl; |
---|
430 | fi |
---|
431 | |
---|
432 | #if [ "$flood" = "0" ]; then |
---|
433 | # echo ' Flood protection disabled.'; |
---|
434 | #else |
---|
435 | # echo ' Flood protection enabled.'; |
---|
436 | #fi |
---|
437 | |
---|
438 | if [ -n "$protocols" ]; then |
---|
439 | echo ' Building with these protocols:' $protocols; |
---|
440 | else |
---|
441 | echo ' Building without IM-protocol support. We wish you a lot of fun...'; |
---|
442 | fi |
---|