source: configure @ 1da00b1

Last change on this file since 1da00b1 was 1da00b1, checked in by Wilmer van der Gaast <wilmer@…>, at 2007-07-14T23:47:38Z

Hiding LDAP support because it doesn't actually work at all ATM.

  • Property mode set to 100755
File size: 12.1 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/'
17includedir='$prefix/include/bitlbee/'
18libevent='/usr/'
19pidfile='/var/run/bitlbee.pid'
20ipcsocket='/var/run/bitlbee.sock'
21pcdir='$prefix/lib/pkgconfig'
22
23msn=1
24jabber=1
25oscar=1
26yahoo=1
27
28debug=0
29strip=1
30gcov=0
31ipv6=1
32
33events=glib
34ldap=0
35ssl=auto
36
37arch=`uname -s`
38cpu=`uname -m`
39
40GLIB_MIN_VERSION=2.4
41
42echo BitlBee configure
43
44while [ -n "$1" ]; do
45        e="`expr "X$1" : 'X--\(.*=.*\)'`"
46        if [ -z "$e" ]; then
47                cat<<EOF
48
49Usage: $0 [OPTIONS]
50
51Option          Description                             Default
52
53--prefix=...    Directories to put files in             $prefix
54--bindir=...                                            $bindir
55--etcdir=...                                            $etcdir
56--mandir=...                                            $mandir
57--datadir=...                                           $datadir
58--plugindir=...                                         $plugindir
59--pidfile=...                                           $pidfile
60--config=...                                            $config
61--ipcsocket=...                                         $ipcsocket
62
63--msn=0/1       Disable/enable MSN part                 $msn
64--jabber=0/1    Disable/enable Jabber part              $jabber
65--oscar=0/1     Disable/enable Oscar part (ICQ, AIM)    $oscar
66--yahoo=0/1     Disable/enable Yahoo part               $yahoo
67
68--debug=0/1     Disable/enable debugging                $debug
69--strip=0/1     Disable/enable binary stripping         $strip
70--gcov=0/1      Disable/enable test coverage reporting  $gcov
71
72--ipv6=0/1      IPv6 socket support                     $ipv6
73
74--events=...    Event handler (glib, libevent)          $events
75--ssl=...       SSL library to use (gnutls, nss, openssl, bogus, auto)
76                                                        $ssl
77EOF
78                exit;
79        fi
80        eval "$e"
81        shift;
82done
83
84# Expand $prefix and get rid of double slashes
85bindir=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'`
86etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'`
87mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'`
88datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'`
89config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'`
90plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
91includedir=`eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g'`
92libevent=`eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g'`
93
94pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'`
95ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'`
96pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'`
97
98cat<<EOF>Makefile.settings
99## BitlBee settings, generated by configure
100PREFIX=$prefix
101BINDIR=$bindir
102ETCDIR=$etcdir
103MANDIR=$mandir
104DATADIR=$datadir
105PLUGINDIR=$plugindir
106CONFIG=$config
107INCLUDEDIR=$includedir
108PCDIR=$pcdir
109
110ARCH=$arch
111CPU=$cpu
112OUTFILE=bitlbee
113
114DESTDIR=
115LFLAGS=
116EFLAGS=
117EOF
118
119cat<<EOF>config.h
120/* BitlBee settings, generated by configure
121   
122   Do *NOT* use any of these defines in your code without thinking twice, most
123   of them can/will be overridden at run-time */
124
125#define CONFIG "$config"
126#define ETCDIR "$etcdir"
127#define VARDIR "$datadir"
128#define PLUGINDIR "$plugindir"
129#define PIDFILE "$pidfile"
130#define IPCSOCKET "$ipcsocket"
131#define ARCH "$arch"
132#define CPU "$cpu"
133EOF
134
135if [ "$ipv6" = "1" ]; then
136        echo '#define IPV6' >> config.h
137fi
138
139if [ "$debug" = "1" ]; then
140        echo 'CFLAGS=-g' >> Makefile.settings
141        echo 'DEBUG=1' >> Makefile.settings
142        echo '#define DEBUG' >> config.h
143else
144        echo 'CFLAGS=-O3' >> Makefile.settings
145fi
146
147echo CFLAGS+=-I`pwd` -I`pwd`/lib -I`pwd`/protocols -I. >> Makefile.settings
148
149echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings
150
151if [ -n "$CC" ]; then
152        CC=$CC
153elif type gcc > /dev/null 2> /dev/null; then
154        CC=gcc
155elif type cc > /dev/null 2> /dev/null; then
156        CC=cc
157else
158        echo 'Cannot find a C compiler, aborting.'
159        exit 1;
160fi
161
162echo "CC=$CC" >> Makefile.settings;
163
164if [ -n "$LD" ]; then
165        echo "LD=$LD" >> Makefile.settings;
166elif type ld > /dev/null 2> /dev/null; then
167        echo "LD=ld" >> Makefile.settings;
168else
169        echo 'Cannot find ld, aborting.'
170        exit 1;
171fi
172
173if [ -z "$PKG_CONFIG" ]; then
174        PKG_CONFIG=pkg-config
175fi
176
177if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then
178        if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then
179                cat<<EOF>>Makefile.settings
180EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0`
181CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0`
182EOF
183        else
184                echo
185                echo 'Found glib2 '`$PKG_CONFIG glib-2.0 --modversion`', but version '$GLIB_MIN_VERSION' or newer is required.'
186                exit 1
187        fi
188else
189        echo
190        echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)'
191        exit 1
192fi
193
194if [ "$events" = "libevent" ]; then
195        if ! [ -e "${libevent}include/event.h" ]; then
196                echo
197                echo 'Warning: Could not find event.h, you might have to install it and/or specify'
198                echo 'its location using the --libevent= argument. (Example: If event.h is in'
199                echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)'
200        fi
201       
202        echo '#define EVENTS_LIBEVENT' >> config.h
203        cat <<EOF>>Makefile.settings
204EFLAGS+=-levent -L${libevent}lib
205CFLAGS+=-I${libevent}include
206EOF
207elif [ "$events" = "glib" ]; then
208        ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...):
209        echo '#define EVENTS_GLIB' >> config.h
210else
211        echo
212        echo 'ERROR: Unknown event handler specified.'
213        exit 1
214fi
215echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings
216
217detect_gnutls()
218{
219        if libgnutls-config --version > /dev/null 2> /dev/null; then
220                cat <<EOF>>Makefile.settings
221EFLAGS+=`libgnutls-config --libs`
222CFLAGS+=`libgnutls-config --cflags`
223EOF
224               
225                ssl=gnutls
226                ret=1;
227        else
228                ret=0;
229        fi;
230}
231
232detect_nss()
233{
234        if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG mozilla-nss; then
235                cat<<EOF>>Makefile.settings
236EFLAGS+=`$PKG_CONFIG --libs mozilla-nss`
237CFLAGS+=`$PKG_CONFIG --cflags mozilla-nss`
238EOF
239               
240                ssl=nss
241                ret=1;
242        else
243                ret=0;
244        fi;
245}
246
247detect_ldap()
248{
249        TMPFILE=`mktemp`
250        if $CC -o $TMPFILE -shared -lldap 2>/dev/null >/dev/null; then
251                cat<<EOF>>Makefile.settings
252EFLAGS+=-lldap
253CFLAGS+=
254EOF
255                ldap=1
256                rm -f $TMPFILE
257                ret=1
258        else
259                ldap=0
260                ret=0
261        fi
262}
263
264if [ "$ssl" = "auto" ]; then
265        detect_gnutls
266        if [ "$ret" = "0" ]; then
267                detect_nss
268        fi
269elif [ "$ssl" = "gnutls" ]; then
270        detect_gnutls
271elif [ "$ssl" = "nss" ]; then
272        detect_nss
273elif [ "$ssl" = "openssl" ]; then
274        echo
275        echo 'No detection code exists for OpenSSL. Make sure that you have a complete'
276        echo 'install of OpenSSL (including devel/header files) before reporting'
277        echo 'compilation problems.'
278        echo
279        echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
280        echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better'
281        echo 'supported by us. However, on many BSD machines, OpenSSL can be considered'
282        echo 'part of the operating system, which makes it GPL-compatible.'
283        echo
284        echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2'
285        echo '                    http://www.gnome.org/~markmc/openssl-and-the-gpl.html'
286        echo
287        echo 'Please note that distributing a BitlBee binary which links to OpenSSL is'
288        echo 'probably illegal. If you want to create and distribute a binary BitlBee'
289        echo 'package, you really should use GnuTLS or NSS instead.'
290        echo
291        echo 'Also, the OpenSSL license requires us to say this:'
292        echo ' *    "This product includes software developed by the OpenSSL Project'
293        echo ' *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"'
294       
295        echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
296       
297        ret=1
298elif [ "$ssl" = "bogus" ]; then
299        echo
300        echo 'Using bogus SSL code. This means some features will not work properly.'
301       
302        ## Yes, you, at the console! How can you authenticate if you don't have any SSL!?
303        if [ "$msn" = "1" ]; then
304                echo
305                echo 'Real SSL support is necessary for MSN authentication, will build without'
306                echo 'MSN protocol support.'
307                msn=0
308        fi
309       
310        ret=1
311else
312        echo
313        echo 'ERROR: Unknown SSL library specified.'
314        exit 1
315fi
316
317if [ "$ret" = "0" ]; then
318        echo
319        echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
320        echo '       Please note that this script doesn'\''t have detection code for OpenSSL,'
321        echo '       so if you want to use that, you have to select it by hand. If you don'\''t'
322        echo '       need SSL support, you can select the "bogus" SSL library. (--ssl=bogus)'
323       
324        exit 1
325fi;
326
327echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
328
329for i in /lib /usr/lib /usr/local/lib; do
330        if [ -e $i/libresolv.a ]; then
331                echo '#define HAVE_RESOLV_A' >> config.h
332                echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings
333                break
334        fi
335done
336
337STORAGES="text xml"
338
339if [ "$ldap" = "auto" ]; then
340        detect_ldap
341fi
342
343if [ "$ldap" = 0 ]; then
344        echo "#undef WITH_LDAP" >> config.h
345elif [ "$ldap" = 1 ]; then
346        echo
347        echo 'LDAP support is a work in progress and does NOT work AT ALL right now.'
348        echo
349        exit 1
350       
351        echo "#define WITH_LDAP 1" >> config.h
352        STORAGES="$STORAGES ldap"
353fi
354
355for i in $STORAGES; do
356        STORAGE_OBJS="$STORAGE_OBJS storage_$i.o"
357done
358echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings
359
360if [ "$strip" = 0 ]; then
361        echo "STRIP=\# skip strip" >> Makefile.settings;
362else
363        if [ "$debug" = 1 ]; then
364                echo
365                echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
366                echo 'STRIP=\# skip strip' >> Makefile.settings
367                strip=0;
368        elif [ -n "$STRIP" ]; then
369                echo "STRIP=$STRIP" >> Makefile.settings;
370        elif type strip > /dev/null 2> /dev/null; then
371                echo "STRIP=strip" >> Makefile.settings;
372        else
373                echo
374                echo 'No strip utility found, cannot remove unnecessary parts from executable.'
375                echo 'STRIP=\# skip strip' >> Makefile.settings
376                strip=0;
377        fi;
378fi
379
380if [ "$gcov" = "1" ]; then
381        echo "CFLAGS+=-ftest-coverage -fprofile-arcs" >> Makefile.settings
382        echo "EFLAGS+=-lgcov" >> Makefile.settings
383fi
384
385echo
386if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then
387        nick=`bzr nick`
388        if [ -n "$nick" -a "$nick" != "bitlbee" ]; then
389                nick="-$nick"
390        else
391                nick=""
392        fi
393        rev=`bzr revno`
394        echo 'Using bzr revision #'$rev' as version number'
395        BITLBEE_VERSION=\"bzr$nick-$rev\"
396fi
397
398if [ -n "$BITLBEE_VERSION" ]; then
399        echo 'Spoofing version number: '$BITLBEE_VERSION
400        echo '#undef BITLBEE_VERSION' >> config.h
401        echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h
402        echo
403fi
404
405cat <<EOF>bitlbee.pc
406prefix=$prefix
407includedir=$includedir
408
409Name: bitlbee
410Description: IRC to IM gateway
411Requires: glib-2.0
412Version: $BITLBEE_VERSION
413Libs:
414Cflags: -I\${includedir}
415
416EOF
417
418protocols=''
419protoobjs=''
420
421if [ "$msn" = 0 ]; then
422        echo '#undef WITH_MSN' >> config.h
423else
424        echo '#define WITH_MSN' >> config.h
425        protocols=$protocols'msn '
426        protoobjs=$protoobjs'msn_mod.o '
427fi
428
429if [ "$jabber" = 0 ]; then
430        echo '#undef WITH_JABBER' >> config.h
431else
432        echo '#define WITH_JABBER' >> config.h
433        protocols=$protocols'jabber '
434        protoobjs=$protoobjs'jabber_mod.o '
435fi
436
437if [ "$oscar" = 0 ]; then
438        echo '#undef WITH_OSCAR' >> config.h
439else
440        echo '#define WITH_OSCAR' >> config.h
441        protocols=$protocols'oscar '
442        protoobjs=$protoobjs'oscar_mod.o '
443fi
444
445if [ "$yahoo" = 0 ]; then
446        echo '#undef WITH_YAHOO' >> config.h
447else
448        echo '#define WITH_YAHOO' >> config.h
449        protocols=$protocols'yahoo '
450        protoobjs=$protoobjs'yahoo_mod.o '
451fi
452
453if [ "$protocols" = "PROTOCOLS = " ]; then
454        echo "WARNING: You haven't selected any communication protocol to compile!"
455        echo "         BitlBee will run, but you will be unable to connect to IM servers!"
456fi
457
458echo "PROTOCOLS = $protocols" >> Makefile.settings
459echo "PROTOOBJS = $protoobjs" >> Makefile.settings
460
461echo Architecture: $arch
462case "$arch" in
463Linux )
464;;
465GNU/* )
466;;
467*BSD )
468;;
469Darwin )
470;;
471IRIX )
472;;
473SunOS )
474        echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
475        echo 'STRIP=\# skip strip' >> Makefile.settings
476;;
477AIX )
478        echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings
479;;
480CYGWIN* )
481        echo 'Cygwin is not officially supported.'
482;;
483* )
484        echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
485        echo 'Please report any problems at http://bugs.bitlbee.org/.'
486;;
487esac
488
489echo
490echo 'Configuration done:'
491
492if [ "$debug" = "1" ]; then
493        echo '  Debugging enabled.'
494else
495        echo '  Debugging disabled.'
496fi
497
498if [ "$strip" = "1" ]; then
499        echo '  Binary stripping enabled.'
500else
501        echo '  Binary stripping disabled.'
502fi
503
504echo '  Using event handler: '$events
505echo '  Using SSL library: '$ssl
506echo '  Building with these storage backends: '$STORAGES
507
508if [ -n "$protocols" ]; then
509        echo '  Building with these protocols:' $protocols
510else
511        echo '  Building without IM-protocol support. We wish you a lot of fun...'
512fi
Note: See TracBrowser for help on using the repository browser.