Skip to contentSkip to conversation

avoid the use of unportable "expr length"

PATCH New Martin Schaffner 1 participant 1 message Dec 9, 2003 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 avoid the use of unportable "expr length"

Hi!

I tried to cross-compile from Mac OS X, which failed because the Makefile uses the "length" feature of GNU expr, which is not found in BSD expr. Here's a fix.

Please CC me when replying.

Makefile +1 -1
@@ -640,7 +640,7 @@
 uts_len := 64
 
 define filechk_version.h
-	if expr length "$(KERNELRELEASE)" \> $(uts_len) >/dev/null ; then \
+	if expr "$(KERNELRELEASE)" : '.*' \> $(uts_len) >/dev/null ; then \
 	  echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
 	  exit 1; \
 	fi; \
Makefile 2003-12-09 14:28:37.000000000 +0100 renamed from Makefile 2003-12-09 14:27:56.000000000 +0100 +1 -1
@@ -353,7 +353,7 @@
        @rm -f .ver1
 
 include/linux/version.h: ./Makefile
-       @expr length "$(KERNELRELEASE)" \<= $(uts_len) > /dev/null || \
+       @expr "$(KERNELRELEASE)" : '.*' \<= $(uts_len) > /dev/null || \
          (echo KERNELRELEASE \"$(KERNELRELEASE)\" exceeds $(uts_len)

characters >&2; false)

        @echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
        @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 +

$(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver

Signature · 2 lines
+++ GMX - die erste Adresse für Mail, Message, More +++
Neu: Preissenkung für MMS und FreeMMS! http://www.gmx.net