implement autoconf tests for langstuff; sync date
This commit is contained in:
parent
d5c0de53e3
commit
11fbdb4378
22
Build.sh
22
Build.sh
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# $MirOS: src/bin/mksh/Build.sh,v 1.60 2006/11/08 23:38:28 tg Exp $
|
||||
# $MirOS: src/bin/mksh/Build.sh,v 1.61 2006/11/08 23:45:46 tg Exp $
|
||||
#-
|
||||
# Environment: CC, CFLAGS, CPPFLAGS, LDFLAGS, LIBS, NROFF
|
||||
|
||||
@ -12,7 +12,9 @@ v()
|
||||
ac_test()
|
||||
{
|
||||
f=$1
|
||||
fu=$(echo $f | tr '[a-z]' '[A-Z]')
|
||||
fu=$(echo $f | tr qwertyuiopasdfghjklzxcvbnm QWERTYUIOPASDFGHJKLZXCVBNM)
|
||||
fd=$3
|
||||
test x"$fd" = x"" && fd=$f
|
||||
test 0 = "$HAVE_$fu" && return
|
||||
test 1 = "$HAVE_$fu" && return
|
||||
if test x"$2" = x""; then
|
||||
@ -24,15 +26,15 @@ ac_test()
|
||||
eval HAVE_$fu=0
|
||||
return
|
||||
fi
|
||||
$e ... $f
|
||||
$e ... $fd
|
||||
cat >scn.c
|
||||
$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN scn.c $LIBS
|
||||
if test -f a.out || test -f a.exe; then
|
||||
eval HAVE_$fu=1
|
||||
$e "==> $f... yes"
|
||||
$e "==> $fd... yes"
|
||||
else
|
||||
eval HAVE_$fu=0
|
||||
$e "==> $f... no"
|
||||
$e "==> $fd... no"
|
||||
fi
|
||||
rm -f scn.c a.out a.exe
|
||||
}
|
||||
@ -167,6 +169,16 @@ ac_test arc4random_push HAVE_ARC4RANDOM <<-'EOF'
|
||||
int main() { arc4random_push(1); return (0); }
|
||||
EOF
|
||||
|
||||
ac_test setlocale_ctype '' 'setlocale(LC_CTYPE, "")' <<'EOF'
|
||||
#include <locale.h>
|
||||
int main() { setlocale(LC_CTYPE, ""); return (0); }
|
||||
EOF
|
||||
|
||||
ac_test langinfo_codeset HAVE_SETLOCALE_CTYPE 'nl_langinfo(CODESET)' <<'EOF'
|
||||
#include <langinfo.h>
|
||||
int main() { nl_langinfo(CODESET); return (0); }
|
||||
EOF
|
||||
|
||||
ac_test setmode <<-'EOF'
|
||||
#include <unistd.h>
|
||||
int main(int ac, char *av[]) { setmode(av[0]); return (0); }
|
||||
|
5
Makefile
5
Makefile
@ -1,9 +1,10 @@
|
||||
# $MirOS: src/bin/mksh/Makefile,v 1.14 2006/11/08 23:24:49 tg Exp $
|
||||
# $MirOS: src/bin/mksh/Makefile,v 1.15 2006/11/08 23:45:46 tg Exp $
|
||||
|
||||
PROG= mksh
|
||||
SRCS= alloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c \
|
||||
jobs.c lex.c main.c misc.c shf.c syn.c tree.c var.c
|
||||
CPPFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_ARC4RANDOM_PUSH -DHAVE_LANGSTUFF
|
||||
CPPFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_ARC4RANDOM_PUSH
|
||||
CPPFLAGS+= -DHAVE_LANGINFO_CODESET -DHAVE_SETLOCALE_CTYPE
|
||||
CPPFLAGS+= -DHAVE_SETMODE -DHAVE_STRLCAT -DHAVE_STRLCPY
|
||||
CDIAGFLAGS+= -Wno-cast-qual
|
||||
|
||||
|
4
check.t
4
check.t
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.69 2006/11/05 17:01:46 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.70 2006/11/08 23:45:46 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 $
|
||||
@ -3872,5 +3872,5 @@ category: pdksh
|
||||
stdin:
|
||||
echo $KSH_VERSION
|
||||
expected-stdout:
|
||||
@(#)MIRBSD KSH R29 2006/11/05
|
||||
@(#)MIRBSD KSH R29 2006/11/08
|
||||
---
|
||||
|
12
main.c
12
main.c
@ -6,12 +6,14 @@
|
||||
#define EXTERN
|
||||
#include "sh.h"
|
||||
|
||||
#if (HAVE_LANGSTUFF - 0)
|
||||
#if HAVE_LANGINFO_CODESET
|
||||
#include <langinfo.h>
|
||||
#endif
|
||||
#if HAVE_SETLOCALE_CTYPE
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.50 2006/11/05 12:11:14 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.51 2006/11/08 23:45:47 tg Exp $");
|
||||
|
||||
extern char **environ;
|
||||
|
||||
@ -65,7 +67,7 @@ main(int argc, char *argv[])
|
||||
pid_t ppid;
|
||||
struct tbl *vp;
|
||||
struct stat s_stdin;
|
||||
#if (HAVE_LANGSTUFF - 0)
|
||||
#if HAVE_SETLOCALE_CTYPE
|
||||
const char *cc;
|
||||
#endif
|
||||
|
||||
@ -142,10 +144,10 @@ main(int argc, char *argv[])
|
||||
setstr(vp, def_path, KSH_RETURN_ERROR);
|
||||
|
||||
|
||||
#if (HAVE_LANGSTUFF - 0)
|
||||
#if HAVE_SETLOCALE_CTYPE
|
||||
/* Check if we're in an UTF-8 locale */
|
||||
cc = setlocale(LC_CTYPE, "");
|
||||
#ifdef CODESET
|
||||
#if HAVE_LANGINFO_CODESET
|
||||
if (strcasecmp(cc, "UTF-8") && strcasecmp(cc, "utf8") &&
|
||||
strcasecmp(cc, "CESU-8") && strcasecmp(cc, "cesu8"))
|
||||
cc = nl_langinfo(CODESET);
|
||||
|
4
sh.h
4
sh.h
@ -8,8 +8,8 @@
|
||||
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
||||
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
||||
|
||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.51 2006/11/08 23:23:41 tg Exp $"
|
||||
#define MKSH_VERSION "R29 2006/11/05"
|
||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.52 2006/11/08 23:45:47 tg Exp $"
|
||||
#define MKSH_VERSION "R29 2006/11/08"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(__RCSID) || !defined(__SCCSID)
|
||||
|
Loading…
Reference in New Issue
Block a user