瀏覽代碼

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

legacy
Sam Hocevar sam 12 年之前
父節點
當前提交
5ca6891030
共有 2 個檔案被更改,包括 48 行新增9 行删除
  1. +22
    -8
      build/check-source.sh
  2. +26
    -1
      configure.ac

+ 22
- 8
build/check-source.sh 查看文件

@@ -28,15 +28,28 @@ done
error() { if [ "$quiet" != true ]; then echo "E: $1"; fi }
info() { if [ "$quiet" != true ]; then echo "I: $1"; fi }

# Ensure the system tools do not attempt to perform multibyte conversions
export LANG=C

# Find out where the top directory is and go there
top_srcdir="$(cd "$(dirname $0)"; cd ..; pwd)"
cd "$top_srcdir"

# Check for working tools
#if [ "$(echo foo | grep -c foo)" != 1 ]; then
# error "grep -c does not appear to work, cancelling"
# exit 0
#fi
if [ "$(echo foo | grep -c foo)" != 1 ]; then
error "grep -c does not appear to work, cancelling"
exit 0
fi

SED=sed
if gsed --version >/dev/null 2>&1; then
SED=gsed
fi
if [ "$(echo 'x\x' | $SED 's/.*[^x\t]//')" != x ]; then
error "sed does not appear to work, cancelling"
exit 0
fi

if d2u -h >/dev/null 2>&1; then
d2u=d2u
elif dos2unix -h >/dev/null 2>&1; then
@@ -73,7 +86,8 @@ total_spaces=0
total_tabs=0

OIFS="$IFS"
IFS=$'\n'
IFS='
'
if [ "$repo" = git ]; then
FILES="`git ls-files`"
else
@@ -118,12 +132,12 @@ for file in $FILES; do
fi

# Check for trailing spaces
nspaces="$(LANG=C sed 's/.*[^ \t]//' "$file" | tr -cd '\t ' | wc -c)"
nspaces="$($SED 's/.*[^ \t]//' "$file" | tr -cd '\t ' | wc -c)"
total_spaces="$(($total_spaces + $nspaces))"
if [ "$nspaces" -gt 0 ]; then
clean=false
if [ "$fix" = true ]; then
LANG=C sed -i 's/[[:space:]][[:space:]]*$//g' "$file"
$SED -i 's/[[:space:]][[:space:]]*$//g' "$file"
info "$file has $nspaces trailing spaces"
else
error "$file has $nspaces trailing spaces"
@@ -136,7 +150,7 @@ for file in $FILES; do
if [ "$ntabs" -gt 0 ]; then
clean=false
if [ "$fix" = true ]; then
LANG=C sed -i 's/\t/ /g' "$file"
$SED -i 's/\t/ /g' "$file"
info "$file has $ntabs tabs"
else
error "$file has $ntabs tabs"


+ 26
- 1
configure.ac 查看文件

@@ -49,6 +49,18 @@ dnl PKG_PROG_PKG_CONFIG which needs to be called first.
AC_EGREP_CPP(yes, foo)
PKG_PROG_PKG_CONFIG()


dnl Check for a working implementation of sed
AC_PROG_SED
AC_MSG_CHECKING(for a sed that understands \t)
if test "$(echo 'x\x' | "${SED}" 's/.*@<:@^x\t@:>@//')" != x; then
AC_MSG_RESULT(no)
AC_MSG_ERROR([[consider installing GNU sed]])
else
AC_MSG_RESULT(yes)
fi


AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
dnl conditional builds
AC_ARG_ENABLE(debug,
@@ -225,7 +237,20 @@ AM_CONDITIONAL(USE_SDL_IMAGE, test "${ac_cv_my_have_sdl_image}" = "yes")
dnl Use Flex's FlexLexer.h or ours?
ac_cv_my_have_flexlexer_h="no"
AC_LANG_PUSH(C++)
AC_CHECK_HEADERS(FlexLexer.h, [ac_cv_my_have_flexlexer_h="yes"])
AC_CHECK_HEADERS(FlexLexer.h,
dnl Ensure that FlexLexer::yleng is of type int, and not size_t like
dnl on recent Apple systems. It would break all our existing code.
[AC_MSG_CHECKING(for FlexLexer.h validity)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <FlexLexer.h>
class Foo : public FlexLexer
{
Foo() { int &test = yyleng; }
}],
[])],
[AC_MSG_RESULT(yes)
ac_cv_my_have_flexlexer_h="yes"],
[AC_MSG_RESULT(no)])])
AC_LANG_POP(C++)
if test "x${ac_cv_my_have_flexlexer_h}" = "xno"; then
LOL_CFLAGS="$LOL_CFLAGS -I\$(top_srcdir)/external/flex-2.5.35/include"


Loading…
取消
儲存