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