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