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