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