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