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