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