Changeset 59c9fa4d for configure


Ignore:
Timestamp:
2023-03-08T19:09:13Z (21 months ago)
Author:
GitHub <noreply@…>
Branches:
master
Children:
a4ac9c4
Parents:
bea6db0
git-author:
Jelmer Vernooij <jelmer@…> (08-03-23 19:09:13)
git-committer:
GitHub <noreply@…> (08-03-23 19:09:13)
Message:

Revert shell fixes (#176)

See https://github.com/bitlbee/bitlbee/pull/167#pullrequestreview-1325211641

This reverts commit 2bd8f392a0d066f8f3c3f937ad2e6c1d90da78b0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • configure

    rbea6db0 r59c9fa4d  
    88##############################
    99
    10 prefix="/usr/local/"
    11 bindir="$prefix/bin/"
    12 sbindir="$prefix/sbin/"
    13 etcdir="$prefix/etc/bitlbee/"
    14 mandir="$prefix/share/man/"
    15 datadir="$prefix/share/bitlbee/"
    16 config="/var/lib/bitlbee/"
    17 libdir="$prefix/lib/"
    18 plugindir="$prefix/lib/bitlbee/"
    19 includedir="$prefix/include/bitlbee/"
    20 systemdsystemunitdir=""
    21 sysusersdir=""
    22 libevent="/usr/"
    23 pidfile="/var/run/bitlbee.pid"
    24 ipcsocket=""
    25 pcdir="$prefix/lib/pkgconfig"
     10prefix='/usr/local/'
     11bindir='$prefix/bin/'
     12sbindir='$prefix/sbin/'
     13etcdir='$prefix/etc/bitlbee/'
     14mandir='$prefix/share/man/'
     15datadir='$prefix/share/bitlbee/'
     16config='/var/lib/bitlbee/'
     17libdir='$prefix/lib/'
     18plugindir='$prefix/lib/bitlbee/'
     19includedir='$prefix/include/bitlbee/'
     20systemdsystemunitdir=''
     21sysusersdir=''
     22libevent='/usr/'
     23pidfile='/var/run/bitlbee.pid'
     24ipcsocket=''
     25pcdir='$prefix/lib/pkgconfig'
    2626systemlibdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib"
    27 sysroot=""
    28 
    29 configure_args="$*"
     27sysroot=''
     28
     29configure_args="$@"
    3030
    3131# Set these to default-on to let it be overriden by either the user or purple
     
    7878
    7979get_version() {
    80         REAL_BITLBEE_VERSION=$(grep '^#define BITLBEE_VERSION ' "$srcdir"/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/')
     80        REAL_BITLBEE_VERSION=$(grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/')
    8181
    8282        if [ -n "$BITLBEE_VERSION" ]; then
     
    8888        BITLBEE_VERSION=$REAL_BITLBEE_VERSION
    8989
    90         if [ -d "$srcdir"/.git ] && type git > /dev/null 2> /dev/null; then
    91                 timestamp=$(cd "$srcdir" || exit 1; git show -s --format=%ci HEAD | sed 's/ .*$//; s/-//g')
    92                 branch=$(cd "$srcdir" || exit 1; git rev-parse --abbrev-ref HEAD)
     90        if [ -d $srcdir/.git ] && type git > /dev/null 2> /dev/null; then
     91                timestamp=$(cd $srcdir; git show -s --format=%ci HEAD | sed 's/ .*$//; s/-//g')
     92                branch=$(cd $srcdir; git rev-parse --abbrev-ref HEAD)
    9393
    9494                search='\(.*\)-\([0-9]*\)-\(g[0-9a-f]*\)'
    9595                replace="\1+$timestamp+$branch+\2-\3-git"
    9696
    97                 if ! describe=$(cd "$srcdir" || exit 1; git describe --long --tags 2>/dev/null) ; then
    98                         describe=${REAL_BITLBEE_VERSION}-0-g$(cd "$srcdir" || exit; git rev-parse --short HEAD)
     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)
    99100                fi
    100101
    101                 BITLBEE_VERSION=$(echo "$describe" | sed "s#$search#$replace#")
     102                BITLBEE_VERSION=$(echo $describe | sed "s#$search#$replace#")
    102103
    103104                unset timestamp branch search replace describe
     
    106107
    107108if [ "$1" = "--dump-version" ]; then
    108         srcdir=$(cd "$(dirname "$0")" || exit;pwd)
     109        srcdir=$(cd $(dirname $0);pwd)
    109110        get_version
    110         echo "$BITLBEE_VERSION"
     111        echo $BITLBEE_VERSION
    111112        exit
    112113fi
     
    216217EOF
    217218
    218 srcdir=$(cd "$(dirname "$0")" || exit;pwd)
     219srcdir=$(cd $(dirname $0);pwd)
    219220currdir=$(pwd)
    220 if [ ! "$srcdir" = "$currdir" ]; then
     221if [ "$srcdir" != "$currdir" ]; then
    221222        echo
    222223        echo "configure script run from a different directory. Will create some symlinks..."
    223         if [ ! -e Makefile ] || [ -L Makefile ]; then
     224        if [ ! -e Makefile -o -L Makefile ]; then
    224225                COPYDIRS="doc lib protocols tests utils"
    225                 mkdir -p $(cd "$srcdir" || exit 1; find $COPYDIRS -type d)
     226                mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d)
    226227                find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null
    227228                dst="$PWD"
    228                 cd "$srcdir" || exit 1
    229                 find . -type f -name Makefile -print | while read -r i ; do
     229                cd "$srcdir"
     230                for i in $(find . -name Makefile -type f); do
    230231                        ln -s "$PWD${i#.}" "$dst/$i";
    231232                done
    232                 cd "$dst" || exit 1
     233                cd "$dst"
    233234                rm -rf .bzr
    234235        fi
     
    272273
    273274        if [ -z "$PKG_CONFIG_LIBDIR" ]; then
    274                 PKG_CONFIG_LIBDIR=/usr/"$target"/lib/pkgconfig
     275                PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig
    275276                export PKG_CONFIG_LIBDIR
    276277        fi
    277278
    278         if [ -d /usr/"$target"/bin ]; then
    279                 PATH=/usr/"$target"/bin:$PATH
    280         fi
    281 
    282         if [ -d /usr/"$target"/lib ]; then
     279        if [ -d /usr/$target/bin ]; then
     280                PATH=/usr/$target/bin:$PATH
     281        fi
     282
     283        if [ -d /usr/$target/lib ]; then
    283284                systemlibdirs="$systemlibdirs /usr/$target/lib"
    284285        fi
     
    326327fi
    327328
    328 # shellcheck disable=SC2129
    329 echo "LDFLAGS=$LDFLAGS" >> Makefile.settings
    330 
    331 echo "CFLAGS=$CFLAGS $CPPFLAGS" >> Makefile.settings
     329echo LDFLAGS=$LDFLAGS >> Makefile.settings
     330
     331echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings
     332echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings
    332333
    333334echo CFLAGS+=-DHAVE_CONFIG_H -D_GNU_SOURCE >> Makefile.settings
    334335
    335 if type gcc > /dev/null 2> /dev/null; then
     336if [ -n "$CC" ]; then
     337        CC=$CC
     338elif type gcc > /dev/null 2> /dev/null; then
    336339        CC=gcc
    337340elif type cc > /dev/null 2> /dev/null; then
     
    377380        else
    378381                echo
    379                 echo "Found glib2 $($PKG_CONFIG glib-2.0 --modversion), but version $GLIB_MIN_VERSION or newer is required."
     382                echo 'Found glib2 '$($PKG_CONFIG glib-2.0 --modversion)', but version '$GLIB_MIN_VERSION' or newer is required.'
    380383                exit 1
    381384        fi
     
    418421echo "EXTERNAL_JSON_PARSER=$external_json_parser" >> Makefile.settings
    419422if [ "$external_json_parser" = "1" ]; then
    420     # shellcheck disable=SC2129
    421423    echo "CFLAGS+=$(pkg-config --cflags json-parser)" >> Makefile.settings
    422424    echo "CFLAGS+=-DUSE_EXTERNAL_JSON_PARSER" >> Makefile.settings
     
    538540        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
    539541        ret=1
    540         if echo "$RESOLV_TESTCODE" | $CC -o "$TMPFILE" -x c - $LIBRESOLV >/dev/null 2>/dev/null ; then
     542        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null
     543        if [ "$?" = "0" ]; then
    541544                echo "EFLAGS+=$LIBRESOLV" >> Makefile.settings
    542545                ret=0
    543546        fi
    544547
    545         rm -f "$TMPFILE"
     548        rm -f $TMPFILE
    546549        return $ret
    547550}
     
    552555        ret=1
    553556        for i in $systemlibdirs; do
    554                 if [ -f "$i"/libresolv.a ]; then
    555                         if echo "$RESOLV_TESTCODE" | $CC -o "$TMPFILE" -x c - -Wl,"$i"/libresolv.a >/dev/null 2>/dev/null ; then
    556                                 echo "EFLAGS+=$i/libresolv.a" >> Makefile.settings
     557                if [ -f $i/libresolv.a ]; then
     558                        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
     559                        if [ "$?" = "0" ]; then
     560                                echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings
    557561                                ret=0
    558562                        fi
     
    560564        done
    561565
    562         rm -f "$TMPFILE"
     566        rm -f $TMPFILE
    563567        return $ret
    564568}
     
    575579        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
    576580        ret=1
    577         if echo "$RESOLV_NS_TESTCODE" | $CC -o "$TMPFILE" -x c - $LIBRESOLV >/dev/null 2>/dev/null ; then
     581        echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null
     582        if [ "$?" = "0" ]; then
    578583                ret=0
    579584        fi
    580585
    581         rm -f "$TMPFILE"
     586        rm -f $TMPFILE
    582587        return $ret
    583588}
     
    588593        ret=1
    589594        for i in $systemlibdirs; do
    590                 if [ -f "$i"/libresolv.a ]; then
    591                         if echo "$RESOLV_NS_TESTCODE" | $CC -o "$TMPFILE" -x c - -Wl,"$i"/libresolv.a >/dev/null 2>/dev/null ; then
     595                if [ -f $i/libresolv.a ]; then
     596                        echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
     597                        if [ "$?" = "0" ]; then
    592598                                ret=0
    593599                        fi
     
    595601        done
    596602
    597         rm -f "$TMPFILE"
     603        rm -f $TMPFILE
    598604        return $ret
    599605}
     
    605611        # since we aren't actually linking with ns_* routines
    606612        # we can just compile the test code
    607         if echo "$RESOLV_NS_TYPES_TESTCODE" | $CC -o "$TMPFILE" -x c -  >/dev/null 2>/dev/null ; then
     613        echo "$RESOLV_NS_TYPES_TESTCODE" | $CC -o $TMPFILE -x c -  >/dev/null 2>/dev/null
     614        if [ "$?" = "0" ]; then
    608615                ret=0
    609616        fi
    610617
    611         rm -f "$TMPFILE"
     618        rm -f $TMPFILE
    612619        return $ret
    613620}
     
    617624        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
    618625        ret=1
    619         if echo "$BACKTRACE_TESTCODE" | $CC -o "$TMPFILE" -x c -  >/dev/null 2>/dev/null ; then
     626        echo "$BACKTRACE_TESTCODE" | $CC -o $TMPFILE -x c -  >/dev/null 2>/dev/null
     627        if [ "$?" = "0" ]; then
    620628                ret=0
    621629        fi
    622630
    623         rm -f "$TMPFILE"
     631        rm -f $TMPFILE
    624632        return $ret
    625633}
     
    692700if detect_backtrace; then
    693701        echo '#define HAVE_BACKTRACE' >> config.h
    694         echo "#define CRASHFILE \"${config}crash.log\"" >> config.h
     702        echo '#define CRASHFILE "'$config'crash.log"' >> config.h
    695703fi
    696704
     
    700708        STORAGE_OBJS="$STORAGE_OBJS storage_$i.o"
    701709done
    702 echo "STORAGE_OBJS=$STORAGE_OBJS" >> Makefile.settings
     710echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings
    703711
    704712authobjs=
    705713authlibs=
    706 if [ "$pam" = "0" ]; then
     714if [ "$pam" = 0 ]; then
    707715        echo '#undef WITH_PAM' >> config.h
    708716else
     
    715723        authlibs=$authlibs'-lpam '
    716724fi
    717 if [ "$ldap" = "0" ]; then
     725if [ "$ldap" = 0 ]; then
    718726        echo '#undef WITH_LDAP' >> config.h
    719727else
     
    726734        authlibs=$authlibs'-lldap '
    727735fi
    728 echo AUTH_OBJS="$authobjs" >> Makefile.settings
    729 echo EFLAGS+="$authlibs" >> Makefile.settings
    730 
    731 if [ "$strip" = "0" ]; then
     736echo AUTH_OBJS=$authobjs >> Makefile.settings
     737echo EFLAGS+=$authlibs >> Makefile.settings
     738
     739if [ "$strip" = 0 ]; then
    732740        echo "STRIP=\# skip strip" >> Makefile.settings;
    733741else
    734         if [ "$debug" = "1" ]; then
     742        if [ "$debug" = 1 ]; then
    735743                echo
    736744                echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
     
    749757fi
    750758
    751 if [ ! "$systemd" = "0" ]; then
     759if [ ! "$systemd" = 0 ]; then
    752760    if ! $PKG_CONFIG --exists systemd ; then
    753761        if [ $systemd -eq 1 ]; then
     
    764772pkgconf_systemd_var() {
    765773    # First try deprecated variable, use newer variable if not found
    766     if $PKG_CONFIG --print-variables systemd | grep -q "$1" ; then
    767         $PKG_CONFIG --variable="$1" systemd
     774    if $PKG_CONFIG --print-variables systemd | grep -q $1 ; then
     775        $PKG_CONFIG --variable=$1 systemd
    768776    else
    769         $PKG_CONFIG --variable="$2" systemd
     777        $PKG_CONFIG --variable=$2 systemd
    770778    fi
    771779}
    772780
    773 if [ "$systemd" = "1" ]; then
     781if [ "$systemd" -eq 1 ]; then
    774782        if [ -z "$systemdsystemunitdir" ]; then
    775783                systemdsystemunitdir=$(pkgconf_systemd_var systemdsystemunitdir systemd_system_unit_dir)
     
    792800fi
    793801
    794 if [ "$plugins" = "0" ]; then
     802if [ "$plugins" = 0 ]; then
    795803        plugindir=""
    796804        echo '#undef WITH_PLUGINS' >> config.h
     
    799807fi
    800808
     809otrprefix=""
    801810if [ "$otr" = "auto" ]; then
    802811        ! $PKG_CONFIG --exists libotr
     
    804813fi
    805814
    806 if [ "$otr" != "0" ] && ! $PKG_CONFIG --atleast-version=4.0 --print-errors libotr; then
     815if [ "$otr" != 0 ] && ! $PKG_CONFIG --atleast-version=4.0 --print-errors libotr; then
    807816        exit 1
    808817fi
    809818
    810 if [ "$otr" = "1" ]; then
     819if [ "$otr" = 1 ]; then
    811820        # BI == built-in
    812821        echo '#define OTR_BI' >> config.h
    813         # shellcheck disable=SC2129
    814822        echo "EFLAGS+=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings
    815823        echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings
     
    819827        # the libgcrypt flags aren't needed when building as plugin. add them anyway.
    820828        echo '#define OTR_PI' >> config.h
    821         # shellcheck disable=SC2129
    822829        echo "OTRFLAGS=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings
    823830        echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings
     
    836843if [ "$doc" = "1" ]; then
    837844        # check this here just in case someone tries to install it in python2.4...
    838         if [ ! -e "$srcdir"/doc/user-guide/help.txt ] && ! $PYTHON -m xml.etree.ElementTree > /dev/null 2>&1; then
     845        if [ ! -e $srcdir/doc/user-guide/help.txt ] && ! $PYTHON -m xml.etree.ElementTree > /dev/null 2>&1; then
    839846                echo
    840847                echo 'ERROR: Python (>=2.5 or 3.x) is required to generate docs'
     
    872879case "$arch" in
    873880CYGWIN* )
    874         pkgconfiglibs="-L${libdir} -lbitlbee -no-undefined"
     881        pkgconfiglibs='-L${libdir} -lbitlbee -no-undefined'
    875882esac
    876883
     
    899906protoobjs=''
    900907
    901 if [ "$purple" = "0" ]; then
     908if [ "$purple" = 0 ]; then
    902909        echo '#undef WITH_PURPLE' >> config.h
    903910else
     
    933940        echo CFLAGS+=-MMD -MF .depend/\$@.d >> Makefile.settings
    934941        for i in . lib tests protocols protocols/*/; do
    935                 mkdir -p "$i"/.depend
     942                mkdir -p $i/.depend
    936943        done
    937944esac
    938945
    939 if [ "$jabber" = "0" ]; then
     946if [ "$jabber" = 0 ]; then
    940947        echo '#undef WITH_JABBER' >> config.h
    941948else
     
    945952fi
    946953
    947 if [ "$twitter" = "0" ]; then
     954if [ "$twitter" = 0 ]; then
    948955        echo '#undef WITH_TWITTER' >> config.h
    949956else
     
    961968echo "PROTOOBJS = $protoobjs" >> Makefile.settings
    962969
    963 echo Architecture: "$arch"
     970echo Architecture: $arch
    964971case "$arch" in
    965972Linux )
     
    10561063
    10571064if [ -n "$protocols" ]; then
    1058         echo '  Building with these protocols:' "$protocols""$protocols_mods"
     1065        echo '  Building with these protocols:' $protocols$protocols_mods
    10591066        case "$protocols" in
    10601067        *purple*)
Note: See TracChangeset for help on using the changeset viewer.