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
="/lib /lib64 /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64"
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
140 srcdir
=$
(cd $
(dirname $0);pwd)
142 if [ "$srcdir" != "$currdir" ]; then
144 echo "configure script run from a different directory. Will create some symlinks..."
145 if [ ! -e Makefile
-o -L Makefile
]; then
146 COPYDIRS
="doc lib protocols tests utils"
147 mkdir
-p $
(cd "$srcdir"; find $COPYDIRS -type d
)
148 find .
-name Makefile
-type l
-print0 |
xargs -0 rm 2> /dev
/null
151 for i
in $
(find .
-name Makefile
-type f
); do
152 ln -s "$PWD${i#.}" "$dst/$i";
158 echo "_SRCDIR_=$srcdir/" >> Makefile.settings
159 CFLAGS
="$CFLAGS -I${dst}"
165 /* BitlBee settings, generated by configure
167 Do *NOT* use any of these defines in your code without thinking twice, most
168 of them can/will be overridden at run-time */
170 #define CONFIG "$config"
171 #define ETCDIR "$etcdir"
172 #define VARDIR "$datadir"
173 #define PLUGINDIR "$plugindir"
174 #define PIDFILE "$pidfile"
175 #define IPCSOCKET "$ipcsocket"
182 if [ -n "$target" ]; then
183 PKG_CONFIG_LIBDIR
=/usr
/$target/lib
/pkgconfig
184 export PKG_CONFIG_LIBDIR
185 PATH
=/usr
/$target/bin
:$PATH
188 systemlibdirs
="/usr/$target/lib"
192 if [ "$debug" = "1" ]; then
193 [ -z "$CFLAGS" ] && CFLAGS
=-g
194 echo 'DEBUG=1' >> Makefile.settings
195 CFLAGS
="$CFLAGS -DDEBUG"
197 [ -z "$CFLAGS" ] && CFLAGS
="-O2 -fno-strict-aliasing"
200 echo CFLAGS
=$CFLAGS $CPPFLAGS >> Makefile.settings
201 echo CFLAGS
+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols
-I.
>> Makefile.settings
203 echo CFLAGS
+=-DHAVE_CONFIG_H >> Makefile.settings
205 if [ -n "$CC" ]; then
207 elif type gcc
> /dev
/null
2> /dev
/null
; then
209 elif type cc
> /dev
/null
2> /dev
/null
; then
212 echo 'Cannot find a C compiler, aborting.'
216 echo "CC=$CC" >> Makefile.settings
;
217 if echo $CC |
grep -qw gcc
; then
218 # Apparently -Wall is gcc-specific?
219 echo CFLAGS
+=-Wall >> Makefile.settings
222 if [ -z "$LD" ]; then
223 if type ld
> /dev
/null
2> /dev
/null
; then
226 echo 'Cannot find ld, aborting.'
231 echo "LD=$LD" >> Makefile.settings
233 if [ -z "$PKG_CONFIG" ]; then
234 PKG_CONFIG
=pkg-config
237 if $PKG_CONFIG --version > /dev
/null
2>/dev
/null
&& $PKG_CONFIG glib-2.0
; then
238 if $PKG_CONFIG glib-2.0
--atleast-version=$GLIB_MIN_VERSION; then
239 cat<<EOF>>Makefile.settings
240 EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0`
241 CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0`
245 echo 'Found glib2 '`$PKG_CONFIG glib-2.0 --modversion`', but version '$GLIB_MIN_VERSION' or newer is required.'
250 echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)'
254 if [ "$events" = "libevent" ]; then
255 if ! [ -f "${libevent}include/event.h" ]; then
257 echo 'Warning: Could not find event.h, you might have to install it and/or specify'
258 echo 'its location using the --libevent= argument. (Example: If event.h is in'
259 echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)'
262 echo '#define EVENTS_LIBEVENT' >> config.h
263 cat <<EOF>>Makefile.settings
264 EFLAGS+=-levent -L${libevent}lib
265 CFLAGS+=-I${libevent}include
267 elif [ "$events" = "glib" ]; then
268 ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...):
269 echo '#define EVENTS_GLIB' >> config.h
272 echo 'ERROR: Unknown event handler specified.'
275 echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings
279 if $PKG_CONFIG --exists gnutls
; then
280 cat <<EOF>>Makefile.settings
281 EFLAGS+=`$PKG_CONFIG --libs gnutls` `libgcrypt-config --libs`
282 CFLAGS+=`$PKG_CONFIG --cflags gnutls` `libgcrypt-config --cflags`
285 if ! pkg-config gnutls
--atleast-version=2.8; then
287 echo 'Warning: With GnuTLS versions <2.8, certificate expire dates are not verified.'
290 elif libgnutls-config
--version > /dev
/null
2> /dev
/null
; then
291 cat <<EOF>>Makefile.settings
292 EFLAGS+=`libgnutls-config --libs` `libgcrypt-config --libs`
293 CFLAGS+=`libgnutls-config --cflags` `libgcrypt-config --cflags`
305 if $PKG_CONFIG --version > /dev
/null
2>/dev
/null
&& $PKG_CONFIG nss
; then
306 cat<<EOF>>Makefile.settings
307 EFLAGS+=`$PKG_CONFIG --libs nss`
308 CFLAGS+=`$PKG_CONFIG --cflags nss`
320 TMPFILE
=$
(mktemp
/tmp
/bitlbee-configure.XXXXXX
)
321 if $CC -o $TMPFILE -shared -lldap 2>/dev
/null
>/dev
/null
; then
322 cat<<EOF>>Makefile.settings
336 #include <sys/types.h>
337 #include <netinet/in.h>
338 #include <arpa/nameser.h>
343 ns_initparse( NULL, 0, NULL );
344 ns_parserr( NULL, ns_s_an, 0, NULL );
348 detect_resolv_dynamic
()
352 # In FreeBSD res_* routines are present in libc.so
357 TMPFILE
=$
(mktemp
/tmp
/bitlbee-configure.XXXXXX
)
359 echo "$RESOLV_TESTCODE" |
$CC -o $TMPFILE -x c
- $LIBRESOLV >/dev
/null
2>/dev
/null
360 if [ "$?" = "0" ]; then
361 echo "EFLAGS+=$LIBRESOLV" >> Makefile.settings
369 detect_resolv_static
()
371 TMPFILE
=$
(mktemp
/tmp
/bitlbee-configure.XXXXXX
)
373 for i
in $systemlibdirs; do
374 if [ -f $i/libresolv.a
]; then
375 echo "$RESOLV_TESTCODE" |
$CC -o $TMPFILE -x c
- -Wl,$i/libresolv.a
>/dev
/null
2>/dev
/null
376 if [ "$?" = "0" ]; then
377 echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings
387 if [ "$ssl" = "auto" ]; then
389 if [ "$ret" = "0" ]; then
390 # Disable NSS for now as it's known to not work very well ATM.
394 elif [ "$ssl" = "gnutls" ]; then
396 elif [ "$ssl" = "nss" ]; then
398 elif [ "$ssl" = "sspi" ]; then
400 elif [ "$ssl" = "openssl" ]; then
402 echo 'No detection code exists for OpenSSL. Make sure that you have a complete'
403 echo 'install of OpenSSL (including devel/header files) before reporting'
404 echo 'compilation problems.'
406 echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
407 echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better'
408 echo 'supported by us. However, on many BSD machines, OpenSSL can be considered'
409 echo 'part of the operating system, which makes it GPL-compatible.'
411 echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2'
412 echo ' http://www.gnome.org/~markmc/openssl-and-the-gpl.html'
414 echo 'Please note that distributing a BitlBee binary which links to OpenSSL is'
415 echo 'probably illegal. If you want to create and distribute a binary BitlBee'
416 echo 'package, you really should use GnuTLS or NSS instead.'
418 echo 'Also, the OpenSSL license requires us to say this:'
419 echo ' * "This product includes software developed by the OpenSSL Project'
420 echo ' * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"'
422 echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
425 elif [ "$ssl" = "bogus" ]; then
427 echo 'Using bogus SSL code. This means some features will not work properly.'
429 ## Yes, you, at the console! How can you authenticate if you don't have any SSL!?
430 if [ "$msn" = "1" -o "$yahoo" = "1" ]; then
432 echo 'WARNING: The MSN and Yahoo! modules will not work without SSL. Disabling.'
440 echo 'ERROR: Unknown SSL library specified.'
444 if [ "$ret" = "0" ]; then
446 echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
447 echo ' Please note that this script doesn'\''t have detection code for OpenSSL,'
448 echo ' so if you want to use that, you have to select it by hand. If you don'\''t'
449 echo ' need SSL support, you can select the "bogus" SSL library. (--ssl=bogus)'
454 if [ "$msn" = "1" -a "$ssl" != "openssl" -a "$ssl" != "gnutls" ]; then
455 # Needed for MSN only. OpenSSL exports nice cipher functions already,
456 # in case of GnuTLS we should be able to use gcrypt. Otherwise, use
457 # built-in stuff. (Since right now those are the only two supported
458 # SSL modules anyway, this is mostly unnecessary.)
459 echo 'DES=des.o' >> Makefile.settings
462 echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
464 if detect_resolv_dynamic || detect_resolv_static
; then
465 echo '#define HAVE_RESOLV_A' >> config.h
470 if [ "$ldap" = "auto" ]; then
474 if [ "$ldap" = 0 ]; then
475 echo "#undef WITH_LDAP" >> config.h
476 elif [ "$ldap" = 1 ]; then
478 echo 'LDAP support is a work in progress and does NOT work AT ALL right now.'
482 echo "#define WITH_LDAP 1" >> config.h
483 STORAGES
="$STORAGES ldap"
486 for i
in $STORAGES; do
487 STORAGE_OBJS
="$STORAGE_OBJS storage_$i.o"
489 echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings
491 if [ "$strip" = 0 ]; then
492 echo "STRIP=\# skip strip" >> Makefile.settings
;
494 if [ "$debug" = 1 ]; then
496 echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
497 echo 'STRIP=\# skip strip' >> Makefile.settings
499 elif [ -n "$STRIP" ]; then
500 echo "STRIP=$STRIP" >> Makefile.settings
;
501 elif type strip
> /dev
/null
2> /dev
/null
; then
502 echo "STRIP=strip" >> Makefile.settings
;
505 echo 'No strip utility found, cannot remove unnecessary parts from executable.'
506 echo 'STRIP=\# skip strip' >> Makefile.settings
511 if [ -z "$systemdsystemunitdir" ]; then
512 if $PKG_CONFIG --exists systemd
; then
513 systemdsystemunitdir
=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
516 if [ -n "$systemdsystemunitdir" ]; then
517 if [ "$systemdsystemunitdir" != "no" ]; then
518 echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings
522 if [ "$gcov" = "1" ]; then
523 echo "CFLAGS+=--coverage" >> Makefile.settings
524 echo "EFLAGS+=--coverage" >> Makefile.settings
527 if [ "$plugins" = 0 ]; then
528 echo '#undef WITH_PLUGINS' >> config.h
530 echo '#define WITH_PLUGINS' >> config.h
534 for i
in / /usr
/usr
/local; do
535 if [ -f ${i}/lib
/libotr.a
]; then
540 if [ "$otr" = "auto" ]; then
541 if [ -n "$otrprefix" ]; then
547 if [ "$otr" = 1 ]; then
549 echo '#define OTR_BI' >> config.h
550 echo "EFLAGS+=-L${otrprefix}/lib -lotr" >> Makefile.settings
551 echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
552 echo 'OTR_BI=otr.o' >> Makefile.settings
553 elif [ "$otr" = "plugin" ]; then
554 echo '#define OTR_PI' >> config.h
555 echo "OTRFLAGS=-L${otrprefix}/lib -lotr" >> Makefile.settings
556 echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
557 echo 'OTR_PI=otr.so' >> Makefile.settings
560 if [ "$skype" = "1" -o "$skype" = "plugin" ]; then
561 echo 'SKYPE_PI=skype.so' >> Makefile.settings
562 protocols_mods
="$protocol_mods skype(plugin)"
565 if [ ! -e doc
/user-guide
/help.txt
] && ! type xmlto
> /dev
/null
2> /dev
/null
; then
567 echo 'WARNING: Building from an unreleased source tree without prebuilt helpfile.'
568 echo 'Install xmlto if you want online help to work.'
572 if [ -z "$BITLBEE_VERSION" -a -d .bzr
] && type bzr
> /dev
/null
2> /dev
/null
; then
574 if [ -n "$nick" -a "$nick" != "bitlbee" ]; then
580 echo 'Using bzr revision #'$rev' as version number'
581 BITLBEE_VERSION
=\"bzr
$nick-$rev\"
584 if [ -n "$BITLBEE_VERSION" ]; then
585 echo 'Spoofing version number: '$BITLBEE_VERSION
586 echo '#undef BITLBEE_VERSION' >> config.h
587 echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h
591 if ! make helloworld
> /dev
/null
2>&1; then
592 echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles."
593 echo "BitlBee needs GNU make to build properly. On most systems GNU make is available"
594 echo "under the name 'gmake'."
596 if gmake helloworld
> /dev
/null
2>&1; then
597 echo "gmake seems to be available on your machine, great."
600 echo "gmake is not installed (or not working). Please try to install it."
607 includedir=$includedir
610 Description: IRC to IM gateway
612 Version: $BITLBEE_VERSION
614 Cflags: -I\${includedir}
621 if [ "$purple" = 0 ]; then
622 echo '#undef WITH_PURPLE' >> config.h
624 if ! $PKG_CONFIG purple
; then
626 echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)'
629 echo '#define WITH_PURPLE' >> config.h
630 cat<<EOF>>Makefile.settings
631 EFLAGS += $($PKG_CONFIG purple --libs)
632 PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags)
634 protocols
=$protocols'purple '
635 protoobjs
=$protoobjs'purple_mod.o '
637 # Having both libpurple and native IM modules in one binary may
638 # do strange things. Let's not do that.
644 echo '#undef PACKAGE' >> config.h
645 echo '#define PACKAGE "BitlBee-LIBPURPLE"' >> config.h
647 if [ "$events" = "libevent" ]; then
648 echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling'
649 echo 'outside libpurple, talking to GLib directly. At least for now the combination'
650 echo 'libpurple + libevent is *not* recommended!'
657 echo CFLAGS
+=-MMD -MF .depend
/\$@.d
>> Makefile.settings
658 for i
in . lib protocols protocols
/*/; do
663 if [ "$msn" = 0 ]; then
664 echo '#undef WITH_MSN' >> config.h
666 echo '#define WITH_MSN' >> config.h
667 protocols
=$protocols'msn '
668 protoobjs
=$protoobjs'msn_mod.o '
671 if [ "$jabber" = 0 ]; then
672 echo '#undef WITH_JABBER' >> config.h
674 echo '#define WITH_JABBER' >> config.h
675 protocols
=$protocols'jabber '
676 protoobjs
=$protoobjs'jabber_mod.o '
679 if [ "$oscar" = 0 ]; then
680 echo '#undef WITH_OSCAR' >> config.h
682 echo '#define WITH_OSCAR' >> config.h
683 protocols
=$protocols'oscar '
684 protoobjs
=$protoobjs'oscar_mod.o '
687 if [ "$yahoo" = 0 ]; then
688 echo '#undef WITH_YAHOO' >> config.h
690 echo '#define WITH_YAHOO' >> config.h
691 protocols
=$protocols'yahoo '
692 protoobjs
=$protoobjs'yahoo_mod.o '
695 if [ "$twitter" = 0 ]; then
696 echo '#undef WITH_TWITTER' >> config.h
698 echo '#define WITH_TWITTER' >> config.h
699 protocols
=$protocols'twitter '
700 protoobjs
=$protoobjs'twitter_mod.o '
703 if [ "$protocols" = "PROTOCOLS = " ]; then
704 echo "Warning: You haven't selected any communication protocol to compile!"
705 echo " BitlBee will run, but you will be unable to connect to IM servers!"
708 echo "PROTOCOLS = $protocols" >> Makefile.settings
709 echo "PROTOOBJS = $protoobjs" >> Makefile.settings
711 echo Architecture
: $arch
720 echo 'STRIP=\# skip strip' >> Makefile.settings
725 echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
726 echo 'STRIP=\# skip strip' >> Makefile.settings
727 echo '#define NO_FD_PASSING' >> config.h
730 echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings
733 echo 'Cygwin is not officially supported.'
738 echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
739 echo 'Please report any problems at http://bugs.bitlbee.org/.'
743 if [ -n "$target" ]; then
744 echo "Cross-compiling for: $target"
748 echo 'Configuration done:'
750 if [ "$debug" = "1" ]; then
751 echo ' Debugging enabled.'
753 echo ' Debugging disabled.'
756 if [ "$strip" = "1" ]; then
757 echo ' Binary stripping enabled.'
759 echo ' Binary stripping disabled.'
762 if [ "$otr" = "1" ]; then
763 echo ' Off-the-Record (OTR) Messaging enabled.'
764 elif [ "$otr" = "plugin" ]; then
765 echo ' Off-the-Record (OTR) Messaging enabled (as a plugin).'
767 echo ' Off-the-Record (OTR) Messaging disabled.'
770 if [ -n "$systemdsystemunitdir" ]; then
771 echo ' systemd enabled.'
773 echo ' systemd disabled.'
776 echo ' Using event handler: '$events
777 echo ' Using SSL library: '$ssl
778 #echo ' Building with these storage backends: '$STORAGES
780 if [ -n "$protocols" ]; then
781 echo ' Building with these protocols:' $protocols$protocols_mods
784 echo " Note that BitlBee-libpurple is supported on a best-effort basis. It's"
785 echo " not *fully* compatible with normal BitlBee. Don't use it unless you"
786 echo " absolutely need it (i.e. support for a certain protocol or feature)."
789 echo ' Building without IM-protocol support. We wish you a lot of fun...'