source: configure @ 19ac9c5

Last change on this file since 19ac9c5 was a014331, checked in by Wilmer van der Gaast <wilmer@…>, at 2006-03-30T17:14:38Z

Made configure quiet when it can't find bzr, and added repository nick to
generated version number.

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