source: configure @ d1d6776

Last change on this file since d1d6776 was 7b23afd, checked in by Jelmer Vernooij <jelmer@…>, at 2005-11-07T16:16:18Z

Migrate my pluginable branch to use Wilmers' branch as parent

  • Property mode set to 100755
File size: 9.7 KB
Line 
1#!/bin/sh
2
3##############################
4##  Configurer for BitlBee  ##
5##                          ##
6##  Copyright 2004 Lintux   ##
7##  Copyright 2002 Lucumo   ##
8##############################
9
10prefix='/usr/local/'
11bindir='$prefix/sbin/'
12etcdir='$prefix/etc/bitlbee/'
13mandir='$prefix/share/man/'
14datadir='$prefix/share/bitlbee/'
15config='/var/lib/bitlbee/'
16plugindir='$prefix/lib/bitlbee'
17
18msn=1
19jabber=1
20oscar=1
21yahoo=1
22
23debug=0
24strip=1
25flood=0
26ipv6=1
27ssl=auto
28
29arch=`uname -s`
30cpu=`uname -m`
31
32echo BitlBee configure
33
34while [ -n "$1" ]; do
35        e="`expr "X$1" : 'X--\(.*=.*\)'`"
36        if [ -z "$e" ]; then
37                cat<<EOF
38
39Usage: $0 [OPTIONS]
40
41Option          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
64EOF
65                exit;
66        fi
67        eval "$e"
68        shift;
69done
70
71# Expand $prefix and get rid of double slashes
72bindir=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'`
73etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'`
74mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'`
75datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'`
76config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'`
77plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
78
79cat<<EOF>Makefile.settings
80## BitlBee settings, generated by configure
81PREFIX=$prefix
82BINDIR=$bindir
83ETCDIR=$etcdir
84MANDIR=$mandir
85DATADIR=$datadir
86PLUGINDIR=$plugindir
87CONFIG=$config
88
89ARCH=$arch
90CPU=$cpu
91OUTFILE=bitlbee
92
93DESTDIR=
94LFLAGS=
95EFLAGS=
96EOF
97
98cat<<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"
110EOF
111
112if [ "$ipv6" = "1" ]; then
113        echo '#define IPV6' >> config.h
114fi
115
116if [ "$debug" = "1" ]; then
117        echo 'CFLAGS=-g' >> Makefile.settings
118        echo 'DEBUG=1' >> Makefile.settings
119        echo '#define DEBUG' >> config.h
120else
121        echo 'CFLAGS=-O3' >> Makefile.settings
122fi
123
124echo CFLAGS+=-I`pwd` -I`pwd`/protocols -I. >> Makefile.settings
125
126if [ -n "$CC" ]; then
127        echo "CC=$CC" >> Makefile.settings;
128elif type gcc > /dev/null 2> /dev/null; then
129        echo "CC=gcc" >> Makefile.settings;
130elif type cc > /dev/null 2> /dev/null; then
131        echo "CC=cc" >> Makefile.settings;
132else
133        echo 'Cannot find a C compiler, aborting.'
134        exit 1;
135fi
136
137if [ -n "$LD" ]; then
138        echo "LD=$LD" >> Makefile.settings;
139elif type ld > /dev/null 2> /dev/null; then
140        echo "LD=ld" >> Makefile.settings;
141else
142        echo 'Cannot find ld, aborting.'
143        exit 1;
144fi
145
146if type pkg-config > /dev/null 2>/dev/null && pkg-config glib-2.0; then
147        cat<<EOF>>Makefile.settings
148EFLAGS+=`pkg-config --libs glib-2.0 gmodule-2.0`
149CFLAGS+=`pkg-config --cflags glib-2.0 gmodule-2.0`
150EOF
151        echo '#define GLIB2' >> config.h
152elif type glib-config > /dev/null 2> /dev/null; then
153        cat<<EOF>>Makefile.settings
154EFLAGS+=`glib-config --libs`
155CFLAGS+=`glib-config --cflags`
156EOF
157        echo '#define GLIB1' >> config.h
158else
159        echo 'Cannot find glib development libraries, aborting. (Install libglib-dev?)'
160        exit 1;
161fi
162
163if [ -r /usr/include/iconv.h ]; then
164        :;
165elif [ -r /usr/local/include/iconv.h ]; then
166        echo CFLAGS+=-I/usr/local/include >> Makefile.settings;
167else
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.';
171fi
172
173
174detect_gnutls()
175{
176        if libgnutls-config --version > /dev/null 2> /dev/null; then
177                cat <<EOF>>Makefile.settings
178EFLAGS+=`libgnutls-config --libs`
179CFLAGS+=`libgnutls-config --cflags`
180EOF
181               
182                ssl=gnutls
183                ret=1;
184        else
185                ret=0;
186        fi;
187}
188
189detect_nss()
190{
191        if type pkg-config > /dev/null 2>/dev/null && pkg-config mozilla-nss; then
192                cat<<EOF>>Makefile.settings
193EFLAGS+=`pkg-config --libs mozilla-nss`
194CFLAGS+=`pkg-config --cflags mozilla-nss`
195EOF
196               
197                ssl=nss
198                ret=1;
199        else
200                ret=0;
201        fi;
202}
203
204if [ "$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
262fi
263
264if [ "$strip" = 0 ]; then
265        echo "STRIP=\# skip strip" >> Makefile.settings;
266else
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;
284fi
285
286if [ "$flood" = 1 ]; then
287        echo '#define FLOOD_SEND' >> config.h
288fi
289
290if [ -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;
295fi
296
297protocols=''
298protoobjs=''
299
300if [ "$msn" = 0 ]; then
301        echo '#undef WITH_MSN' >> config.h
302else
303        echo '#define WITH_MSN' >> config.h
304        protocols=$protocols'msn '
305        protoobjs=$protoobjs'msnn.o '
306fi
307
308if [ "$jabber" = 0 ]; then
309        echo '#undef WITH_JABBER' >> config.h
310else
311        echo '#define WITH_JABBER' >> config.h
312        protocols=$protocols'jabber '
313        protoobjs=$protoobjs'jabberr.o '
314fi
315
316if [ "$oscar" = 0 ]; then
317        echo '#undef WITH_OSCAR' >> config.h
318else
319        echo '#define WITH_OSCAR' >> config.h
320        protocols=$protocols'oscar '
321        protoobjs=$protoobjs'oscarr.o '
322fi
323
324if [ "$yahoo" = 0 ]; then
325        echo '#undef WITH_YAHOO' >> config.h
326else
327        echo '#define WITH_YAHOO' >> config.h
328        protocols=$protocols'yahoo '
329        protoobjs=$protoobjs'yahooo.o '
330fi
331
332if [ "$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!"
336fi
337
338echo "PROTOCOLS = $protocols" >> Makefile.settings
339echo "PROTOOBJS = $protoobjs" >> Makefile.settings
340
341echo
342echo Architecture: $arch
343case "$arch" in
344Linux )
345        echo 'Linux.'
346;;
347GNU/* )
348        echo 'Debian with non-Linux kernel?'
349;;
350*BSD )
351        echo '*BSD.'
352        echo 'EFLAGS+=-liconv' >> Makefile.settings;
353;;
354SunOS )
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;;
360Darwin )
361        echo 'Darwin/Mac OS X.'
362        echo 'EFLAGS+=-liconv' >> Makefile.settings;
363;;
364IRIX )
365        echo 'IRIX.'
366;;
367CYGWIN* )
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;;
373esac
374
375echo
376echo 'Configuration done:'
377
378if [ "$debug" = "1" ]; then
379        echo '  Debugging enabled.';
380else
381        echo '  Debugging disabled.';
382fi
383
384if [ "$strip" = "1" ]; then
385        echo '  Binary stripping enabled.';
386else
387        echo '  Binary stripping disabled.';
388fi
389
390if [ "$msn" = "1" ]; then
391        echo '  Using SSL library: '$ssl;
392fi
393
394if [ "$flood" = "0" ]; then
395        echo '  Flood protection disabled.';
396else
397        echo '  Flood protection enabled.';
398fi
399
400if [ -n "$protocols" ]; then
401        echo '  Building with these protocols:' $protocols;
402else
403        echo '  Building without IM-protocol support. We wish you a lot of fun...';
404fi
Note: See TracBrowser for help on using the repository browser.