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