Changeset 2036


Ignore:
Timestamp:
Oct 20, 2012, 4:08:52 PM (5 years ago)
Author:
sam
Message:

build: check for a decent version of sed (ie. not the shitty BSD one).

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/build/check-source.sh

    r1995 r2036  
    2929info() { if [ "$quiet" != true ]; then echo "I: $1"; fi }
    3030
     31# Ensure the system tools do not attempt to perform multibyte conversions
     32export LANG=C
     33
    3134# Find out where the top directory is and go there
    3235top_srcdir="$(cd "$(dirname $0)"; cd ..; pwd)"
     
    3437
    3538# Check for working tools
    36 #if [ "$(echo foo | grep -c foo)" != 1 ]; then
    37 #    error "grep -c does not appear to work, cancelling"
    38 #    exit 0
    39 #fi
     39if [ "$(echo foo | grep -c foo)" != 1 ]; then
     40    error "grep -c does not appear to work, cancelling"
     41    exit 0
     42fi
     43
     44SED=sed
     45if gsed --version >/dev/null 2>&1; then
     46    SED=gsed
     47fi
     48if [ "$(echo 'x\x' | $SED 's/.*[^x\t]//')" != x ]; then
     49    error "sed does not appear to work, cancelling"
     50    exit 0
     51fi
     52
    4053if d2u -h >/dev/null 2>&1; then
    4154    d2u=d2u
     
    7487
    7588OIFS="$IFS"
    76 IFS=$'\n'
     89IFS='
     90'
    7791if [ "$repo" = git ]; then
    7892    FILES="`git ls-files`"
     
    119133
    120134          # Check for trailing spaces
    121           nspaces="$(LANG=C sed 's/.*[^ \t]//' "$file" | tr -cd '\t ' | wc -c)"
     135          nspaces="$($SED 's/.*[^ \t]//' "$file" | tr -cd '\t ' | wc -c)"
    122136          total_spaces="$(($total_spaces + $nspaces))"
    123137          if [ "$nspaces" -gt 0 ]; then
    124138              clean=false
    125139              if [ "$fix" = true ]; then
    126                   LANG=C sed -i 's/[[:space:]][[:space:]]*$//g' "$file"
     140                  $SED -i 's/[[:space:]][[:space:]]*$//g' "$file"
    127141                  info "$file has $nspaces trailing spaces"
    128142              else
     
    137151              clean=false
    138152              if [ "$fix" = true ]; then
    139                   LANG=C sed -i 's/\t/    /g' "$file"
     153                  $SED -i 's/\t/    /g' "$file"
    140154                  info "$file has $ntabs tabs"
    141155              else
  • trunk/configure.ac

    r1995 r2036  
    4949AC_EGREP_CPP(yes, foo)
    5050PKG_PROG_PKG_CONFIG()
     51
     52
     53dnl  Check for a working implementation of sed
     54AC_PROG_SED
     55AC_MSG_CHECKING(for a sed that understands \t)
     56if test "$(echo 'x\x' | "${SED}" 's/.*@<:@^x\t@:>@//')" != x; then
     57  AC_MSG_RESULT(no)
     58  AC_MSG_ERROR([[consider installing GNU sed]])
     59else
     60  AC_MSG_RESULT(yes)
     61fi
     62
    5163
    5264AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
     
    226238ac_cv_my_have_flexlexer_h="no"
    227239AC_LANG_PUSH(C++)
    228 AC_CHECK_HEADERS(FlexLexer.h, [ac_cv_my_have_flexlexer_h="yes"])
     240AC_CHECK_HEADERS(FlexLexer.h,
     241 dnl  Ensure that FlexLexer::yleng is of type int, and not size_t like
     242 dnl  on recent Apple systems. It would break all our existing code.
     243 [AC_MSG_CHECKING(for FlexLexer.h validity)
     244  AC_COMPILE_IFELSE(
     245   [AC_LANG_PROGRAM([#include <FlexLexer.h>
     246      class Foo : public FlexLexer
     247      {
     248          Foo() { int &test = yyleng; }
     249      }],
     250     [])],
     251   [AC_MSG_RESULT(yes)
     252    ac_cv_my_have_flexlexer_h="yes"],
     253   [AC_MSG_RESULT(no)])])
    229254AC_LANG_POP(C++)
    230255if test "x${ac_cv_my_have_flexlexer_h}" = "xno"; then
Note: See TracChangeset for help on using the changeset viewer.