[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 | |
---|
| 61 | --ssl=... SSL library to use (gnutls, nss, openssl, bogus, auto) |
---|
| 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 | |
---|
| 147 | if type pkg-config > /dev/null 2>/dev/null && pkg-config glib-2.0; then |
---|
| 148 | cat<<EOF>>Makefile.settings |
---|
[7b23afd] | 149 | EFLAGS+=`pkg-config --libs glib-2.0 gmodule-2.0` |
---|
| 150 | CFLAGS+=`pkg-config --cflags glib-2.0 gmodule-2.0` |
---|
[b7d3cc34] | 151 | EOF |
---|
| 152 | echo '#define GLIB2' >> config.h |
---|
| 153 | elif type glib-config > /dev/null 2> /dev/null; then |
---|
| 154 | cat<<EOF>>Makefile.settings |
---|
| 155 | EFLAGS+=`glib-config --libs` |
---|
| 156 | CFLAGS+=`glib-config --cflags` |
---|
| 157 | EOF |
---|
| 158 | echo '#define GLIB1' >> config.h |
---|
| 159 | else |
---|
| 160 | echo 'Cannot find glib development libraries, aborting. (Install libglib-dev?)' |
---|
| 161 | exit 1; |
---|
| 162 | fi |
---|
| 163 | |
---|
| 164 | if [ -r /usr/include/iconv.h ]; then |
---|
| 165 | :; |
---|
| 166 | elif [ -r /usr/local/include/iconv.h ]; then |
---|
| 167 | echo CFLAGS+=-I/usr/local/include >> Makefile.settings; |
---|
| 168 | else |
---|
| 169 | echo |
---|
| 170 | echo 'Warning: Could not find iconv.h, you might have to install it and/or modify' |
---|
| 171 | echo 'Makefile.settings to tell where this file is.'; |
---|
| 172 | fi |
---|
| 173 | |
---|
| 174 | |
---|
| 175 | detect_gnutls() |
---|
| 176 | { |
---|
| 177 | if libgnutls-config --version > /dev/null 2> /dev/null; then |
---|
| 178 | cat <<EOF>>Makefile.settings |
---|
| 179 | EFLAGS+=`libgnutls-config --libs` |
---|
| 180 | CFLAGS+=`libgnutls-config --cflags` |
---|
| 181 | EOF |
---|
| 182 | |
---|
| 183 | ssl=gnutls |
---|
| 184 | ret=1; |
---|
| 185 | else |
---|
| 186 | ret=0; |
---|
| 187 | fi; |
---|
| 188 | } |
---|
| 189 | |
---|
| 190 | detect_nss() |
---|
| 191 | { |
---|
| 192 | if type pkg-config > /dev/null 2>/dev/null && pkg-config mozilla-nss; then |
---|
| 193 | cat<<EOF>>Makefile.settings |
---|
| 194 | EFLAGS+=`pkg-config --libs mozilla-nss` |
---|
| 195 | CFLAGS+=`pkg-config --cflags mozilla-nss` |
---|
| 196 | EOF |
---|
| 197 | |
---|
| 198 | ssl=nss |
---|
| 199 | ret=1; |
---|
| 200 | else |
---|
| 201 | ret=0; |
---|
| 202 | fi; |
---|
| 203 | } |
---|
| 204 | |
---|
| 205 | if [ "$msn" = 1 -o "$jabber" = 1 ]; then |
---|
| 206 | if [ "$ssl" = "auto" ]; then |
---|
| 207 | detect_gnutls |
---|
| 208 | if [ "$ret" = "0" ]; then |
---|
| 209 | detect_nss |
---|
| 210 | fi; |
---|
| 211 | elif [ "$ssl" = "gnutls" ]; then |
---|
| 212 | detect_gnutls; |
---|
| 213 | elif [ "$ssl" = "nss" ]; then |
---|
| 214 | detect_nss; |
---|
| 215 | elif [ "$ssl" = "openssl" ]; then |
---|
| 216 | echo |
---|
| 217 | echo 'No detection code exists for OpenSSL. Make sure that you have a complete' |
---|
| 218 | echo 'install of OpenSSL (including devel/header files) before reporting' |
---|
| 219 | echo 'compilation problems.' |
---|
| 220 | echo |
---|
| 221 | echo 'Also, keep in mind that the OpenSSL is, according to some people, not' |
---|
| 222 | echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better' |
---|
| 223 | echo 'supported by us. However, on many BSD machines, OpenSSL can be considered' |
---|
| 224 | echo 'part of the operating system, which makes it GPL-compatible.' |
---|
| 225 | echo |
---|
| 226 | echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2' |
---|
| 227 | echo ' http://www.gnome.org/~markmc/openssl-and-the-gpl.html' |
---|
| 228 | echo |
---|
| 229 | echo 'Please note that distributing a BitlBee binary which links to OpenSSL is' |
---|
| 230 | echo 'probably illegal. If you want to create and distribute a binary BitlBee' |
---|
| 231 | echo 'package, you really should use GnuTLS or NSS instead.' |
---|
| 232 | echo |
---|
| 233 | echo 'Also, the OpenSSL license requires us to say this:' |
---|
| 234 | echo ' * "This product includes software developed by the OpenSSL Project' |
---|
| 235 | echo ' * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"' |
---|
| 236 | |
---|
| 237 | echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings |
---|
| 238 | |
---|
| 239 | ret=1; |
---|
| 240 | elif [ "$ssl" = "bogus" ]; then |
---|
| 241 | echo |
---|
| 242 | echo 'Using bogus SSL code. This will not make the MSN module work, but it will' |
---|
| 243 | echo 'allow you to use the Jabber module - although without working SSL support.' |
---|
| 244 | |
---|
| 245 | ret=1; |
---|
| 246 | else |
---|
| 247 | echo |
---|
| 248 | echo 'ERROR: Unknown SSL library specified.' |
---|
| 249 | exit 1; |
---|
| 250 | fi |
---|
| 251 | |
---|
| 252 | if [ "$ret" = "0" ]; then |
---|
| 253 | echo |
---|
| 254 | echo 'WARNING: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).' |
---|
| 255 | echo ' This is necessary for MSN and full Jabber support. To continue,' |
---|
| 256 | echo ' install a suitable SSL library or disable MSN support (--msn=0).' |
---|
| 257 | echo ' If you want Jabber without SSL support you can try --ssl=bogus.' |
---|
| 258 | |
---|
| 259 | exit 1; |
---|
| 260 | fi; |
---|
| 261 | |
---|
| 262 | echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings |
---|
| 263 | fi |
---|
| 264 | |
---|
| 265 | if [ "$strip" = 0 ]; then |
---|
| 266 | echo "STRIP=\# skip strip" >> Makefile.settings; |
---|
| 267 | else |
---|
| 268 | if [ "$debug" = 1 ]; then |
---|
| 269 | echo |
---|
| 270 | echo 'Stripping binaries does not make sense when debugging. Stripping disabled.' |
---|
| 271 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 272 | strip=0; |
---|
| 273 | elif [ -n "$STRIP" ]; then |
---|
| 274 | echo "STRIP=$STRIP" >> Makefile.settings; |
---|
| 275 | elif type strip > /dev/null 2> /dev/null; then |
---|
| 276 | echo "STRIP=strip" >> Makefile.settings; |
---|
| 277 | elif /bin/test -x /usr/ccs/bin/strip; then |
---|
| 278 | echo "STRIP=/usr/ccs/bin/strip" >> Makefile.settings; |
---|
| 279 | else |
---|
| 280 | echo |
---|
| 281 | echo 'No strip utility found, cannot remove unnecessary parts from executable.' |
---|
| 282 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 283 | strip=0; |
---|
| 284 | fi; |
---|
| 285 | fi |
---|
| 286 | |
---|
| 287 | if [ "$flood" = 1 ]; then |
---|
[e5663e0] | 288 | # echo '#define FLOOD_SEND' >> config.h |
---|
| 289 | echo 'Flood protection is disabled in this release because of too many bugs.' 2> /dev/stderr |
---|
| 290 | rm config.h |
---|
| 291 | rm Makefile.settings |
---|
| 292 | exit 1 |
---|
[b7d3cc34] | 293 | fi |
---|
| 294 | |
---|
| 295 | if [ -n "$BITLBEE_VERSION" ]; then |
---|
| 296 | echo |
---|
| 297 | echo 'Spoofing version number: '$BITLBEE_VERSION |
---|
| 298 | echo '#undef BITLBEE_VERSION' >> config.h |
---|
| 299 | echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h; |
---|
| 300 | fi |
---|
| 301 | |
---|
| 302 | protocols='' |
---|
| 303 | protoobjs='' |
---|
| 304 | |
---|
| 305 | if [ "$msn" = 0 ]; then |
---|
| 306 | echo '#undef WITH_MSN' >> config.h |
---|
| 307 | else |
---|
| 308 | echo '#define WITH_MSN' >> config.h |
---|
| 309 | protocols=$protocols'msn ' |
---|
| 310 | protoobjs=$protoobjs'msnn.o ' |
---|
| 311 | fi |
---|
| 312 | |
---|
| 313 | if [ "$jabber" = 0 ]; then |
---|
| 314 | echo '#undef WITH_JABBER' >> config.h |
---|
| 315 | else |
---|
| 316 | echo '#define WITH_JABBER' >> config.h |
---|
| 317 | protocols=$protocols'jabber ' |
---|
| 318 | protoobjs=$protoobjs'jabberr.o ' |
---|
| 319 | fi |
---|
| 320 | |
---|
| 321 | if [ "$oscar" = 0 ]; then |
---|
| 322 | echo '#undef WITH_OSCAR' >> config.h |
---|
| 323 | else |
---|
| 324 | echo '#define WITH_OSCAR' >> config.h |
---|
| 325 | protocols=$protocols'oscar ' |
---|
| 326 | protoobjs=$protoobjs'oscarr.o ' |
---|
| 327 | fi |
---|
| 328 | |
---|
| 329 | if [ "$yahoo" = 0 ]; then |
---|
| 330 | echo '#undef WITH_YAHOO' >> config.h |
---|
| 331 | else |
---|
| 332 | echo '#define WITH_YAHOO' >> config.h |
---|
| 333 | protocols=$protocols'yahoo ' |
---|
| 334 | protoobjs=$protoobjs'yahooo.o ' |
---|
| 335 | fi |
---|
| 336 | |
---|
| 337 | if [ "$protocols" = "PROTOCOLS = " ]; then |
---|
| 338 | echo |
---|
| 339 | echo "WARNING: You haven't selected any communication protocol to compile!" |
---|
| 340 | echo " Bitlbee will run, but you will be unable to connect to IM servers!" |
---|
| 341 | fi |
---|
| 342 | |
---|
| 343 | echo "PROTOCOLS = $protocols" >> Makefile.settings |
---|
| 344 | echo "PROTOOBJS = $protoobjs" >> Makefile.settings |
---|
| 345 | |
---|
| 346 | echo |
---|
| 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 |
---|