[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/' |
---|
[85cf37f] | 16 | plugindir='$prefix/lib/bitlbee/' |
---|
| 17 | includedir='$prefix/include/bitlbee/' |
---|
[417002e] | 18 | systemdsystemunitdir='' |
---|
[85cf37f] | 19 | libevent='/usr/' |
---|
[34b17d9] | 20 | pidfile='/var/run/bitlbee.pid' |
---|
[5c5a586] | 21 | ipcsocket='/var/run/bitlbee.sock' |
---|
[e506d6c] | 22 | pcdir='$prefix/lib/pkgconfig' |
---|
[8462239] | 23 | systemlibdirs="/lib /lib64 /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64" |
---|
[b7d3cc34] | 24 | |
---|
| 25 | msn=1 |
---|
| 26 | jabber=1 |
---|
| 27 | oscar=1 |
---|
| 28 | yahoo=1 |
---|
[1b221e0] | 29 | twitter=1 |
---|
[4aa0f6b] | 30 | twitter=1 |
---|
[04dc563] | 31 | purple=0 |
---|
[b7d3cc34] | 32 | |
---|
| 33 | debug=0 |
---|
| 34 | strip=1 |
---|
[66b9e86e] | 35 | gcov=0 |
---|
[2abfbc5] | 36 | plugins=1 |
---|
[04f0c10] | 37 | otr=0 |
---|
[85cf37f] | 38 | |
---|
| 39 | events=glib |
---|
[670204f] | 40 | ldap=0 |
---|
[b7d3cc34] | 41 | ssl=auto |
---|
| 42 | |
---|
| 43 | arch=`uname -s` |
---|
| 44 | cpu=`uname -m` |
---|
| 45 | |
---|
[670204f] | 46 | GLIB_MIN_VERSION=2.4 |
---|
| 47 | |
---|
[b7d3cc34] | 48 | echo BitlBee configure |
---|
| 49 | |
---|
| 50 | while [ -n "$1" ]; do |
---|
| 51 | e="`expr "X$1" : 'X--\(.*=.*\)'`" |
---|
| 52 | if [ -z "$e" ]; then |
---|
| 53 | cat<<EOF |
---|
| 54 | |
---|
| 55 | Usage: $0 [OPTIONS] |
---|
| 56 | |
---|
| 57 | Option Description Default |
---|
| 58 | |
---|
| 59 | --prefix=... Directories to put files in $prefix |
---|
| 60 | --bindir=... $bindir |
---|
| 61 | --etcdir=... $etcdir |
---|
| 62 | --mandir=... $mandir |
---|
| 63 | --datadir=... $datadir |
---|
[7b23afd] | 64 | --plugindir=... $plugindir |
---|
[417002e] | 65 | --systemdsystemunitdir=... $systemdsystemunitdir |
---|
[34b17d9] | 66 | --pidfile=... $pidfile |
---|
[b7d3cc34] | 67 | --config=... $config |
---|
[6dff9d4] | 68 | --ipcsocket=... $ipcsocket |
---|
[b7d3cc34] | 69 | |
---|
| 70 | --msn=0/1 Disable/enable MSN part $msn |
---|
| 71 | --jabber=0/1 Disable/enable Jabber part $jabber |
---|
| 72 | --oscar=0/1 Disable/enable Oscar part (ICQ, AIM) $oscar |
---|
| 73 | --yahoo=0/1 Disable/enable Yahoo part $yahoo |
---|
[4aa0f6b] | 74 | --twitter=0/1 Disable/enable Twitter part $twitter |
---|
[b7d3cc34] | 75 | |
---|
[796da03] | 76 | --purple=0/1 Disable/enable libpurple support $purple |
---|
[04f0c10] | 77 | (automatically disables other protocol modules) |
---|
[b7d3cc34] | 78 | |
---|
| 79 | --debug=0/1 Disable/enable debugging $debug |
---|
| 80 | --strip=0/1 Disable/enable binary stripping $strip |
---|
[66b9e86e] | 81 | --gcov=0/1 Disable/enable test coverage reporting $gcov |
---|
[2abfbc5] | 82 | --plugins=0/1 Disable/enable plugins support $plugins |
---|
[04f0c10] | 83 | --otr=0/1/auto/plugin |
---|
| 84 | Disable/enable OTR encryption support $otr |
---|
[b7d3cc34] | 85 | |
---|
[85cf37f] | 86 | --events=... Event handler (glib, libevent) $events |
---|
[b7d3cc34] | 87 | --ssl=... SSL library to use (gnutls, nss, openssl, bogus, auto) |
---|
| 88 | $ssl |
---|
[aec56b0] | 89 | |
---|
[f1e7407] | 90 | --target=... Cross compilation target same as host |
---|
[b7d3cc34] | 91 | EOF |
---|
| 92 | exit; |
---|
| 93 | fi |
---|
| 94 | eval "$e" |
---|
| 95 | shift; |
---|
| 96 | done |
---|
| 97 | |
---|
| 98 | # Expand $prefix and get rid of double slashes |
---|
| 99 | bindir=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'` |
---|
| 100 | etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'` |
---|
| 101 | mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'` |
---|
| 102 | datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'` |
---|
| 103 | config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'` |
---|
[7b23afd] | 104 | plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'` |
---|
[85cf37f] | 105 | includedir=`eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g'` |
---|
| 106 | libevent=`eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g'` |
---|
| 107 | |
---|
[6dff9d4] | 108 | pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'` |
---|
| 109 | ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'` |
---|
[e506d6c] | 110 | pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'` |
---|
[b7d3cc34] | 111 | |
---|
| 112 | cat<<EOF>Makefile.settings |
---|
| 113 | ## BitlBee settings, generated by configure |
---|
| 114 | PREFIX=$prefix |
---|
| 115 | BINDIR=$bindir |
---|
| 116 | ETCDIR=$etcdir |
---|
| 117 | MANDIR=$mandir |
---|
| 118 | DATADIR=$datadir |
---|
[7b23afd] | 119 | PLUGINDIR=$plugindir |
---|
[b7d3cc34] | 120 | CONFIG=$config |
---|
[e506d6c] | 121 | INCLUDEDIR=$includedir |
---|
| 122 | PCDIR=$pcdir |
---|
[b7d3cc34] | 123 | |
---|
[1bf9492] | 124 | TARGET=$target |
---|
[b7d3cc34] | 125 | ARCH=$arch |
---|
| 126 | CPU=$cpu |
---|
| 127 | |
---|
| 128 | DESTDIR= |
---|
| 129 | LFLAGS= |
---|
| 130 | EFLAGS= |
---|
| 131 | EOF |
---|
| 132 | |
---|
[1074806] | 133 | srcdir=$(cd $(dirname $0);pwd) |
---|
| 134 | currdir=$(pwd) |
---|
| 135 | if [ "$srcdir" != "$currdir" ]; then |
---|
[f60079b] | 136 | echo |
---|
| 137 | echo "configure script run from a different directory. Will create some symlinks..." |
---|
| 138 | if [ ! -e Makefile -o -L Makefile ]; then |
---|
[04dc563] | 139 | COPYDIRS="doc lib protocols tests utils" |
---|
| 140 | mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d) |
---|
[f60079b] | 141 | find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null |
---|
| 142 | dst="$PWD" |
---|
| 143 | cd "$srcdir" |
---|
[04dc563] | 144 | for i in $(find . -name Makefile -type f); do |
---|
[f60079b] | 145 | ln -s "$PWD${i#.}" "$dst/$i"; |
---|
| 146 | done |
---|
| 147 | cd "$dst" |
---|
| 148 | rm -rf .bzr |
---|
| 149 | fi |
---|
| 150 | |
---|
| 151 | echo "SRCDIR=$srcdir/" >> Makefile.settings |
---|
| 152 | CFLAGS="$CFLAGS -I${dst}" |
---|
| 153 | else |
---|
| 154 | srcdir=$PWD |
---|
| 155 | fi |
---|
| 156 | |
---|
[b7d3cc34] | 157 | cat<<EOF>config.h |
---|
| 158 | /* BitlBee settings, generated by configure |
---|
| 159 | |
---|
| 160 | Do *NOT* use any of these defines in your code without thinking twice, most |
---|
| 161 | of them can/will be overridden at run-time */ |
---|
| 162 | |
---|
| 163 | #define CONFIG "$config" |
---|
| 164 | #define ETCDIR "$etcdir" |
---|
| 165 | #define VARDIR "$datadir" |
---|
[7b23afd] | 166 | #define PLUGINDIR "$plugindir" |
---|
[34b17d9] | 167 | #define PIDFILE "$pidfile" |
---|
[6dff9d4] | 168 | #define IPCSOCKET "$ipcsocket" |
---|
[b7d3cc34] | 169 | #define ARCH "$arch" |
---|
| 170 | #define CPU "$cpu" |
---|
| 171 | EOF |
---|
| 172 | |
---|
[1bf9492] | 173 | |
---|
| 174 | |
---|
[f1e7407] | 175 | if [ -n "$target" ]; then |
---|
[1bf9492] | 176 | PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig |
---|
| 177 | export PKG_CONFIG_LIBDIR |
---|
[f1e7407] | 178 | PATH=/usr/$target/bin:$PATH |
---|
| 179 | CC=$target-cc |
---|
| 180 | LD=$target-ld |
---|
[1bf9492] | 181 | systemlibdirs="/usr/$target/lib" |
---|
[f1e7407] | 182 | fi |
---|
| 183 | |
---|
[1bf9492] | 184 | |
---|
[b7d3cc34] | 185 | if [ "$debug" = "1" ]; then |
---|
[285b55d] | 186 | [ -z "$CFLAGS" ] && CFLAGS=-g |
---|
[b7d3cc34] | 187 | echo 'DEBUG=1' >> Makefile.settings |
---|
[911cc4f] | 188 | CFLAGS="$CFLAGS -DDEBUG" |
---|
[b7d3cc34] | 189 | else |
---|
[56f260a] | 190 | [ -z "$CFLAGS" ] && CFLAGS="-O2 -fno-strict-aliasing" |
---|
[b7d3cc34] | 191 | fi |
---|
| 192 | |
---|
[daae10f] | 193 | echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings |
---|
[f60079b] | 194 | echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings |
---|
[b7d3cc34] | 195 | |
---|
[f712188] | 196 | echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings |
---|
| 197 | |
---|
[b7d3cc34] | 198 | if [ -n "$CC" ]; then |
---|
[5973412] | 199 | CC=$CC |
---|
[b7d3cc34] | 200 | elif type gcc > /dev/null 2> /dev/null; then |
---|
[5973412] | 201 | CC=gcc |
---|
[b7d3cc34] | 202 | elif type cc > /dev/null 2> /dev/null; then |
---|
[5973412] | 203 | CC=cc |
---|
[b7d3cc34] | 204 | else |
---|
| 205 | echo 'Cannot find a C compiler, aborting.' |
---|
| 206 | exit 1; |
---|
| 207 | fi |
---|
| 208 | |
---|
[5973412] | 209 | echo "CC=$CC" >> Makefile.settings; |
---|
[daae10f] | 210 | if echo $CC | grep -qw gcc; then |
---|
| 211 | # Apparently -Wall is gcc-specific? |
---|
| 212 | echo CFLAGS+=-Wall >> Makefile.settings |
---|
| 213 | fi |
---|
[5973412] | 214 | |
---|
[f1e7407] | 215 | if [ -z "$LD" ]; then |
---|
| 216 | if type ld > /dev/null 2> /dev/null; then |
---|
| 217 | LD=ld |
---|
| 218 | else |
---|
| 219 | echo 'Cannot find ld, aborting.' |
---|
| 220 | exit 1; |
---|
| 221 | fi |
---|
[b7d3cc34] | 222 | fi |
---|
| 223 | |
---|
[f1e7407] | 224 | echo "LD=$LD" >> Makefile.settings |
---|
| 225 | |
---|
[32c632f] | 226 | if [ -z "$PKG_CONFIG" ]; then |
---|
| 227 | PKG_CONFIG=pkg-config |
---|
| 228 | fi |
---|
| 229 | |
---|
| 230 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then |
---|
[670204f] | 231 | if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then |
---|
| 232 | cat<<EOF>>Makefile.settings |
---|
[32c632f] | 233 | EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0` |
---|
| 234 | CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0` |
---|
[b7d3cc34] | 235 | EOF |
---|
[670204f] | 236 | else |
---|
| 237 | echo |
---|
| 238 | echo 'Found glib2 '`$PKG_CONFIG glib-2.0 --modversion`', but version '$GLIB_MIN_VERSION' or newer is required.' |
---|
| 239 | exit 1 |
---|
| 240 | fi |
---|
[b7d3cc34] | 241 | else |
---|
[670204f] | 242 | echo |
---|
[574af7e] | 243 | echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)' |
---|
[670204f] | 244 | exit 1 |
---|
[b7d3cc34] | 245 | fi |
---|
| 246 | |
---|
[85cf37f] | 247 | if [ "$events" = "libevent" ]; then |
---|
[003553b] | 248 | if ! [ -f "${libevent}include/event.h" ]; then |
---|
[85cf37f] | 249 | echo |
---|
| 250 | echo 'Warning: Could not find event.h, you might have to install it and/or specify' |
---|
| 251 | echo 'its location using the --libevent= argument. (Example: If event.h is in' |
---|
| 252 | echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)' |
---|
| 253 | fi |
---|
| 254 | |
---|
| 255 | echo '#define EVENTS_LIBEVENT' >> config.h |
---|
| 256 | cat <<EOF>>Makefile.settings |
---|
| 257 | EFLAGS+=-levent -L${libevent}lib |
---|
| 258 | CFLAGS+=-I${libevent}include |
---|
| 259 | EOF |
---|
| 260 | elif [ "$events" = "glib" ]; then |
---|
| 261 | ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...): |
---|
| 262 | echo '#define EVENTS_GLIB' >> config.h |
---|
[b7d3cc34] | 263 | else |
---|
| 264 | echo |
---|
[85cf37f] | 265 | echo 'ERROR: Unknown event handler specified.' |
---|
| 266 | exit 1 |
---|
[b7d3cc34] | 267 | fi |
---|
[85cf37f] | 268 | echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings |
---|
[b7d3cc34] | 269 | |
---|
| 270 | detect_gnutls() |
---|
| 271 | { |
---|
[4af7b4f] | 272 | if $PKG_CONFIG --exists gnutls; then |
---|
| 273 | cat <<EOF>>Makefile.settings |
---|
[83e47ec] | 274 | EFLAGS+=`$PKG_CONFIG --libs gnutls` `libgcrypt-config --libs` |
---|
| 275 | CFLAGS+=`$PKG_CONFIG --cflags gnutls` `libgcrypt-config --cflags` |
---|
[4af7b4f] | 276 | EOF |
---|
| 277 | ssl=gnutls |
---|
| 278 | ret=1 |
---|
| 279 | elif libgnutls-config --version > /dev/null 2> /dev/null; then |
---|
[b7d3cc34] | 280 | cat <<EOF>>Makefile.settings |
---|
[83e47ec] | 281 | EFLAGS+=`libgnutls-config --libs` `libgcrypt-config --libs` |
---|
| 282 | CFLAGS+=`libgnutls-config --cflags` `libgcrypt-config --cflags` |
---|
[b7d3cc34] | 283 | EOF |
---|
| 284 | |
---|
| 285 | ssl=gnutls |
---|
| 286 | ret=1; |
---|
| 287 | else |
---|
| 288 | ret=0; |
---|
| 289 | fi; |
---|
| 290 | } |
---|
| 291 | |
---|
| 292 | detect_nss() |
---|
| 293 | { |
---|
[ef043d3] | 294 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then |
---|
[b7d3cc34] | 295 | cat<<EOF>>Makefile.settings |
---|
[ef043d3] | 296 | EFLAGS+=`$PKG_CONFIG --libs nss` |
---|
| 297 | CFLAGS+=`$PKG_CONFIG --cflags nss` |
---|
[b7d3cc34] | 298 | EOF |
---|
| 299 | |
---|
| 300 | ssl=nss |
---|
| 301 | ret=1; |
---|
| 302 | else |
---|
| 303 | ret=0; |
---|
| 304 | fi; |
---|
| 305 | } |
---|
| 306 | |
---|
[f32d557] | 307 | detect_ldap() |
---|
[f665dab] | 308 | { |
---|
[4fca1db] | 309 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
[5973412] | 310 | if $CC -o $TMPFILE -shared -lldap 2>/dev/null >/dev/null; then |
---|
[f665dab] | 311 | cat<<EOF>>Makefile.settings |
---|
[5973412] | 312 | EFLAGS+=-lldap |
---|
| 313 | CFLAGS+= |
---|
[f665dab] | 314 | EOF |
---|
[f32d557] | 315 | ldap=1 |
---|
[5973412] | 316 | rm -f $TMPFILE |
---|
[f665dab] | 317 | ret=1 |
---|
[b7d3cc34] | 318 | else |
---|
[5973412] | 319 | ldap=0 |
---|
[f665dab] | 320 | ret=0 |
---|
[b7d3cc34] | 321 | fi |
---|
[f665dab] | 322 | } |
---|
| 323 | |
---|
[36cf9fd] | 324 | RESOLV_TESTCODE=' |
---|
| 325 | #include <arpa/nameser.h> |
---|
| 326 | #include <resolv.h> |
---|
| 327 | |
---|
| 328 | int main() |
---|
| 329 | { |
---|
| 330 | ns_initparse( NULL, 0, NULL ); |
---|
| 331 | ns_parserr( NULL, ns_s_an, 0, NULL ); |
---|
| 332 | } |
---|
| 333 | ' |
---|
| 334 | |
---|
| 335 | detect_resolv_dynamic() |
---|
| 336 | { |
---|
[4fca1db] | 337 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
[8462239] | 338 | ret=1 |
---|
| 339 | echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -lresolv >/dev/null 2>/dev/null |
---|
[36cf9fd] | 340 | if [ "$?" = "0" ]; then |
---|
| 341 | echo 'EFLAGS+=-lresolv' >> Makefile.settings |
---|
[8462239] | 342 | ret=0 |
---|
[36cf9fd] | 343 | fi |
---|
| 344 | |
---|
[8462239] | 345 | rm -f $TMPFILE |
---|
| 346 | return $ret |
---|
[36cf9fd] | 347 | } |
---|
| 348 | |
---|
| 349 | detect_resolv_static() |
---|
| 350 | { |
---|
[4fca1db] | 351 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
[8462239] | 352 | ret=1 |
---|
[36cf9fd] | 353 | for i in $systemlibdirs; do |
---|
| 354 | if [ -f $i/libresolv.a ]; then |
---|
[8462239] | 355 | echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null |
---|
[36cf9fd] | 356 | if [ "$?" = "0" ]; then |
---|
| 357 | echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings |
---|
[8462239] | 358 | ret=0 |
---|
[36cf9fd] | 359 | fi |
---|
| 360 | fi |
---|
| 361 | done |
---|
| 362 | |
---|
[8462239] | 363 | rm -f $TMPFILE |
---|
| 364 | return $ret |
---|
[36cf9fd] | 365 | } |
---|
| 366 | |
---|
[b3c467b] | 367 | if [ "$ssl" = "auto" ]; then |
---|
| 368 | detect_gnutls |
---|
[b7d3cc34] | 369 | if [ "$ret" = "0" ]; then |
---|
[c5920df] | 370 | # Disable NSS for now as it's known to not work very well ATM. |
---|
| 371 | #detect_nss |
---|
[191cfb1] | 372 | : |
---|
[b7d3cc34] | 373 | fi |
---|
[b3c467b] | 374 | elif [ "$ssl" = "gnutls" ]; then |
---|
| 375 | detect_gnutls |
---|
| 376 | elif [ "$ssl" = "nss" ]; then |
---|
| 377 | detect_nss |
---|
[85d7b85] | 378 | elif [ "$ssl" = "sspi" ]; then |
---|
| 379 | echo |
---|
[b3c467b] | 380 | elif [ "$ssl" = "openssl" ]; then |
---|
| 381 | echo |
---|
| 382 | echo 'No detection code exists for OpenSSL. Make sure that you have a complete' |
---|
| 383 | echo 'install of OpenSSL (including devel/header files) before reporting' |
---|
| 384 | echo 'compilation problems.' |
---|
| 385 | echo |
---|
| 386 | echo 'Also, keep in mind that the OpenSSL is, according to some people, not' |
---|
| 387 | echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better' |
---|
| 388 | echo 'supported by us. However, on many BSD machines, OpenSSL can be considered' |
---|
| 389 | echo 'part of the operating system, which makes it GPL-compatible.' |
---|
| 390 | echo |
---|
| 391 | echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2' |
---|
| 392 | echo ' http://www.gnome.org/~markmc/openssl-and-the-gpl.html' |
---|
| 393 | echo |
---|
| 394 | echo 'Please note that distributing a BitlBee binary which links to OpenSSL is' |
---|
| 395 | echo 'probably illegal. If you want to create and distribute a binary BitlBee' |
---|
| 396 | echo 'package, you really should use GnuTLS or NSS instead.' |
---|
| 397 | echo |
---|
| 398 | echo 'Also, the OpenSSL license requires us to say this:' |
---|
| 399 | echo ' * "This product includes software developed by the OpenSSL Project' |
---|
| 400 | echo ' * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"' |
---|
[b7d3cc34] | 401 | |
---|
[b3c467b] | 402 | echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings |
---|
| 403 | |
---|
| 404 | ret=1 |
---|
| 405 | elif [ "$ssl" = "bogus" ]; then |
---|
| 406 | echo |
---|
[670204f] | 407 | echo 'Using bogus SSL code. This means some features will not work properly.' |
---|
[b3c467b] | 408 | |
---|
| 409 | ## Yes, you, at the console! How can you authenticate if you don't have any SSL!? |
---|
[1c2eaa3] | 410 | if [ "$msn" = "1" -o "$yahoo" = "1" ]; then |
---|
[b7d3cc34] | 411 | echo |
---|
[1c2eaa3] | 412 | echo 'WARNING: The MSN and Yahoo! modules will not work without SSL. Disabling.' |
---|
[b3c467b] | 413 | msn=0 |
---|
[1c2eaa3] | 414 | yahoo=0 |
---|
[b3c467b] | 415 | fi |
---|
[b7d3cc34] | 416 | |
---|
[b3c467b] | 417 | ret=1 |
---|
| 418 | else |
---|
| 419 | echo |
---|
| 420 | echo 'ERROR: Unknown SSL library specified.' |
---|
| 421 | exit 1 |
---|
[b7d3cc34] | 422 | fi |
---|
| 423 | |
---|
[b3c467b] | 424 | if [ "$ret" = "0" ]; then |
---|
| 425 | echo |
---|
| 426 | echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).' |
---|
| 427 | echo ' Please note that this script doesn'\''t have detection code for OpenSSL,' |
---|
| 428 | echo ' so if you want to use that, you have to select it by hand. If you don'\''t' |
---|
| 429 | echo ' need SSL support, you can select the "bogus" SSL library. (--ssl=bogus)' |
---|
[b7d3cc34] | 430 | |
---|
[b3c467b] | 431 | exit 1 |
---|
| 432 | fi; |
---|
| 433 | |
---|
[83e47ec] | 434 | if [ "$msn" = "1" -a "$ssl" != "openssl" -a "$ssl" != "gnutls" ]; then |
---|
[a366cca] | 435 | # Needed for MSN only. OpenSSL exports nice cipher functions already, |
---|
[83e47ec] | 436 | # in case of GnuTLS we should be able to use gcrypt. Otherwise, use |
---|
| 437 | # built-in stuff. (Since right now those are the only two supported |
---|
| 438 | # SSL modules anyway, this is mostly unnecessary.) |
---|
[a366cca] | 439 | echo 'DES=des.o' >> Makefile.settings |
---|
| 440 | fi |
---|
| 441 | |
---|
[b3c467b] | 442 | echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings |
---|
| 443 | |
---|
[36cf9fd] | 444 | if detect_resolv_dynamic || detect_resolv_static; then |
---|
| 445 | echo '#define HAVE_RESOLV_A' >> config.h |
---|
| 446 | fi |
---|
[36e9f62] | 447 | |
---|
[ba7d16f] | 448 | STORAGES="xml" |
---|
[b3c467b] | 449 | |
---|
[f32d557] | 450 | if [ "$ldap" = "auto" ]; then |
---|
| 451 | detect_ldap |
---|
[b7d3cc34] | 452 | fi |
---|
| 453 | |
---|
[f32d557] | 454 | if [ "$ldap" = 0 ]; then |
---|
[5973412] | 455 | echo "#undef WITH_LDAP" >> config.h |
---|
[f32d557] | 456 | elif [ "$ldap" = 1 ]; then |
---|
[5c5a586] | 457 | echo |
---|
| 458 | echo 'LDAP support is a work in progress and does NOT work AT ALL right now.' |
---|
| 459 | echo |
---|
| 460 | exit 1 |
---|
| 461 | |
---|
[5973412] | 462 | echo "#define WITH_LDAP 1" >> config.h |
---|
[b3c467b] | 463 | STORAGES="$STORAGES ldap" |
---|
[b7d3cc34] | 464 | fi |
---|
| 465 | |
---|
[b3c467b] | 466 | for i in $STORAGES; do |
---|
| 467 | STORAGE_OBJS="$STORAGE_OBJS storage_$i.o" |
---|
| 468 | done |
---|
| 469 | echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings |
---|
| 470 | |
---|
[b7d3cc34] | 471 | if [ "$strip" = 0 ]; then |
---|
| 472 | echo "STRIP=\# skip strip" >> Makefile.settings; |
---|
| 473 | else |
---|
| 474 | if [ "$debug" = 1 ]; then |
---|
| 475 | echo |
---|
| 476 | echo 'Stripping binaries does not make sense when debugging. Stripping disabled.' |
---|
| 477 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 478 | strip=0; |
---|
| 479 | elif [ -n "$STRIP" ]; then |
---|
| 480 | echo "STRIP=$STRIP" >> Makefile.settings; |
---|
| 481 | elif type strip > /dev/null 2> /dev/null; then |
---|
| 482 | echo "STRIP=strip" >> Makefile.settings; |
---|
| 483 | else |
---|
| 484 | echo |
---|
| 485 | echo 'No strip utility found, cannot remove unnecessary parts from executable.' |
---|
| 486 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 487 | strip=0; |
---|
| 488 | fi; |
---|
| 489 | fi |
---|
| 490 | |
---|
[417002e] | 491 | if [ -z "$systemdsystemunitdir" ]; then |
---|
| 492 | if $PKG_CONFIG --exists systemd; then |
---|
| 493 | systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd` |
---|
| 494 | fi |
---|
| 495 | fi |
---|
| 496 | if [ -n "$systemdsystemunitdir" ]; then |
---|
| 497 | if [ "$systemdsystemunitdir" != "no" ]; then |
---|
| 498 | echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings |
---|
| 499 | fi |
---|
| 500 | fi |
---|
| 501 | |
---|
[66b9e86e] | 502 | if [ "$gcov" = "1" ]; then |
---|
[31fc3970] | 503 | echo "CFLAGS+=--coverage" >> Makefile.settings |
---|
| 504 | echo "EFLAGS+=--coverage" >> Makefile.settings |
---|
[66b9e86e] | 505 | fi |
---|
| 506 | |
---|
[2abfbc5] | 507 | if [ "$plugins" = 0 ]; then |
---|
| 508 | echo '#undef WITH_PLUGINS' >> config.h |
---|
| 509 | else |
---|
| 510 | echo '#define WITH_PLUGINS' >> config.h |
---|
| 511 | fi |
---|
| 512 | |
---|
[6738a67] | 513 | otrprefix="" |
---|
| 514 | for i in / /usr /usr/local; do |
---|
| 515 | if [ -f ${i}/lib/libotr.a ]; then |
---|
| 516 | otrprefix=${i} |
---|
| 517 | break |
---|
| 518 | fi |
---|
| 519 | done |
---|
[764c7d1] | 520 | if [ "$otr" = "auto" ]; then |
---|
[6738a67] | 521 | if [ -n "$otrprefix" ]; then |
---|
| 522 | otr=1 |
---|
| 523 | else |
---|
| 524 | otr=0 |
---|
| 525 | fi |
---|
[764c7d1] | 526 | fi |
---|
[6738a67] | 527 | if [ "$otr" = 1 ]; then |
---|
[858ea01] | 528 | # BI == built-in |
---|
| 529 | echo '#define OTR_BI' >> config.h |
---|
[6738a67] | 530 | echo "EFLAGS+=-L${otrprefix}/lib -lotr" >> Makefile.settings |
---|
| 531 | echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings |
---|
[858ea01] | 532 | echo 'OTR_BI=otr.o' >> Makefile.settings |
---|
| 533 | elif [ "$otr" = "plugin" ]; then |
---|
| 534 | echo '#define OTR_PI' >> config.h |
---|
| 535 | echo "OTRFLAGS=-L${otrprefix}/lib -lotr" >> Makefile.settings |
---|
| 536 | echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings |
---|
| 537 | echo 'OTR_PI=otr.so' >> Makefile.settings |
---|
[764c7d1] | 538 | fi |
---|
| 539 | |
---|
[ceebeb1] | 540 | if [ ! -e doc/user-guide/help.txt ] && ! type xmlto > /dev/null 2> /dev/null; then |
---|
| 541 | echo |
---|
| 542 | echo 'WARNING: Building from an unreleased source tree without prebuilt helpfile.' |
---|
| 543 | echo 'Install xmlto if you want online help to work.' |
---|
| 544 | fi |
---|
| 545 | |
---|
[ffea9b9] | 546 | echo |
---|
[a014331] | 547 | if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then |
---|
| 548 | nick=`bzr nick` |
---|
| 549 | if [ -n "$nick" -a "$nick" != "bitlbee" ]; then |
---|
| 550 | nick="-$nick" |
---|
| 551 | else |
---|
| 552 | nick="" |
---|
| 553 | fi |
---|
[ffea9b9] | 554 | rev=`bzr revno` |
---|
| 555 | echo 'Using bzr revision #'$rev' as version number' |
---|
[a014331] | 556 | BITLBEE_VERSION=\"bzr$nick-$rev\" |
---|
[b7d3cc34] | 557 | fi |
---|
| 558 | |
---|
| 559 | if [ -n "$BITLBEE_VERSION" ]; then |
---|
| 560 | echo 'Spoofing version number: '$BITLBEE_VERSION |
---|
| 561 | echo '#undef BITLBEE_VERSION' >> config.h |
---|
[ffea9b9] | 562 | echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h |
---|
| 563 | echo |
---|
[b7d3cc34] | 564 | fi |
---|
| 565 | |
---|
[4fca1db] | 566 | if ! make helloworld > /dev/null 2>&1; then |
---|
| 567 | echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles." |
---|
| 568 | echo "BitlBee needs GNU make to build properly. On most systems GNU make is available" |
---|
| 569 | echo "under the name 'gmake'." |
---|
| 570 | echo |
---|
| 571 | if gmake helloworld > /dev/null 2>&1; then |
---|
| 572 | echo "gmake seems to be available on your machine, great." |
---|
| 573 | echo |
---|
| 574 | else |
---|
| 575 | echo "gmake is not installed (or not working). Please try to install it." |
---|
| 576 | echo |
---|
| 577 | fi |
---|
| 578 | fi |
---|
| 579 | |
---|
[e506d6c] | 580 | cat <<EOF>bitlbee.pc |
---|
| 581 | prefix=$prefix |
---|
| 582 | includedir=$includedir |
---|
| 583 | |
---|
| 584 | Name: bitlbee |
---|
| 585 | Description: IRC to IM gateway |
---|
| 586 | Requires: glib-2.0 |
---|
| 587 | Version: $BITLBEE_VERSION |
---|
| 588 | Libs: |
---|
| 589 | Cflags: -I\${includedir} |
---|
| 590 | |
---|
| 591 | EOF |
---|
| 592 | |
---|
[b7d3cc34] | 593 | protocols='' |
---|
| 594 | protoobjs='' |
---|
| 595 | |
---|
[e248c7f] | 596 | if [ "$purple" = 0 ]; then |
---|
| 597 | echo '#undef WITH_PURPLE' >> config.h |
---|
| 598 | else |
---|
[e08e53c] | 599 | if ! $PKG_CONFIG purple; then |
---|
| 600 | echo |
---|
| 601 | echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)' |
---|
| 602 | exit 1 |
---|
| 603 | fi |
---|
[e248c7f] | 604 | echo '#define WITH_PURPLE' >> config.h |
---|
[e08e53c] | 605 | cat<<EOF>>Makefile.settings |
---|
| 606 | EFLAGS += $($PKG_CONFIG purple --libs) |
---|
| 607 | PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags) |
---|
| 608 | EOF |
---|
[e248c7f] | 609 | protocols=$protocols'purple ' |
---|
| 610 | protoobjs=$protoobjs'purple_mod.o ' |
---|
| 611 | |
---|
| 612 | # Having both libpurple and native IM modules in one binary may |
---|
| 613 | # do strange things. Let's not do that. |
---|
| 614 | msn=0 |
---|
| 615 | jabber=0 |
---|
| 616 | oscar=0 |
---|
| 617 | yahoo=0 |
---|
[bda2975] | 618 | |
---|
| 619 | if [ "$events" = "libevent" ]; then |
---|
| 620 | echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling' |
---|
| 621 | echo 'outside libpurple, talking to GLib directly. At least for now the combination' |
---|
| 622 | echo 'libpurple + libevent is *not* recommended!' |
---|
[c775a58] | 623 | echo |
---|
[bda2975] | 624 | fi |
---|
[e248c7f] | 625 | fi |
---|
| 626 | |
---|
[b0a89cc] | 627 | case "$CC" in |
---|
| 628 | *gcc* ) |
---|
| 629 | echo CFLAGS+=-MD -MF .depend/\$@.d >> Makefile.settings |
---|
| 630 | for i in . lib protocols protocols/*/; do |
---|
| 631 | mkdir -p $i/.depend |
---|
| 632 | done |
---|
| 633 | esac |
---|
| 634 | |
---|
[b7d3cc34] | 635 | if [ "$msn" = 0 ]; then |
---|
| 636 | echo '#undef WITH_MSN' >> config.h |
---|
| 637 | else |
---|
| 638 | echo '#define WITH_MSN' >> config.h |
---|
| 639 | protocols=$protocols'msn ' |
---|
[b5a22e3] | 640 | protoobjs=$protoobjs'msn_mod.o ' |
---|
[b7d3cc34] | 641 | fi |
---|
| 642 | |
---|
| 643 | if [ "$jabber" = 0 ]; then |
---|
| 644 | echo '#undef WITH_JABBER' >> config.h |
---|
| 645 | else |
---|
| 646 | echo '#define WITH_JABBER' >> config.h |
---|
| 647 | protocols=$protocols'jabber ' |
---|
[b5a22e3] | 648 | protoobjs=$protoobjs'jabber_mod.o ' |
---|
[b7d3cc34] | 649 | fi |
---|
| 650 | |
---|
| 651 | if [ "$oscar" = 0 ]; then |
---|
| 652 | echo '#undef WITH_OSCAR' >> config.h |
---|
| 653 | else |
---|
| 654 | echo '#define WITH_OSCAR' >> config.h |
---|
| 655 | protocols=$protocols'oscar ' |
---|
[b5a22e3] | 656 | protoobjs=$protoobjs'oscar_mod.o ' |
---|
[b7d3cc34] | 657 | fi |
---|
| 658 | |
---|
| 659 | if [ "$yahoo" = 0 ]; then |
---|
| 660 | echo '#undef WITH_YAHOO' >> config.h |
---|
| 661 | else |
---|
| 662 | echo '#define WITH_YAHOO' >> config.h |
---|
| 663 | protocols=$protocols'yahoo ' |
---|
[b5a22e3] | 664 | protoobjs=$protoobjs'yahoo_mod.o ' |
---|
[b7d3cc34] | 665 | fi |
---|
| 666 | |
---|
[1b221e0] | 667 | if [ "$twitter" = 0 ]; then |
---|
| 668 | echo '#undef WITH_TWITTER' >> config.h |
---|
| 669 | else |
---|
| 670 | echo '#define WITH_TWITTER' >> config.h |
---|
| 671 | protocols=$protocols'twitter ' |
---|
| 672 | protoobjs=$protoobjs'twitter_mod.o ' |
---|
| 673 | fi |
---|
| 674 | |
---|
[b7d3cc34] | 675 | if [ "$protocols" = "PROTOCOLS = " ]; then |
---|
[43462708] | 676 | echo "Warning: You haven't selected any communication protocol to compile!" |
---|
[b3c467b] | 677 | echo " BitlBee will run, but you will be unable to connect to IM servers!" |
---|
[b7d3cc34] | 678 | fi |
---|
| 679 | |
---|
| 680 | echo "PROTOCOLS = $protocols" >> Makefile.settings |
---|
| 681 | echo "PROTOOBJS = $protoobjs" >> Makefile.settings |
---|
| 682 | |
---|
| 683 | echo Architecture: $arch |
---|
| 684 | case "$arch" in |
---|
| 685 | Linux ) |
---|
| 686 | ;; |
---|
| 687 | GNU/* ) |
---|
| 688 | ;; |
---|
| 689 | *BSD ) |
---|
| 690 | ;; |
---|
| 691 | Darwin ) |
---|
[caceb06] | 692 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
[b7d3cc34] | 693 | ;; |
---|
| 694 | IRIX ) |
---|
| 695 | ;; |
---|
| 696 | SunOS ) |
---|
| 697 | echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings |
---|
| 698 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
[70d7795] | 699 | echo '#define NO_FD_PASSING' >> config.h |
---|
[b7d3cc34] | 700 | ;; |
---|
[8de63c3] | 701 | AIX ) |
---|
| 702 | echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings |
---|
[b7d3cc34] | 703 | ;; |
---|
| 704 | CYGWIN* ) |
---|
| 705 | echo 'Cygwin is not officially supported.' |
---|
| 706 | ;; |
---|
[aec56b0] | 707 | Windows ) |
---|
| 708 | ;; |
---|
[b7d3cc34] | 709 | * ) |
---|
[8d6c4b1] | 710 | echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' |
---|
| 711 | echo 'Please report any problems at http://bugs.bitlbee.org/.' |
---|
[b7d3cc34] | 712 | ;; |
---|
| 713 | esac |
---|
| 714 | |
---|
[f1e7407] | 715 | if [ -n "$target" ]; then |
---|
| 716 | echo "Cross-compiling for: $target" |
---|
| 717 | fi |
---|
| 718 | |
---|
[b7d3cc34] | 719 | echo |
---|
| 720 | echo 'Configuration done:' |
---|
| 721 | |
---|
| 722 | if [ "$debug" = "1" ]; then |
---|
[b3c467b] | 723 | echo ' Debugging enabled.' |
---|
[b7d3cc34] | 724 | else |
---|
[b3c467b] | 725 | echo ' Debugging disabled.' |
---|
[b7d3cc34] | 726 | fi |
---|
| 727 | |
---|
| 728 | if [ "$strip" = "1" ]; then |
---|
[b3c467b] | 729 | echo ' Binary stripping enabled.' |
---|
[b7d3cc34] | 730 | else |
---|
[b3c467b] | 731 | echo ' Binary stripping disabled.' |
---|
[b7d3cc34] | 732 | fi |
---|
| 733 | |
---|
[764c7d1] | 734 | if [ "$otr" = "1" ]; then |
---|
| 735 | echo ' Off-the-Record (OTR) Messaging enabled.' |
---|
[858ea01] | 736 | elif [ "$otr" = "plugin" ]; then |
---|
| 737 | echo ' Off-the-Record (OTR) Messaging enabled (as a plugin).' |
---|
[764c7d1] | 738 | else |
---|
| 739 | echo ' Off-the-Record (OTR) Messaging disabled.' |
---|
| 740 | fi |
---|
| 741 | |
---|
[417002e] | 742 | if [ -n "$systemdsystemunitdir" ]; then |
---|
| 743 | echo ' systemd enabled.' |
---|
| 744 | else |
---|
| 745 | echo ' systemd disabled.' |
---|
| 746 | fi |
---|
| 747 | |
---|
[b3c467b] | 748 | echo ' Using event handler: '$events |
---|
| 749 | echo ' Using SSL library: '$ssl |
---|
[4e3df8a] | 750 | #echo ' Building with these storage backends: '$STORAGES |
---|
[b7d3cc34] | 751 | |
---|
| 752 | if [ -n "$protocols" ]; then |
---|
[b3c467b] | 753 | echo ' Building with these protocols:' $protocols |
---|
[4e3df8a] | 754 | case "$protocols" in |
---|
| 755 | *purple*) |
---|
| 756 | echo " Note that BitlBee-libpurple is supported on a best-effort basis. It's" |
---|
| 757 | echo " not *fully* compatible with normal BitlBee. Don't use it unless you" |
---|
| 758 | echo " absolutely need it (i.e. support for a certain protocol or feature)." |
---|
| 759 | esac |
---|
[b7d3cc34] | 760 | else |
---|
[b3c467b] | 761 | echo ' Building without IM-protocol support. We wish you a lot of fun...' |
---|
[b7d3cc34] | 762 | fi |
---|