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