source: configure @ 875ad42

Last change on this file since 875ad42 was aec56b0, checked in by Jelmer Vernooij <jelmer@…>, at 2006-05-26T15:46:23Z

Allow overriding --arch, support --arch=Windows

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