- Timestamp:
- 2023-04-16T03:18:07Z (20 months ago)
- Branches:
- master
- Children:
- 53cd518
- Parents:
- 08964da
- git-author:
- Robert Scheck <robert-scheck@…> (16-04-23 03:18:07)
- git-committer:
- GitHub <noreply@…> (16-04-23 03:18:07)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
configure
r08964da r612b49d 8 8 ############################## 9 9 10 # shellcheck disable=SC2016,SC2164,SC2181 10 11 prefix='/usr/local/' 11 12 bindir='$prefix/bin/' … … 27 28 sysroot='' 28 29 29 configure_args="$ @"30 configure_args="$*" 30 31 31 32 # Set these to default-on to let it be overriden by either the user or purple … … 78 79 79 80 get_version() { 80 REAL_BITLBEE_VERSION=$(grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h| sed 's/.*\"\(.*\)\".*/\1/')81 REAL_BITLBEE_VERSION=$(grep '^#define BITLBEE_VERSION ' "$srcdir/bitlbee.h" | sed 's/.*\"\(.*\)\".*/\1/') 81 82 82 83 if [ -n "$BITLBEE_VERSION" ]; then … … 88 89 BITLBEE_VERSION=$REAL_BITLBEE_VERSION 89 90 90 if [ -d $srcdir/.git] && type git > /dev/null 2> /dev/null; then91 timestamp=$(cd $srcdir; git show -s --format=%ci HEAD | sed 's/ .*$//; s/-//g')92 branch=$(cd $srcdir; git rev-parse --abbrev-ref HEAD)91 if [ -d "$srcdir/.git" ] && type git > /dev/null 2> /dev/null; then 92 timestamp=$(cd "$srcdir"; git show -s --format=%ci HEAD | sed 's/ .*$//; s/-//g') 93 branch=$(cd "$srcdir"; git rev-parse --abbrev-ref HEAD) 93 94 94 95 search='\(.*\)-\([0-9]*\)-\(g[0-9a-f]*\)' 95 96 replace="\1+$timestamp+$branch+\2-\3-git" 96 97 97 describe=$(cd $srcdir; git describe --long --tags 2>/dev/null) 98 if [ $? -ne 0 ]; then 99 describe=${REAL_BITLBEE_VERSION}-0-g$(cd $srcdir; git rev-parse --short HEAD) 98 if ! (cd "$srcdir"; git describe --long --tags 2>/dev/null); then 99 describe=${REAL_BITLBEE_VERSION}-0-g$(cd "$srcdir"; git rev-parse --short HEAD) 100 100 fi 101 101 102 BITLBEE_VERSION=$(echo $describe| sed "s#$search#$replace#")102 BITLBEE_VERSION=$(echo "$describe" | sed "s#$search#$replace#") 103 103 104 104 unset timestamp branch search replace describe … … 107 107 108 108 if [ "$1" = "--dump-version" ]; then 109 srcdir=$(cd $(dirname $0);pwd)109 srcdir=$(cd "$(dirname "$0")"; pwd) 110 110 get_version 111 echo $BITLBEE_VERSION111 echo "$BITLBEE_VERSION" 112 112 exit 113 113 fi … … 167 167 --sysroot=... Cross compilation sysroot $sysroot 168 168 EOF 169 exit ;169 exit 170 170 fi 171 171 eval "$e" 172 shift ;172 shift 173 173 done 174 174 … … 217 217 EOF 218 218 219 srcdir=$(cd $(dirname $0);pwd)219 srcdir=$(cd "$(dirname "$0")"; pwd) 220 220 currdir=$(pwd) 221 if [ "$srcdir" != "$currdir" ]; then 221 if [ "$srcdir" != "$currdir" ]; then 222 222 echo 223 223 echo "configure script run from a different directory. Will create some symlinks..." 224 if [ ! -e Makefile -o-L Makefile ]; then224 if [ ! -e Makefile ] || [ -L Makefile ]; then 225 225 COPYDIRS="doc lib protocols tests utils" 226 # shellcheck disable=SC2046,SC2086 226 227 mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d) 227 228 find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null 228 229 dst="$PWD" 229 230 cd "$srcdir" 231 # shellcheck disable=SC2044 230 232 for i in $(find . -name Makefile -type f); do 231 ln -s "$PWD${i#.}" "$dst/$i" ;233 ln -s "$PWD${i#.}" "$dst/$i" 232 234 done 233 235 cd "$dst" … … 243 245 cat<<EOF >config.h 244 246 /* BitlBee settings, generated by configure 245 247 246 248 Do *NOT* use any of these defines in your code without thinking twice, most 247 249 of them can/will be overridden at run-time */ … … 273 275 274 276 if [ -z "$PKG_CONFIG_LIBDIR" ]; then 275 PKG_CONFIG_LIBDIR= /usr/$target/lib/pkgconfig277 PKG_CONFIG_LIBDIR="/usr/$target/lib/pkgconfig" 276 278 export PKG_CONFIG_LIBDIR 277 279 fi 278 280 279 if [ -d /usr/$target/bin]; then280 PATH= /usr/$target/bin:$PATH281 fi 282 283 if [ -d /usr/$target/lib]; then281 if [ -d "/usr/$target/bin" ]; then 282 PATH="/usr/$target/bin:$PATH" 283 fi 284 285 if [ -d "/usr/$target/lib" ]; then 284 286 systemlibdirs="$systemlibdirs /usr/$target/lib" 285 287 fi … … 327 329 fi 328 330 329 echo LDFLAGS=$LDFLAGS >>Makefile.settings330 331 echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings 332 333 echo CFLAGS+=-DHAVE_CONFIG_H -D_GNU_SOURCE >> Makefile.settings 331 cat<<EOF >>Makefile.settings 332 LDFLAGS=$LDFLAGS 333 CFLAGS=$CFLAGS $CPPFLAGS 334 CFLAGS+=-DHAVE_CONFIG_H -D_GNU_SOURCE 335 EOF 334 336 335 337 if [ -n "$CC" ]; then 336 CC=$CC338 : 337 339 elif type gcc > /dev/null 2> /dev/null; then 338 340 CC=gcc … … 341 343 else 342 344 echo 'Cannot find a C compiler, aborting.' 343 exit 1 ;344 fi 345 346 echo "CC=$CC" >> Makefile.settings ;347 if echo $CC| grep -qw 'gcc\|clang'; then345 exit 1 346 fi 347 348 echo "CC=$CC" >> Makefile.settings 349 if echo "$CC" | grep -qw 'gcc\|clang'; then 348 350 # Apparently -Wall is gcc-specific? 349 echo CFLAGS+=-Wall -Wformat -Werror=format-security>> Makefile.settings351 echo 'CFLAGS+=-Wall -Wformat -Werror=format-security' >> Makefile.settings 350 352 fi 351 353 … … 355 357 else 356 358 echo 'Cannot find ld, aborting.' 357 exit 1 ;359 exit 1 358 360 fi 359 361 fi … … 379 381 else 380 382 echo 381 echo 'Found glib2 '$($PKG_CONFIG glib-2.0 --modversion)', but version '$GLIB_MIN_VERSION' or newer is required.'383 echo "Found glib2 $($PKG_CONFIG glib-2.0 --modversion), but version $GLIB_MIN_VERSION or newer is required." 382 384 exit 1 383 385 fi … … 420 422 echo "EXTERNAL_JSON_PARSER=$external_json_parser" >> Makefile.settings 421 423 if [ "$external_json_parser" = "1" ]; then 422 echo "CFLAGS+=$(pkg-config --cflags json-parser)" >> Makefile.settings 423 echo "CFLAGS+=-DUSE_EXTERNAL_JSON_PARSER" >> Makefile.settings 424 echo "LDFLAGS_BITLBEE+=$(pkg-config --libs json-parser)" >> Makefile.settings 425 echo "LDFLAGS_TESTS+=$(pkg-config --libs json-parser)" >> Makefile.settings 424 cat <<EOF >>Makefile.settings 425 CFLAGS+=$(pkg-config --cflags json-parser) 426 CFLAGS+=-DUSE_EXTERNAL_JSON_PARSER 427 LDFLAGS_BITLBEE+=$(pkg-config --libs json-parser) 428 LDFLAGS_TESTS+=$(pkg-config --libs json-parser) 429 EOF 426 430 fi 427 431 … … 448 452 449 453 ssl=gnutls 450 ret=1 ;454 ret=1 451 455 else 452 ret=0 ;453 fi ;456 ret=0 457 fi 454 458 } 455 459 … … 463 467 464 468 ssl=nss 465 ret=1 ;469 ret=1 466 470 else 467 ret=0 ;468 fi ;471 ret=0 472 fi 469 473 } 470 474 … … 473 477 #include <netinet/in.h> 474 478 #include <arpa/nameser.h> 475 #include <resolv.h> 479 #include <resolv.h> 476 480 477 481 int main() … … 487 491 #include <netinet/in.h> 488 492 #include <arpa/nameser.h> 489 #include <resolv.h> 493 #include <resolv.h> 490 494 491 495 int main() … … 539 543 TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) 540 544 ret=1 541 echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE-x c - $LIBRESOLV >/dev/null 2>/dev/null545 echo "$RESOLV_TESTCODE" | $CC -o "$TMPFILE" -x c - $LIBRESOLV >/dev/null 2>/dev/null 542 546 if [ "$?" = "0" ]; then 543 547 echo "EFLAGS+=$LIBRESOLV" >> Makefile.settings … … 545 549 fi 546 550 547 rm -f $TMPFILE551 rm -f "$TMPFILE" 548 552 return $ret 549 553 } … … 554 558 ret=1 555 559 for i in $systemlibdirs; do 556 if [ -f $i/libresolv.a]; then557 echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a>/dev/null 2>/dev/null560 if [ -f "$i/libresolv.a" ]; then 561 echo "$RESOLV_TESTCODE" | $CC -o "$TMPFILE" -x c - -Wl,"$i/libresolv.a" >/dev/null 2>/dev/null 558 562 if [ "$?" = "0" ]; then 559 echo 'EFLAGS+='$i'/libresolv.a'>> Makefile.settings563 echo "EFLAGS+=$i/libresolv.a" >> Makefile.settings 560 564 ret=0 561 565 fi … … 563 567 done 564 568 565 rm -f $TMPFILE569 rm -f "$TMPFILE" 566 570 return $ret 567 571 } … … 578 582 TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) 579 583 ret=1 580 echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE-x c - $LIBRESOLV >/dev/null 2>/dev/null584 echo "$RESOLV_NS_TESTCODE" | $CC -o "$TMPFILE" -x c - $LIBRESOLV >/dev/null 2>/dev/null 581 585 if [ "$?" = "0" ]; then 582 586 ret=0 583 587 fi 584 588 585 rm -f $TMPFILE589 rm -f "$TMPFILE" 586 590 return $ret 587 591 } … … 592 596 ret=1 593 597 for i in $systemlibdirs; do 594 if [ -f $i/libresolv.a]; then595 echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a>/dev/null 2>/dev/null598 if [ -f "$i/libresolv.a" ]; then 599 echo "$RESOLV_NS_TESTCODE" | $CC -o "$TMPFILE" -x c - -Wl,"$i/libresolv.a" >/dev/null 2>/dev/null 596 600 if [ "$?" = "0" ]; then 597 601 ret=0 … … 600 604 done 601 605 602 rm -f $TMPFILE606 rm -f "$TMPFILE" 603 607 return $ret 604 608 } … … 610 614 # since we aren't actually linking with ns_* routines 611 615 # we can just compile the test code 612 echo "$RESOLV_NS_TYPES_TESTCODE" | $CC -o $TMPFILE -x c ->/dev/null 2>/dev/null616 echo "$RESOLV_NS_TYPES_TESTCODE" | $CC -o "$TMPFILE" -x c - >/dev/null 2>/dev/null 613 617 if [ "$?" = "0" ]; then 614 618 ret=0 615 619 fi 616 620 617 rm -f $TMPFILE621 rm -f "$TMPFILE" 618 622 return $ret 619 623 } … … 623 627 TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) 624 628 ret=1 625 echo "$BACKTRACE_TESTCODE" | $CC -o $TMPFILE -x c ->/dev/null 2>/dev/null629 echo "$BACKTRACE_TESTCODE" | $CC -o "$TMPFILE" -x c - >/dev/null 2>/dev/null 626 630 if [ "$?" = "0" ]; then 627 631 ret=0 628 632 fi 629 633 630 rm -f $TMPFILE634 rm -f "$TMPFILE" 631 635 return $ret 632 636 } … … 681 685 682 686 exit 1 683 fi ;687 fi 684 688 685 689 echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings … … 699 703 if detect_backtrace; then 700 704 echo '#define HAVE_BACKTRACE' >> config.h 701 echo '#define CRASHFILE "' $config'crash.log"' >> config.h705 echo '#define CRASHFILE "'"$config"'crash.log"' >> config.h 702 706 fi 703 707 … … 707 711 STORAGE_OBJS="$STORAGE_OBJS storage_$i.o" 708 712 done 709 echo "STORAGE_OBJS= "$STORAGE_OBJS>> Makefile.settings713 echo "STORAGE_OBJS=$STORAGE_OBJS" >> Makefile.settings 710 714 711 715 authobjs= … … 719 723 fi 720 724 echo '#define WITH_PAM' >> config.h 721 authobjs= $authobjs'auth_pam.o '722 authlibs= $authlibs'-lpam '725 authobjs="${authobjs}auth_pam.o " 726 authlibs="${authlibs}-lpam " 723 727 fi 724 728 if [ "$ldap" = 0 ]; then … … 730 734 fi 731 735 echo '#define WITH_LDAP' >> config.h 732 authobjs= $authobjs'auth_ldap.o '733 authlibs= $authlibs'-lldap '734 fi 735 echo AUTH_OBJS=$authobjs>> Makefile.settings736 echo EFLAGS+=$authlibs>> Makefile.settings736 authobjs="${authobjs}auth_ldap.o " 737 authlibs="${authlibs}-lldap " 738 fi 739 echo "AUTH_OBJS=$authobjs" >> Makefile.settings 740 echo "EFLAGS+=$authlibs" >> Makefile.settings 737 741 738 742 if [ "$strip" = 0 ]; then 739 echo "STRIP=\# skip strip" >> Makefile.settings ;743 echo "STRIP=\# skip strip" >> Makefile.settings 740 744 else 741 745 if [ "$debug" = 1 ]; then … … 743 747 echo 'Stripping binaries does not make sense when debugging. Stripping disabled.' 744 748 echo 'STRIP=\# skip strip' >> Makefile.settings 745 strip=0 ;749 strip=0 746 750 elif [ -n "$STRIP" ]; then 747 echo "STRIP=$STRIP" >> Makefile.settings ;751 echo "STRIP=$STRIP" >> Makefile.settings 748 752 elif type strip > /dev/null 2> /dev/null; then 749 echo "STRIP=strip" >> Makefile.settings ;753 echo "STRIP=strip" >> Makefile.settings 750 754 else 751 755 echo 752 756 echo 'No strip utility found, cannot remove unnecessary parts from executable.' 753 757 echo 'STRIP=\# skip strip' >> Makefile.settings 754 strip=0 ;755 fi ;758 strip=0 759 fi 756 760 fi 757 761 758 762 if [ ! "$systemd" = "0" ]; then 759 760 761 762 763 764 765 766 767 systemd=1768 763 if ! $PKG_CONFIG --exists systemd; then 764 if [ "$systemd" = "1" ]; then 765 echo "systemd requested but not found" 766 exit 1 767 else 768 systemd=0 769 fi 770 elif [ "$systemd" = "auto" ]; then 771 systemd=1 772 fi 769 773 fi 770 774 771 775 pkgconf_systemd_var() { 772 773 774 775 776 777 776 # First try deprecated variable, use newer variable if not found 777 if $PKG_CONFIG --print-variables systemd | grep -q "$1"; then 778 $PKG_CONFIG --variable="$1" systemd 779 else 780 $PKG_CONFIG --variable="$2" systemd 781 fi 778 782 } 779 783 … … 806 810 fi 807 811 808 otrprefix=""809 812 if [ "$otr" = "auto" ]; then 810 813 ! $PKG_CONFIG --exists libotr … … 819 822 # BI == built-in 820 823 echo '#define OTR_BI' >> config.h 821 echo "EFLAGS+=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings 822 echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings 823 echo 'OTR_BI=otr.o' >> Makefile.settings 824 cat <<EOF >>Makefile.settings 825 EFLAGS+=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs) 826 CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags) 827 OTR_BI=otr.o 828 EOF 824 829 elif [ "$otr" = "plugin" ]; then 825 830 # for some mysterious reason beyond the comprehension of my mortal mind, 826 831 # the libgcrypt flags aren't needed when building as plugin. add them anyway. 827 832 echo '#define OTR_PI' >> config.h 828 echo "OTRFLAGS=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings 829 echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings 830 echo 'OTR_PI=otr.so' >> Makefile.settings 833 cat <<EOF >>Makefile.settings 834 OTRFLAGS=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs) 835 CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags) 836 OTR_PI=otr.so 837 EOF 831 838 fi 832 839 … … 842 849 if [ "$doc" = "1" ]; then 843 850 # check this here just in case someone tries to install it in python2.4... 844 if [ ! -e $srcdir/doc/user-guide/help.txt] && ! $PYTHON -m xml.etree.ElementTree > /dev/null 2>&1; then851 if [ ! -e "$srcdir/doc/user-guide/help.txt" ] && ! $PYTHON -m xml.etree.ElementTree > /dev/null 2>&1; then 845 852 echo 846 853 echo 'ERROR: Python (>=2.5 or 3.x) is required to generate docs' … … 857 864 echo "Spoofing version number: $BITLBEE_VERSION" 858 865 echo "#undef BITLBEE_VERSION" >> config.h 859 echo '#define BITLBEE_VERSION "' $BITLBEE_VERSION'"' >> config.h866 echo '#define BITLBEE_VERSION "'"$BITLBEE_VERSION"'"' >> config.h 860 867 echo 861 868 fi … … 878 885 case "$arch" in 879 886 CYGWIN* ) 887 # shellcheck disable=SC2016 880 888 pkgconfiglibs='-L${libdir} -lbitlbee -no-undefined' 881 889 esac … … 915 923 echo '#define WITH_PURPLE' >> config.h 916 924 cat<<EOF >>Makefile.settings 917 EFLAGS +=$($PKG_CONFIG purple --libs)918 PURPLE_CFLAGS +=$($PKG_CONFIG purple --cflags)925 EFLAGS+=$($PKG_CONFIG purple --libs) 926 PURPLE_CFLAGS+=$($PKG_CONFIG purple --cflags) 919 927 EOF 920 928 protocols=$protocols'purple ' … … 937 945 case "$CC" in 938 946 *gcc* ) 939 echo CFLAGS+=-MMD -MF .depend/\$@.d>> Makefile.settings947 echo "CFLAGS+=-MMD -MF .depend/\$@.d" >> Makefile.settings 940 948 for i in . lib tests protocols protocols/*/; do 941 mkdir -p $i/.depend949 mkdir -p "$i/.depend" 942 950 done 943 951 esac … … 967 975 echo "PROTOOBJS = $protoobjs" >> Makefile.settings 968 976 969 echo Architecture: $arch977 echo "Architecture: $arch" 970 978 case "$arch" in 971 979 Linux ) … … 1049 1057 fi 1050 1058 1051 echo ' Using python: '$PYTHON1059 echo " Using python: $PYTHON" 1052 1060 1053 1061 if [ "$external_json_parser" = "1" ]; then 1054 1055 else 1056 1057 fi 1058 1059 echo ' Using event handler: '$events1060 echo ' Using SSL library: '$ssl1062 echo ' Using system JSON parser.' 1063 else 1064 echo ' Using bundled JSON parser.' 1065 fi 1066 1067 echo " Using event handler: $events" 1068 echo " Using SSL library: $ssl" 1061 1069 #echo ' Building with these storage backends: '$STORAGES 1062 1070 1063 1071 if [ -n "$protocols" ]; then 1064 echo ' Building with these protocols:' $protocols$protocols_mods1072 echo " Building with these protocols: $protocols$protocols_mods" 1065 1073 case "$protocols" in 1066 1074 *purple*)
Note: See TracChangeset
for help on using the changeset viewer.