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