simplify this LDSTATIC shit and fix -nd in the process *sigh*

found on ecce!GNU/Linux 1.0, all tests pass, mksh-current
is exactly half the size of bash 2.01.1(1)r, both dynamic
This commit is contained in:
tg 2007-01-18 02:54:19 +00:00
parent 8df4639675
commit ef81fd0b75

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# $MirOS: src/bin/mksh/Build.sh,v 1.139 2007/01/18 01:10:55 tg Exp $ # $MirOS: src/bin/mksh/Build.sh,v 1.140 2007/01/18 02:54:19 tg Exp $
#- #-
# Env: CC, CFLAGS, CPP, CPPFLAGS, LDFLAGS, LIBS, NOWARN, NROFF, TARGET_OS # Env: CC, CFLAGS, CPP, CPPFLAGS, LDFLAGS, LIBS, NOWARN, NROFF, TARGET_OS
# CPPFLAGS recognised: MKSH_SMALL MKSH_NOPWNAM # CPPFLAGS recognised: MKSH_SMALL MKSH_NOPWNAM
@ -124,16 +124,16 @@ curdir=`pwd` srcdir=`dirname "$0"` check_categories=pdksh
e=echo e=echo
h=1 h=1
r=0 r=0
LDSTATIC=-static LDSTATIC=default
for i for i
do do
case $i in case $i in
-d) -d)
LDSTATIC=@@ LDSTATIC=dynamic
;; ;;
-nd) -nd)
LDSTATIC=@@@ LDSTATIC=static
;; ;;
-q) -q)
e=: e=:
@ -159,10 +159,10 @@ test $r = 0 && echo | $NROFF -v 2>&1 | grep GNU >/dev/null 2>&1 && \
test x"$TARGET_OS" = x"" && TARGET_OS=`uname -s 2>/dev/null || uname` test x"$TARGET_OS" = x"" && TARGET_OS=`uname -s 2>/dev/null || uname`
case $TARGET_OS in case $TARGET_OS in
CYGWIN*) CYGWIN*)
test x"@@" = x"$LDSTATIC" || LDSTATIC=@ test x"default" = x"$LDSTATIC" || LDSTATIC=pwnam
;; ;;
Darwin) Darwin)
test x"@@" = x"$LDSTATIC" || LDSTATIC=@ test x"default" = x"$LDSTATIC" || LDSTATIC=pwnam
CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64" CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64"
;; ;;
DragonFly) DragonFly)
@ -175,7 +175,7 @@ Interix)
Linux) Linux)
CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=2 -D_BSD_SOURCE -D_GNU_SOURCE" CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=2 -D_BSD_SOURCE -D_GNU_SOURCE"
CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64" CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64"
test x"@@" = x"$LDSTATIC" || LDSTATIC=@ test x"default" = x"$LDSTATIC" || LDSTATIC=pwnam
;; ;;
MirBSD) MirBSD)
;; ;;
@ -186,7 +186,7 @@ OpenBSD)
SunOS) SunOS)
CPPFLAGS="$CPPFLAGS -D_BSD_SOURCE -D__EXTENSIONS__" CPPFLAGS="$CPPFLAGS -D_BSD_SOURCE -D__EXTENSIONS__"
CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64" CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64"
test x"@@" = x"$LDSTATIC" || LDSTATIC=@ test x"default" = x"$LDSTATIC" || LDSTATIC=pwnam
r=1 r=1
;; ;;
*) *)
@ -542,15 +542,11 @@ addsrcs HAVE_STRCASESTR strcasestr.c
addsrcs HAVE_STRLCPY strlfun.c addsrcs HAVE_STRLCPY strlfun.c
CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H -DCONFIG_H_FILENAME=\\\"sh.h\\\"" CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H -DCONFIG_H_FILENAME=\\\"sh.h\\\""
case $LDSTATIC in case $LDSTATIC:$HAVE_MKSH_NOPAM in
@) if test 1 = $HAVE_MKSH_NOPAM; then default:*|static:*|pwnam:1)
LDSTATIC=-static LDSTATIC=-static ;;
else dynamic:*|pwnam:0)
LDSTATIC= LDSTATIC= ;;
fi
;;
@@) LDSTATIC= ;;
@@@) LDSTATIC=-static ;;
esac esac
(v "cd '$srcdir' && exec $CC $CFLAGS $CPPFLAGS" \ (v "cd '$srcdir' && exec $CC $CFLAGS $CPPFLAGS" \
"$LDFLAGS $LDSTATIC -o '$curdir/mksh' $SRCS $LIBS") || exit 1 "$LDFLAGS $LDSTATIC -o '$curdir/mksh' $SRCS $LIBS") || exit 1