source: configure @ 7c0a497

Last change on this file since 7c0a497 was b5a22e3, checked in by Wilmer van der Gaast <wilmer@…>, at 2005-12-17T16:55:18Z

Forgot to update configure for the _mod change.

  • 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--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'`
76plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
77
78cat<<EOF>Makefile.settings
79## BitlBee settings, generated by configure
80PREFIX=$prefix
81BINDIR=$bindir
82ETCDIR=$etcdir
83MANDIR=$mandir
84DATADIR=$datadir
85PLUGINDIR=$plugindir
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"
106#define PLUGINDIR "$plugindir"
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
125echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings
126
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
147if type pkg-config > /dev/null 2>/dev/null && pkg-config glib-2.0; then
148        cat<<EOF>>Makefile.settings
149EFLAGS+=`pkg-config --libs glib-2.0 gmodule-2.0`
150CFLAGS+=`pkg-config --cflags glib-2.0 gmodule-2.0`
151EOF
152        echo '#define GLIB2' >> config.h
153elif type glib-config > /dev/null 2> /dev/null; then
154        cat<<EOF>>Makefile.settings
155EFLAGS+=`glib-config --libs`
156CFLAGS+=`glib-config --cflags`
157EOF
158        echo '#define GLIB1' >> config.h
159else
160        echo 'Cannot find glib development libraries, aborting. (Install libglib-dev?)'
161        exit 1;
162fi
163
164if [ -r /usr/include/iconv.h ]; then
165        :;
166elif [ -r /usr/local/include/iconv.h ]; then
167        echo CFLAGS+=-I/usr/local/include >> Makefile.settings;
168else
169        echo
170        echo 'Warning: Could not find iconv.h, you might have to install it and/or modify'
171        echo 'Makefile.settings to tell where this file is.';
172fi
173
174
175detect_gnutls()
176{
177        if libgnutls-config --version > /dev/null 2> /dev/null; then
178                cat <<EOF>>Makefile.settings
179EFLAGS+=`libgnutls-config --libs`
180CFLAGS+=`libgnutls-config --cflags`
181EOF
182               
183                ssl=gnutls
184                ret=1;
185        else
186                ret=0;
187        fi;
188}
189
190detect_nss()
191{
192        if type pkg-config > /dev/null 2>/dev/null && pkg-config mozilla-nss; then
193                cat<<EOF>>Makefile.settings
194EFLAGS+=`pkg-config --libs mozilla-nss`
195CFLAGS+=`pkg-config --cflags mozilla-nss`
196EOF
197               
198                ssl=nss
199                ret=1;
200        else
201                ret=0;
202        fi;
203}
204
205if [ "$msn" = 1 -o "$jabber" = 1 ]; then
206        if [ "$ssl" = "auto" ]; then
207                detect_gnutls
208                if [ "$ret" = "0" ]; then
209                        detect_nss
210                fi;
211        elif [ "$ssl" = "gnutls" ]; then
212                detect_gnutls;
213        elif [ "$ssl" = "nss" ]; then
214                detect_nss;
215        elif [ "$ssl" = "openssl" ]; then
216                echo
217                echo 'No detection code exists for OpenSSL. Make sure that you have a complete'
218                echo 'install of OpenSSL (including devel/header files) before reporting'
219                echo 'compilation problems.'
220                echo
221                echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
222                echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better'
223                echo 'supported by us. However, on many BSD machines, OpenSSL can be considered'
224                echo 'part of the operating system, which makes it GPL-compatible.'
225                echo
226                echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2'
227                echo '                    http://www.gnome.org/~markmc/openssl-and-the-gpl.html'
228                echo
229                echo 'Please note that distributing a BitlBee binary which links to OpenSSL is'
230                echo 'probably illegal. If you want to create and distribute a binary BitlBee'
231                echo 'package, you really should use GnuTLS or NSS instead.'
232                echo
233                echo 'Also, the OpenSSL license requires us to say this:'
234                echo ' *    "This product includes software developed by the OpenSSL Project'
235                echo ' *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"'
236               
237                echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
238               
239                ret=1;
240        elif [ "$ssl" = "bogus" ]; then
241                echo
242                echo 'Using bogus SSL code. This will not make the MSN module work, but it will'
243                echo 'allow you to use the Jabber module - although without working SSL support.'
244               
245                ret=1;
246        else
247                echo
248                echo 'ERROR: Unknown SSL library specified.'
249                exit 1;
250        fi
251       
252        if [ "$ret" = "0" ]; then
253                echo
254                echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
255                echo '       This is necessary for MSN and full Jabber support. To continue,'
256                echo '       install a suitable SSL library or disable MSN support (--msn=0).'
257                echo '       If you want Jabber without SSL support you can try --ssl=bogus.'
258               
259                exit 1;
260        fi;
261       
262        echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
263fi
264
265if [ "$strip" = 0 ]; then
266        echo "STRIP=\# skip strip" >> Makefile.settings;
267else
268        if [ "$debug" = 1 ]; then
269                echo
270                echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
271                echo 'STRIP=\# skip strip' >> Makefile.settings
272                strip=0;
273        elif [ -n "$STRIP" ]; then
274                echo "STRIP=$STRIP" >> Makefile.settings;
275        elif type strip > /dev/null 2> /dev/null; then
276                echo "STRIP=strip" >> Makefile.settings;
277        elif /bin/test -x /usr/ccs/bin/strip; then
278                echo "STRIP=/usr/ccs/bin/strip" >> Makefile.settings;
279        else
280                echo
281                echo 'No strip utility found, cannot remove unnecessary parts from executable.'
282                echo 'STRIP=\# skip strip' >> Makefile.settings
283                strip=0;
284        fi;
285fi
286
287if [ "$flood" = 1 ]; then
288        # echo '#define FLOOD_SEND' >> config.h
289        echo 'Flood protection is disabled in this release because of too many bugs.' 2> /dev/stderr
290        rm config.h
291        rm Makefile.settings
292        exit 1
293fi
294
295if [ -n "$BITLBEE_VERSION" ]; then
296        echo
297        echo 'Spoofing version number: '$BITLBEE_VERSION
298        echo '#undef BITLBEE_VERSION' >> config.h
299        echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h;
300fi
301
302protocols=''
303protoobjs=''
304
305if [ "$msn" = 0 ]; then
306        echo '#undef WITH_MSN' >> config.h
307else
308        echo '#define WITH_MSN' >> config.h
309        protocols=$protocols'msn '
310        protoobjs=$protoobjs'msn_mod.o '
311fi
312
313if [ "$jabber" = 0 ]; then
314        echo '#undef WITH_JABBER' >> config.h
315else
316        echo '#define WITH_JABBER' >> config.h
317        protocols=$protocols'jabber '
318        protoobjs=$protoobjs'jabber_mod.o '
319fi
320
321if [ "$oscar" = 0 ]; then
322        echo '#undef WITH_OSCAR' >> config.h
323else
324        echo '#define WITH_OSCAR' >> config.h
325        protocols=$protocols'oscar '
326        protoobjs=$protoobjs'oscar_mod.o '
327fi
328
329if [ "$yahoo" = 0 ]; then
330        echo '#undef WITH_YAHOO' >> config.h
331else
332        echo '#define WITH_YAHOO' >> config.h
333        protocols=$protocols'yahoo '
334        protoobjs=$protoobjs'yahoo_mod.o '
335fi
336
337if [ "$protocols" = "PROTOCOLS = " ]; then
338        echo
339        echo "WARNING: You haven't selected any communication protocol to compile!"
340        echo "         Bitlbee will run, but you will be unable to connect to IM servers!"
341fi
342
343echo "PROTOCOLS = $protocols" >> Makefile.settings
344echo "PROTOOBJS = $protoobjs" >> Makefile.settings
345
346echo
347echo Architecture: $arch
348case "$arch" in
349Linux )
350;;
351GNU/* )
352;;
353*BSD )
354        echo 'EFLAGS+=-liconv' >> Makefile.settings;
355;;
356SunOS )
357        echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
358        echo 'STRIP=\# skip strip' >> Makefile.settings
359        echo 'EFLAGS+=-liconv' >> Makefile.settings;
360;;
361Darwin )
362        echo 'EFLAGS+=-liconv' >> Makefile.settings;
363;;
364IRIX )
365;;
366CYGWIN* )
367        echo 'Cygwin is not officially supported.'
368;;
369* )
370        echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
371        echo 'Please report any problems at http://bugs.bitlbee.org/.'
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
394#if [ "$flood" = "0" ]; then
395#       echo '  Flood protection disabled.';
396#else
397#       echo '  Flood protection enabled.';
398#fi
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.