[b7d3cc34] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | ############################## |
---|
| 4 | ## Configurer for BitlBee ## |
---|
| 5 | ## ## |
---|
| 6 | ## Copyright 2004 Lintux ## |
---|
| 7 | ## Copyright 2002 Lucumo ## |
---|
| 8 | ############################## |
---|
| 9 | |
---|
| 10 | prefix='/usr/local/' |
---|
| 11 | bindir='$prefix/sbin/' |
---|
| 12 | etcdir='$prefix/etc/bitlbee/' |
---|
| 13 | mandir='$prefix/share/man/' |
---|
| 14 | datadir='$prefix/share/bitlbee/' |
---|
| 15 | config='/var/lib/bitlbee/' |
---|
[85cf37f] | 16 | plugindir='$prefix/lib/bitlbee/' |
---|
| 17 | includedir='$prefix/include/bitlbee/' |
---|
| 18 | libevent='/usr/' |
---|
[34b17d9] | 19 | pidfile='/var/run/bitlbee.pid' |
---|
[5c5a586] | 20 | ipcsocket='/var/run/bitlbee.sock' |
---|
[e506d6c] | 21 | pcdir='$prefix/lib/pkgconfig' |
---|
[8462239] | 22 | systemlibdirs="/lib /lib64 /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64" |
---|
[b7d3cc34] | 23 | |
---|
| 24 | msn=1 |
---|
| 25 | jabber=1 |
---|
| 26 | oscar=1 |
---|
| 27 | yahoo=1 |
---|
[1b221e0] | 28 | twitter=1 |
---|
[4aa0f6b] | 29 | twitter=1 |
---|
[04dc563] | 30 | purple=0 |
---|
[b7d3cc34] | 31 | |
---|
| 32 | debug=0 |
---|
| 33 | strip=1 |
---|
[66b9e86e] | 34 | gcov=0 |
---|
[2abfbc5] | 35 | plugins=1 |
---|
[04f0c10] | 36 | otr=0 |
---|
[85cf37f] | 37 | |
---|
| 38 | events=glib |
---|
[670204f] | 39 | ldap=0 |
---|
[b7d3cc34] | 40 | ssl=auto |
---|
| 41 | |
---|
| 42 | arch=`uname -s` |
---|
| 43 | cpu=`uname -m` |
---|
| 44 | |
---|
[670204f] | 45 | GLIB_MIN_VERSION=2.4 |
---|
| 46 | |
---|
[b7d3cc34] | 47 | echo BitlBee configure |
---|
| 48 | |
---|
| 49 | while [ -n "$1" ]; do |
---|
| 50 | e="`expr "X$1" : 'X--\(.*=.*\)'`" |
---|
| 51 | if [ -z "$e" ]; then |
---|
| 52 | cat<<EOF |
---|
| 53 | |
---|
| 54 | Usage: $0 [OPTIONS] |
---|
| 55 | |
---|
| 56 | Option Description Default |
---|
| 57 | |
---|
| 58 | --prefix=... Directories to put files in $prefix |
---|
| 59 | --bindir=... $bindir |
---|
| 60 | --etcdir=... $etcdir |
---|
| 61 | --mandir=... $mandir |
---|
| 62 | --datadir=... $datadir |
---|
[7b23afd] | 63 | --plugindir=... $plugindir |
---|
[34b17d9] | 64 | --pidfile=... $pidfile |
---|
[b7d3cc34] | 65 | --config=... $config |
---|
[6dff9d4] | 66 | --ipcsocket=... $ipcsocket |
---|
[b7d3cc34] | 67 | |
---|
| 68 | --msn=0/1 Disable/enable MSN part $msn |
---|
| 69 | --jabber=0/1 Disable/enable Jabber part $jabber |
---|
| 70 | --oscar=0/1 Disable/enable Oscar part (ICQ, AIM) $oscar |
---|
| 71 | --yahoo=0/1 Disable/enable Yahoo part $yahoo |
---|
[4aa0f6b] | 72 | --twitter=0/1 Disable/enable Twitter part $twitter |
---|
[b7d3cc34] | 73 | |
---|
[796da03] | 74 | --purple=0/1 Disable/enable libpurple support $purple |
---|
[04f0c10] | 75 | (automatically disables other protocol modules) |
---|
[b7d3cc34] | 76 | |
---|
| 77 | --debug=0/1 Disable/enable debugging $debug |
---|
| 78 | --strip=0/1 Disable/enable binary stripping $strip |
---|
[66b9e86e] | 79 | --gcov=0/1 Disable/enable test coverage reporting $gcov |
---|
[2abfbc5] | 80 | --plugins=0/1 Disable/enable plugins support $plugins |
---|
[04f0c10] | 81 | --otr=0/1/auto/plugin |
---|
| 82 | Disable/enable OTR encryption support $otr |
---|
[b7d3cc34] | 83 | |
---|
[85cf37f] | 84 | --events=... Event handler (glib, libevent) $events |
---|
[b7d3cc34] | 85 | --ssl=... SSL library to use (gnutls, nss, openssl, bogus, auto) |
---|
| 86 | $ssl |
---|
[aec56b0] | 87 | |
---|
[f1e7407] | 88 | --target=... Cross compilation target same as host |
---|
[b7d3cc34] | 89 | EOF |
---|
| 90 | exit; |
---|
| 91 | fi |
---|
| 92 | eval "$e" |
---|
| 93 | shift; |
---|
| 94 | done |
---|
| 95 | |
---|
| 96 | # Expand $prefix and get rid of double slashes |
---|
| 97 | bindir=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'` |
---|
| 98 | etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'` |
---|
| 99 | mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'` |
---|
| 100 | datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'` |
---|
| 101 | config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'` |
---|
[7b23afd] | 102 | plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'` |
---|
[85cf37f] | 103 | includedir=`eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g'` |
---|
| 104 | libevent=`eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g'` |
---|
| 105 | |
---|
[6dff9d4] | 106 | pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'` |
---|
| 107 | ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'` |
---|
[e506d6c] | 108 | pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'` |
---|
[b7d3cc34] | 109 | |
---|
| 110 | cat<<EOF>Makefile.settings |
---|
| 111 | ## BitlBee settings, generated by configure |
---|
| 112 | PREFIX=$prefix |
---|
| 113 | BINDIR=$bindir |
---|
| 114 | ETCDIR=$etcdir |
---|
| 115 | MANDIR=$mandir |
---|
| 116 | DATADIR=$datadir |
---|
[7b23afd] | 117 | PLUGINDIR=$plugindir |
---|
[b7d3cc34] | 118 | CONFIG=$config |
---|
[e506d6c] | 119 | INCLUDEDIR=$includedir |
---|
| 120 | PCDIR=$pcdir |
---|
[b7d3cc34] | 121 | |
---|
[1bf9492] | 122 | TARGET=$target |
---|
[b7d3cc34] | 123 | ARCH=$arch |
---|
| 124 | CPU=$cpu |
---|
| 125 | |
---|
| 126 | DESTDIR= |
---|
| 127 | LFLAGS= |
---|
| 128 | EFLAGS= |
---|
| 129 | EOF |
---|
| 130 | |
---|
[f60079b] | 131 | srcdir="$(dirname $0)" |
---|
| 132 | if [ "$srcdir" != "." ]; then |
---|
| 133 | echo |
---|
| 134 | echo "configure script run from a different directory. Will create some symlinks..." |
---|
| 135 | if [ ! -e Makefile -o -L Makefile ]; then |
---|
[04dc563] | 136 | COPYDIRS="doc lib protocols tests utils" |
---|
| 137 | mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d) |
---|
[f60079b] | 138 | find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null |
---|
| 139 | dst="$PWD" |
---|
| 140 | cd "$srcdir" |
---|
[04dc563] | 141 | for i in $(find . -name Makefile -type f); do |
---|
[f60079b] | 142 | ln -s "$PWD${i#.}" "$dst/$i"; |
---|
| 143 | done |
---|
| 144 | cd "$dst" |
---|
| 145 | rm -rf .bzr |
---|
| 146 | fi |
---|
| 147 | |
---|
| 148 | echo "SRCDIR=$srcdir/" >> Makefile.settings |
---|
| 149 | CFLAGS="$CFLAGS -I${dst}" |
---|
| 150 | else |
---|
| 151 | srcdir=$PWD |
---|
| 152 | fi |
---|
| 153 | |
---|
[b7d3cc34] | 154 | cat<<EOF>config.h |
---|
| 155 | /* BitlBee settings, generated by configure |
---|
| 156 | |
---|
| 157 | Do *NOT* use any of these defines in your code without thinking twice, most |
---|
| 158 | of them can/will be overridden at run-time */ |
---|
| 159 | |
---|
| 160 | #define CONFIG "$config" |
---|
| 161 | #define ETCDIR "$etcdir" |
---|
| 162 | #define VARDIR "$datadir" |
---|
[7b23afd] | 163 | #define PLUGINDIR "$plugindir" |
---|
[34b17d9] | 164 | #define PIDFILE "$pidfile" |
---|
[6dff9d4] | 165 | #define IPCSOCKET "$ipcsocket" |
---|
[b7d3cc34] | 166 | #define ARCH "$arch" |
---|
| 167 | #define CPU "$cpu" |
---|
| 168 | EOF |
---|
| 169 | |
---|
[1bf9492] | 170 | |
---|
| 171 | |
---|
[f1e7407] | 172 | if [ -n "$target" ]; then |
---|
[1bf9492] | 173 | PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig |
---|
| 174 | export PKG_CONFIG_LIBDIR |
---|
[f1e7407] | 175 | PATH=/usr/$target/bin:$PATH |
---|
| 176 | CC=$target-cc |
---|
| 177 | LD=$target-ld |
---|
[1bf9492] | 178 | systemlibdirs="/usr/$target/lib" |
---|
[f1e7407] | 179 | fi |
---|
| 180 | |
---|
[1bf9492] | 181 | |
---|
[b7d3cc34] | 182 | if [ "$debug" = "1" ]; then |
---|
[285b55d] | 183 | [ -z "$CFLAGS" ] && CFLAGS=-g |
---|
[b7d3cc34] | 184 | echo 'DEBUG=1' >> Makefile.settings |
---|
[911cc4f] | 185 | CFLAGS="$CFLAGS -DDEBUG" |
---|
[b7d3cc34] | 186 | else |
---|
[56f260a] | 187 | [ -z "$CFLAGS" ] && CFLAGS="-O2 -fno-strict-aliasing" |
---|
[b7d3cc34] | 188 | fi |
---|
| 189 | |
---|
[daae10f] | 190 | echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings |
---|
[f60079b] | 191 | echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings |
---|
[b7d3cc34] | 192 | |
---|
[f712188] | 193 | echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings |
---|
| 194 | |
---|
[b7d3cc34] | 195 | if [ -n "$CC" ]; then |
---|
[5973412] | 196 | CC=$CC |
---|
[b7d3cc34] | 197 | elif type gcc > /dev/null 2> /dev/null; then |
---|
[5973412] | 198 | CC=gcc |
---|
[b7d3cc34] | 199 | elif type cc > /dev/null 2> /dev/null; then |
---|
[5973412] | 200 | CC=cc |
---|
[b7d3cc34] | 201 | else |
---|
| 202 | echo 'Cannot find a C compiler, aborting.' |
---|
| 203 | exit 1; |
---|
| 204 | fi |
---|
| 205 | |
---|
[5973412] | 206 | echo "CC=$CC" >> Makefile.settings; |
---|
[daae10f] | 207 | if echo $CC | grep -qw gcc; then |
---|
| 208 | # Apparently -Wall is gcc-specific? |
---|
| 209 | echo CFLAGS+=-Wall >> Makefile.settings |
---|
| 210 | fi |
---|
[5973412] | 211 | |
---|
[f1e7407] | 212 | if [ -z "$LD" ]; then |
---|
| 213 | if type ld > /dev/null 2> /dev/null; then |
---|
| 214 | LD=ld |
---|
| 215 | else |
---|
| 216 | echo 'Cannot find ld, aborting.' |
---|
| 217 | exit 1; |
---|
| 218 | fi |
---|
[b7d3cc34] | 219 | fi |
---|
| 220 | |
---|
[f1e7407] | 221 | echo "LD=$LD" >> Makefile.settings |
---|
| 222 | |
---|
[32c632f] | 223 | if [ -z "$PKG_CONFIG" ]; then |
---|
| 224 | PKG_CONFIG=pkg-config |
---|
| 225 | fi |
---|
| 226 | |
---|
| 227 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then |
---|
[670204f] | 228 | if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then |
---|
| 229 | cat<<EOF>>Makefile.settings |
---|
[32c632f] | 230 | EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0` |
---|
| 231 | CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0` |
---|
[b7d3cc34] | 232 | EOF |
---|
[670204f] | 233 | else |
---|
| 234 | echo |
---|
| 235 | echo 'Found glib2 '`$PKG_CONFIG glib-2.0 --modversion`', but version '$GLIB_MIN_VERSION' or newer is required.' |
---|
| 236 | exit 1 |
---|
| 237 | fi |
---|
[b7d3cc34] | 238 | else |
---|
[670204f] | 239 | echo |
---|
[574af7e] | 240 | echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)' |
---|
[670204f] | 241 | exit 1 |
---|
[b7d3cc34] | 242 | fi |
---|
| 243 | |
---|
[85cf37f] | 244 | if [ "$events" = "libevent" ]; then |
---|
[003553b] | 245 | if ! [ -f "${libevent}include/event.h" ]; then |
---|
[85cf37f] | 246 | echo |
---|
| 247 | echo 'Warning: Could not find event.h, you might have to install it and/or specify' |
---|
| 248 | echo 'its location using the --libevent= argument. (Example: If event.h is in' |
---|
| 249 | echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)' |
---|
| 250 | fi |
---|
| 251 | |
---|
| 252 | echo '#define EVENTS_LIBEVENT' >> config.h |
---|
| 253 | cat <<EOF>>Makefile.settings |
---|
| 254 | EFLAGS+=-levent -L${libevent}lib |
---|
| 255 | CFLAGS+=-I${libevent}include |
---|
| 256 | EOF |
---|
| 257 | elif [ "$events" = "glib" ]; then |
---|
| 258 | ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...): |
---|
| 259 | echo '#define EVENTS_GLIB' >> config.h |
---|
[b7d3cc34] | 260 | else |
---|
| 261 | echo |
---|
[85cf37f] | 262 | echo 'ERROR: Unknown event handler specified.' |
---|
| 263 | exit 1 |
---|
[b7d3cc34] | 264 | fi |
---|
[85cf37f] | 265 | echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings |
---|
[b7d3cc34] | 266 | |
---|
| 267 | detect_gnutls() |
---|
| 268 | { |
---|
[4af7b4f] | 269 | if $PKG_CONFIG --exists gnutls; then |
---|
| 270 | cat <<EOF>>Makefile.settings |
---|
[83e47ec] | 271 | EFLAGS+=`$PKG_CONFIG --libs gnutls` `libgcrypt-config --libs` |
---|
| 272 | CFLAGS+=`$PKG_CONFIG --cflags gnutls` `libgcrypt-config --cflags` |
---|
[4af7b4f] | 273 | EOF |
---|
| 274 | ssl=gnutls |
---|
| 275 | ret=1 |
---|
| 276 | elif libgnutls-config --version > /dev/null 2> /dev/null; then |
---|
[b7d3cc34] | 277 | cat <<EOF>>Makefile.settings |
---|
[83e47ec] | 278 | EFLAGS+=`libgnutls-config --libs` `libgcrypt-config --libs` |
---|
| 279 | CFLAGS+=`libgnutls-config --cflags` `libgcrypt-config --cflags` |
---|
[b7d3cc34] | 280 | EOF |
---|
| 281 | |
---|
| 282 | ssl=gnutls |
---|
| 283 | ret=1; |
---|
| 284 | else |
---|
| 285 | ret=0; |
---|
| 286 | fi; |
---|
| 287 | } |
---|
| 288 | |
---|
| 289 | detect_nss() |
---|
| 290 | { |
---|
[32c632f] | 291 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG mozilla-nss; then |
---|
[b7d3cc34] | 292 | cat<<EOF>>Makefile.settings |
---|
[32c632f] | 293 | EFLAGS+=`$PKG_CONFIG --libs mozilla-nss` |
---|
| 294 | CFLAGS+=`$PKG_CONFIG --cflags mozilla-nss` |
---|
[b7d3cc34] | 295 | EOF |
---|
| 296 | |
---|
| 297 | ssl=nss |
---|
| 298 | ret=1; |
---|
| 299 | else |
---|
| 300 | ret=0; |
---|
| 301 | fi; |
---|
| 302 | } |
---|
| 303 | |
---|
[f32d557] | 304 | detect_ldap() |
---|
[f665dab] | 305 | { |
---|
[4fca1db] | 306 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
[5973412] | 307 | if $CC -o $TMPFILE -shared -lldap 2>/dev/null >/dev/null; then |
---|
[f665dab] | 308 | cat<<EOF>>Makefile.settings |
---|
[5973412] | 309 | EFLAGS+=-lldap |
---|
| 310 | CFLAGS+= |
---|
[f665dab] | 311 | EOF |
---|
[f32d557] | 312 | ldap=1 |
---|
[5973412] | 313 | rm -f $TMPFILE |
---|
[f665dab] | 314 | ret=1 |
---|
[b7d3cc34] | 315 | else |
---|
[5973412] | 316 | ldap=0 |
---|
[f665dab] | 317 | ret=0 |
---|
[b7d3cc34] | 318 | fi |
---|
[f665dab] | 319 | } |
---|
| 320 | |
---|
[36cf9fd] | 321 | RESOLV_TESTCODE=' |
---|
| 322 | #include <arpa/nameser.h> |
---|
| 323 | #include <resolv.h> |
---|
| 324 | |
---|
| 325 | int main() |
---|
| 326 | { |
---|
| 327 | ns_initparse( NULL, 0, NULL ); |
---|
| 328 | ns_parserr( NULL, ns_s_an, 0, NULL ); |
---|
| 329 | } |
---|
| 330 | ' |
---|
| 331 | |
---|
| 332 | detect_resolv_dynamic() |
---|
| 333 | { |
---|
[4fca1db] | 334 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
[8462239] | 335 | ret=1 |
---|
| 336 | echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -lresolv >/dev/null 2>/dev/null |
---|
[36cf9fd] | 337 | if [ "$?" = "0" ]; then |
---|
| 338 | echo 'EFLAGS+=-lresolv' >> Makefile.settings |
---|
[8462239] | 339 | ret=0 |
---|
[36cf9fd] | 340 | fi |
---|
| 341 | |
---|
[8462239] | 342 | rm -f $TMPFILE |
---|
| 343 | return $ret |
---|
[36cf9fd] | 344 | } |
---|
| 345 | |
---|
| 346 | detect_resolv_static() |
---|
| 347 | { |
---|
[4fca1db] | 348 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
[8462239] | 349 | ret=1 |
---|
[36cf9fd] | 350 | for i in $systemlibdirs; do |
---|
| 351 | if [ -f $i/libresolv.a ]; then |
---|
[8462239] | 352 | echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null |
---|
[36cf9fd] | 353 | if [ "$?" = "0" ]; then |
---|
| 354 | echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings |
---|
[8462239] | 355 | ret=0 |
---|
[36cf9fd] | 356 | fi |
---|
| 357 | fi |
---|
| 358 | done |
---|
| 359 | |
---|
[8462239] | 360 | rm -f $TMPFILE |
---|
| 361 | return $ret |
---|
[36cf9fd] | 362 | } |
---|
| 363 | |
---|
[b3c467b] | 364 | if [ "$ssl" = "auto" ]; then |
---|
| 365 | detect_gnutls |
---|
[b7d3cc34] | 366 | if [ "$ret" = "0" ]; then |
---|
[b3c467b] | 367 | detect_nss |
---|
[b7d3cc34] | 368 | fi |
---|
[b3c467b] | 369 | elif [ "$ssl" = "gnutls" ]; then |
---|
| 370 | detect_gnutls |
---|
| 371 | elif [ "$ssl" = "nss" ]; then |
---|
| 372 | detect_nss |
---|
[85d7b85] | 373 | elif [ "$ssl" = "sspi" ]; then |
---|
| 374 | echo |
---|
[b3c467b] | 375 | elif [ "$ssl" = "openssl" ]; then |
---|
| 376 | echo |
---|
| 377 | echo 'No detection code exists for OpenSSL. Make sure that you have a complete' |
---|
| 378 | echo 'install of OpenSSL (including devel/header files) before reporting' |
---|
| 379 | echo 'compilation problems.' |
---|
| 380 | echo |
---|
| 381 | echo 'Also, keep in mind that the OpenSSL is, according to some people, not' |
---|
| 382 | echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better' |
---|
| 383 | echo 'supported by us. However, on many BSD machines, OpenSSL can be considered' |
---|
| 384 | echo 'part of the operating system, which makes it GPL-compatible.' |
---|
| 385 | echo |
---|
| 386 | echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2' |
---|
| 387 | echo ' http://www.gnome.org/~markmc/openssl-and-the-gpl.html' |
---|
| 388 | echo |
---|
| 389 | echo 'Please note that distributing a BitlBee binary which links to OpenSSL is' |
---|
| 390 | echo 'probably illegal. If you want to create and distribute a binary BitlBee' |
---|
| 391 | echo 'package, you really should use GnuTLS or NSS instead.' |
---|
| 392 | echo |
---|
| 393 | echo 'Also, the OpenSSL license requires us to say this:' |
---|
| 394 | echo ' * "This product includes software developed by the OpenSSL Project' |
---|
| 395 | echo ' * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"' |
---|
[b7d3cc34] | 396 | |
---|
[b3c467b] | 397 | echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings |
---|
| 398 | |
---|
| 399 | ret=1 |
---|
| 400 | elif [ "$ssl" = "bogus" ]; then |
---|
| 401 | echo |
---|
[670204f] | 402 | echo 'Using bogus SSL code. This means some features will not work properly.' |
---|
[b3c467b] | 403 | |
---|
| 404 | ## Yes, you, at the console! How can you authenticate if you don't have any SSL!? |
---|
[1c2eaa3] | 405 | if [ "$msn" = "1" -o "$yahoo" = "1" ]; then |
---|
[b7d3cc34] | 406 | echo |
---|
[1c2eaa3] | 407 | echo 'WARNING: The MSN and Yahoo! modules will not work without SSL. Disabling.' |
---|
[b3c467b] | 408 | msn=0 |
---|
[1c2eaa3] | 409 | yahoo=0 |
---|
[b3c467b] | 410 | fi |
---|
[b7d3cc34] | 411 | |
---|
[b3c467b] | 412 | ret=1 |
---|
| 413 | else |
---|
| 414 | echo |
---|
| 415 | echo 'ERROR: Unknown SSL library specified.' |
---|
| 416 | exit 1 |
---|
[b7d3cc34] | 417 | fi |
---|
| 418 | |
---|
[b3c467b] | 419 | if [ "$ret" = "0" ]; then |
---|
| 420 | echo |
---|
| 421 | echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).' |
---|
| 422 | echo ' Please note that this script doesn'\''t have detection code for OpenSSL,' |
---|
| 423 | echo ' so if you want to use that, you have to select it by hand. If you don'\''t' |
---|
| 424 | echo ' need SSL support, you can select the "bogus" SSL library. (--ssl=bogus)' |
---|
[b7d3cc34] | 425 | |
---|
[b3c467b] | 426 | exit 1 |
---|
| 427 | fi; |
---|
| 428 | |
---|
[83e47ec] | 429 | if [ "$msn" = "1" -a "$ssl" != "openssl" -a "$ssl" != "gnutls" ]; then |
---|
[a366cca] | 430 | # Needed for MSN only. OpenSSL exports nice cipher functions already, |
---|
[83e47ec] | 431 | # in case of GnuTLS we should be able to use gcrypt. Otherwise, use |
---|
| 432 | # built-in stuff. (Since right now those are the only two supported |
---|
| 433 | # SSL modules anyway, this is mostly unnecessary.) |
---|
[a366cca] | 434 | echo 'DES=des.o' >> Makefile.settings |
---|
| 435 | fi |
---|
| 436 | |
---|
[b3c467b] | 437 | echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings |
---|
| 438 | |
---|
[36cf9fd] | 439 | if detect_resolv_dynamic || detect_resolv_static; then |
---|
| 440 | echo '#define HAVE_RESOLV_A' >> config.h |
---|
| 441 | fi |
---|
[36e9f62] | 442 | |
---|
[ba7d16f] | 443 | STORAGES="xml" |
---|
[b3c467b] | 444 | |
---|
[f32d557] | 445 | if [ "$ldap" = "auto" ]; then |
---|
| 446 | detect_ldap |
---|
[b7d3cc34] | 447 | fi |
---|
| 448 | |
---|
[f32d557] | 449 | if [ "$ldap" = 0 ]; then |
---|
[5973412] | 450 | echo "#undef WITH_LDAP" >> config.h |
---|
[f32d557] | 451 | elif [ "$ldap" = 1 ]; then |
---|
[5c5a586] | 452 | echo |
---|
| 453 | echo 'LDAP support is a work in progress and does NOT work AT ALL right now.' |
---|
| 454 | echo |
---|
| 455 | exit 1 |
---|
| 456 | |
---|
[5973412] | 457 | echo "#define WITH_LDAP 1" >> config.h |
---|
[b3c467b] | 458 | STORAGES="$STORAGES ldap" |
---|
[b7d3cc34] | 459 | fi |
---|
| 460 | |
---|
[b3c467b] | 461 | for i in $STORAGES; do |
---|
| 462 | STORAGE_OBJS="$STORAGE_OBJS storage_$i.o" |
---|
| 463 | done |
---|
| 464 | echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings |
---|
| 465 | |
---|
[b7d3cc34] | 466 | if [ "$strip" = 0 ]; then |
---|
| 467 | echo "STRIP=\# skip strip" >> Makefile.settings; |
---|
| 468 | else |
---|
| 469 | if [ "$debug" = 1 ]; then |
---|
| 470 | echo |
---|
| 471 | echo 'Stripping binaries does not make sense when debugging. Stripping disabled.' |
---|
| 472 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 473 | strip=0; |
---|
| 474 | elif [ -n "$STRIP" ]; then |
---|
| 475 | echo "STRIP=$STRIP" >> Makefile.settings; |
---|
| 476 | elif type strip > /dev/null 2> /dev/null; then |
---|
| 477 | echo "STRIP=strip" >> Makefile.settings; |
---|
| 478 | else |
---|
| 479 | echo |
---|
| 480 | echo 'No strip utility found, cannot remove unnecessary parts from executable.' |
---|
| 481 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 482 | strip=0; |
---|
| 483 | fi; |
---|
| 484 | fi |
---|
| 485 | |
---|
[66b9e86e] | 486 | if [ "$gcov" = "1" ]; then |
---|
[31fc3970] | 487 | echo "CFLAGS+=--coverage" >> Makefile.settings |
---|
| 488 | echo "EFLAGS+=--coverage" >> Makefile.settings |
---|
[66b9e86e] | 489 | fi |
---|
| 490 | |
---|
[2abfbc5] | 491 | if [ "$plugins" = 0 ]; then |
---|
| 492 | echo '#undef WITH_PLUGINS' >> config.h |
---|
| 493 | else |
---|
| 494 | echo '#define WITH_PLUGINS' >> config.h |
---|
| 495 | fi |
---|
| 496 | |
---|
[6738a67] | 497 | otrprefix="" |
---|
| 498 | for i in / /usr /usr/local; do |
---|
| 499 | if [ -f ${i}/lib/libotr.a ]; then |
---|
| 500 | otrprefix=${i} |
---|
| 501 | break |
---|
| 502 | fi |
---|
| 503 | done |
---|
[764c7d1] | 504 | if [ "$otr" = "auto" ]; then |
---|
[6738a67] | 505 | if [ -n "$otrprefix" ]; then |
---|
| 506 | otr=1 |
---|
| 507 | else |
---|
| 508 | otr=0 |
---|
| 509 | fi |
---|
[764c7d1] | 510 | fi |
---|
[6738a67] | 511 | if [ "$otr" = 1 ]; then |
---|
[858ea01] | 512 | # BI == built-in |
---|
| 513 | echo '#define OTR_BI' >> config.h |
---|
[6738a67] | 514 | echo "EFLAGS+=-L${otrprefix}/lib -lotr" >> Makefile.settings |
---|
| 515 | echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings |
---|
[858ea01] | 516 | echo 'OTR_BI=otr.o' >> Makefile.settings |
---|
| 517 | elif [ "$otr" = "plugin" ]; then |
---|
| 518 | echo '#define OTR_PI' >> config.h |
---|
| 519 | echo "OTRFLAGS=-L${otrprefix}/lib -lotr" >> Makefile.settings |
---|
| 520 | echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings |
---|
| 521 | echo 'OTR_PI=otr.so' >> Makefile.settings |
---|
[764c7d1] | 522 | fi |
---|
| 523 | |
---|
[ceebeb1] | 524 | if [ ! -e doc/user-guide/help.txt ] && ! type xmlto > /dev/null 2> /dev/null; then |
---|
| 525 | echo |
---|
| 526 | echo 'WARNING: Building from an unreleased source tree without prebuilt helpfile.' |
---|
| 527 | echo 'Install xmlto if you want online help to work.' |
---|
| 528 | fi |
---|
| 529 | |
---|
[ffea9b9] | 530 | echo |
---|
[a014331] | 531 | if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then |
---|
| 532 | nick=`bzr nick` |
---|
| 533 | if [ -n "$nick" -a "$nick" != "bitlbee" ]; then |
---|
| 534 | nick="-$nick" |
---|
| 535 | else |
---|
| 536 | nick="" |
---|
| 537 | fi |
---|
[ffea9b9] | 538 | rev=`bzr revno` |
---|
| 539 | echo 'Using bzr revision #'$rev' as version number' |
---|
[a014331] | 540 | BITLBEE_VERSION=\"bzr$nick-$rev\" |
---|
[b7d3cc34] | 541 | fi |
---|
| 542 | |
---|
| 543 | if [ -n "$BITLBEE_VERSION" ]; then |
---|
| 544 | echo 'Spoofing version number: '$BITLBEE_VERSION |
---|
| 545 | echo '#undef BITLBEE_VERSION' >> config.h |
---|
[ffea9b9] | 546 | echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h |
---|
| 547 | echo |
---|
[b7d3cc34] | 548 | fi |
---|
| 549 | |
---|
[4fca1db] | 550 | if ! make helloworld > /dev/null 2>&1; then |
---|
| 551 | echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles." |
---|
| 552 | echo "BitlBee needs GNU make to build properly. On most systems GNU make is available" |
---|
| 553 | echo "under the name 'gmake'." |
---|
| 554 | echo |
---|
| 555 | if gmake helloworld > /dev/null 2>&1; then |
---|
| 556 | echo "gmake seems to be available on your machine, great." |
---|
| 557 | echo |
---|
| 558 | else |
---|
| 559 | echo "gmake is not installed (or not working). Please try to install it." |
---|
| 560 | echo |
---|
| 561 | fi |
---|
| 562 | fi |
---|
| 563 | |
---|
[e506d6c] | 564 | cat <<EOF>bitlbee.pc |
---|
| 565 | prefix=$prefix |
---|
| 566 | includedir=$includedir |
---|
| 567 | |
---|
| 568 | Name: bitlbee |
---|
| 569 | Description: IRC to IM gateway |
---|
| 570 | Requires: glib-2.0 |
---|
| 571 | Version: $BITLBEE_VERSION |
---|
| 572 | Libs: |
---|
| 573 | Cflags: -I\${includedir} |
---|
| 574 | |
---|
| 575 | EOF |
---|
| 576 | |
---|
[b7d3cc34] | 577 | protocols='' |
---|
| 578 | protoobjs='' |
---|
| 579 | |
---|
[e248c7f] | 580 | if [ "$purple" = 0 ]; then |
---|
| 581 | echo '#undef WITH_PURPLE' >> config.h |
---|
| 582 | else |
---|
[e08e53c] | 583 | if ! $PKG_CONFIG purple; then |
---|
| 584 | echo |
---|
| 585 | echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)' |
---|
| 586 | exit 1 |
---|
| 587 | fi |
---|
[e248c7f] | 588 | echo '#define WITH_PURPLE' >> config.h |
---|
[e08e53c] | 589 | cat<<EOF>>Makefile.settings |
---|
| 590 | EFLAGS += $($PKG_CONFIG purple --libs) |
---|
| 591 | PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags) |
---|
| 592 | EOF |
---|
[e248c7f] | 593 | protocols=$protocols'purple ' |
---|
| 594 | protoobjs=$protoobjs'purple_mod.o ' |
---|
| 595 | |
---|
| 596 | # Having both libpurple and native IM modules in one binary may |
---|
| 597 | # do strange things. Let's not do that. |
---|
| 598 | msn=0 |
---|
| 599 | jabber=0 |
---|
| 600 | oscar=0 |
---|
| 601 | yahoo=0 |
---|
[a348d00] | 602 | twitter=0 |
---|
[bda2975] | 603 | |
---|
| 604 | if [ "$events" = "libevent" ]; then |
---|
| 605 | echo |
---|
| 606 | echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling' |
---|
| 607 | echo 'outside libpurple, talking to GLib directly. At least for now the combination' |
---|
| 608 | echo 'libpurple + libevent is *not* recommended!' |
---|
| 609 | fi |
---|
[e248c7f] | 610 | fi |
---|
| 611 | |
---|
[b0a89cc] | 612 | case "$CC" in |
---|
| 613 | *gcc* ) |
---|
| 614 | echo CFLAGS+=-MD -MF .depend/\$@.d >> Makefile.settings |
---|
| 615 | for i in . lib protocols protocols/*/; do |
---|
| 616 | mkdir -p $i/.depend |
---|
| 617 | done |
---|
| 618 | esac |
---|
| 619 | |
---|
[b7d3cc34] | 620 | if [ "$msn" = 0 ]; then |
---|
| 621 | echo '#undef WITH_MSN' >> config.h |
---|
| 622 | else |
---|
| 623 | echo '#define WITH_MSN' >> config.h |
---|
| 624 | protocols=$protocols'msn ' |
---|
[b5a22e3] | 625 | protoobjs=$protoobjs'msn_mod.o ' |
---|
[b7d3cc34] | 626 | fi |
---|
| 627 | |
---|
| 628 | if [ "$jabber" = 0 ]; then |
---|
| 629 | echo '#undef WITH_JABBER' >> config.h |
---|
| 630 | else |
---|
| 631 | echo '#define WITH_JABBER' >> config.h |
---|
| 632 | protocols=$protocols'jabber ' |
---|
[b5a22e3] | 633 | protoobjs=$protoobjs'jabber_mod.o ' |
---|
[b7d3cc34] | 634 | fi |
---|
| 635 | |
---|
| 636 | if [ "$oscar" = 0 ]; then |
---|
| 637 | echo '#undef WITH_OSCAR' >> config.h |
---|
| 638 | else |
---|
| 639 | echo '#define WITH_OSCAR' >> config.h |
---|
| 640 | protocols=$protocols'oscar ' |
---|
[b5a22e3] | 641 | protoobjs=$protoobjs'oscar_mod.o ' |
---|
[b7d3cc34] | 642 | fi |
---|
| 643 | |
---|
| 644 | if [ "$yahoo" = 0 ]; then |
---|
| 645 | echo '#undef WITH_YAHOO' >> config.h |
---|
| 646 | else |
---|
| 647 | echo '#define WITH_YAHOO' >> config.h |
---|
| 648 | protocols=$protocols'yahoo ' |
---|
[b5a22e3] | 649 | protoobjs=$protoobjs'yahoo_mod.o ' |
---|
[b7d3cc34] | 650 | fi |
---|
| 651 | |
---|
[1b221e0] | 652 | if [ "$twitter" = 0 ]; then |
---|
| 653 | echo '#undef WITH_TWITTER' >> config.h |
---|
| 654 | else |
---|
| 655 | echo '#define WITH_TWITTER' >> config.h |
---|
| 656 | protocols=$protocols'twitter ' |
---|
| 657 | protoobjs=$protoobjs'twitter_mod.o ' |
---|
| 658 | fi |
---|
| 659 | |
---|
[b7d3cc34] | 660 | if [ "$protocols" = "PROTOCOLS = " ]; then |
---|
[43462708] | 661 | echo "Warning: You haven't selected any communication protocol to compile!" |
---|
[b3c467b] | 662 | echo " BitlBee will run, but you will be unable to connect to IM servers!" |
---|
[b7d3cc34] | 663 | fi |
---|
| 664 | |
---|
| 665 | echo "PROTOCOLS = $protocols" >> Makefile.settings |
---|
| 666 | echo "PROTOOBJS = $protoobjs" >> Makefile.settings |
---|
| 667 | |
---|
| 668 | echo Architecture: $arch |
---|
| 669 | case "$arch" in |
---|
| 670 | Linux ) |
---|
| 671 | ;; |
---|
| 672 | GNU/* ) |
---|
| 673 | ;; |
---|
| 674 | *BSD ) |
---|
| 675 | ;; |
---|
| 676 | Darwin ) |
---|
[caceb06] | 677 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
[b7d3cc34] | 678 | ;; |
---|
| 679 | IRIX ) |
---|
| 680 | ;; |
---|
| 681 | SunOS ) |
---|
| 682 | echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings |
---|
| 683 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 684 | ;; |
---|
[8de63c3] | 685 | AIX ) |
---|
| 686 | echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings |
---|
[b7d3cc34] | 687 | ;; |
---|
| 688 | CYGWIN* ) |
---|
| 689 | echo 'Cygwin is not officially supported.' |
---|
| 690 | ;; |
---|
[aec56b0] | 691 | Windows ) |
---|
| 692 | ;; |
---|
[b7d3cc34] | 693 | * ) |
---|
[8d6c4b1] | 694 | echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' |
---|
| 695 | echo 'Please report any problems at http://bugs.bitlbee.org/.' |
---|
[b7d3cc34] | 696 | ;; |
---|
| 697 | esac |
---|
| 698 | |
---|
[f1e7407] | 699 | if [ -n "$target" ]; then |
---|
| 700 | echo "Cross-compiling for: $target" |
---|
| 701 | fi |
---|
| 702 | |
---|
[b7d3cc34] | 703 | echo |
---|
| 704 | echo 'Configuration done:' |
---|
| 705 | |
---|
| 706 | if [ "$debug" = "1" ]; then |
---|
[b3c467b] | 707 | echo ' Debugging enabled.' |
---|
[b7d3cc34] | 708 | else |
---|
[b3c467b] | 709 | echo ' Debugging disabled.' |
---|
[b7d3cc34] | 710 | fi |
---|
| 711 | |
---|
| 712 | if [ "$strip" = "1" ]; then |
---|
[b3c467b] | 713 | echo ' Binary stripping enabled.' |
---|
[b7d3cc34] | 714 | else |
---|
[b3c467b] | 715 | echo ' Binary stripping disabled.' |
---|
[b7d3cc34] | 716 | fi |
---|
| 717 | |
---|
[764c7d1] | 718 | if [ "$otr" = "1" ]; then |
---|
| 719 | echo ' Off-the-Record (OTR) Messaging enabled.' |
---|
[858ea01] | 720 | elif [ "$otr" = "plugin" ]; then |
---|
| 721 | echo ' Off-the-Record (OTR) Messaging enabled (as a plugin).' |
---|
[764c7d1] | 722 | else |
---|
| 723 | echo ' Off-the-Record (OTR) Messaging disabled.' |
---|
| 724 | fi |
---|
| 725 | |
---|
[b3c467b] | 726 | echo ' Using event handler: '$events |
---|
| 727 | echo ' Using SSL library: '$ssl |
---|
| 728 | echo ' Building with these storage backends: '$STORAGES |
---|
[b7d3cc34] | 729 | |
---|
| 730 | if [ -n "$protocols" ]; then |
---|
[b3c467b] | 731 | echo ' Building with these protocols:' $protocols |
---|
[b7d3cc34] | 732 | else |
---|
[b3c467b] | 733 | echo ' Building without IM-protocol support. We wish you a lot of fun...' |
---|
[b7d3cc34] | 734 | fi |
---|