[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/' |
---|
[34b17d9] | 16 | pidfile='/var/run/bitlbee.pid' |
---|
[6dff9d4] | 17 | ipcsocket='/var/run/bitlbee' |
---|
[7b23afd] | 18 | plugindir='$prefix/lib/bitlbee' |
---|
[b7d3cc34] | 19 | |
---|
| 20 | msn=1 |
---|
| 21 | jabber=1 |
---|
| 22 | oscar=1 |
---|
| 23 | yahoo=1 |
---|
| 24 | |
---|
| 25 | debug=0 |
---|
| 26 | strip=1 |
---|
| 27 | ipv6=1 |
---|
| 28 | ssl=auto |
---|
| 29 | |
---|
| 30 | arch=`uname -s` |
---|
| 31 | cpu=`uname -m` |
---|
| 32 | |
---|
| 33 | echo BitlBee configure |
---|
| 34 | |
---|
| 35 | while [ -n "$1" ]; do |
---|
| 36 | e="`expr "X$1" : 'X--\(.*=.*\)'`" |
---|
| 37 | if [ -z "$e" ]; then |
---|
| 38 | cat<<EOF |
---|
| 39 | |
---|
| 40 | Usage: $0 [OPTIONS] |
---|
| 41 | |
---|
| 42 | Option Description Default |
---|
| 43 | |
---|
| 44 | --prefix=... Directories to put files in $prefix |
---|
| 45 | --bindir=... $bindir |
---|
| 46 | --etcdir=... $etcdir |
---|
| 47 | --mandir=... $mandir |
---|
| 48 | --datadir=... $datadir |
---|
[7b23afd] | 49 | --plugindir=... $plugindir |
---|
[34b17d9] | 50 | --pidfile=... $pidfile |
---|
[b7d3cc34] | 51 | --config=... $config |
---|
[6dff9d4] | 52 | --ipcsocket=... $ipcsocket |
---|
[b7d3cc34] | 53 | |
---|
| 54 | --msn=0/1 Disable/enable MSN part $msn |
---|
| 55 | --jabber=0/1 Disable/enable Jabber part $jabber |
---|
| 56 | --oscar=0/1 Disable/enable Oscar part (ICQ, AIM) $oscar |
---|
| 57 | --yahoo=0/1 Disable/enable Yahoo part $yahoo |
---|
| 58 | |
---|
| 59 | --debug=0/1 Disable/enable debugging $debug |
---|
| 60 | --strip=0/1 Disable/enable binary stripping $strip |
---|
| 61 | |
---|
| 62 | --ipv6=0/1 IPv6 socket support $ipv6 |
---|
| 63 | |
---|
| 64 | --ssl=... SSL library to use (gnutls, nss, openssl, bogus, auto) |
---|
| 65 | $ssl |
---|
| 66 | EOF |
---|
| 67 | exit; |
---|
| 68 | fi |
---|
| 69 | eval "$e" |
---|
| 70 | shift; |
---|
| 71 | done |
---|
| 72 | |
---|
| 73 | # Expand $prefix and get rid of double slashes |
---|
| 74 | bindir=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'` |
---|
| 75 | etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'` |
---|
| 76 | mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'` |
---|
| 77 | datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'` |
---|
| 78 | config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'` |
---|
[7b23afd] | 79 | plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'` |
---|
[6dff9d4] | 80 | pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'` |
---|
| 81 | ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'` |
---|
[b7d3cc34] | 82 | |
---|
| 83 | cat<<EOF>Makefile.settings |
---|
| 84 | ## BitlBee settings, generated by configure |
---|
| 85 | PREFIX=$prefix |
---|
| 86 | BINDIR=$bindir |
---|
| 87 | ETCDIR=$etcdir |
---|
| 88 | MANDIR=$mandir |
---|
| 89 | DATADIR=$datadir |
---|
[7b23afd] | 90 | PLUGINDIR=$plugindir |
---|
[b7d3cc34] | 91 | CONFIG=$config |
---|
[6dff9d4] | 92 | IPCSOCKET=$ipcsocket |
---|
[b7d3cc34] | 93 | |
---|
| 94 | ARCH=$arch |
---|
| 95 | CPU=$cpu |
---|
| 96 | OUTFILE=bitlbee |
---|
| 97 | |
---|
| 98 | DESTDIR= |
---|
| 99 | LFLAGS= |
---|
| 100 | EFLAGS= |
---|
| 101 | EOF |
---|
| 102 | |
---|
| 103 | cat<<EOF>config.h |
---|
| 104 | /* BitlBee settings, generated by configure |
---|
| 105 | |
---|
| 106 | Do *NOT* use any of these defines in your code without thinking twice, most |
---|
| 107 | of them can/will be overridden at run-time */ |
---|
| 108 | |
---|
| 109 | #define CONFIG "$config" |
---|
| 110 | #define ETCDIR "$etcdir" |
---|
| 111 | #define VARDIR "$datadir" |
---|
[7b23afd] | 112 | #define PLUGINDIR "$plugindir" |
---|
[34b17d9] | 113 | #define PIDFILE "$pidfile" |
---|
[6dff9d4] | 114 | #define IPCSOCKET "$ipcsocket" |
---|
[b7d3cc34] | 115 | #define ARCH "$arch" |
---|
| 116 | #define CPU "$cpu" |
---|
| 117 | EOF |
---|
| 118 | |
---|
| 119 | if [ "$ipv6" = "1" ]; then |
---|
| 120 | echo '#define IPV6' >> config.h |
---|
| 121 | fi |
---|
| 122 | |
---|
| 123 | if [ "$debug" = "1" ]; then |
---|
| 124 | echo 'CFLAGS=-g' >> Makefile.settings |
---|
| 125 | echo 'DEBUG=1' >> Makefile.settings |
---|
| 126 | echo '#define DEBUG' >> config.h |
---|
| 127 | else |
---|
| 128 | echo 'CFLAGS=-O3' >> Makefile.settings |
---|
| 129 | fi |
---|
| 130 | |
---|
| 131 | echo CFLAGS+=-I`pwd` -I`pwd`/protocols -I. >> Makefile.settings |
---|
| 132 | |
---|
[f712188] | 133 | echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings |
---|
| 134 | |
---|
[b7d3cc34] | 135 | if [ -n "$CC" ]; then |
---|
| 136 | echo "CC=$CC" >> Makefile.settings; |
---|
| 137 | elif type gcc > /dev/null 2> /dev/null; then |
---|
| 138 | echo "CC=gcc" >> Makefile.settings; |
---|
| 139 | elif type cc > /dev/null 2> /dev/null; then |
---|
| 140 | echo "CC=cc" >> Makefile.settings; |
---|
| 141 | else |
---|
| 142 | echo 'Cannot find a C compiler, aborting.' |
---|
| 143 | exit 1; |
---|
| 144 | fi |
---|
| 145 | |
---|
| 146 | if [ -n "$LD" ]; then |
---|
| 147 | echo "LD=$LD" >> Makefile.settings; |
---|
| 148 | elif type ld > /dev/null 2> /dev/null; then |
---|
| 149 | echo "LD=ld" >> Makefile.settings; |
---|
| 150 | else |
---|
| 151 | echo 'Cannot find ld, aborting.' |
---|
| 152 | exit 1; |
---|
| 153 | fi |
---|
| 154 | |
---|
[32c632f] | 155 | if [ -z "$PKG_CONFIG" ]; then |
---|
| 156 | PKG_CONFIG=pkg-config |
---|
| 157 | fi |
---|
| 158 | |
---|
| 159 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then |
---|
[b7d3cc34] | 160 | cat<<EOF>>Makefile.settings |
---|
[32c632f] | 161 | EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0` |
---|
| 162 | CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0` |
---|
[b7d3cc34] | 163 | EOF |
---|
| 164 | echo '#define GLIB2' >> config.h |
---|
| 165 | elif type glib-config > /dev/null 2> /dev/null; then |
---|
| 166 | cat<<EOF>>Makefile.settings |
---|
| 167 | EFLAGS+=`glib-config --libs` |
---|
| 168 | CFLAGS+=`glib-config --cflags` |
---|
| 169 | EOF |
---|
| 170 | echo '#define GLIB1' >> config.h |
---|
| 171 | else |
---|
| 172 | echo 'Cannot find glib development libraries, aborting. (Install libglib-dev?)' |
---|
| 173 | exit 1; |
---|
| 174 | fi |
---|
| 175 | |
---|
| 176 | if [ -r /usr/include/iconv.h ]; then |
---|
| 177 | :; |
---|
| 178 | elif [ -r /usr/local/include/iconv.h ]; then |
---|
| 179 | echo CFLAGS+=-I/usr/local/include >> Makefile.settings; |
---|
| 180 | else |
---|
| 181 | echo |
---|
| 182 | echo 'Warning: Could not find iconv.h, you might have to install it and/or modify' |
---|
| 183 | echo 'Makefile.settings to tell where this file is.'; |
---|
| 184 | fi |
---|
| 185 | |
---|
| 186 | |
---|
| 187 | detect_gnutls() |
---|
| 188 | { |
---|
| 189 | if libgnutls-config --version > /dev/null 2> /dev/null; then |
---|
| 190 | cat <<EOF>>Makefile.settings |
---|
| 191 | EFLAGS+=`libgnutls-config --libs` |
---|
| 192 | CFLAGS+=`libgnutls-config --cflags` |
---|
| 193 | EOF |
---|
| 194 | |
---|
| 195 | ssl=gnutls |
---|
| 196 | ret=1; |
---|
| 197 | else |
---|
| 198 | ret=0; |
---|
| 199 | fi; |
---|
| 200 | } |
---|
| 201 | |
---|
| 202 | detect_nss() |
---|
| 203 | { |
---|
[32c632f] | 204 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG mozilla-nss; then |
---|
[b7d3cc34] | 205 | cat<<EOF>>Makefile.settings |
---|
[32c632f] | 206 | EFLAGS+=`$PKG_CONFIG --libs mozilla-nss` |
---|
| 207 | CFLAGS+=`$PKG_CONFIG --cflags mozilla-nss` |
---|
[b7d3cc34] | 208 | EOF |
---|
| 209 | |
---|
| 210 | ssl=nss |
---|
| 211 | ret=1; |
---|
| 212 | else |
---|
| 213 | ret=0; |
---|
| 214 | fi; |
---|
| 215 | } |
---|
| 216 | |
---|
| 217 | if [ "$msn" = 1 -o "$jabber" = 1 ]; then |
---|
| 218 | if [ "$ssl" = "auto" ]; then |
---|
| 219 | detect_gnutls |
---|
| 220 | if [ "$ret" = "0" ]; then |
---|
| 221 | detect_nss |
---|
| 222 | fi; |
---|
| 223 | elif [ "$ssl" = "gnutls" ]; then |
---|
| 224 | detect_gnutls; |
---|
| 225 | elif [ "$ssl" = "nss" ]; then |
---|
| 226 | detect_nss; |
---|
| 227 | elif [ "$ssl" = "openssl" ]; then |
---|
| 228 | echo |
---|
| 229 | echo 'No detection code exists for OpenSSL. Make sure that you have a complete' |
---|
| 230 | echo 'install of OpenSSL (including devel/header files) before reporting' |
---|
| 231 | echo 'compilation problems.' |
---|
| 232 | echo |
---|
| 233 | echo 'Also, keep in mind that the OpenSSL is, according to some people, not' |
---|
| 234 | echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better' |
---|
| 235 | echo 'supported by us. However, on many BSD machines, OpenSSL can be considered' |
---|
| 236 | echo 'part of the operating system, which makes it GPL-compatible.' |
---|
| 237 | echo |
---|
| 238 | echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2' |
---|
| 239 | echo ' http://www.gnome.org/~markmc/openssl-and-the-gpl.html' |
---|
| 240 | echo |
---|
| 241 | echo 'Please note that distributing a BitlBee binary which links to OpenSSL is' |
---|
| 242 | echo 'probably illegal. If you want to create and distribute a binary BitlBee' |
---|
| 243 | echo 'package, you really should use GnuTLS or NSS instead.' |
---|
| 244 | echo |
---|
| 245 | echo 'Also, the OpenSSL license requires us to say this:' |
---|
| 246 | echo ' * "This product includes software developed by the OpenSSL Project' |
---|
| 247 | echo ' * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"' |
---|
| 248 | |
---|
| 249 | echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings |
---|
| 250 | |
---|
| 251 | ret=1; |
---|
| 252 | elif [ "$ssl" = "bogus" ]; then |
---|
| 253 | echo |
---|
| 254 | echo 'Using bogus SSL code. This will not make the MSN module work, but it will' |
---|
| 255 | echo 'allow you to use the Jabber module - although without working SSL support.' |
---|
| 256 | |
---|
| 257 | ret=1; |
---|
| 258 | else |
---|
| 259 | echo |
---|
| 260 | echo 'ERROR: Unknown SSL library specified.' |
---|
| 261 | exit 1; |
---|
| 262 | fi |
---|
| 263 | |
---|
| 264 | if [ "$ret" = "0" ]; then |
---|
| 265 | echo |
---|
[54c5ca1] | 266 | echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).' |
---|
| 267 | echo ' This is necessary for MSN and full Jabber support. To continue,' |
---|
| 268 | echo ' install a suitable SSL library or disable MSN support (--msn=0).' |
---|
| 269 | echo ' If you want Jabber without SSL support you can try --ssl=bogus.' |
---|
[b7d3cc34] | 270 | |
---|
| 271 | exit 1; |
---|
| 272 | fi; |
---|
| 273 | |
---|
| 274 | echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings |
---|
| 275 | fi |
---|
| 276 | |
---|
| 277 | if [ "$strip" = 0 ]; then |
---|
| 278 | echo "STRIP=\# skip strip" >> Makefile.settings; |
---|
| 279 | else |
---|
| 280 | if [ "$debug" = 1 ]; then |
---|
| 281 | echo |
---|
| 282 | echo 'Stripping binaries does not make sense when debugging. Stripping disabled.' |
---|
| 283 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 284 | strip=0; |
---|
| 285 | elif [ -n "$STRIP" ]; then |
---|
| 286 | echo "STRIP=$STRIP" >> Makefile.settings; |
---|
| 287 | elif type strip > /dev/null 2> /dev/null; then |
---|
| 288 | echo "STRIP=strip" >> Makefile.settings; |
---|
| 289 | elif /bin/test -x /usr/ccs/bin/strip; then |
---|
| 290 | echo "STRIP=/usr/ccs/bin/strip" >> Makefile.settings; |
---|
| 291 | else |
---|
| 292 | echo |
---|
| 293 | echo 'No strip utility found, cannot remove unnecessary parts from executable.' |
---|
| 294 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 295 | strip=0; |
---|
| 296 | fi; |
---|
| 297 | fi |
---|
| 298 | |
---|
[ffea9b9] | 299 | echo |
---|
| 300 | if [ -z "$BITLBEE_VERSION" -a -d .bzr -a -x "`which bzr`" ]; then |
---|
| 301 | rev=`bzr revno` |
---|
| 302 | echo 'Using bzr revision #'$rev' as version number' |
---|
| 303 | BITLBEE_VERSION=\"bzr-$rev\" |
---|
| 304 | fi |
---|
| 305 | |
---|
[b7d3cc34] | 306 | if [ -n "$BITLBEE_VERSION" ]; then |
---|
| 307 | echo 'Spoofing version number: '$BITLBEE_VERSION |
---|
| 308 | echo '#undef BITLBEE_VERSION' >> config.h |
---|
[ffea9b9] | 309 | echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h |
---|
| 310 | echo |
---|
[b7d3cc34] | 311 | fi |
---|
| 312 | |
---|
| 313 | protocols='' |
---|
| 314 | protoobjs='' |
---|
| 315 | |
---|
| 316 | if [ "$msn" = 0 ]; then |
---|
| 317 | echo '#undef WITH_MSN' >> config.h |
---|
| 318 | else |
---|
| 319 | echo '#define WITH_MSN' >> config.h |
---|
| 320 | protocols=$protocols'msn ' |
---|
[b5a22e3] | 321 | protoobjs=$protoobjs'msn_mod.o ' |
---|
[b7d3cc34] | 322 | fi |
---|
| 323 | |
---|
| 324 | if [ "$jabber" = 0 ]; then |
---|
| 325 | echo '#undef WITH_JABBER' >> config.h |
---|
| 326 | else |
---|
| 327 | echo '#define WITH_JABBER' >> config.h |
---|
| 328 | protocols=$protocols'jabber ' |
---|
[b5a22e3] | 329 | protoobjs=$protoobjs'jabber_mod.o ' |
---|
[b7d3cc34] | 330 | fi |
---|
| 331 | |
---|
| 332 | if [ "$oscar" = 0 ]; then |
---|
| 333 | echo '#undef WITH_OSCAR' >> config.h |
---|
| 334 | else |
---|
| 335 | echo '#define WITH_OSCAR' >> config.h |
---|
| 336 | protocols=$protocols'oscar ' |
---|
[b5a22e3] | 337 | protoobjs=$protoobjs'oscar_mod.o ' |
---|
[b7d3cc34] | 338 | fi |
---|
| 339 | |
---|
| 340 | if [ "$yahoo" = 0 ]; then |
---|
| 341 | echo '#undef WITH_YAHOO' >> config.h |
---|
| 342 | else |
---|
| 343 | echo '#define WITH_YAHOO' >> config.h |
---|
| 344 | protocols=$protocols'yahoo ' |
---|
[b5a22e3] | 345 | protoobjs=$protoobjs'yahoo_mod.o ' |
---|
[b7d3cc34] | 346 | fi |
---|
| 347 | |
---|
| 348 | if [ "$protocols" = "PROTOCOLS = " ]; then |
---|
| 349 | echo "WARNING: You haven't selected any communication protocol to compile!" |
---|
| 350 | echo " Bitlbee will run, but you will be unable to connect to IM servers!" |
---|
| 351 | fi |
---|
| 352 | |
---|
| 353 | echo "PROTOCOLS = $protocols" >> Makefile.settings |
---|
| 354 | echo "PROTOOBJS = $protoobjs" >> Makefile.settings |
---|
| 355 | |
---|
| 356 | echo Architecture: $arch |
---|
| 357 | case "$arch" in |
---|
| 358 | Linux ) |
---|
| 359 | ;; |
---|
| 360 | GNU/* ) |
---|
| 361 | ;; |
---|
| 362 | *BSD ) |
---|
| 363 | echo 'EFLAGS+=-liconv' >> Makefile.settings; |
---|
| 364 | ;; |
---|
| 365 | SunOS ) |
---|
| 366 | echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings |
---|
| 367 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 368 | echo 'EFLAGS+=-liconv' >> Makefile.settings; |
---|
| 369 | ;; |
---|
| 370 | Darwin ) |
---|
| 371 | echo 'EFLAGS+=-liconv' >> Makefile.settings; |
---|
| 372 | ;; |
---|
| 373 | IRIX ) |
---|
| 374 | ;; |
---|
| 375 | CYGWIN* ) |
---|
| 376 | echo 'Cygwin is not officially supported.' |
---|
| 377 | ;; |
---|
| 378 | * ) |
---|
[8d6c4b1] | 379 | echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' |
---|
| 380 | echo 'Please report any problems at http://bugs.bitlbee.org/.' |
---|
[b7d3cc34] | 381 | ;; |
---|
| 382 | esac |
---|
| 383 | |
---|
| 384 | echo |
---|
| 385 | echo 'Configuration done:' |
---|
| 386 | |
---|
| 387 | if [ "$debug" = "1" ]; then |
---|
| 388 | echo ' Debugging enabled.'; |
---|
| 389 | else |
---|
| 390 | echo ' Debugging disabled.'; |
---|
| 391 | fi |
---|
| 392 | |
---|
| 393 | if [ "$strip" = "1" ]; then |
---|
| 394 | echo ' Binary stripping enabled.'; |
---|
| 395 | else |
---|
| 396 | echo ' Binary stripping disabled.'; |
---|
| 397 | fi |
---|
| 398 | |
---|
| 399 | if [ "$msn" = "1" ]; then |
---|
| 400 | echo ' Using SSL library: '$ssl; |
---|
| 401 | fi |
---|
| 402 | |
---|
[e5663e0] | 403 | #if [ "$flood" = "0" ]; then |
---|
| 404 | # echo ' Flood protection disabled.'; |
---|
| 405 | #else |
---|
| 406 | # echo ' Flood protection enabled.'; |
---|
| 407 | #fi |
---|
[b7d3cc34] | 408 | |
---|
| 409 | if [ -n "$protocols" ]; then |
---|
| 410 | echo ' Building with these protocols:' $protocols; |
---|
| 411 | else |
---|
| 412 | echo ' Building without IM-protocol support. We wish you a lot of fun...'; |
---|
| 413 | fi |
---|