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