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