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