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