source: configure @ 34b17d9

Last change on this file since 34b17d9 was 34b17d9, checked in by Wilmer van der Gaast <wilmer@…>, at 2006-02-02T13:21:44Z

Added PID-file code.

  • Property mode set to 100755
File size: 9.9 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'
17plugindir='$prefix/lib/bitlbee'
18
19msn=1
20jabber=1
21oscar=1
22yahoo=1
23
24debug=0
25strip=1
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--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
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'`
78pidfile=`eval echo "$pidfile/" | sed 's/\/\{1,\}/\//g'`
79
80cat<<EOF>Makefile.settings
81## BitlBee settings, generated by configure
82PREFIX=$prefix
83BINDIR=$bindir
84ETCDIR=$etcdir
85MANDIR=$mandir
86DATADIR=$datadir
87PLUGINDIR=$plugindir
88PIDFILE=$pidfile
89CONFIG=$config
90
91ARCH=$arch
92CPU=$cpu
93OUTFILE=bitlbee
94
95DESTDIR=
96LFLAGS=
97EFLAGS=
98EOF
99
100cat<<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"
113EOF
114
115if [ "$ipv6" = "1" ]; then
116        echo '#define IPV6' >> config.h
117fi
118
119if [ "$debug" = "1" ]; then
120        echo 'CFLAGS=-g' >> Makefile.settings
121        echo 'DEBUG=1' >> Makefile.settings
122        echo '#define DEBUG' >> config.h
123else
124        echo 'CFLAGS=-O3' >> Makefile.settings
125fi
126
127echo CFLAGS+=-I`pwd` -I`pwd`/protocols -I. >> Makefile.settings
128
129echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings
130
131if [ -n "$CC" ]; then
132        echo "CC=$CC" >> Makefile.settings;
133elif type gcc > /dev/null 2> /dev/null; then
134        echo "CC=gcc" >> Makefile.settings;
135elif type cc > /dev/null 2> /dev/null; then
136        echo "CC=cc" >> Makefile.settings;
137else
138        echo 'Cannot find a C compiler, aborting.'
139        exit 1;
140fi
141
142if [ -n "$LD" ]; then
143        echo "LD=$LD" >> Makefile.settings;
144elif type ld > /dev/null 2> /dev/null; then
145        echo "LD=ld" >> Makefile.settings;
146else
147        echo 'Cannot find ld, aborting.'
148        exit 1;
149fi
150
151if [ -z "$PKG_CONFIG" ]; then
152        PKG_CONFIG=pkg-config
153fi
154
155if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then
156        cat<<EOF>>Makefile.settings
157EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0`
158CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0`
159EOF
160        echo '#define GLIB2' >> config.h
161elif type glib-config > /dev/null 2> /dev/null; then
162        cat<<EOF>>Makefile.settings
163EFLAGS+=`glib-config --libs`
164CFLAGS+=`glib-config --cflags`
165EOF
166        echo '#define GLIB1' >> config.h
167else
168        echo 'Cannot find glib development libraries, aborting. (Install libglib-dev?)'
169        exit 1;
170fi
171
172if [ -r /usr/include/iconv.h ]; then
173        :;
174elif [ -r /usr/local/include/iconv.h ]; then
175        echo CFLAGS+=-I/usr/local/include >> Makefile.settings;
176else
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.';
180fi
181
182
183detect_gnutls()
184{
185        if libgnutls-config --version > /dev/null 2> /dev/null; then
186                cat <<EOF>>Makefile.settings
187EFLAGS+=`libgnutls-config --libs`
188CFLAGS+=`libgnutls-config --cflags`
189EOF
190               
191                ssl=gnutls
192                ret=1;
193        else
194                ret=0;
195        fi;
196}
197
198detect_nss()
199{
200        if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG mozilla-nss; then
201                cat<<EOF>>Makefile.settings
202EFLAGS+=`$PKG_CONFIG --libs mozilla-nss`
203CFLAGS+=`$PKG_CONFIG --cflags mozilla-nss`
204EOF
205               
206                ssl=nss
207                ret=1;
208        else
209                ret=0;
210        fi;
211}
212
213if [ "$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
271fi
272
273if [ "$strip" = 0 ]; then
274        echo "STRIP=\# skip strip" >> Makefile.settings;
275else
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;
293fi
294
295echo
296if [ -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\"
300fi
301
302if [ -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
307fi
308
309protocols=''
310protoobjs=''
311
312if [ "$msn" = 0 ]; then
313        echo '#undef WITH_MSN' >> config.h
314else
315        echo '#define WITH_MSN' >> config.h
316        protocols=$protocols'msn '
317        protoobjs=$protoobjs'msn_mod.o '
318fi
319
320if [ "$jabber" = 0 ]; then
321        echo '#undef WITH_JABBER' >> config.h
322else
323        echo '#define WITH_JABBER' >> config.h
324        protocols=$protocols'jabber '
325        protoobjs=$protoobjs'jabber_mod.o '
326fi
327
328if [ "$oscar" = 0 ]; then
329        echo '#undef WITH_OSCAR' >> config.h
330else
331        echo '#define WITH_OSCAR' >> config.h
332        protocols=$protocols'oscar '
333        protoobjs=$protoobjs'oscar_mod.o '
334fi
335
336if [ "$yahoo" = 0 ]; then
337        echo '#undef WITH_YAHOO' >> config.h
338else
339        echo '#define WITH_YAHOO' >> config.h
340        protocols=$protocols'yahoo '
341        protoobjs=$protoobjs'yahoo_mod.o '
342fi
343
344if [ "$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!"
347fi
348
349echo "PROTOCOLS = $protocols" >> Makefile.settings
350echo "PROTOOBJS = $protoobjs" >> Makefile.settings
351
352echo Architecture: $arch
353case "$arch" in
354Linux )
355;;
356GNU/* )
357;;
358*BSD )
359        echo 'EFLAGS+=-liconv' >> Makefile.settings;
360;;
361SunOS )
362        echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
363        echo 'STRIP=\# skip strip' >> Makefile.settings
364        echo 'EFLAGS+=-liconv' >> Makefile.settings;
365;;
366Darwin )
367        echo 'EFLAGS+=-liconv' >> Makefile.settings;
368;;
369IRIX )
370;;
371CYGWIN* )
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;;
378esac
379
380echo
381echo 'Configuration done:'
382
383if [ "$debug" = "1" ]; then
384        echo '  Debugging enabled.';
385else
386        echo '  Debugging disabled.';
387fi
388
389if [ "$strip" = "1" ]; then
390        echo '  Binary stripping enabled.';
391else
392        echo '  Binary stripping disabled.';
393fi
394
395if [ "$msn" = "1" ]; then
396        echo '  Using SSL library: '$ssl;
397fi
398
399#if [ "$flood" = "0" ]; then
400#       echo '  Flood protection disabled.';
401#else
402#       echo '  Flood protection enabled.';
403#fi
404
405if [ -n "$protocols" ]; then
406        echo '  Building with these protocols:' $protocols;
407else
408        echo '  Building without IM-protocol support. We wish you a lot of fun...';
409fi
Note: See TracBrowser for help on using the repository browser.