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