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