move linkage check (which uses sh.h INCLUDES_ONLY) to when all of its

prerequisites are actually fulfilled, i.e. evrn further down than with
the last commit doing this, and move some prerequisites of stuff that
has wandered outside the !INCLUDES_ONLY block with the compile-time
assert changes to the outside, too

fixes FTBFS on MSYS which has neither <stdint.h> nor uint32_t
reported by RT
This commit is contained in:
tg 2012-01-03 00:58:09 +00:00
parent 7564594bb8
commit 2578c66b61
3 changed files with 86 additions and 79 deletions

View File

@ -1,7 +1,8 @@
#!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.502 2011/12/31 02:54:15 tg Exp $'
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.503 2012/01/03 00:58:06 tg Exp $'
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012
# Thorsten Glaser <tg@mirbsd.org>
#
# Provided that these terms and disclaimer and all copyright notices
@ -1161,51 +1162,6 @@ ac_header strings.h sys/types.h string.h
ac_header ulimit.h sys/types.h
ac_header values.h
#
# check whether whatever we use for the final link will succeed
#
if test $cm = makefile; then
: nothing to check
else
HAVE_LINK_WORKS=x
ac_testinit link_works '' 'checking if the final link command may succeed'
fv=1
cat >conftest.c <<-'EOF'
#define EXTERN
#define MKSH_INCLUDES_ONLY
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.502 2011/12/31 02:54:15 tg Exp $");
int main(void) { printf("Hello, World!\n"); return (0); }
EOF
case $cm in
llvm)
v "$CC $CFLAGS $CPPFLAGS $NOWARN -emit-llvm -c conftest.c" || fv=0
rmf mksh.s
test $fv = 0 || v "llvm-link -o - conftest.o | opt $optflags | llc -o mksh.s" || fv=0
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn mksh.s $LIBS $ccpr"
;;
dragonegg)
v "$CC $CFLAGS $CPPFLAGS $NOWARN -S -flto conftest.c" || fv=0
test $fv = 0 || v "mv conftest.s conftest.ll"
test $fv = 0 || v "llvm-as conftest.ll" || fv=0
rmf mksh.s
test $fv = 0 || v "llvm-link -o - conftest.bc | opt $optflags | llc -o mksh.s" || fv=0
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn mksh.s $LIBS $ccpr"
;;
combine)
v "$CC $CFLAGS $CPPFLAGS $LDFLAGS -fwhole-program --combine $NOWARN -o $tcfn conftest.c $LIBS $ccpr"
;;
lto|normal)
cm=normal
v "$CC $CFLAGS $CPPFLAGS $NOWARN -c conftest.c" || fv=0
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn conftest.o $LIBS $ccpr"
;;
esac
test -f $tcfn || fv=0
ac_testdone
test $fv = 1 || exit 1
fi
#
# Environment: definitions
#
@ -1292,6 +1248,51 @@ fi
test 1 = $HAVE_SIG_T || add_cppflags -Dsig_t=nosig_t
ac_cppflags SIG_T
#
# check whether whatever we use for the final link will succeed
#
if test $cm = makefile; then
: nothing to check
else
HAVE_LINK_WORKS=x
ac_testinit link_works '' 'checking if the final link command may succeed'
fv=1
cat >conftest.c <<-'EOF'
#define EXTERN
#define MKSH_INCLUDES_ONLY
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.503 2012/01/03 00:58:06 tg Exp $");
int main(void) { printf("Hello, World!\n"); return (0); }
EOF
case $cm in
llvm)
v "$CC $CFLAGS $CPPFLAGS $NOWARN -emit-llvm -c conftest.c" || fv=0
rmf mksh.s
test $fv = 0 || v "llvm-link -o - conftest.o | opt $optflags | llc -o mksh.s" || fv=0
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn mksh.s $LIBS $ccpr"
;;
dragonegg)
v "$CC $CFLAGS $CPPFLAGS $NOWARN -S -flto conftest.c" || fv=0
test $fv = 0 || v "mv conftest.s conftest.ll"
test $fv = 0 || v "llvm-as conftest.ll" || fv=0
rmf mksh.s
test $fv = 0 || v "llvm-link -o - conftest.bc | opt $optflags | llc -o mksh.s" || fv=0
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn mksh.s $LIBS $ccpr"
;;
combine)
v "$CC $CFLAGS $CPPFLAGS $LDFLAGS -fwhole-program --combine $NOWARN -o $tcfn conftest.c $LIBS $ccpr"
;;
lto|normal)
cm=normal
v "$CC $CFLAGS $CPPFLAGS $NOWARN -c conftest.c" || fv=0
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn conftest.o $LIBS $ccpr"
;;
esac
test -f $tcfn || fv=0
ac_testdone
test $fv = 1 || exit 1
fi
#
# Environment: signals
#

View File

@ -1,9 +1,10 @@
# $MirOS: src/bin/mksh/check.t,v 1.507 2011/12/31 00:27:23 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.508 2012/01/03 00:58:07 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
#-
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012
# Thorsten Glaser <tg@mirbsd.org>
#
# Provided that these terms and disclaimer and all copyright notices
@ -28,7 +29,7 @@
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
expected-stdout:
@(#)MIRBSD KSH R40 2011/12/30
@(#)MIRBSD KSH R40 2012/01/03
description:
Check version of shell.
stdin:

63
sh.h
View File

@ -9,7 +9,8 @@
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
/*-
* Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
* Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
* 2011, 2012
* Thorsten Glaser <tg@mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
@ -151,11 +152,21 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.516 2011/12/31 00:27:25 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.517 2012/01/03 00:58:09 tg Exp $");
#endif
#define MKSH_VERSION "R40 2011/12/30"
/* arithmetics types */
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES
#if !HAVE_CAN_UCBINTS
typedef signed int int32_t;
typedef unsigned int uint32_t;
#else
typedef u_int32_t uint32_t;
#endif
#endif
/* arithmetic types: shell arithmetics */
typedef int32_t mksh_ari_t;
typedef uint32_t mksh_uari_t;
@ -173,6 +184,26 @@ typedef unsigned char mksh_bool;
/* make any-type into bool or short */
#define tobool(cond) ((cond) ? true : false)
/* char (octet) type: C implementation */
#if !HAVE_CAN_INT8TYPE
#if !HAVE_CAN_UCBINT8
typedef unsigned char uint8_t;
#else
typedef u_int8_t uint8_t;
#endif
#endif
/* other standard types */
#if !HAVE_RLIM_T
typedef long rlim_t;
#endif
#if !HAVE_SIG_T
#undef sig_t
typedef void (*sig_t)(int);
#endif
#ifndef MKSH_INCLUDES_ONLY
/* extra types */
@ -191,32 +222,6 @@ struct rusage {
};
#endif
#if !HAVE_RLIM_T
typedef long rlim_t;
#endif
#if !HAVE_SIG_T
#undef sig_t
typedef void (*sig_t)(int);
#endif
#if !HAVE_CAN_INTTYPES
#if !HAVE_CAN_UCBINTS
typedef signed int int32_t;
typedef unsigned int uint32_t;
#else
typedef u_int32_t uint32_t;
#endif
#endif
#if !HAVE_CAN_INT8TYPE
#if !HAVE_CAN_UCBINT8
typedef unsigned char uint8_t;
#else
typedef u_int8_t uint8_t;
#endif
#endif
/* extra macros */
#ifndef timerclear