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