[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/' |
---|
[54b2a36] | 17 | libdir='$prefix/lib/' |
---|
[85cf37f] | 18 | plugindir='$prefix/lib/bitlbee/' |
---|
| 19 | includedir='$prefix/include/bitlbee/' |
---|
[417002e] | 20 | systemdsystemunitdir='' |
---|
[85cf37f] | 21 | libevent='/usr/' |
---|
[34b17d9] | 22 | pidfile='/var/run/bitlbee.pid' |
---|
[4c225f0] | 23 | ipcsocket='' |
---|
[e506d6c] | 24 | pcdir='$prefix/lib/pkgconfig' |
---|
[25b80e9c] | 25 | systemlibdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib" |
---|
[f5bbaba] | 26 | sysroot='' |
---|
[b7d3cc34] | 27 | |
---|
[2f8e3ca] | 28 | configure_args="$@" |
---|
| 29 | |
---|
[04e2a05] | 30 | # Set these to default-on to let it be overriden by either the user or purple |
---|
| 31 | # |
---|
| 32 | # If the user sets one of these to 1, purple won't disable them. |
---|
| 33 | # Otherwise, if it's still default-on, it gets included in normal builds, |
---|
| 34 | # but not purple ones. |
---|
| 35 | jabber="default-on" |
---|
| 36 | |
---|
[1b221e0] | 37 | twitter=1 |
---|
[04dc563] | 38 | purple=0 |
---|
[b7d3cc34] | 39 | |
---|
[65d0dfd] | 40 | verbose=0 |
---|
[a85a8ab] | 41 | doc=1 |
---|
[b7d3cc34] | 42 | debug=0 |
---|
[2a1c27f] | 43 | strip=0 |
---|
[66b9e86e] | 44 | gcov=0 |
---|
[e2472dd] | 45 | asan=0 |
---|
[2abfbc5] | 46 | plugins=1 |
---|
[04f0c10] | 47 | otr=0 |
---|
[85cf37f] | 48 | |
---|
| 49 | events=glib |
---|
[b7d3cc34] | 50 | ssl=auto |
---|
| 51 | |
---|
[a6005da] | 52 | pam=0 |
---|
[50bb490] | 53 | ldap=0 |
---|
[a6005da] | 54 | |
---|
[7281ad1] | 55 | pie=1 |
---|
| 56 | |
---|
[21f450c] | 57 | arch=$(uname -s) |
---|
| 58 | |
---|
[3a547ee] | 59 | GLIB_MIN_VERSION=2.32 |
---|
[670204f] | 60 | |
---|
[25c4c78] | 61 | # Cygwin and Darwin don't support PIC/PIE |
---|
| 62 | case "$arch" in |
---|
[a85a8ab] | 63 | CYGWIN* ) |
---|
| 64 | pie=0;; |
---|
| 65 | Darwin ) |
---|
| 66 | pie=0;; |
---|
[25c4c78] | 67 | esac |
---|
| 68 | |
---|
[70ec7ab] | 69 | get_version() { |
---|
| 70 | REAL_BITLBEE_VERSION=$(grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/') |
---|
[041777e] | 71 | |
---|
| 72 | if [ -n "$BITLBEE_VERSION" ]; then |
---|
| 73 | # environment variable already set to something to spoof it |
---|
| 74 | # don't replace it with the git stuff |
---|
| 75 | return |
---|
| 76 | fi |
---|
| 77 | |
---|
[70ec7ab] | 78 | BITLBEE_VERSION=$REAL_BITLBEE_VERSION |
---|
| 79 | |
---|
| 80 | if [ -d $srcdir/.git ] && type git > /dev/null 2> /dev/null; then |
---|
| 81 | timestamp=$(cd $srcdir; git show -s --format=%ci HEAD | sed 's/ .*$//; s/-//g') |
---|
| 82 | branch=$(cd $srcdir; git rev-parse --abbrev-ref HEAD) |
---|
| 83 | |
---|
[1d8cbc9] | 84 | search='\(.*\)-\([0-9]*\)-\(g[0-9a-f]*\)' |
---|
[70ec7ab] | 85 | replace="\1+$timestamp+$branch+\2-\3-git" |
---|
| 86 | |
---|
[e28c449] | 87 | describe=$(cd $srcdir; git describe --long --tags 2>/dev/null) |
---|
| 88 | if [ $? -ne 0 ]; then |
---|
| 89 | describe=${REAL_BITLBEE_VERSION}-0-g$(cd $srcdir; git rev-parse --short HEAD) |
---|
| 90 | fi |
---|
[70ec7ab] | 91 | |
---|
[c984ee3] | 92 | BITLBEE_VERSION=$(echo $describe | sed "s#$search#$replace#") |
---|
[e28c449] | 93 | |
---|
| 94 | unset timestamp branch search replace describe |
---|
[70ec7ab] | 95 | fi |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | if [ "$1" = "--dump-version" ]; then |
---|
| 99 | srcdir=$(cd $(dirname $0);pwd) |
---|
| 100 | get_version |
---|
| 101 | echo $BITLBEE_VERSION |
---|
| 102 | exit |
---|
| 103 | fi |
---|
| 104 | |
---|
| 105 | echo BitlBee configure |
---|
| 106 | |
---|
[b7d3cc34] | 107 | while [ -n "$1" ]; do |
---|
[4966712a] | 108 | e="$(expr "X$1" : 'X--\(.*=.*\)')" |
---|
[b7d3cc34] | 109 | if [ -z "$e" ]; then |
---|
| 110 | cat<<EOF |
---|
| 111 | |
---|
| 112 | Usage: $0 [OPTIONS] |
---|
| 113 | |
---|
| 114 | Option Description Default |
---|
| 115 | |
---|
| 116 | --prefix=... Directories to put files in $prefix |
---|
| 117 | --bindir=... $bindir |
---|
[57da960] | 118 | --sbindir=... $sbindir |
---|
[b7d3cc34] | 119 | --etcdir=... $etcdir |
---|
| 120 | --mandir=... $mandir |
---|
| 121 | --datadir=... $datadir |
---|
[7b23afd] | 122 | --plugindir=... $plugindir |
---|
[417002e] | 123 | --systemdsystemunitdir=... $systemdsystemunitdir |
---|
[34b17d9] | 124 | --pidfile=... $pidfile |
---|
[b7d3cc34] | 125 | --config=... $config |
---|
| 126 | |
---|
[65d0dfd] | 127 | --verbose=0/1 Disable/enable verbose build $verbose |
---|
| 128 | |
---|
[b7d3cc34] | 129 | --jabber=0/1 Disable/enable Jabber part $jabber |
---|
[4aa0f6b] | 130 | --twitter=0/1 Disable/enable Twitter part $twitter |
---|
[b7d3cc34] | 131 | |
---|
[796da03] | 132 | --purple=0/1 Disable/enable libpurple support $purple |
---|
[04f0c10] | 133 | (automatically disables other protocol modules) |
---|
[b7d3cc34] | 134 | |
---|
[a6005da] | 135 | --pam=0/1 Disable/enable PAM authentication $pam |
---|
[50bb490] | 136 | --ldap=0/1 Disable/enable LDAP authentication $ldap |
---|
[a6005da] | 137 | |
---|
[a85a8ab] | 138 | --doc=0/1 Disable/enable help.txt generation $doc |
---|
[b7d3cc34] | 139 | --debug=0/1 Disable/enable debugging $debug |
---|
| 140 | --strip=0/1 Disable/enable binary stripping $strip |
---|
[7281ad1] | 141 | --pie=0/1 Build position independent executable $pie |
---|
[66b9e86e] | 142 | --gcov=0/1 Disable/enable test coverage reporting $gcov |
---|
[e2472dd] | 143 | --asan=0/1 Disable/enable AddressSanitizer $asan |
---|
[2abfbc5] | 144 | --plugins=0/1 Disable/enable plugins support $plugins |
---|
[04f0c10] | 145 | --otr=0/1/auto/plugin |
---|
| 146 | Disable/enable OTR encryption support $otr |
---|
[b7d3cc34] | 147 | |
---|
[85cf37f] | 148 | --events=... Event handler (glib, libevent) $events |
---|
[e1d3f98] | 149 | --ssl=... SSL library to use (gnutls, nss, openssl, auto) |
---|
[b7d3cc34] | 150 | $ssl |
---|
[aec56b0] | 151 | |
---|
[7281ad1] | 152 | |
---|
[f1e7407] | 153 | --target=... Cross compilation target same as host |
---|
[f5bbaba] | 154 | --sysroot=... Cross compilation sysroot $sysroot |
---|
[b7d3cc34] | 155 | EOF |
---|
| 156 | exit; |
---|
| 157 | fi |
---|
| 158 | eval "$e" |
---|
| 159 | shift; |
---|
| 160 | done |
---|
| 161 | |
---|
| 162 | # Expand $prefix and get rid of double slashes |
---|
[4966712a] | 163 | bindir=$(eval echo "$bindir/" | sed 's/\/\{1,\}/\//g') |
---|
| 164 | sbindir=$(eval echo "$sbindir/" | sed 's/\/\{1,\}/\//g') |
---|
| 165 | etcdir=$(eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g') |
---|
| 166 | mandir=$(eval echo "$mandir/" | sed 's/\/\{1,\}/\//g') |
---|
| 167 | datadir=$(eval echo "$datadir/" | sed 's/\/\{1,\}/\//g') |
---|
| 168 | config=$(eval echo "$config/" | sed 's/\/\{1,\}/\//g') |
---|
[54b2a36] | 169 | libdir=$(eval echo "$libdir/" | sed 's/\/\{1,\}/\//g') |
---|
[4966712a] | 170 | plugindir=$(eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g') |
---|
| 171 | includedir=$(eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g') |
---|
| 172 | libevent=$(eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g') |
---|
| 173 | |
---|
| 174 | pidfile=$(eval echo "$pidfile" | sed 's/\/\{1,\}/\//g') |
---|
| 175 | ipcsocket=$(eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g') |
---|
| 176 | pcdir=$(eval echo "$pcdir" | sed 's/\/\{1,\}/\//g') |
---|
[b7d3cc34] | 177 | |
---|
[17f6079] | 178 | protocols_mods="" |
---|
| 179 | |
---|
[b95b0c8] | 180 | cat <<EOF >Makefile.settings |
---|
[b7d3cc34] | 181 | ## BitlBee settings, generated by configure |
---|
[2f8e3ca] | 182 | |
---|
| 183 | # ./configure $configure_args |
---|
| 184 | |
---|
[b7d3cc34] | 185 | PREFIX=$prefix |
---|
| 186 | BINDIR=$bindir |
---|
[57da960] | 187 | SBINDIR=$sbindir |
---|
[b7d3cc34] | 188 | ETCDIR=$etcdir |
---|
| 189 | MANDIR=$mandir |
---|
| 190 | DATADIR=$datadir |
---|
[7b23afd] | 191 | PLUGINDIR=$plugindir |
---|
[b7d3cc34] | 192 | CONFIG=$config |
---|
[54b2a36] | 193 | LIBDIR=$libdir |
---|
[e506d6c] | 194 | INCLUDEDIR=$includedir |
---|
| 195 | PCDIR=$pcdir |
---|
[b7d3cc34] | 196 | |
---|
[1bf9492] | 197 | TARGET=$target |
---|
[b7d3cc34] | 198 | |
---|
[25b80e9c] | 199 | INSTALL=install -p |
---|
| 200 | |
---|
[b7d3cc34] | 201 | DESTDIR= |
---|
| 202 | LFLAGS= |
---|
[7a80925] | 203 | EFLAGS=-lm |
---|
[b7d3cc34] | 204 | EOF |
---|
| 205 | |
---|
[1074806] | 206 | srcdir=$(cd $(dirname $0);pwd) |
---|
| 207 | currdir=$(pwd) |
---|
| 208 | if [ "$srcdir" != "$currdir" ]; then |
---|
[f60079b] | 209 | echo |
---|
| 210 | echo "configure script run from a different directory. Will create some symlinks..." |
---|
| 211 | if [ ! -e Makefile -o -L Makefile ]; then |
---|
[04dc563] | 212 | COPYDIRS="doc lib protocols tests utils" |
---|
| 213 | mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d) |
---|
[f60079b] | 214 | find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null |
---|
| 215 | dst="$PWD" |
---|
| 216 | cd "$srcdir" |
---|
[04dc563] | 217 | for i in $(find . -name Makefile -type f); do |
---|
[f60079b] | 218 | ln -s "$PWD${i#.}" "$dst/$i"; |
---|
| 219 | done |
---|
| 220 | cd "$dst" |
---|
| 221 | rm -rf .bzr |
---|
| 222 | fi |
---|
| 223 | |
---|
[7fa5c19] | 224 | echo "_SRCDIR_=$srcdir/" >> Makefile.settings |
---|
[f60079b] | 225 | CFLAGS="$CFLAGS -I${dst}" |
---|
| 226 | else |
---|
| 227 | srcdir=$PWD |
---|
| 228 | fi |
---|
| 229 | |
---|
[b95b0c8] | 230 | cat<<EOF >config.h |
---|
[b7d3cc34] | 231 | /* BitlBee settings, generated by configure |
---|
| 232 | |
---|
| 233 | Do *NOT* use any of these defines in your code without thinking twice, most |
---|
| 234 | of them can/will be overridden at run-time */ |
---|
| 235 | |
---|
[2f8e3ca] | 236 | #define BITLBEE_CONFIGURE_ARGS "$configure_args" |
---|
| 237 | |
---|
[b7d3cc34] | 238 | #define CONFIG "$config" |
---|
| 239 | #define ETCDIR "$etcdir" |
---|
| 240 | #define VARDIR "$datadir" |
---|
[7b23afd] | 241 | #define PLUGINDIR "$plugindir" |
---|
[ad66dcd] | 242 | #define DATADIR "$datadir" |
---|
[34b17d9] | 243 | #define PIDFILE "$pidfile" |
---|
[6dff9d4] | 244 | #define IPCSOCKET "$ipcsocket" |
---|
[b7d3cc34] | 245 | EOF |
---|
| 246 | |
---|
[1bf9492] | 247 | |
---|
| 248 | |
---|
[f1e7407] | 249 | if [ -n "$target" ]; then |
---|
[f5bbaba] | 250 | # prepend sysroot to system lib dirs |
---|
| 251 | |
---|
| 252 | systemlibdirs_cross='' |
---|
| 253 | for i in $systemlibdirs; do |
---|
| 254 | systemlibdirs_cross="$systemlibdirs_cross $sysroot$i" |
---|
| 255 | done |
---|
| 256 | systemlibdirs=$systemlibdirs_cross |
---|
| 257 | unset systemlibdirs_cross |
---|
| 258 | |
---|
| 259 | # backward compatibility |
---|
| 260 | |
---|
| 261 | if [ -z "$PKG_CONFIG_LIBDIR" ]; then |
---|
| 262 | PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig |
---|
| 263 | export PKG_CONFIG_LIBDIR |
---|
| 264 | fi |
---|
| 265 | |
---|
| 266 | if [ -d /usr/$target/bin ]; then |
---|
| 267 | PATH=/usr/$target/bin:$PATH |
---|
| 268 | fi |
---|
| 269 | |
---|
| 270 | if [ -d /usr/$target/lib ]; then |
---|
| 271 | systemlibdirs="$systemlibdirs /usr/$target/lib" |
---|
| 272 | fi |
---|
| 273 | |
---|
[f1e7407] | 274 | CC=$target-cc |
---|
| 275 | LD=$target-ld |
---|
[f5bbaba] | 276 | STRIP=$target-strip |
---|
[f1e7407] | 277 | fi |
---|
| 278 | |
---|
[e2472dd] | 279 | if [ "$asan" = "1" ]; then |
---|
| 280 | CFLAGS="$CFLAGS -fsanitize=address" |
---|
| 281 | LDFLAGS="$LDFLAGS -fsanitize=address" |
---|
| 282 | debug=1 |
---|
| 283 | fi |
---|
[1bf9492] | 284 | |
---|
[65d0dfd] | 285 | if [ "$verbose" = "0" ]; then |
---|
| 286 | echo 'VERBOSE=@' >> Makefile.settings |
---|
| 287 | else |
---|
| 288 | echo 'VERBOSE=' >> Makefile.settings |
---|
| 289 | fi |
---|
| 290 | |
---|
[08b0ed8] | 291 | cat <<EOF >>Makefile.settings |
---|
| 292 | |
---|
| 293 | # Enable/disable output verbosity |
---|
| 294 | ifdef V |
---|
| 295 | ifeq (\$(V),1) |
---|
| 296 | VERBOSE= |
---|
| 297 | else |
---|
| 298 | VERBOSE=@ |
---|
| 299 | endif |
---|
| 300 | endif |
---|
| 301 | |
---|
| 302 | EOF |
---|
| 303 | |
---|
[b7d3cc34] | 304 | if [ "$debug" = "1" ]; then |
---|
| 305 | echo 'DEBUG=1' >> Makefile.settings |
---|
[e2472dd] | 306 | CFLAGS="$CFLAGS -g3 -DDEBUG -O0" |
---|
[b7d3cc34] | 307 | else |
---|
[2a1c27f] | 308 | [ -z "$CFLAGS" ] && CFLAGS="-g -O2 -fno-strict-aliasing" |
---|
[b7d3cc34] | 309 | fi |
---|
| 310 | |
---|
[7281ad1] | 311 | if [ "$pie" = "1" ]; then |
---|
| 312 | echo 'CFLAGS_BITLBEE=-fPIE' >> Makefile.settings |
---|
| 313 | echo 'LDFLAGS_BITLBEE=-pie' >> Makefile.settings |
---|
| 314 | fi |
---|
| 315 | |
---|
[d203495] | 316 | echo LDFLAGS=$LDFLAGS >> Makefile.settings |
---|
| 317 | |
---|
[daae10f] | 318 | echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings |
---|
[f60079b] | 319 | echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings |
---|
[b7d3cc34] | 320 | |
---|
[41a94dd] | 321 | echo CFLAGS+=-DHAVE_CONFIG_H -D_GNU_SOURCE >> Makefile.settings |
---|
[f712188] | 322 | |
---|
[b7d3cc34] | 323 | if [ -n "$CC" ]; then |
---|
[5973412] | 324 | CC=$CC |
---|
[b7d3cc34] | 325 | elif type gcc > /dev/null 2> /dev/null; then |
---|
[5973412] | 326 | CC=gcc |
---|
[b7d3cc34] | 327 | elif type cc > /dev/null 2> /dev/null; then |
---|
[5973412] | 328 | CC=cc |
---|
[b7d3cc34] | 329 | else |
---|
| 330 | echo 'Cannot find a C compiler, aborting.' |
---|
| 331 | exit 1; |
---|
| 332 | fi |
---|
| 333 | |
---|
[5973412] | 334 | echo "CC=$CC" >> Makefile.settings; |
---|
[1de945b] | 335 | if echo $CC | grep -qw 'gcc\|clang'; then |
---|
[daae10f] | 336 | # Apparently -Wall is gcc-specific? |
---|
[1de945b] | 337 | echo CFLAGS+=-Wall -Wformat -Werror=format-security >> Makefile.settings |
---|
[daae10f] | 338 | fi |
---|
[5973412] | 339 | |
---|
[f1e7407] | 340 | if [ -z "$LD" ]; then |
---|
| 341 | if type ld > /dev/null 2> /dev/null; then |
---|
| 342 | LD=ld |
---|
| 343 | else |
---|
| 344 | echo 'Cannot find ld, aborting.' |
---|
| 345 | exit 1; |
---|
| 346 | fi |
---|
[b7d3cc34] | 347 | fi |
---|
| 348 | |
---|
[f1e7407] | 349 | echo "LD=$LD" >> Makefile.settings |
---|
| 350 | |
---|
[32c632f] | 351 | if [ -z "$PKG_CONFIG" ]; then |
---|
| 352 | PKG_CONFIG=pkg-config |
---|
| 353 | fi |
---|
| 354 | |
---|
[9ae8f82] | 355 | if ! $PKG_CONFIG --version > /dev/null 2>/dev/null; then |
---|
| 356 | echo |
---|
| 357 | echo 'Cannot find pkg-config, aborting.' |
---|
| 358 | exit 1 |
---|
| 359 | fi |
---|
| 360 | |
---|
| 361 | if $PKG_CONFIG glib-2.0; then |
---|
[670204f] | 362 | if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then |
---|
[b95b0c8] | 363 | cat<<EOF >>Makefile.settings |
---|
[4966712a] | 364 | EFLAGS+=$($PKG_CONFIG --libs glib-2.0 gmodule-2.0) |
---|
| 365 | CFLAGS+=$($PKG_CONFIG --cflags glib-2.0 gmodule-2.0) |
---|
[b7d3cc34] | 366 | EOF |
---|
[670204f] | 367 | else |
---|
| 368 | echo |
---|
[4966712a] | 369 | echo 'Found glib2 '$($PKG_CONFIG glib-2.0 --modversion)', but version '$GLIB_MIN_VERSION' or newer is required.' |
---|
[670204f] | 370 | exit 1 |
---|
| 371 | fi |
---|
[b7d3cc34] | 372 | else |
---|
[670204f] | 373 | echo |
---|
[574af7e] | 374 | echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)' |
---|
[670204f] | 375 | exit 1 |
---|
[b7d3cc34] | 376 | fi |
---|
| 377 | |
---|
[85cf37f] | 378 | if [ "$events" = "libevent" ]; then |
---|
[003553b] | 379 | if ! [ -f "${libevent}include/event.h" ]; then |
---|
[85cf37f] | 380 | echo |
---|
| 381 | echo 'Warning: Could not find event.h, you might have to install it and/or specify' |
---|
| 382 | echo 'its location using the --libevent= argument. (Example: If event.h is in' |
---|
| 383 | echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)' |
---|
| 384 | fi |
---|
| 385 | |
---|
| 386 | echo '#define EVENTS_LIBEVENT' >> config.h |
---|
[b95b0c8] | 387 | cat <<EOF >>Makefile.settings |
---|
[85cf37f] | 388 | EFLAGS+=-levent -L${libevent}lib |
---|
| 389 | CFLAGS+=-I${libevent}include |
---|
| 390 | EOF |
---|
| 391 | elif [ "$events" = "glib" ]; then |
---|
| 392 | ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...): |
---|
| 393 | echo '#define EVENTS_GLIB' >> config.h |
---|
[b7d3cc34] | 394 | else |
---|
| 395 | echo |
---|
[85cf37f] | 396 | echo 'ERROR: Unknown event handler specified.' |
---|
| 397 | exit 1 |
---|
[b7d3cc34] | 398 | fi |
---|
[85cf37f] | 399 | echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings |
---|
[b7d3cc34] | 400 | |
---|
| 401 | detect_gnutls() |
---|
| 402 | { |
---|
[4af7b4f] | 403 | if $PKG_CONFIG --exists gnutls; then |
---|
[b95b0c8] | 404 | cat <<EOF >>Makefile.settings |
---|
[4966712a] | 405 | EFLAGS+=$($PKG_CONFIG --libs gnutls) $(libgcrypt-config --libs) |
---|
| 406 | CFLAGS+=$($PKG_CONFIG --cflags gnutls) $(libgcrypt-config --cflags) |
---|
[4af7b4f] | 407 | EOF |
---|
| 408 | ssl=gnutls |
---|
[a59bd11] | 409 | if ! $PKG_CONFIG gnutls --atleast-version=2.8; then |
---|
[5513f3e] | 410 | echo |
---|
| 411 | echo 'Warning: With GnuTLS versions <2.8, certificate expire dates are not verified.' |
---|
| 412 | fi |
---|
[4af7b4f] | 413 | ret=1 |
---|
| 414 | elif libgnutls-config --version > /dev/null 2> /dev/null; then |
---|
[b95b0c8] | 415 | cat <<EOF >>Makefile.settings |
---|
[4966712a] | 416 | EFLAGS+=$(libgnutls-config --libs) $(libgcrypt-config --libs) |
---|
| 417 | CFLAGS+=$(libgnutls-config --cflags) $(libgcrypt-config --cflags) |
---|
[b7d3cc34] | 418 | EOF |
---|
| 419 | |
---|
| 420 | ssl=gnutls |
---|
| 421 | ret=1; |
---|
| 422 | else |
---|
| 423 | ret=0; |
---|
| 424 | fi; |
---|
| 425 | } |
---|
| 426 | |
---|
| 427 | detect_nss() |
---|
| 428 | { |
---|
[ef043d3] | 429 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then |
---|
[b95b0c8] | 430 | cat<<EOF >>Makefile.settings |
---|
[4966712a] | 431 | EFLAGS+=$($PKG_CONFIG --libs nss) |
---|
| 432 | CFLAGS+=$($PKG_CONFIG --cflags nss) |
---|
[b7d3cc34] | 433 | EOF |
---|
| 434 | |
---|
| 435 | ssl=nss |
---|
| 436 | ret=1; |
---|
| 437 | else |
---|
| 438 | ret=0; |
---|
| 439 | fi; |
---|
| 440 | } |
---|
| 441 | |
---|
[36cf9fd] | 442 | RESOLV_TESTCODE=' |
---|
[aee8c19] | 443 | #include <sys/types.h> |
---|
| 444 | #include <netinet/in.h> |
---|
[36cf9fd] | 445 | #include <arpa/nameser.h> |
---|
| 446 | #include <resolv.h> |
---|
| 447 | |
---|
[632627e] | 448 | int main() |
---|
| 449 | { |
---|
| 450 | |
---|
| 451 | res_query( NULL, 0, 0, NULL, 0); |
---|
| 452 | dn_expand( NULL, NULL, NULL, NULL, 0); |
---|
| 453 | dn_skipname( NULL, NULL); |
---|
| 454 | } |
---|
| 455 | ' |
---|
| 456 | RESOLV_NS_TESTCODE=' |
---|
| 457 | #include <sys/types.h> |
---|
| 458 | #include <netinet/in.h> |
---|
| 459 | #include <arpa/nameser.h> |
---|
| 460 | #include <resolv.h> |
---|
| 461 | |
---|
[36cf9fd] | 462 | int main() |
---|
| 463 | { |
---|
| 464 | ns_initparse( NULL, 0, NULL ); |
---|
| 465 | ns_parserr( NULL, ns_s_an, 0, NULL ); |
---|
| 466 | } |
---|
| 467 | ' |
---|
[632627e] | 468 | RESOLV_NS_TYPES_TESTCODE=' |
---|
| 469 | #include <sys/types.h> |
---|
| 470 | #include <netinet/in.h> |
---|
| 471 | #include <arpa/nameser.h> |
---|
| 472 | |
---|
| 473 | int main() |
---|
| 474 | { |
---|
| 475 | ns_msg nsh; |
---|
| 476 | ns_rr rr; |
---|
| 477 | |
---|
[fb87924] | 478 | /* Not all platforms we want to work on have |
---|
| 479 | ns_* routines, so use this to make sure |
---|
| 480 | the compiler uses it.*/ |
---|
| 481 | return (int)(sizeof(nsh) + sizeof(rr)); |
---|
[632627e] | 482 | } |
---|
| 483 | ' |
---|
[36cf9fd] | 484 | |
---|
[0d2cd10] | 485 | BACKTRACE_TESTCODE=' |
---|
| 486 | #include <execinfo.h> |
---|
| 487 | |
---|
| 488 | int main() |
---|
| 489 | { |
---|
| 490 | void *trace[16]; |
---|
| 491 | return backtrace(trace, 16); |
---|
| 492 | } |
---|
| 493 | ' |
---|
| 494 | |
---|
[36cf9fd] | 495 | detect_resolv_dynamic() |
---|
| 496 | { |
---|
[aee8c19] | 497 | case "$arch" in |
---|
[632627e] | 498 | OpenBSD ) |
---|
| 499 | # In FreeBSD res_*/dn_* routines are present in libc.so |
---|
| 500 | LIBRESOLV=;; |
---|
[aee8c19] | 501 | FreeBSD ) |
---|
[632627e] | 502 | # In FreeBSD res_*/dn_* routines are present in libc.so |
---|
| 503 | LIBRESOLV=;; |
---|
| 504 | CYGWIN* ) |
---|
| 505 | # In Cygwin res_*/dn_* routines are present in libc.so |
---|
[aee8c19] | 506 | LIBRESOLV=;; |
---|
| 507 | * ) |
---|
| 508 | LIBRESOLV=-lresolv;; |
---|
| 509 | esac |
---|
[4fca1db] | 510 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
[8462239] | 511 | ret=1 |
---|
[aee8c19] | 512 | echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null |
---|
[36cf9fd] | 513 | if [ "$?" = "0" ]; then |
---|
[aee8c19] | 514 | echo "EFLAGS+=$LIBRESOLV" >> Makefile.settings |
---|
[8462239] | 515 | ret=0 |
---|
[36cf9fd] | 516 | fi |
---|
| 517 | |
---|
[8462239] | 518 | rm -f $TMPFILE |
---|
| 519 | return $ret |
---|
[36cf9fd] | 520 | } |
---|
| 521 | |
---|
| 522 | detect_resolv_static() |
---|
| 523 | { |
---|
[4fca1db] | 524 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
[8462239] | 525 | ret=1 |
---|
[36cf9fd] | 526 | for i in $systemlibdirs; do |
---|
| 527 | if [ -f $i/libresolv.a ]; then |
---|
[8462239] | 528 | echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null |
---|
[36cf9fd] | 529 | if [ "$?" = "0" ]; then |
---|
| 530 | echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings |
---|
[8462239] | 531 | ret=0 |
---|
[36cf9fd] | 532 | fi |
---|
| 533 | fi |
---|
| 534 | done |
---|
| 535 | |
---|
[8462239] | 536 | rm -f $TMPFILE |
---|
| 537 | return $ret |
---|
[36cf9fd] | 538 | } |
---|
| 539 | |
---|
[632627e] | 540 | detect_resolv_ns_dynamic() |
---|
| 541 | { |
---|
| 542 | case "$arch" in |
---|
| 543 | FreeBSD ) |
---|
| 544 | # In FreeBSD ns_ routines are present in libc.so |
---|
| 545 | LIBRESOLV=;; |
---|
| 546 | * ) |
---|
| 547 | LIBRESOLV=-lresolv;; |
---|
| 548 | esac |
---|
| 549 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
| 550 | ret=1 |
---|
| 551 | echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null |
---|
[a67e781] | 552 | if [ "$?" = "0" ]; then |
---|
| 553 | ret=0 |
---|
| 554 | fi |
---|
[632627e] | 555 | |
---|
| 556 | rm -f $TMPFILE |
---|
| 557 | return $ret |
---|
| 558 | } |
---|
| 559 | |
---|
| 560 | detect_resolv_ns_static() |
---|
| 561 | { |
---|
| 562 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
| 563 | ret=1 |
---|
| 564 | for i in $systemlibdirs; do |
---|
| 565 | if [ -f $i/libresolv.a ]; then |
---|
| 566 | echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null |
---|
[a67e781] | 567 | if [ "$?" = "0" ]; then |
---|
| 568 | ret=0 |
---|
| 569 | fi |
---|
[632627e] | 570 | fi |
---|
| 571 | done |
---|
| 572 | |
---|
| 573 | rm -f $TMPFILE |
---|
| 574 | return $ret |
---|
| 575 | } |
---|
| 576 | |
---|
| 577 | detect_nameser_has_ns_types() |
---|
| 578 | { |
---|
[a67e781] | 579 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
| 580 | ret=1 |
---|
| 581 | # since we aren't actually linking with ns_* routines |
---|
| 582 | # we can just compile the test code |
---|
| 583 | echo "$RESOLV_NS_TYPES_TESTCODE" | $CC -o $TMPFILE -x c - >/dev/null 2>/dev/null |
---|
| 584 | if [ "$?" = "0" ]; then |
---|
| 585 | ret=0 |
---|
| 586 | fi |
---|
| 587 | |
---|
| 588 | rm -f $TMPFILE |
---|
| 589 | return $ret |
---|
[632627e] | 590 | } |
---|
| 591 | |
---|
[0d2cd10] | 592 | detect_backtrace() |
---|
| 593 | { |
---|
| 594 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
| 595 | ret=1 |
---|
| 596 | echo "$BACKTRACE_TESTCODE" | $CC -o $TMPFILE -x c - >/dev/null 2>/dev/null |
---|
| 597 | if [ "$?" = "0" ]; then |
---|
| 598 | ret=0 |
---|
| 599 | fi |
---|
| 600 | |
---|
| 601 | rm -f $TMPFILE |
---|
| 602 | return $ret |
---|
| 603 | } |
---|
| 604 | |
---|
[b3c467b] | 605 | if [ "$ssl" = "auto" ]; then |
---|
| 606 | detect_gnutls |
---|
[b7d3cc34] | 607 | if [ "$ret" = "0" ]; then |
---|
[c5920df] | 608 | # Disable NSS for now as it's known to not work very well ATM. |
---|
| 609 | #detect_nss |
---|
[191cfb1] | 610 | : |
---|
[b7d3cc34] | 611 | fi |
---|
[b3c467b] | 612 | elif [ "$ssl" = "gnutls" ]; then |
---|
| 613 | detect_gnutls |
---|
| 614 | elif [ "$ssl" = "nss" ]; then |
---|
| 615 | detect_nss |
---|
| 616 | elif [ "$ssl" = "openssl" ]; then |
---|
| 617 | echo |
---|
| 618 | echo 'No detection code exists for OpenSSL. Make sure that you have a complete' |
---|
[b3eee9b] | 619 | echo 'installation of OpenSSL (including devel/header files) before reporting' |
---|
[b3c467b] | 620 | echo 'compilation problems.' |
---|
| 621 | echo |
---|
| 622 | echo 'Also, keep in mind that the OpenSSL is, according to some people, not' |
---|
[b3eee9b] | 623 | echo 'completely GPL-compatible. Using GnuTLS is recommended and better supported' |
---|
| 624 | echo 'by us. However, on many BSD machines, OpenSSL can be considered part of the' |
---|
| 625 | echo 'operating system, which makes it GPL-compatible.' |
---|
[b3c467b] | 626 | echo |
---|
| 627 | echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2' |
---|
| 628 | echo ' http://www.gnome.org/~markmc/openssl-and-the-gpl.html' |
---|
| 629 | echo |
---|
| 630 | echo 'Please note that distributing a BitlBee binary which links to OpenSSL is' |
---|
| 631 | echo 'probably illegal. If you want to create and distribute a binary BitlBee' |
---|
[b3eee9b] | 632 | echo 'package, you really should use GnuTLS instead.' |
---|
[b3c467b] | 633 | echo |
---|
| 634 | echo 'Also, the OpenSSL license requires us to say this:' |
---|
| 635 | echo ' * "This product includes software developed by the OpenSSL Project' |
---|
| 636 | echo ' * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"' |
---|
[b7d3cc34] | 637 | |
---|
[b3c467b] | 638 | echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings |
---|
| 639 | |
---|
| 640 | ret=1 |
---|
| 641 | else |
---|
| 642 | echo |
---|
| 643 | echo 'ERROR: Unknown SSL library specified.' |
---|
| 644 | exit 1 |
---|
[b7d3cc34] | 645 | fi |
---|
| 646 | |
---|
[b3c467b] | 647 | if [ "$ret" = "0" ]; then |
---|
| 648 | echo |
---|
| 649 | echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).' |
---|
| 650 | echo ' Please note that this script doesn'\''t have detection code for OpenSSL,' |
---|
[e1d3f98] | 651 | echo ' so if you want to use that, you have to select it by hand.' |
---|
[b7d3cc34] | 652 | |
---|
[b3c467b] | 653 | exit 1 |
---|
| 654 | fi; |
---|
| 655 | |
---|
| 656 | echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings |
---|
| 657 | |
---|
[632627e] | 658 | if detect_nameser_has_ns_types; then |
---|
| 659 | echo '#define NAMESER_HAS_NS_TYPES' >> config.h |
---|
| 660 | fi |
---|
[36cf9fd] | 661 | if detect_resolv_dynamic || detect_resolv_static; then |
---|
| 662 | echo '#define HAVE_RESOLV_A' >> config.h |
---|
[a67e781] | 663 | if detect_resolv_ns_dynamic || detect_resolv_ns_static; then |
---|
| 664 | echo '#define HAVE_RESOLV_A_WITH_NS' >> config.h |
---|
| 665 | fi |
---|
[632627e] | 666 | else |
---|
[a67e781] | 667 | echo 'Insufficient resolv routines. Jabber server must be set explicitly' |
---|
[36cf9fd] | 668 | fi |
---|
[36e9f62] | 669 | |
---|
[0d2cd10] | 670 | if detect_backtrace; then |
---|
| 671 | echo '#define HAVE_BACKTRACE' >> config.h |
---|
| 672 | echo '#define CRASHFILE "'$config'crash.log"' >> config.h |
---|
| 673 | fi |
---|
[632627e] | 674 | |
---|
[ba7d16f] | 675 | STORAGES="xml" |
---|
[b3c467b] | 676 | |
---|
| 677 | for i in $STORAGES; do |
---|
| 678 | STORAGE_OBJS="$STORAGE_OBJS storage_$i.o" |
---|
| 679 | done |
---|
| 680 | echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings |
---|
| 681 | |
---|
[8e6ecfe] | 682 | authobjs= |
---|
| 683 | authlibs= |
---|
[a6005da] | 684 | if [ "$pam" = 0 ]; then |
---|
| 685 | echo '#undef WITH_PAM' >> config.h |
---|
| 686 | else |
---|
| 687 | if ! echo '#include <security/pam_appl.h>' | $CC -E - >/dev/null 2>/dev/null; then |
---|
| 688 | echo 'Cannot find libpam development libraries, aborting. (Install libpam0g-dev?)' |
---|
| 689 | exit 1 |
---|
| 690 | fi |
---|
| 691 | echo '#define WITH_PAM' >> config.h |
---|
| 692 | authobjs=$authobjs'auth_pam.o ' |
---|
| 693 | authlibs=$authlibs'-lpam ' |
---|
| 694 | fi |
---|
[50bb490] | 695 | if [ "$ldap" = 0 ]; then |
---|
| 696 | echo '#undef WITH_LDAP' >> config.h |
---|
| 697 | else |
---|
| 698 | if ! echo '#include <ldap.h>' | $CC -E - >/dev/null 2>/dev/null; then |
---|
| 699 | echo 'Cannot find libldap development libraries, aborting. (Install libldap2-dev?)' |
---|
| 700 | exit 1 |
---|
| 701 | fi |
---|
| 702 | echo '#define WITH_LDAP' >> config.h |
---|
| 703 | authobjs=$authobjs'auth_ldap.o ' |
---|
| 704 | authlibs=$authlibs'-lldap ' |
---|
| 705 | fi |
---|
[8e6ecfe] | 706 | echo AUTH_OBJS=$authobjs >> Makefile.settings |
---|
| 707 | echo EFLAGS+=$authlibs >> Makefile.settings |
---|
| 708 | |
---|
[b7d3cc34] | 709 | if [ "$strip" = 0 ]; then |
---|
| 710 | echo "STRIP=\# skip strip" >> Makefile.settings; |
---|
| 711 | else |
---|
| 712 | if [ "$debug" = 1 ]; then |
---|
| 713 | echo |
---|
| 714 | echo 'Stripping binaries does not make sense when debugging. Stripping disabled.' |
---|
| 715 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 716 | strip=0; |
---|
| 717 | elif [ -n "$STRIP" ]; then |
---|
| 718 | echo "STRIP=$STRIP" >> Makefile.settings; |
---|
| 719 | elif type strip > /dev/null 2> /dev/null; then |
---|
| 720 | echo "STRIP=strip" >> Makefile.settings; |
---|
| 721 | else |
---|
| 722 | echo |
---|
| 723 | echo 'No strip utility found, cannot remove unnecessary parts from executable.' |
---|
| 724 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 725 | strip=0; |
---|
| 726 | fi; |
---|
| 727 | fi |
---|
| 728 | |
---|
[417002e] | 729 | if [ -z "$systemdsystemunitdir" ]; then |
---|
| 730 | if $PKG_CONFIG --exists systemd; then |
---|
[4966712a] | 731 | systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) |
---|
[417002e] | 732 | fi |
---|
| 733 | fi |
---|
| 734 | if [ -n "$systemdsystemunitdir" ]; then |
---|
| 735 | if [ "$systemdsystemunitdir" != "no" ]; then |
---|
| 736 | echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings |
---|
| 737 | fi |
---|
| 738 | fi |
---|
| 739 | |
---|
[66b9e86e] | 740 | if [ "$gcov" = "1" ]; then |
---|
[31fc3970] | 741 | echo "CFLAGS+=--coverage" >> Makefile.settings |
---|
| 742 | echo "EFLAGS+=--coverage" >> Makefile.settings |
---|
[66b9e86e] | 743 | fi |
---|
| 744 | |
---|
[2abfbc5] | 745 | if [ "$plugins" = 0 ]; then |
---|
[489847f] | 746 | plugindir="" |
---|
[2abfbc5] | 747 | echo '#undef WITH_PLUGINS' >> config.h |
---|
| 748 | else |
---|
| 749 | echo '#define WITH_PLUGINS' >> config.h |
---|
| 750 | fi |
---|
| 751 | |
---|
[6738a67] | 752 | otrprefix="" |
---|
[764c7d1] | 753 | if [ "$otr" = "auto" ]; then |
---|
[a59bd11] | 754 | ! $PKG_CONFIG --exists libotr |
---|
| 755 | otr=$? |
---|
| 756 | fi |
---|
| 757 | |
---|
| 758 | if [ "$otr" != 0 ] && ! $PKG_CONFIG --atleast-version=4.0 --print-errors libotr; then |
---|
| 759 | exit 1 |
---|
[764c7d1] | 760 | fi |
---|
[a59bd11] | 761 | |
---|
[6738a67] | 762 | if [ "$otr" = 1 ]; then |
---|
[858ea01] | 763 | # BI == built-in |
---|
| 764 | echo '#define OTR_BI' >> config.h |
---|
[872e017] | 765 | echo "EFLAGS+=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings |
---|
| 766 | echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings |
---|
[858ea01] | 767 | echo 'OTR_BI=otr.o' >> Makefile.settings |
---|
| 768 | elif [ "$otr" = "plugin" ]; then |
---|
[a59bd11] | 769 | # for some mysterious reason beyond the comprehension of my mortal mind, |
---|
| 770 | # the libgcrypt flags aren't needed when building as plugin. add them anyway. |
---|
[858ea01] | 771 | echo '#define OTR_PI' >> config.h |
---|
[872e017] | 772 | echo "OTRFLAGS=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings |
---|
| 773 | echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings |
---|
[858ea01] | 774 | echo 'OTR_PI=otr.so' >> Makefile.settings |
---|
[764c7d1] | 775 | fi |
---|
| 776 | |
---|
[1cef55f] | 777 | if [ -z "$PYTHON" ]; then |
---|
| 778 | PYTHON=python |
---|
| 779 | fi |
---|
| 780 | |
---|
[a85a8ab] | 781 | if [ "$doc" = "1" ]; then |
---|
[beb0f54] | 782 | # check this here just in case someone tries to install it in python2.4... |
---|
[4d51c84] | 783 | if [ ! -e $srcdir/doc/user-guide/help.txt ] && ! $PYTHON -m xml.etree.ElementTree > /dev/null 2>&1; then |
---|
[a85a8ab] | 784 | echo |
---|
[beb0f54] | 785 | echo 'ERROR: Python (>=2.5 or 3.x) is required to generate docs' |
---|
[1cef55f] | 786 | echo "(Use the PYTHON environment variable if it's in a weird location)" |
---|
[beb0f54] | 787 | exit 1 |
---|
[a85a8ab] | 788 | fi |
---|
[beb0f54] | 789 | echo "DOC=1" >> Makefile.settings |
---|
[1cef55f] | 790 | echo "PYTHON=$PYTHON" >> Makefile.settings |
---|
[ceebeb1] | 791 | fi |
---|
| 792 | |
---|
[70ec7ab] | 793 | get_version |
---|
[e26aa72] | 794 | |
---|
[70ec7ab] | 795 | if [ "$BITLBEE_VERSION" != "$REAL_BITLBEE_VERSION" ]; then |
---|
[b7d3cc34] | 796 | echo 'Spoofing version number: '$BITLBEE_VERSION |
---|
| 797 | echo '#undef BITLBEE_VERSION' >> config.h |
---|
[f287f04] | 798 | echo '#define BITLBEE_VERSION "'$BITLBEE_VERSION'"' >> config.h |
---|
[ffea9b9] | 799 | echo |
---|
[b7d3cc34] | 800 | fi |
---|
| 801 | |
---|
[4fca1db] | 802 | if ! make helloworld > /dev/null 2>&1; then |
---|
| 803 | echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles." |
---|
| 804 | echo "BitlBee needs GNU make to build properly. On most systems GNU make is available" |
---|
| 805 | echo "under the name 'gmake'." |
---|
| 806 | echo |
---|
| 807 | if gmake helloworld > /dev/null 2>&1; then |
---|
| 808 | echo "gmake seems to be available on your machine, great." |
---|
| 809 | echo |
---|
| 810 | else |
---|
| 811 | echo "gmake is not installed (or not working). Please try to install it." |
---|
| 812 | echo |
---|
| 813 | fi |
---|
| 814 | fi |
---|
| 815 | |
---|
[54b2a36] | 816 | pkgconfiglibs='' |
---|
| 817 | case "$arch" in |
---|
| 818 | CYGWIN* ) |
---|
[b9c10a1] | 819 | pkgconfiglibs='-L${libdir} -lbitlbee -no-undefined' |
---|
[54b2a36] | 820 | esac |
---|
| 821 | |
---|
[b95b0c8] | 822 | cat <<EOF >bitlbee.pc |
---|
[e506d6c] | 823 | prefix=$prefix |
---|
| 824 | includedir=$includedir |
---|
[489847f] | 825 | plugindir=$plugindir |
---|
[54b2a36] | 826 | libdir=$libdir |
---|
[ad66dcd] | 827 | datadir=$datadir |
---|
[e506d6c] | 828 | |
---|
| 829 | Name: bitlbee |
---|
| 830 | Description: IRC to IM gateway |
---|
| 831 | Requires: glib-2.0 |
---|
| 832 | Version: $BITLBEE_VERSION |
---|
[54b2a36] | 833 | Libs: $pkgconfiglibs |
---|
[e506d6c] | 834 | Cflags: -I\${includedir} |
---|
| 835 | |
---|
| 836 | EOF |
---|
| 837 | |
---|
[b7d3cc34] | 838 | protocols='' |
---|
| 839 | protoobjs='' |
---|
| 840 | |
---|
[e248c7f] | 841 | if [ "$purple" = 0 ]; then |
---|
| 842 | echo '#undef WITH_PURPLE' >> config.h |
---|
| 843 | else |
---|
[e08e53c] | 844 | if ! $PKG_CONFIG purple; then |
---|
| 845 | echo |
---|
| 846 | echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)' |
---|
| 847 | exit 1 |
---|
| 848 | fi |
---|
[e248c7f] | 849 | echo '#define WITH_PURPLE' >> config.h |
---|
[b95b0c8] | 850 | cat<<EOF >>Makefile.settings |
---|
[e08e53c] | 851 | EFLAGS += $($PKG_CONFIG purple --libs) |
---|
| 852 | PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags) |
---|
| 853 | EOF |
---|
[e248c7f] | 854 | protocols=$protocols'purple ' |
---|
| 855 | protoobjs=$protoobjs'purple_mod.o ' |
---|
| 856 | |
---|
[04e2a05] | 857 | # only disable these if the user didn't enable them explicitly |
---|
| 858 | [ "$jabber" = "default-on" ] && jabber=0 |
---|
[18e1f3b] | 859 | |
---|
| 860 | echo '#undef PACKAGE' >> config.h |
---|
| 861 | echo '#define PACKAGE "BitlBee-LIBPURPLE"' >> config.h |
---|
[bda2975] | 862 | |
---|
| 863 | if [ "$events" = "libevent" ]; then |
---|
| 864 | echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling' |
---|
| 865 | echo 'outside libpurple, talking to GLib directly. At least for now the combination' |
---|
| 866 | echo 'libpurple + libevent is *not* recommended!' |
---|
[c775a58] | 867 | echo |
---|
[bda2975] | 868 | fi |
---|
[e248c7f] | 869 | fi |
---|
| 870 | |
---|
[b0a89cc] | 871 | case "$CC" in |
---|
| 872 | *gcc* ) |
---|
[e371011] | 873 | echo CFLAGS+=-MMD -MF .depend/\$@.d >> Makefile.settings |
---|
[fe92921] | 874 | for i in . lib tests protocols protocols/*/; do |
---|
[b0a89cc] | 875 | mkdir -p $i/.depend |
---|
| 876 | done |
---|
| 877 | esac |
---|
| 878 | |
---|
[b7d3cc34] | 879 | if [ "$jabber" = 0 ]; then |
---|
| 880 | echo '#undef WITH_JABBER' >> config.h |
---|
| 881 | else |
---|
| 882 | echo '#define WITH_JABBER' >> config.h |
---|
| 883 | protocols=$protocols'jabber ' |
---|
[b5a22e3] | 884 | protoobjs=$protoobjs'jabber_mod.o ' |
---|
[b7d3cc34] | 885 | fi |
---|
| 886 | |
---|
[1b221e0] | 887 | if [ "$twitter" = 0 ]; then |
---|
| 888 | echo '#undef WITH_TWITTER' >> config.h |
---|
| 889 | else |
---|
| 890 | echo '#define WITH_TWITTER' >> config.h |
---|
| 891 | protocols=$protocols'twitter ' |
---|
| 892 | protoobjs=$protoobjs'twitter_mod.o ' |
---|
| 893 | fi |
---|
| 894 | |
---|
[b7d3cc34] | 895 | if [ "$protocols" = "PROTOCOLS = " ]; then |
---|
[43462708] | 896 | echo "Warning: You haven't selected any communication protocol to compile!" |
---|
[b3c467b] | 897 | echo " BitlBee will run, but you will be unable to connect to IM servers!" |
---|
[b7d3cc34] | 898 | fi |
---|
| 899 | |
---|
| 900 | echo "PROTOCOLS = $protocols" >> Makefile.settings |
---|
| 901 | echo "PROTOOBJS = $protoobjs" >> Makefile.settings |
---|
| 902 | |
---|
| 903 | echo Architecture: $arch |
---|
| 904 | case "$arch" in |
---|
| 905 | Linux ) |
---|
| 906 | ;; |
---|
| 907 | GNU/* ) |
---|
| 908 | ;; |
---|
| 909 | *BSD ) |
---|
| 910 | ;; |
---|
| 911 | Darwin ) |
---|
[caceb06] | 912 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
[b7d3cc34] | 913 | ;; |
---|
| 914 | IRIX ) |
---|
| 915 | ;; |
---|
| 916 | SunOS ) |
---|
| 917 | echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings |
---|
| 918 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
[70d7795] | 919 | echo '#define NO_FD_PASSING' >> config.h |
---|
[b7d3cc34] | 920 | ;; |
---|
[8de63c3] | 921 | AIX ) |
---|
| 922 | echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings |
---|
[b7d3cc34] | 923 | ;; |
---|
| 924 | CYGWIN* ) |
---|
[54b2a36] | 925 | echo 'EFLAGS+=-Wl,--export-all,--out-implib,libbitlbee.dll.a' >> Makefile.settings |
---|
| 926 | echo 'IMPLIB=libbitlbee.dll.a' >> Makefile.settings |
---|
[b7d3cc34] | 927 | ;; |
---|
[aec56b0] | 928 | Windows ) |
---|
[e252d8c] | 929 | echo 'Native windows compilation is not supported anymore, use cygwin instead.' |
---|
[aec56b0] | 930 | ;; |
---|
[b7d3cc34] | 931 | * ) |
---|
[8d6c4b1] | 932 | echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' |
---|
| 933 | echo 'Please report any problems at http://bugs.bitlbee.org/.' |
---|
[b7d3cc34] | 934 | ;; |
---|
| 935 | esac |
---|
| 936 | |
---|
[f1e7407] | 937 | if [ -n "$target" ]; then |
---|
| 938 | echo "Cross-compiling for: $target" |
---|
| 939 | fi |
---|
| 940 | |
---|
[b7d3cc34] | 941 | echo |
---|
| 942 | echo 'Configuration done:' |
---|
| 943 | |
---|
| 944 | if [ "$debug" = "1" ]; then |
---|
[b3c467b] | 945 | echo ' Debugging enabled.' |
---|
[b7d3cc34] | 946 | else |
---|
[b3c467b] | 947 | echo ' Debugging disabled.' |
---|
[b7d3cc34] | 948 | fi |
---|
| 949 | |
---|
[e2472dd] | 950 | if [ "$asan" = "1" ]; then |
---|
| 951 | echo ' AddressSanitizer (ASAN) enabled.' |
---|
| 952 | else |
---|
| 953 | echo ' AddressSanitizer (ASAN) disabled.' |
---|
| 954 | fi |
---|
| 955 | |
---|
[7281ad1] | 956 | if [ "$pie" = "1" ]; then |
---|
| 957 | echo ' Building PIE executable' |
---|
| 958 | else |
---|
| 959 | echo ' Building non-PIE executable' |
---|
| 960 | fi |
---|
| 961 | |
---|
[b7d3cc34] | 962 | if [ "$strip" = "1" ]; then |
---|
[b3c467b] | 963 | echo ' Binary stripping enabled.' |
---|
[b7d3cc34] | 964 | else |
---|
[b3c467b] | 965 | echo ' Binary stripping disabled.' |
---|
[b7d3cc34] | 966 | fi |
---|
| 967 | |
---|
[764c7d1] | 968 | if [ "$otr" = "1" ]; then |
---|
| 969 | echo ' Off-the-Record (OTR) Messaging enabled.' |
---|
[858ea01] | 970 | elif [ "$otr" = "plugin" ]; then |
---|
| 971 | echo ' Off-the-Record (OTR) Messaging enabled (as a plugin).' |
---|
[764c7d1] | 972 | else |
---|
| 973 | echo ' Off-the-Record (OTR) Messaging disabled.' |
---|
| 974 | fi |
---|
| 975 | |
---|
[417002e] | 976 | if [ -n "$systemdsystemunitdir" ]; then |
---|
| 977 | echo ' systemd enabled.' |
---|
| 978 | else |
---|
| 979 | echo ' systemd disabled.' |
---|
| 980 | fi |
---|
| 981 | |
---|
[b3c467b] | 982 | echo ' Using event handler: '$events |
---|
| 983 | echo ' Using SSL library: '$ssl |
---|
[4e3df8a] | 984 | #echo ' Building with these storage backends: '$STORAGES |
---|
[b7d3cc34] | 985 | |
---|
| 986 | if [ -n "$protocols" ]; then |
---|
[17f6079] | 987 | echo ' Building with these protocols:' $protocols$protocols_mods |
---|
[4e3df8a] | 988 | case "$protocols" in |
---|
| 989 | *purple*) |
---|
| 990 | echo " Note that BitlBee-libpurple is supported on a best-effort basis. It's" |
---|
| 991 | echo " not *fully* compatible with normal BitlBee. Don't use it unless you" |
---|
| 992 | echo " absolutely need it (i.e. support for a certain protocol or feature)." |
---|
| 993 | esac |
---|
[b7d3cc34] | 994 | else |
---|
[b3c467b] | 995 | echo ' Building without IM-protocol support. We wish you a lot of fun...' |
---|
[b7d3cc34] | 996 | fi |
---|