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