source: configure @ 39cc341

Last change on this file since 39cc341 was ffea9b9, checked in by Wilmer van der Gaast <wilmer@…>, at 2005-12-26T12:41:29Z

configure now uses the bzr revision number as version number if compiling from a .bzr tree.

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