[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 | |
---|
[e3fb678] | 64 | --ssl=... SSL library to use (gnutls, nss, openssl, sspi, bogus, auto) |
---|
[b7d3cc34] | 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; |
---|
[e3fb678] | 227 | elif [ "$ssl" = "sspi" ]; then |
---|
| 228 | echo |
---|
[b7d3cc34] | 229 | elif [ "$ssl" = "openssl" ]; then |
---|
| 230 | echo |
---|
| 231 | echo 'No detection code exists for OpenSSL. Make sure that you have a complete' |
---|
| 232 | echo 'install of OpenSSL (including devel/header files) before reporting' |
---|
| 233 | echo 'compilation problems.' |
---|
| 234 | echo |
---|
| 235 | echo 'Also, keep in mind that the OpenSSL is, according to some people, not' |
---|
| 236 | echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better' |
---|
| 237 | echo 'supported by us. However, on many BSD machines, OpenSSL can be considered' |
---|
| 238 | echo 'part of the operating system, which makes it GPL-compatible.' |
---|
| 239 | echo |
---|
| 240 | echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2' |
---|
| 241 | echo ' http://www.gnome.org/~markmc/openssl-and-the-gpl.html' |
---|
| 242 | echo |
---|
| 243 | echo 'Please note that distributing a BitlBee binary which links to OpenSSL is' |
---|
| 244 | echo 'probably illegal. If you want to create and distribute a binary BitlBee' |
---|
| 245 | echo 'package, you really should use GnuTLS or NSS instead.' |
---|
| 246 | echo |
---|
| 247 | echo 'Also, the OpenSSL license requires us to say this:' |
---|
| 248 | echo ' * "This product includes software developed by the OpenSSL Project' |
---|
| 249 | echo ' * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"' |
---|
| 250 | |
---|
| 251 | echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings |
---|
| 252 | |
---|
| 253 | ret=1; |
---|
| 254 | elif [ "$ssl" = "bogus" ]; then |
---|
| 255 | echo |
---|
| 256 | echo 'Using bogus SSL code. This will not make the MSN module work, but it will' |
---|
| 257 | echo 'allow you to use the Jabber module - although without working SSL support.' |
---|
| 258 | |
---|
| 259 | ret=1; |
---|
| 260 | else |
---|
| 261 | echo |
---|
| 262 | echo 'ERROR: Unknown SSL library specified.' |
---|
| 263 | exit 1; |
---|
| 264 | fi |
---|
| 265 | |
---|
| 266 | if [ "$ret" = "0" ]; then |
---|
| 267 | echo |
---|
[54c5ca1] | 268 | echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).' |
---|
| 269 | echo ' This is necessary for MSN and full Jabber support. To continue,' |
---|
| 270 | echo ' install a suitable SSL library or disable MSN support (--msn=0).' |
---|
| 271 | echo ' If you want Jabber without SSL support you can try --ssl=bogus.' |
---|
[b7d3cc34] | 272 | |
---|
| 273 | exit 1; |
---|
| 274 | fi; |
---|
| 275 | |
---|
| 276 | echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings |
---|
| 277 | fi |
---|
| 278 | |
---|
| 279 | if [ "$strip" = 0 ]; then |
---|
| 280 | echo "STRIP=\# skip strip" >> Makefile.settings; |
---|
| 281 | else |
---|
| 282 | if [ "$debug" = 1 ]; then |
---|
| 283 | echo |
---|
| 284 | echo 'Stripping binaries does not make sense when debugging. Stripping disabled.' |
---|
| 285 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 286 | strip=0; |
---|
| 287 | elif [ -n "$STRIP" ]; then |
---|
| 288 | echo "STRIP=$STRIP" >> Makefile.settings; |
---|
| 289 | elif type strip > /dev/null 2> /dev/null; then |
---|
| 290 | echo "STRIP=strip" >> Makefile.settings; |
---|
| 291 | elif /bin/test -x /usr/ccs/bin/strip; then |
---|
| 292 | echo "STRIP=/usr/ccs/bin/strip" >> Makefile.settings; |
---|
| 293 | else |
---|
| 294 | echo |
---|
| 295 | echo 'No strip utility found, cannot remove unnecessary parts from executable.' |
---|
| 296 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 297 | strip=0; |
---|
| 298 | fi; |
---|
| 299 | fi |
---|
| 300 | |
---|
[ffea9b9] | 301 | echo |
---|
| 302 | if [ -z "$BITLBEE_VERSION" -a -d .bzr -a -x "`which bzr`" ]; then |
---|
| 303 | rev=`bzr revno` |
---|
| 304 | echo 'Using bzr revision #'$rev' as version number' |
---|
| 305 | BITLBEE_VERSION=\"bzr-$rev\" |
---|
[b7d3cc34] | 306 | fi |
---|
| 307 | |
---|
| 308 | if [ -n "$BITLBEE_VERSION" ]; then |
---|
| 309 | echo 'Spoofing version number: '$BITLBEE_VERSION |
---|
| 310 | echo '#undef BITLBEE_VERSION' >> config.h |
---|
[ffea9b9] | 311 | echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h |
---|
| 312 | echo |
---|
[b7d3cc34] | 313 | fi |
---|
| 314 | |
---|
| 315 | protocols='' |
---|
| 316 | protoobjs='' |
---|
| 317 | |
---|
| 318 | if [ "$msn" = 0 ]; then |
---|
| 319 | echo '#undef WITH_MSN' >> config.h |
---|
| 320 | else |
---|
| 321 | echo '#define WITH_MSN' >> config.h |
---|
| 322 | protocols=$protocols'msn ' |
---|
[b5a22e3] | 323 | protoobjs=$protoobjs'msn_mod.o ' |
---|
[b7d3cc34] | 324 | fi |
---|
| 325 | |
---|
| 326 | if [ "$jabber" = 0 ]; then |
---|
| 327 | echo '#undef WITH_JABBER' >> config.h |
---|
| 328 | else |
---|
| 329 | echo '#define WITH_JABBER' >> config.h |
---|
| 330 | protocols=$protocols'jabber ' |
---|
[b5a22e3] | 331 | protoobjs=$protoobjs'jabber_mod.o ' |
---|
[b7d3cc34] | 332 | fi |
---|
| 333 | |
---|
| 334 | if [ "$oscar" = 0 ]; then |
---|
| 335 | echo '#undef WITH_OSCAR' >> config.h |
---|
| 336 | else |
---|
| 337 | echo '#define WITH_OSCAR' >> config.h |
---|
| 338 | protocols=$protocols'oscar ' |
---|
[b5a22e3] | 339 | protoobjs=$protoobjs'oscar_mod.o ' |
---|
[b7d3cc34] | 340 | fi |
---|
| 341 | |
---|
| 342 | if [ "$yahoo" = 0 ]; then |
---|
| 343 | echo '#undef WITH_YAHOO' >> config.h |
---|
| 344 | else |
---|
| 345 | echo '#define WITH_YAHOO' >> config.h |
---|
| 346 | protocols=$protocols'yahoo ' |
---|
[b5a22e3] | 347 | protoobjs=$protoobjs'yahoo_mod.o ' |
---|
[b7d3cc34] | 348 | fi |
---|
| 349 | |
---|
| 350 | if [ "$protocols" = "PROTOCOLS = " ]; then |
---|
| 351 | echo "WARNING: You haven't selected any communication protocol to compile!" |
---|
| 352 | echo " Bitlbee will run, but you will be unable to connect to IM servers!" |
---|
| 353 | fi |
---|
| 354 | |
---|
| 355 | echo "PROTOCOLS = $protocols" >> Makefile.settings |
---|
| 356 | echo "PROTOOBJS = $protoobjs" >> Makefile.settings |
---|
| 357 | |
---|
| 358 | echo Architecture: $arch |
---|
| 359 | case "$arch" in |
---|
| 360 | Linux ) |
---|
| 361 | ;; |
---|
| 362 | GNU/* ) |
---|
| 363 | ;; |
---|
| 364 | *BSD ) |
---|
| 365 | echo 'EFLAGS+=-liconv' >> Makefile.settings; |
---|
| 366 | ;; |
---|
| 367 | SunOS ) |
---|
| 368 | echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings |
---|
| 369 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 370 | echo 'EFLAGS+=-liconv' >> Makefile.settings; |
---|
| 371 | ;; |
---|
| 372 | Darwin ) |
---|
| 373 | echo 'EFLAGS+=-liconv' >> Makefile.settings; |
---|
| 374 | ;; |
---|
| 375 | IRIX ) |
---|
| 376 | ;; |
---|
| 377 | CYGWIN* ) |
---|
| 378 | echo 'Cygwin is not officially supported.' |
---|
| 379 | ;; |
---|
| 380 | * ) |
---|
[8d6c4b1] | 381 | echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' |
---|
| 382 | echo 'Please report any problems at http://bugs.bitlbee.org/.' |
---|
[b7d3cc34] | 383 | ;; |
---|
| 384 | esac |
---|
| 385 | |
---|
| 386 | echo |
---|
| 387 | echo 'Configuration done:' |
---|
| 388 | |
---|
| 389 | if [ "$debug" = "1" ]; then |
---|
| 390 | echo ' Debugging enabled.'; |
---|
| 391 | else |
---|
| 392 | echo ' Debugging disabled.'; |
---|
| 393 | fi |
---|
| 394 | |
---|
| 395 | if [ "$strip" = "1" ]; then |
---|
| 396 | echo ' Binary stripping enabled.'; |
---|
| 397 | else |
---|
| 398 | echo ' Binary stripping disabled.'; |
---|
| 399 | fi |
---|
| 400 | |
---|
| 401 | if [ "$msn" = "1" ]; then |
---|
| 402 | echo ' Using SSL library: '$ssl; |
---|
| 403 | fi |
---|
| 404 | |
---|
[e5663e0] | 405 | #if [ "$flood" = "0" ]; then |
---|
| 406 | # echo ' Flood protection disabled.'; |
---|
| 407 | #else |
---|
| 408 | # echo ' Flood protection enabled.'; |
---|
| 409 | #fi |
---|
[b7d3cc34] | 410 | |
---|
| 411 | if [ -n "$protocols" ]; then |
---|
| 412 | echo ' Building with these protocols:' $protocols; |
---|
| 413 | else |
---|
| 414 | echo ' Building without IM-protocol support. We wish you a lot of fun...'; |
---|
| 415 | fi |
---|