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