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