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