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