[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/' |
---|
[57da960] | 11 | bindir='$prefix/bin/' |
---|
| 12 | sbindir='$prefix/sbin/' |
---|
[b7d3cc34] | 13 | etcdir='$prefix/etc/bitlbee/' |
---|
| 14 | mandir='$prefix/share/man/' |
---|
| 15 | datadir='$prefix/share/bitlbee/' |
---|
| 16 | config='/var/lib/bitlbee/' |
---|
[85cf37f] | 17 | plugindir='$prefix/lib/bitlbee/' |
---|
| 18 | includedir='$prefix/include/bitlbee/' |
---|
[417002e] | 19 | systemdsystemunitdir='' |
---|
[85cf37f] | 20 | libevent='/usr/' |
---|
[34b17d9] | 21 | pidfile='/var/run/bitlbee.pid' |
---|
[4c225f0] | 22 | ipcsocket='' |
---|
[e506d6c] | 23 | pcdir='$prefix/lib/pkgconfig' |
---|
[25b80e9c] | 24 | systemlibdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib" |
---|
[b7d3cc34] | 25 | |
---|
| 26 | msn=1 |
---|
| 27 | jabber=1 |
---|
| 28 | oscar=1 |
---|
| 29 | yahoo=1 |
---|
[1b221e0] | 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 |
---|
[b7d3cc34] | 41 | ssl=auto |
---|
| 42 | |
---|
| 43 | arch=`uname -s` |
---|
| 44 | cpu=`uname -m` |
---|
| 45 | |
---|
[74c5718] | 46 | GLIB_MIN_VERSION=2.14 |
---|
[670204f] | 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 |
---|
[57da960] | 61 | --sbindir=... $sbindir |
---|
[b7d3cc34] | 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'` |
---|
[57da960] | 102 | sbindir=`eval echo "$sbindir/" | sed 's/\/\{1,\}/\//g'` |
---|
[b7d3cc34] | 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 |
---|
[57da960] | 121 | SBINDIR=$sbindir |
---|
[b7d3cc34] | 122 | ETCDIR=$etcdir |
---|
| 123 | MANDIR=$mandir |
---|
| 124 | DATADIR=$datadir |
---|
[7b23afd] | 125 | PLUGINDIR=$plugindir |
---|
[b7d3cc34] | 126 | CONFIG=$config |
---|
[e506d6c] | 127 | INCLUDEDIR=$includedir |
---|
| 128 | PCDIR=$pcdir |
---|
[b7d3cc34] | 129 | |
---|
[1bf9492] | 130 | TARGET=$target |
---|
[b7d3cc34] | 131 | ARCH=$arch |
---|
| 132 | CPU=$cpu |
---|
| 133 | |
---|
[25b80e9c] | 134 | INSTALL=install -p |
---|
| 135 | |
---|
[b7d3cc34] | 136 | DESTDIR= |
---|
| 137 | LFLAGS= |
---|
| 138 | EFLAGS= |
---|
| 139 | EOF |
---|
| 140 | |
---|
[1074806] | 141 | srcdir=$(cd $(dirname $0);pwd) |
---|
| 142 | currdir=$(pwd) |
---|
| 143 | if [ "$srcdir" != "$currdir" ]; then |
---|
[f60079b] | 144 | echo |
---|
| 145 | echo "configure script run from a different directory. Will create some symlinks..." |
---|
| 146 | if [ ! -e Makefile -o -L Makefile ]; then |
---|
[04dc563] | 147 | COPYDIRS="doc lib protocols tests utils" |
---|
| 148 | mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d) |
---|
[f60079b] | 149 | find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null |
---|
| 150 | dst="$PWD" |
---|
| 151 | cd "$srcdir" |
---|
[04dc563] | 152 | for i in $(find . -name Makefile -type f); do |
---|
[f60079b] | 153 | ln -s "$PWD${i#.}" "$dst/$i"; |
---|
| 154 | done |
---|
| 155 | cd "$dst" |
---|
| 156 | rm -rf .bzr |
---|
| 157 | fi |
---|
| 158 | |
---|
[7fa5c19] | 159 | echo "_SRCDIR_=$srcdir/" >> Makefile.settings |
---|
[f60079b] | 160 | CFLAGS="$CFLAGS -I${dst}" |
---|
| 161 | else |
---|
| 162 | srcdir=$PWD |
---|
| 163 | fi |
---|
| 164 | |
---|
[b7d3cc34] | 165 | cat<<EOF>config.h |
---|
| 166 | /* BitlBee settings, generated by configure |
---|
| 167 | |
---|
| 168 | Do *NOT* use any of these defines in your code without thinking twice, most |
---|
| 169 | of them can/will be overridden at run-time */ |
---|
| 170 | |
---|
| 171 | #define CONFIG "$config" |
---|
| 172 | #define ETCDIR "$etcdir" |
---|
| 173 | #define VARDIR "$datadir" |
---|
[7b23afd] | 174 | #define PLUGINDIR "$plugindir" |
---|
[34b17d9] | 175 | #define PIDFILE "$pidfile" |
---|
[6dff9d4] | 176 | #define IPCSOCKET "$ipcsocket" |
---|
[b7d3cc34] | 177 | #define ARCH "$arch" |
---|
| 178 | #define CPU "$cpu" |
---|
| 179 | EOF |
---|
| 180 | |
---|
[1bf9492] | 181 | |
---|
| 182 | |
---|
[f1e7407] | 183 | if [ -n "$target" ]; then |
---|
[1bf9492] | 184 | PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig |
---|
| 185 | export PKG_CONFIG_LIBDIR |
---|
[f1e7407] | 186 | PATH=/usr/$target/bin:$PATH |
---|
| 187 | CC=$target-cc |
---|
| 188 | LD=$target-ld |
---|
[1bf9492] | 189 | systemlibdirs="/usr/$target/lib" |
---|
[f1e7407] | 190 | fi |
---|
| 191 | |
---|
[1bf9492] | 192 | |
---|
[b7d3cc34] | 193 | if [ "$debug" = "1" ]; then |
---|
[285b55d] | 194 | [ -z "$CFLAGS" ] && CFLAGS=-g |
---|
[b7d3cc34] | 195 | echo 'DEBUG=1' >> Makefile.settings |
---|
[911cc4f] | 196 | CFLAGS="$CFLAGS -DDEBUG" |
---|
[b7d3cc34] | 197 | else |
---|
[56f260a] | 198 | [ -z "$CFLAGS" ] && CFLAGS="-O2 -fno-strict-aliasing" |
---|
[b7d3cc34] | 199 | fi |
---|
| 200 | |
---|
[daae10f] | 201 | echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings |
---|
[f60079b] | 202 | echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings |
---|
[b7d3cc34] | 203 | |
---|
[f712188] | 204 | echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings |
---|
| 205 | |
---|
[b7d3cc34] | 206 | if [ -n "$CC" ]; then |
---|
[5973412] | 207 | CC=$CC |
---|
[b7d3cc34] | 208 | elif type gcc > /dev/null 2> /dev/null; then |
---|
[5973412] | 209 | CC=gcc |
---|
[b7d3cc34] | 210 | elif type cc > /dev/null 2> /dev/null; then |
---|
[5973412] | 211 | CC=cc |
---|
[b7d3cc34] | 212 | else |
---|
| 213 | echo 'Cannot find a C compiler, aborting.' |
---|
| 214 | exit 1; |
---|
| 215 | fi |
---|
| 216 | |
---|
[5973412] | 217 | echo "CC=$CC" >> Makefile.settings; |
---|
[daae10f] | 218 | if echo $CC | grep -qw gcc; then |
---|
| 219 | # Apparently -Wall is gcc-specific? |
---|
| 220 | echo CFLAGS+=-Wall >> Makefile.settings |
---|
| 221 | fi |
---|
[5973412] | 222 | |
---|
[f1e7407] | 223 | if [ -z "$LD" ]; then |
---|
| 224 | if type ld > /dev/null 2> /dev/null; then |
---|
| 225 | LD=ld |
---|
| 226 | else |
---|
| 227 | echo 'Cannot find ld, aborting.' |
---|
| 228 | exit 1; |
---|
| 229 | fi |
---|
[b7d3cc34] | 230 | fi |
---|
| 231 | |
---|
[f1e7407] | 232 | echo "LD=$LD" >> Makefile.settings |
---|
| 233 | |
---|
[32c632f] | 234 | if [ -z "$PKG_CONFIG" ]; then |
---|
| 235 | PKG_CONFIG=pkg-config |
---|
| 236 | fi |
---|
| 237 | |
---|
| 238 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then |
---|
[670204f] | 239 | if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then |
---|
| 240 | cat<<EOF>>Makefile.settings |
---|
[32c632f] | 241 | EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0` |
---|
| 242 | CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0` |
---|
[b7d3cc34] | 243 | EOF |
---|
[670204f] | 244 | else |
---|
| 245 | echo |
---|
| 246 | echo 'Found glib2 '`$PKG_CONFIG glib-2.0 --modversion`', but version '$GLIB_MIN_VERSION' or newer is required.' |
---|
| 247 | exit 1 |
---|
| 248 | fi |
---|
[b7d3cc34] | 249 | else |
---|
[670204f] | 250 | echo |
---|
[574af7e] | 251 | echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)' |
---|
[670204f] | 252 | exit 1 |
---|
[b7d3cc34] | 253 | fi |
---|
| 254 | |
---|
[85cf37f] | 255 | if [ "$events" = "libevent" ]; then |
---|
[003553b] | 256 | if ! [ -f "${libevent}include/event.h" ]; then |
---|
[85cf37f] | 257 | echo |
---|
| 258 | echo 'Warning: Could not find event.h, you might have to install it and/or specify' |
---|
| 259 | echo 'its location using the --libevent= argument. (Example: If event.h is in' |
---|
| 260 | echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)' |
---|
| 261 | fi |
---|
| 262 | |
---|
| 263 | echo '#define EVENTS_LIBEVENT' >> config.h |
---|
| 264 | cat <<EOF>>Makefile.settings |
---|
| 265 | EFLAGS+=-levent -L${libevent}lib |
---|
| 266 | CFLAGS+=-I${libevent}include |
---|
| 267 | EOF |
---|
| 268 | elif [ "$events" = "glib" ]; then |
---|
| 269 | ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...): |
---|
| 270 | echo '#define EVENTS_GLIB' >> config.h |
---|
[b7d3cc34] | 271 | else |
---|
| 272 | echo |
---|
[85cf37f] | 273 | echo 'ERROR: Unknown event handler specified.' |
---|
| 274 | exit 1 |
---|
[b7d3cc34] | 275 | fi |
---|
[85cf37f] | 276 | echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings |
---|
[b7d3cc34] | 277 | |
---|
| 278 | detect_gnutls() |
---|
| 279 | { |
---|
[4af7b4f] | 280 | if $PKG_CONFIG --exists gnutls; then |
---|
| 281 | cat <<EOF>>Makefile.settings |
---|
[83e47ec] | 282 | EFLAGS+=`$PKG_CONFIG --libs gnutls` `libgcrypt-config --libs` |
---|
| 283 | CFLAGS+=`$PKG_CONFIG --cflags gnutls` `libgcrypt-config --cflags` |
---|
[4af7b4f] | 284 | EOF |
---|
| 285 | ssl=gnutls |
---|
[5513f3e] | 286 | if ! pkg-config gnutls --atleast-version=2.8; then |
---|
| 287 | echo |
---|
| 288 | echo 'Warning: With GnuTLS versions <2.8, certificate expire dates are not verified.' |
---|
| 289 | fi |
---|
[4af7b4f] | 290 | ret=1 |
---|
| 291 | elif libgnutls-config --version > /dev/null 2> /dev/null; then |
---|
[b7d3cc34] | 292 | cat <<EOF>>Makefile.settings |
---|
[83e47ec] | 293 | EFLAGS+=`libgnutls-config --libs` `libgcrypt-config --libs` |
---|
| 294 | CFLAGS+=`libgnutls-config --cflags` `libgcrypt-config --cflags` |
---|
[b7d3cc34] | 295 | EOF |
---|
| 296 | |
---|
| 297 | ssl=gnutls |
---|
| 298 | ret=1; |
---|
| 299 | else |
---|
| 300 | ret=0; |
---|
| 301 | fi; |
---|
| 302 | } |
---|
| 303 | |
---|
| 304 | detect_nss() |
---|
| 305 | { |
---|
[ef043d3] | 306 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then |
---|
[b7d3cc34] | 307 | cat<<EOF>>Makefile.settings |
---|
[ef043d3] | 308 | EFLAGS+=`$PKG_CONFIG --libs nss` |
---|
| 309 | CFLAGS+=`$PKG_CONFIG --cflags nss` |
---|
[b7d3cc34] | 310 | EOF |
---|
| 311 | |
---|
| 312 | ssl=nss |
---|
| 313 | ret=1; |
---|
| 314 | else |
---|
| 315 | ret=0; |
---|
| 316 | fi; |
---|
| 317 | } |
---|
| 318 | |
---|
[36cf9fd] | 319 | RESOLV_TESTCODE=' |
---|
[aee8c19] | 320 | #include <sys/types.h> |
---|
| 321 | #include <netinet/in.h> |
---|
[36cf9fd] | 322 | #include <arpa/nameser.h> |
---|
| 323 | #include <resolv.h> |
---|
| 324 | |
---|
| 325 | int main() |
---|
| 326 | { |
---|
| 327 | ns_initparse( NULL, 0, NULL ); |
---|
| 328 | ns_parserr( NULL, ns_s_an, 0, NULL ); |
---|
| 329 | } |
---|
| 330 | ' |
---|
| 331 | |
---|
| 332 | detect_resolv_dynamic() |
---|
| 333 | { |
---|
[aee8c19] | 334 | case "$arch" in |
---|
| 335 | FreeBSD ) |
---|
| 336 | # In FreeBSD res_* routines are present in libc.so |
---|
| 337 | LIBRESOLV=;; |
---|
| 338 | * ) |
---|
| 339 | LIBRESOLV=-lresolv;; |
---|
| 340 | esac |
---|
[4fca1db] | 341 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
[8462239] | 342 | ret=1 |
---|
[aee8c19] | 343 | echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null |
---|
[36cf9fd] | 344 | if [ "$?" = "0" ]; then |
---|
[aee8c19] | 345 | echo "EFLAGS+=$LIBRESOLV" >> 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 | |
---|
| 454 | for i in $STORAGES; do |
---|
| 455 | STORAGE_OBJS="$STORAGE_OBJS storage_$i.o" |
---|
| 456 | done |
---|
| 457 | echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings |
---|
| 458 | |
---|
[b7d3cc34] | 459 | if [ "$strip" = 0 ]; then |
---|
| 460 | echo "STRIP=\# skip strip" >> Makefile.settings; |
---|
| 461 | else |
---|
| 462 | if [ "$debug" = 1 ]; then |
---|
| 463 | echo |
---|
| 464 | echo 'Stripping binaries does not make sense when debugging. Stripping disabled.' |
---|
| 465 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 466 | strip=0; |
---|
| 467 | elif [ -n "$STRIP" ]; then |
---|
| 468 | echo "STRIP=$STRIP" >> Makefile.settings; |
---|
| 469 | elif type strip > /dev/null 2> /dev/null; then |
---|
| 470 | echo "STRIP=strip" >> Makefile.settings; |
---|
| 471 | else |
---|
| 472 | echo |
---|
| 473 | echo 'No strip utility found, cannot remove unnecessary parts from executable.' |
---|
| 474 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 475 | strip=0; |
---|
| 476 | fi; |
---|
| 477 | fi |
---|
| 478 | |
---|
[417002e] | 479 | if [ -z "$systemdsystemunitdir" ]; then |
---|
| 480 | if $PKG_CONFIG --exists systemd; then |
---|
| 481 | systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd` |
---|
| 482 | fi |
---|
| 483 | fi |
---|
| 484 | if [ -n "$systemdsystemunitdir" ]; then |
---|
| 485 | if [ "$systemdsystemunitdir" != "no" ]; then |
---|
| 486 | echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings |
---|
| 487 | fi |
---|
| 488 | fi |
---|
| 489 | |
---|
[66b9e86e] | 490 | if [ "$gcov" = "1" ]; then |
---|
[31fc3970] | 491 | echo "CFLAGS+=--coverage" >> Makefile.settings |
---|
| 492 | echo "EFLAGS+=--coverage" >> Makefile.settings |
---|
[66b9e86e] | 493 | fi |
---|
| 494 | |
---|
[2abfbc5] | 495 | if [ "$plugins" = 0 ]; then |
---|
| 496 | echo '#undef WITH_PLUGINS' >> config.h |
---|
| 497 | else |
---|
| 498 | echo '#define WITH_PLUGINS' >> config.h |
---|
| 499 | fi |
---|
| 500 | |
---|
[6738a67] | 501 | otrprefix="" |
---|
| 502 | for i in / /usr /usr/local; do |
---|
| 503 | if [ -f ${i}/lib/libotr.a ]; then |
---|
| 504 | otrprefix=${i} |
---|
| 505 | break |
---|
| 506 | fi |
---|
| 507 | done |
---|
[764c7d1] | 508 | if [ "$otr" = "auto" ]; then |
---|
[6738a67] | 509 | if [ -n "$otrprefix" ]; then |
---|
| 510 | otr=1 |
---|
| 511 | else |
---|
| 512 | otr=0 |
---|
| 513 | fi |
---|
[764c7d1] | 514 | fi |
---|
[6738a67] | 515 | if [ "$otr" = 1 ]; then |
---|
[858ea01] | 516 | # BI == built-in |
---|
| 517 | echo '#define OTR_BI' >> config.h |
---|
[6738a67] | 518 | echo "EFLAGS+=-L${otrprefix}/lib -lotr" >> Makefile.settings |
---|
| 519 | echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings |
---|
[858ea01] | 520 | echo 'OTR_BI=otr.o' >> Makefile.settings |
---|
| 521 | elif [ "$otr" = "plugin" ]; then |
---|
| 522 | echo '#define OTR_PI' >> config.h |
---|
| 523 | echo "OTRFLAGS=-L${otrprefix}/lib -lotr" >> Makefile.settings |
---|
| 524 | echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings |
---|
| 525 | echo 'OTR_PI=otr.so' >> Makefile.settings |
---|
[764c7d1] | 526 | fi |
---|
| 527 | |
---|
[17f6079] | 528 | if [ "$skype" = "1" -o "$skype" = "plugin" ]; then |
---|
[370899f] | 529 | echo 'SKYPE_PI=skype.so' >> Makefile.settings |
---|
[17f6079] | 530 | protocols_mods="$protocol_mods skype(plugin)" |
---|
[370899f] | 531 | fi |
---|
| 532 | |
---|
[ceebeb1] | 533 | if [ ! -e doc/user-guide/help.txt ] && ! type xmlto > /dev/null 2> /dev/null; then |
---|
| 534 | echo |
---|
| 535 | echo 'WARNING: Building from an unreleased source tree without prebuilt helpfile.' |
---|
| 536 | echo 'Install xmlto if you want online help to work.' |
---|
| 537 | fi |
---|
| 538 | |
---|
[ffea9b9] | 539 | echo |
---|
[a014331] | 540 | if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then |
---|
| 541 | nick=`bzr nick` |
---|
| 542 | if [ -n "$nick" -a "$nick" != "bitlbee" ]; then |
---|
| 543 | nick="-$nick" |
---|
| 544 | else |
---|
| 545 | nick="" |
---|
| 546 | fi |
---|
[ffea9b9] | 547 | rev=`bzr revno` |
---|
| 548 | echo 'Using bzr revision #'$rev' as version number' |
---|
[a014331] | 549 | BITLBEE_VERSION=\"bzr$nick-$rev\" |
---|
[b7d3cc34] | 550 | fi |
---|
| 551 | |
---|
| 552 | if [ -n "$BITLBEE_VERSION" ]; then |
---|
| 553 | echo 'Spoofing version number: '$BITLBEE_VERSION |
---|
| 554 | echo '#undef BITLBEE_VERSION' >> config.h |
---|
[ffea9b9] | 555 | echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h |
---|
| 556 | echo |
---|
[b7d3cc34] | 557 | fi |
---|
| 558 | |
---|
[4fca1db] | 559 | if ! make helloworld > /dev/null 2>&1; then |
---|
| 560 | echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles." |
---|
| 561 | echo "BitlBee needs GNU make to build properly. On most systems GNU make is available" |
---|
| 562 | echo "under the name 'gmake'." |
---|
| 563 | echo |
---|
| 564 | if gmake helloworld > /dev/null 2>&1; then |
---|
| 565 | echo "gmake seems to be available on your machine, great." |
---|
| 566 | echo |
---|
| 567 | else |
---|
| 568 | echo "gmake is not installed (or not working). Please try to install it." |
---|
| 569 | echo |
---|
| 570 | fi |
---|
| 571 | fi |
---|
| 572 | |
---|
[e506d6c] | 573 | cat <<EOF>bitlbee.pc |
---|
| 574 | prefix=$prefix |
---|
| 575 | includedir=$includedir |
---|
| 576 | |
---|
| 577 | Name: bitlbee |
---|
| 578 | Description: IRC to IM gateway |
---|
| 579 | Requires: glib-2.0 |
---|
| 580 | Version: $BITLBEE_VERSION |
---|
| 581 | Libs: |
---|
| 582 | Cflags: -I\${includedir} |
---|
| 583 | |
---|
| 584 | EOF |
---|
| 585 | |
---|
[b7d3cc34] | 586 | protocols='' |
---|
| 587 | protoobjs='' |
---|
| 588 | |
---|
[e248c7f] | 589 | if [ "$purple" = 0 ]; then |
---|
| 590 | echo '#undef WITH_PURPLE' >> config.h |
---|
| 591 | else |
---|
[e08e53c] | 592 | if ! $PKG_CONFIG purple; then |
---|
| 593 | echo |
---|
| 594 | echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)' |
---|
| 595 | exit 1 |
---|
| 596 | fi |
---|
[e248c7f] | 597 | echo '#define WITH_PURPLE' >> config.h |
---|
[e08e53c] | 598 | cat<<EOF>>Makefile.settings |
---|
| 599 | EFLAGS += $($PKG_CONFIG purple --libs) |
---|
| 600 | PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags) |
---|
| 601 | EOF |
---|
[e248c7f] | 602 | protocols=$protocols'purple ' |
---|
| 603 | protoobjs=$protoobjs'purple_mod.o ' |
---|
| 604 | |
---|
| 605 | # Having both libpurple and native IM modules in one binary may |
---|
| 606 | # do strange things. Let's not do that. |
---|
| 607 | msn=0 |
---|
| 608 | jabber=0 |
---|
| 609 | oscar=0 |
---|
| 610 | yahoo=0 |
---|
[18e1f3b] | 611 | |
---|
| 612 | echo '#undef PACKAGE' >> config.h |
---|
| 613 | echo '#define PACKAGE "BitlBee-LIBPURPLE"' >> config.h |
---|
[bda2975] | 614 | |
---|
| 615 | if [ "$events" = "libevent" ]; then |
---|
| 616 | echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling' |
---|
| 617 | echo 'outside libpurple, talking to GLib directly. At least for now the combination' |
---|
| 618 | echo 'libpurple + libevent is *not* recommended!' |
---|
[c775a58] | 619 | echo |
---|
[bda2975] | 620 | fi |
---|
[e248c7f] | 621 | fi |
---|
| 622 | |
---|
[b0a89cc] | 623 | case "$CC" in |
---|
| 624 | *gcc* ) |
---|
[e371011] | 625 | echo CFLAGS+=-MMD -MF .depend/\$@.d >> Makefile.settings |
---|
[b0a89cc] | 626 | for i in . lib protocols protocols/*/; do |
---|
| 627 | mkdir -p $i/.depend |
---|
| 628 | done |
---|
| 629 | esac |
---|
| 630 | |
---|
[b7d3cc34] | 631 | if [ "$msn" = 0 ]; then |
---|
| 632 | echo '#undef WITH_MSN' >> config.h |
---|
| 633 | else |
---|
| 634 | echo '#define WITH_MSN' >> config.h |
---|
| 635 | protocols=$protocols'msn ' |
---|
[b5a22e3] | 636 | protoobjs=$protoobjs'msn_mod.o ' |
---|
[b7d3cc34] | 637 | fi |
---|
| 638 | |
---|
| 639 | if [ "$jabber" = 0 ]; then |
---|
| 640 | echo '#undef WITH_JABBER' >> config.h |
---|
| 641 | else |
---|
| 642 | echo '#define WITH_JABBER' >> config.h |
---|
| 643 | protocols=$protocols'jabber ' |
---|
[b5a22e3] | 644 | protoobjs=$protoobjs'jabber_mod.o ' |
---|
[b7d3cc34] | 645 | fi |
---|
| 646 | |
---|
| 647 | if [ "$oscar" = 0 ]; then |
---|
| 648 | echo '#undef WITH_OSCAR' >> config.h |
---|
| 649 | else |
---|
| 650 | echo '#define WITH_OSCAR' >> config.h |
---|
| 651 | protocols=$protocols'oscar ' |
---|
[b5a22e3] | 652 | protoobjs=$protoobjs'oscar_mod.o ' |
---|
[b7d3cc34] | 653 | fi |
---|
| 654 | |
---|
| 655 | if [ "$yahoo" = 0 ]; then |
---|
| 656 | echo '#undef WITH_YAHOO' >> config.h |
---|
| 657 | else |
---|
| 658 | echo '#define WITH_YAHOO' >> config.h |
---|
| 659 | protocols=$protocols'yahoo ' |
---|
[b5a22e3] | 660 | protoobjs=$protoobjs'yahoo_mod.o ' |
---|
[b7d3cc34] | 661 | fi |
---|
| 662 | |
---|
[1b221e0] | 663 | if [ "$twitter" = 0 ]; then |
---|
| 664 | echo '#undef WITH_TWITTER' >> config.h |
---|
| 665 | else |
---|
| 666 | echo '#define WITH_TWITTER' >> config.h |
---|
| 667 | protocols=$protocols'twitter ' |
---|
| 668 | protoobjs=$protoobjs'twitter_mod.o ' |
---|
| 669 | fi |
---|
| 670 | |
---|
[b7d3cc34] | 671 | if [ "$protocols" = "PROTOCOLS = " ]; then |
---|
[43462708] | 672 | echo "Warning: You haven't selected any communication protocol to compile!" |
---|
[b3c467b] | 673 | echo " BitlBee will run, but you will be unable to connect to IM servers!" |
---|
[b7d3cc34] | 674 | fi |
---|
| 675 | |
---|
| 676 | echo "PROTOCOLS = $protocols" >> Makefile.settings |
---|
| 677 | echo "PROTOOBJS = $protoobjs" >> Makefile.settings |
---|
| 678 | |
---|
| 679 | echo Architecture: $arch |
---|
| 680 | case "$arch" in |
---|
| 681 | Linux ) |
---|
| 682 | ;; |
---|
| 683 | GNU/* ) |
---|
| 684 | ;; |
---|
| 685 | *BSD ) |
---|
| 686 | ;; |
---|
| 687 | Darwin ) |
---|
[caceb06] | 688 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
[b7d3cc34] | 689 | ;; |
---|
| 690 | IRIX ) |
---|
| 691 | ;; |
---|
| 692 | SunOS ) |
---|
| 693 | echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings |
---|
| 694 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
[70d7795] | 695 | echo '#define NO_FD_PASSING' >> config.h |
---|
[b7d3cc34] | 696 | ;; |
---|
[8de63c3] | 697 | AIX ) |
---|
| 698 | echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings |
---|
[b7d3cc34] | 699 | ;; |
---|
| 700 | CYGWIN* ) |
---|
| 701 | echo 'Cygwin is not officially supported.' |
---|
| 702 | ;; |
---|
[aec56b0] | 703 | Windows ) |
---|
| 704 | ;; |
---|
[b7d3cc34] | 705 | * ) |
---|
[8d6c4b1] | 706 | echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' |
---|
| 707 | echo 'Please report any problems at http://bugs.bitlbee.org/.' |
---|
[b7d3cc34] | 708 | ;; |
---|
| 709 | esac |
---|
| 710 | |
---|
[f1e7407] | 711 | if [ -n "$target" ]; then |
---|
| 712 | echo "Cross-compiling for: $target" |
---|
| 713 | fi |
---|
| 714 | |
---|
[b7d3cc34] | 715 | echo |
---|
| 716 | echo 'Configuration done:' |
---|
| 717 | |
---|
| 718 | if [ "$debug" = "1" ]; then |
---|
[b3c467b] | 719 | echo ' Debugging enabled.' |
---|
[b7d3cc34] | 720 | else |
---|
[b3c467b] | 721 | echo ' Debugging disabled.' |
---|
[b7d3cc34] | 722 | fi |
---|
| 723 | |
---|
| 724 | if [ "$strip" = "1" ]; then |
---|
[b3c467b] | 725 | echo ' Binary stripping enabled.' |
---|
[b7d3cc34] | 726 | else |
---|
[b3c467b] | 727 | echo ' Binary stripping disabled.' |
---|
[b7d3cc34] | 728 | fi |
---|
| 729 | |
---|
[764c7d1] | 730 | if [ "$otr" = "1" ]; then |
---|
| 731 | echo ' Off-the-Record (OTR) Messaging enabled.' |
---|
[858ea01] | 732 | elif [ "$otr" = "plugin" ]; then |
---|
| 733 | echo ' Off-the-Record (OTR) Messaging enabled (as a plugin).' |
---|
[764c7d1] | 734 | else |
---|
| 735 | echo ' Off-the-Record (OTR) Messaging disabled.' |
---|
| 736 | fi |
---|
| 737 | |
---|
[417002e] | 738 | if [ -n "$systemdsystemunitdir" ]; then |
---|
| 739 | echo ' systemd enabled.' |
---|
| 740 | else |
---|
| 741 | echo ' systemd disabled.' |
---|
| 742 | fi |
---|
| 743 | |
---|
[b3c467b] | 744 | echo ' Using event handler: '$events |
---|
| 745 | echo ' Using SSL library: '$ssl |
---|
[4e3df8a] | 746 | #echo ' Building with these storage backends: '$STORAGES |
---|
[b7d3cc34] | 747 | |
---|
| 748 | if [ -n "$protocols" ]; then |
---|
[17f6079] | 749 | echo ' Building with these protocols:' $protocols$protocols_mods |
---|
[4e3df8a] | 750 | case "$protocols" in |
---|
| 751 | *purple*) |
---|
| 752 | echo " Note that BitlBee-libpurple is supported on a best-effort basis. It's" |
---|
| 753 | echo " not *fully* compatible with normal BitlBee. Don't use it unless you" |
---|
| 754 | echo " absolutely need it (i.e. support for a certain protocol or feature)." |
---|
| 755 | esac |
---|
[b7d3cc34] | 756 | else |
---|
[b3c467b] | 757 | echo ' Building without IM-protocol support. We wish you a lot of fun...' |
---|
[b7d3cc34] | 758 | fi |
---|