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