3 ##############################
4 ## Configurer for BitlBee ##
6 ## Copyright 2004 Lintux ##
7 ## Copyright 2002 Lucumo ##
8 ##############################
12 sbindir
='$prefix/sbin/'
13 etcdir
='$prefix/etc/bitlbee/'
14 mandir
='$prefix/share/man/'
15 datadir
='$prefix/share/bitlbee/'
16 config
='/var/lib/bitlbee/'
17 plugindir
='$prefix/lib/bitlbee/'
18 includedir
='$prefix/include/bitlbee/'
19 systemdsystemunitdir
=''
21 pidfile
='/var/run/bitlbee.pid'
23 pcdir
='$prefix/lib/pkgconfig'
24 systemlibdirs
="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib"
49 echo BitlBee configure
52 e
="`expr "X
$1" : 'X--\(.*=.*\)'`"
58 Option Description Default
60 --prefix=... Directories to put files in $prefix
62 --sbindir=... $sbindir
65 --datadir=... $datadir
66 --plugindir=... $plugindir
67 --systemdsystemunitdir=... $systemdsystemunitdir
68 --pidfile=... $pidfile
71 --msn=0/1 Disable/enable MSN part $msn
72 --jabber=0/1 Disable/enable Jabber part $jabber
73 --oscar=0/1 Disable/enable Oscar part (ICQ, AIM) $oscar
74 --yahoo=0/1 Disable/enable Yahoo part $yahoo
75 --twitter=0/1 Disable/enable Twitter part $twitter
77 --purple=0/1 Disable/enable libpurple support $purple
78 (automatically disables other protocol modules)
80 --debug=0/1 Disable/enable debugging $debug
81 --strip=0/1 Disable/enable binary stripping $strip
82 --gcov=0/1 Disable/enable test coverage reporting $gcov
83 --plugins=0/1 Disable/enable plugins support $plugins
85 Disable/enable OTR encryption support $otr
87 Disable/enable Skype support $skype
89 --events=... Event handler (glib, libevent) $events
90 --ssl=... SSL library to use (gnutls, nss, openssl, bogus, auto)
93 --target=... Cross compilation target same as host
101 # Expand $prefix and get rid of double slashes
102 bindir
=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'`
103 sbindir
=`eval echo "$sbindir/" | sed 's/\/\{1,\}/\//g'`
104 etcdir
=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'`
105 mandir
=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'`
106 datadir
=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'`
107 config
=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'`
108 plugindir
=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
109 includedir
=`eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g'`
110 libevent
=`eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g'`
112 pidfile
=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'`
113 ipcsocket
=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'`
114 pcdir
=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'`
118 cat<<EOF>Makefile.settings
119 ## BitlBee settings, generated by configure
128 INCLUDEDIR=$includedir
142 srcdir
=$
(cd $
(dirname $0);pwd)
144 if [ "$srcdir" != "$currdir" ]; then
146 echo "configure script run from a different directory. Will create some symlinks..."
147 if [ ! -e Makefile
-o -L Makefile
]; then
148 COPYDIRS
="doc lib protocols tests utils"
149 mkdir
-p $
(cd "$srcdir"; find $COPYDIRS -type d
)
150 find .
-name Makefile
-type l
-print0 |
xargs -0 rm 2> /dev
/null
153 for i
in $
(find .
-name Makefile
-type f
); do
154 ln -s "$PWD${i#.}" "$dst/$i";
160 echo "_SRCDIR_=$srcdir/" >> Makefile.settings
161 CFLAGS
="$CFLAGS -I${dst}"
167 /* BitlBee settings, generated by configure
169 Do *NOT* use any of these defines in your code without thinking twice, most
170 of them can/will be overridden at run-time */
172 #define CONFIG "$config"
173 #define ETCDIR "$etcdir"
174 #define VARDIR "$datadir"
175 #define PLUGINDIR "$plugindir"
176 #define PIDFILE "$pidfile"
177 #define IPCSOCKET "$ipcsocket"
184 if [ -n "$target" ]; then
185 PKG_CONFIG_LIBDIR
=/usr
/$target/lib
/pkgconfig
186 export PKG_CONFIG_LIBDIR
187 PATH
=/usr
/$target/bin
:$PATH
190 systemlibdirs
="/usr/$target/lib"
194 if [ "$debug" = "1" ]; then
195 [ -z "$CFLAGS" ] && CFLAGS
=-g
196 echo 'DEBUG=1' >> Makefile.settings
197 CFLAGS
="$CFLAGS -DDEBUG"
199 [ -z "$CFLAGS" ] && CFLAGS
="-O2 -fno-strict-aliasing"
202 echo CFLAGS
=$CFLAGS $CPPFLAGS >> Makefile.settings
203 echo CFLAGS
+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols
-I.
>> Makefile.settings
205 echo CFLAGS
+=-DHAVE_CONFIG_H >> Makefile.settings
207 if [ -n "$CC" ]; then
209 elif type gcc
> /dev
/null
2> /dev
/null
; then
211 elif type cc
> /dev
/null
2> /dev
/null
; then
214 echo 'Cannot find a C compiler, aborting.'
218 echo "CC=$CC" >> Makefile.settings
;
219 if echo $CC |
grep -qw gcc
; then
220 # Apparently -Wall is gcc-specific?
221 echo CFLAGS
+=-Wall >> Makefile.settings
224 if [ -z "$LD" ]; then
225 if type ld
> /dev
/null
2> /dev
/null
; then
228 echo 'Cannot find ld, aborting.'
233 echo "LD=$LD" >> Makefile.settings
235 if [ -z "$PKG_CONFIG" ]; then
236 PKG_CONFIG
=pkg-config
239 if $PKG_CONFIG --version > /dev
/null
2>/dev
/null
&& $PKG_CONFIG glib-2.0
; then
240 if $PKG_CONFIG glib-2.0
--atleast-version=$GLIB_MIN_VERSION; then
241 cat<<EOF>>Makefile.settings
242 EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0`
243 CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0`
247 echo 'Found glib2 '`$PKG_CONFIG glib-2.0 --modversion`', but version '$GLIB_MIN_VERSION' or newer is required.'
252 echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)'
256 if [ "$events" = "libevent" ]; then
257 if ! [ -f "${libevent}include/event.h" ]; then
259 echo 'Warning: Could not find event.h, you might have to install it and/or specify'
260 echo 'its location using the --libevent= argument. (Example: If event.h is in'
261 echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)'
264 echo '#define EVENTS_LIBEVENT' >> config.h
265 cat <<EOF>>Makefile.settings
266 EFLAGS+=-levent -L${libevent}lib
267 CFLAGS+=-I${libevent}include
269 elif [ "$events" = "glib" ]; then
270 ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...):
271 echo '#define EVENTS_GLIB' >> config.h
274 echo 'ERROR: Unknown event handler specified.'
277 echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings
281 if $PKG_CONFIG --exists gnutls
; then
282 cat <<EOF>>Makefile.settings
283 EFLAGS+=`$PKG_CONFIG --libs gnutls` `libgcrypt-config --libs`
284 CFLAGS+=`$PKG_CONFIG --cflags gnutls` `libgcrypt-config --cflags`
287 if ! pkg-config gnutls
--atleast-version=2.8; then
289 echo 'Warning: With GnuTLS versions <2.8, certificate expire dates are not verified.'
292 elif libgnutls-config
--version > /dev
/null
2> /dev
/null
; then
293 cat <<EOF>>Makefile.settings
294 EFLAGS+=`libgnutls-config --libs` `libgcrypt-config --libs`
295 CFLAGS+=`libgnutls-config --cflags` `libgcrypt-config --cflags`
307 if $PKG_CONFIG --version > /dev
/null
2>/dev
/null
&& $PKG_CONFIG nss
; then
308 cat<<EOF>>Makefile.settings
309 EFLAGS+=`$PKG_CONFIG --libs nss`
310 CFLAGS+=`$PKG_CONFIG --cflags nss`
322 TMPFILE
=$
(mktemp
/tmp
/bitlbee-configure.XXXXXX
)
323 if $CC -o $TMPFILE -shared -lldap 2>/dev
/null
>/dev
/null
; then
324 cat<<EOF>>Makefile.settings
338 #include <sys/types.h>
339 #include <netinet/in.h>
340 #include <arpa/nameser.h>
345 ns_initparse( NULL, 0, NULL );
346 ns_parserr( NULL, ns_s_an, 0, NULL );
350 detect_resolv_dynamic
()
354 # In FreeBSD res_* routines are present in libc.so
359 TMPFILE
=$
(mktemp
/tmp
/bitlbee-configure.XXXXXX
)
361 echo "$RESOLV_TESTCODE" |
$CC -o $TMPFILE -x c
- $LIBRESOLV >/dev
/null
2>/dev
/null
362 if [ "$?" = "0" ]; then
363 echo "EFLAGS+=$LIBRESOLV" >> Makefile.settings
371 detect_resolv_static
()
373 TMPFILE
=$
(mktemp
/tmp
/bitlbee-configure.XXXXXX
)
375 for i
in $systemlibdirs; do
376 if [ -f $i/libresolv.a
]; then
377 echo "$RESOLV_TESTCODE" |
$CC -o $TMPFILE -x c
- -Wl,$i/libresolv.a
>/dev
/null
2>/dev
/null
378 if [ "$?" = "0" ]; then
379 echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings
389 if [ "$ssl" = "auto" ]; then
391 if [ "$ret" = "0" ]; then
392 # Disable NSS for now as it's known to not work very well ATM.
396 elif [ "$ssl" = "gnutls" ]; then
398 elif [ "$ssl" = "nss" ]; then
400 elif [ "$ssl" = "sspi" ]; then
402 elif [ "$ssl" = "openssl" ]; then
404 echo 'No detection code exists for OpenSSL. Make sure that you have a complete'
405 echo 'install of OpenSSL (including devel/header files) before reporting'
406 echo 'compilation problems.'
408 echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
409 echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better'
410 echo 'supported by us. However, on many BSD machines, OpenSSL can be considered'
411 echo 'part of the operating system, which makes it GPL-compatible.'
413 echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2'
414 echo ' http://www.gnome.org/~markmc/openssl-and-the-gpl.html'
416 echo 'Please note that distributing a BitlBee binary which links to OpenSSL is'
417 echo 'probably illegal. If you want to create and distribute a binary BitlBee'
418 echo 'package, you really should use GnuTLS or NSS instead.'
420 echo 'Also, the OpenSSL license requires us to say this:'
421 echo ' * "This product includes software developed by the OpenSSL Project'
422 echo ' * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"'
424 echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
427 elif [ "$ssl" = "bogus" ]; then
429 echo 'Using bogus SSL code. This means some features will not work properly.'
431 ## Yes, you, at the console! How can you authenticate if you don't have any SSL!?
432 if [ "$msn" = "1" -o "$yahoo" = "1" ]; then
434 echo 'WARNING: The MSN and Yahoo! modules will not work without SSL. Disabling.'
442 echo 'ERROR: Unknown SSL library specified.'
446 if [ "$ret" = "0" ]; then
448 echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
449 echo ' Please note that this script doesn'\''t have detection code for OpenSSL,'
450 echo ' so if you want to use that, you have to select it by hand. If you don'\''t'
451 echo ' need SSL support, you can select the "bogus" SSL library. (--ssl=bogus)'
456 if [ "$msn" = "1" -a "$ssl" != "openssl" -a "$ssl" != "gnutls" ]; then
457 # Needed for MSN only. OpenSSL exports nice cipher functions already,
458 # in case of GnuTLS we should be able to use gcrypt. Otherwise, use
459 # built-in stuff. (Since right now those are the only two supported
460 # SSL modules anyway, this is mostly unnecessary.)
461 echo 'DES=des.o' >> Makefile.settings
464 echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
466 if detect_resolv_dynamic || detect_resolv_static
; then
467 echo '#define HAVE_RESOLV_A' >> config.h
472 if [ "$ldap" = "auto" ]; then
476 if [ "$ldap" = 0 ]; then
477 echo "#undef WITH_LDAP" >> config.h
478 elif [ "$ldap" = 1 ]; then
480 echo 'LDAP support is a work in progress and does NOT work AT ALL right now.'
484 echo "#define WITH_LDAP 1" >> config.h
485 STORAGES
="$STORAGES ldap"
488 for i
in $STORAGES; do
489 STORAGE_OBJS
="$STORAGE_OBJS storage_$i.o"
491 echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings
493 if [ "$strip" = 0 ]; then
494 echo "STRIP=\# skip strip" >> Makefile.settings
;
496 if [ "$debug" = 1 ]; then
498 echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
499 echo 'STRIP=\# skip strip' >> Makefile.settings
501 elif [ -n "$STRIP" ]; then
502 echo "STRIP=$STRIP" >> Makefile.settings
;
503 elif type strip
> /dev
/null
2> /dev
/null
; then
504 echo "STRIP=strip" >> Makefile.settings
;
507 echo 'No strip utility found, cannot remove unnecessary parts from executable.'
508 echo 'STRIP=\# skip strip' >> Makefile.settings
513 if [ -z "$systemdsystemunitdir" ]; then
514 if $PKG_CONFIG --exists systemd
; then
515 systemdsystemunitdir
=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
518 if [ -n "$systemdsystemunitdir" ]; then
519 if [ "$systemdsystemunitdir" != "no" ]; then
520 echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings
524 if [ "$gcov" = "1" ]; then
525 echo "CFLAGS+=--coverage" >> Makefile.settings
526 echo "EFLAGS+=--coverage" >> Makefile.settings
529 if [ "$plugins" = 0 ]; then
530 echo '#undef WITH_PLUGINS' >> config.h
532 echo '#define WITH_PLUGINS' >> config.h
536 for i
in / /usr
/usr
/local; do
537 if [ -f ${i}/lib
/libotr.a
]; then
542 if [ "$otr" = "auto" ]; then
543 if [ -n "$otrprefix" ]; then
549 if [ "$otr" = 1 ]; then
551 echo '#define OTR_BI' >> config.h
552 echo "EFLAGS+=-L${otrprefix}/lib -lotr" >> Makefile.settings
553 echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
554 echo 'OTR_BI=otr.o' >> Makefile.settings
555 elif [ "$otr" = "plugin" ]; then
556 echo '#define OTR_PI' >> config.h
557 echo "OTRFLAGS=-L${otrprefix}/lib -lotr" >> Makefile.settings
558 echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
559 echo 'OTR_PI=otr.so' >> Makefile.settings
562 if [ "$skype" = "1" -o "$skype" = "plugin" ]; then
563 echo 'SKYPE_PI=skype.so' >> Makefile.settings
564 protocols_mods
="$protocol_mods skype(plugin)"
567 if [ ! -e doc
/user-guide
/help.txt
] && ! type xmlto
> /dev
/null
2> /dev
/null
; then
569 echo 'WARNING: Building from an unreleased source tree without prebuilt helpfile.'
570 echo 'Install xmlto if you want online help to work.'
574 if [ -z "$BITLBEE_VERSION" -a -d .bzr
] && type bzr
> /dev
/null
2> /dev
/null
; then
576 if [ -n "$nick" -a "$nick" != "bitlbee" ]; then
582 echo 'Using bzr revision #'$rev' as version number'
583 BITLBEE_VERSION
=\"bzr
$nick-$rev\"
586 if [ -n "$BITLBEE_VERSION" ]; then
587 echo 'Spoofing version number: '$BITLBEE_VERSION
588 echo '#undef BITLBEE_VERSION' >> config.h
589 echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h
593 if ! make helloworld
> /dev
/null
2>&1; then
594 echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles."
595 echo "BitlBee needs GNU make to build properly. On most systems GNU make is available"
596 echo "under the name 'gmake'."
598 if gmake helloworld
> /dev
/null
2>&1; then
599 echo "gmake seems to be available on your machine, great."
602 echo "gmake is not installed (or not working). Please try to install it."
609 includedir=$includedir
612 Description: IRC to IM gateway
614 Version: $BITLBEE_VERSION
616 Cflags: -I\${includedir}
623 if [ "$purple" = 0 ]; then
624 echo '#undef WITH_PURPLE' >> config.h
626 if ! $PKG_CONFIG purple
; then
628 echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)'
631 echo '#define WITH_PURPLE' >> config.h
632 cat<<EOF>>Makefile.settings
633 EFLAGS += $($PKG_CONFIG purple --libs)
634 PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags)
636 protocols
=$protocols'purple '
637 protoobjs
=$protoobjs'purple_mod.o '
639 # Having both libpurple and native IM modules in one binary may
640 # do strange things. Let's not do that.
646 echo '#undef PACKAGE' >> config.h
647 echo '#define PACKAGE "BitlBee-LIBPURPLE"' >> config.h
649 if [ "$events" = "libevent" ]; then
650 echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling'
651 echo 'outside libpurple, talking to GLib directly. At least for now the combination'
652 echo 'libpurple + libevent is *not* recommended!'
659 echo CFLAGS
+=-MMD -MF .depend
/\$@.d
>> Makefile.settings
660 for i
in . lib protocols protocols
/*/; do
665 if [ "$msn" = 0 ]; then
666 echo '#undef WITH_MSN' >> config.h
668 echo '#define WITH_MSN' >> config.h
669 protocols
=$protocols'msn '
670 protoobjs
=$protoobjs'msn_mod.o '
673 if [ "$jabber" = 0 ]; then
674 echo '#undef WITH_JABBER' >> config.h
676 echo '#define WITH_JABBER' >> config.h
677 protocols
=$protocols'jabber '
678 protoobjs
=$protoobjs'jabber_mod.o '
681 if [ "$oscar" = 0 ]; then
682 echo '#undef WITH_OSCAR' >> config.h
684 echo '#define WITH_OSCAR' >> config.h
685 protocols
=$protocols'oscar '
686 protoobjs
=$protoobjs'oscar_mod.o '
689 if [ "$yahoo" = 0 ]; then
690 echo '#undef WITH_YAHOO' >> config.h
692 echo '#define WITH_YAHOO' >> config.h
693 protocols
=$protocols'yahoo '
694 protoobjs
=$protoobjs'yahoo_mod.o '
697 if [ "$twitter" = 0 ]; then
698 echo '#undef WITH_TWITTER' >> config.h
700 echo '#define WITH_TWITTER' >> config.h
701 protocols
=$protocols'twitter '
702 protoobjs
=$protoobjs'twitter_mod.o '
705 if [ "$protocols" = "PROTOCOLS = " ]; then
706 echo "Warning: You haven't selected any communication protocol to compile!"
707 echo " BitlBee will run, but you will be unable to connect to IM servers!"
710 echo "PROTOCOLS = $protocols" >> Makefile.settings
711 echo "PROTOOBJS = $protoobjs" >> Makefile.settings
713 echo Architecture
: $arch
722 echo 'STRIP=\# skip strip' >> Makefile.settings
727 echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
728 echo 'STRIP=\# skip strip' >> Makefile.settings
729 echo '#define NO_FD_PASSING' >> config.h
732 echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings
735 echo 'Cygwin is not officially supported.'
740 echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
741 echo 'Please report any problems at http://bugs.bitlbee.org/.'
745 if [ -n "$target" ]; then
746 echo "Cross-compiling for: $target"
750 echo 'Configuration done:'
752 if [ "$debug" = "1" ]; then
753 echo ' Debugging enabled.'
755 echo ' Debugging disabled.'
758 if [ "$strip" = "1" ]; then
759 echo ' Binary stripping enabled.'
761 echo ' Binary stripping disabled.'
764 if [ "$otr" = "1" ]; then
765 echo ' Off-the-Record (OTR) Messaging enabled.'
766 elif [ "$otr" = "plugin" ]; then
767 echo ' Off-the-Record (OTR) Messaging enabled (as a plugin).'
769 echo ' Off-the-Record (OTR) Messaging disabled.'
772 if [ -n "$systemdsystemunitdir" ]; then
773 echo ' systemd enabled.'
775 echo ' systemd disabled.'
778 echo ' Using event handler: '$events
779 echo ' Using SSL library: '$ssl
780 #echo ' Building with these storage backends: '$STORAGES
782 if [ -n "$protocols" ]; then
783 echo ' Building with these protocols:' $protocols$protocols_mods
786 echo " Note that BitlBee-libpurple is supported on a best-effort basis. It's"
787 echo " not *fully* compatible with normal BitlBee. Don't use it unless you"
788 echo " absolutely need it (i.e. support for a certain protocol or feature)."
791 echo ' Building without IM-protocol support. We wish you a lot of fun...'