source: configure @ 5973412

Last change on this file since 5973412 was 5973412, checked in by Jelmer Vernooij <jelmer@…>, at 2006-06-03T20:52:40Z

Try to detect -lldap

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