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