header overhaul: replace all #ifdef __OS__ with mirtoconf checks
(except the persistent history one)
This commit is contained in:
parent
44af708ac8
commit
7b903e4aa9
60
Build.sh
60
Build.sh
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# $MirOS: src/bin/mksh/Build.sh,v 1.142 2007/01/18 03:31:50 tg Exp $
|
# $MirOS: src/bin/mksh/Build.sh,v 1.143 2007/01/18 15:50:31 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
|
||||||
@ -25,10 +25,13 @@ else
|
|||||||
ao=
|
ao=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
allu=QWERTYUIOPASDFGHJKLZXCVBNM
|
||||||
|
alll=qwertyuiopasdfghjklzxcvbnm
|
||||||
|
alln=0123456789
|
||||||
|
|
||||||
upper()
|
upper()
|
||||||
{
|
{
|
||||||
echo :"$@" | sed 's/^://' | \
|
echo :"$@" | sed 's/^://' | tr $alll $allu
|
||||||
tr qwertyuiopasdfghjklzxcvbnm QWERTYUIOPASDFGHJKLZXCVBNM
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# pipe .c | ac_test[n] label [!] checkif[!]0 [setlabelifcheckis[!]0] useroutput
|
# pipe .c | ac_test[n] label [!] checkif[!]0 [setlabelifcheckis[!]0] useroutput
|
||||||
@ -103,6 +106,21 @@ ac_flags()
|
|||||||
test 11 = $fa$fv || CFLAGS=$save_CFLAGS
|
test 11 = $fa$fv || CFLAGS=$save_CFLAGS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ac_header header [prereq ...]
|
||||||
|
ac_header()
|
||||||
|
{
|
||||||
|
hf=$1; shift
|
||||||
|
hv=`echo "$hf" | tr -d '\r\n' | tr -c $alll$allu$alln- _`
|
||||||
|
for i
|
||||||
|
do
|
||||||
|
echo "#include <$i>" >>x
|
||||||
|
done
|
||||||
|
echo "#include <$hf>" >>x
|
||||||
|
echo 'int main(void) { return (0); }' >>x
|
||||||
|
ac_test "$hv" "" "<$hf>" <x
|
||||||
|
rm -f x
|
||||||
|
}
|
||||||
|
|
||||||
addsrcs()
|
addsrcs()
|
||||||
{
|
{
|
||||||
eval i=\$$1
|
eval i=\$$1
|
||||||
@ -202,6 +220,7 @@ CPPFLAGS="$CPPFLAGS -I'$curdir'"
|
|||||||
#
|
#
|
||||||
# Begin of mirtoconf checks
|
# Begin of mirtoconf checks
|
||||||
#
|
#
|
||||||
|
rm -f scn.c a.out a.exe x
|
||||||
$e ${ao}Scanning for functions... please ignore any errors.
|
$e ${ao}Scanning for functions... please ignore any errors.
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -251,8 +270,7 @@ NOWARN=$save_NOWARN
|
|||||||
#
|
#
|
||||||
# Compiler: extra flags (-O2 -f* -W* etc.)
|
# Compiler: extra flags (-O2 -f* -W* etc.)
|
||||||
#
|
#
|
||||||
i=`echo :"$CFLAGS" | sed 's/^://' | \
|
i=`echo :"$CFLAGS" | sed 's/^://' | tr -c -d $alll$allu$alln-`
|
||||||
tr -c -d qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789-`
|
|
||||||
test x"$i" = x"" && ac_flags 1 otwo "-O2"
|
test x"$i" = x"" && ac_flags 1 otwo "-O2"
|
||||||
ac_flags 1 fnostrictaliasing "-fno-strict-aliasing"
|
ac_flags 1 fnostrictaliasing "-fno-strict-aliasing"
|
||||||
ac_flags 1 fwholepgm "-fwhole-program --combine"
|
ac_flags 1 fwholepgm "-fwhole-program --combine"
|
||||||
@ -289,25 +307,15 @@ fi
|
|||||||
#
|
#
|
||||||
# Environment: headers
|
# Environment: headers
|
||||||
#
|
#
|
||||||
ac_test sys_param_h '' '<sys/param.h>' <<-'EOF'
|
ac_header sys/param.h
|
||||||
#include <sys/param.h>
|
ac_header sys/mkdev.h
|
||||||
int main(void) { return (0); }
|
ac_header sys/sysmacros.h
|
||||||
EOF
|
ac_header libgen.h
|
||||||
|
ac_header paths.h
|
||||||
ac_test sys_sysmacros_h '' '<sys/sysmacros.h>' <<-'EOF'
|
ac_header stdbool.h
|
||||||
#include <sys/sysmacros.h>
|
ac_header grp.h sys/types.h
|
||||||
int main(void) { return (0); }
|
ac_header ulimit.h
|
||||||
EOF
|
ac_header values.h
|
||||||
|
|
||||||
ac_test libgen_h '' '<libgen.h>' <<-'EOF'
|
|
||||||
#include <libgen.h>
|
|
||||||
int main(void) { return (0); }
|
|
||||||
EOF
|
|
||||||
|
|
||||||
ac_test stdbool_h '' '<stdbool.h>' <<-'EOF'
|
|
||||||
#include <stdbool.h>
|
|
||||||
int main(void) { return (0); }
|
|
||||||
EOF
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Environment: types
|
# Environment: types
|
||||||
@ -443,7 +451,9 @@ EOF
|
|||||||
|
|
||||||
ac_test setgroups setresugid 0 <<-'EOF'
|
ac_test setgroups setresugid 0 <<-'EOF'
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#if HAVE_GRP_H
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
|
#endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
int main(void) { gid_t gid = 0; return (setgroups(0, &gid)); }
|
int main(void) { gid_t gid = 0; return (setgroups(0, &gid)); }
|
||||||
EOF
|
EOF
|
||||||
@ -476,7 +486,6 @@ EOF
|
|||||||
#
|
#
|
||||||
if test 1 = $NEED_MKSH_SIGNAME; then
|
if test 1 = $NEED_MKSH_SIGNAME; then
|
||||||
$e ... checking how to run the C Preprocessor
|
$e ... checking how to run the C Preprocessor
|
||||||
rm -f x
|
|
||||||
save_CPP=$CPP
|
save_CPP=$CPP
|
||||||
for i in "$save_CPP" "$CC -E -" "cpp" "/usr/libexec/cpp" "/lib/cpp"; do
|
for i in "$save_CPP" "$CC -E -" "cpp" "/usr/libexec/cpp" "/lib/cpp"; do
|
||||||
CPP=$i
|
CPP=$i
|
||||||
@ -500,7 +509,6 @@ $e ... done.
|
|||||||
|
|
||||||
# Some operating systems have ancient versions of ed(1) writing
|
# Some operating systems have ancient versions of ed(1) writing
|
||||||
# the character count to standard output; cope for that
|
# the character count to standard output; cope for that
|
||||||
rm -f x
|
|
||||||
echo wq >x
|
echo wq >x
|
||||||
ed x <x 2>/dev/null | grep 3 >/dev/null 2>&1 && \
|
ed x <x 2>/dev/null | grep 3 >/dev/null 2>&1 && \
|
||||||
check_categories=$check_categories,oldish-ed
|
check_categories=$check_categories,oldish-ed
|
||||||
|
13
Makefile
13
Makefile
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/Makefile,v 1.27 2007/01/18 01:24:46 tg Exp $
|
# $MirOS: src/bin/mksh/Makefile,v 1.28 2007/01/18 15:50:32 tg Exp $
|
||||||
|
|
||||||
PROG= mksh
|
PROG= mksh
|
||||||
SRCS= alloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c \
|
SRCS= alloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c \
|
||||||
@ -6,11 +6,12 @@ SRCS= alloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c \
|
|||||||
.if !make(test-build)
|
.if !make(test-build)
|
||||||
CPPFLAGS+= -DHAVE_ATTRIBUTE=1 -DHAVE_ATTRIBUTE_BOUNDED=1 \
|
CPPFLAGS+= -DHAVE_ATTRIBUTE=1 -DHAVE_ATTRIBUTE_BOUNDED=1 \
|
||||||
-DHAVE_ATTRIBUTE_USED=1 -DHAVE_SYS_PARAM_H=1 \
|
-DHAVE_ATTRIBUTE_USED=1 -DHAVE_SYS_PARAM_H=1 \
|
||||||
-DHAVE_SYS_SYSMACROS_H=0 -DHAVE_LIBGEN_H=1 \
|
-DHAVE_SYS_MKDEV_H=0 -DHAVE_SYS_SYSMACROS_H=0 \
|
||||||
-DHAVE_STDBOOL_H=1 -DHAVE_RLIM_T=1 -DHAVE_SIG_T=1 \
|
-DHAVE_LIBGEN_H=1 -DHAVE_PATHS_H=1 -DHAVE_STDBOOL_H=1 \
|
||||||
-DHAVE_MKSH_SIGNAME=0 -DHAVE_SYS_SIGNAME=1 \
|
-DHAVE_GRP_H=1 -DHAVE_ULIMIT_H=0 -DHAVE_VALUES_H=0 \
|
||||||
-DHAVE__SYS_SIGNAME=0 -DHAVE_SYS_SIGLIST=1 \
|
-DHAVE_RLIM_T=1 -DHAVE_SIG_T=1 -DHAVE_MKSH_SIGNAME=0 \
|
||||||
-DHAVE_STRSIGNAL=0 -DHAVE_ARC4RANDOM=1 \
|
-DHAVE_SYS_SIGNAME=1 -DHAVE__SYS_SIGNAME=0 \
|
||||||
|
-DHAVE_SYS_SIGLIST=1 -DHAVE_STRSIGNAL=0 -DHAVE_ARC4RANDOM=1 \
|
||||||
-DHAVE_ARC4RANDOM_PUSH=1 -DHAVE_SETLOCALE_CTYPE=1 \
|
-DHAVE_ARC4RANDOM_PUSH=1 -DHAVE_SETLOCALE_CTYPE=1 \
|
||||||
-DHAVE_LANGINFO_CODESET=1 -DHAVE_REVOKE=1 -DHAVE_SETMODE=1 \
|
-DHAVE_LANGINFO_CODESET=1 -DHAVE_REVOKE=1 -DHAVE_SETMODE=1 \
|
||||||
-DHAVE_SETRESUGID=1 -DHAVE_SETGROUPS=1 -DHAVE_STRCASESTR=1 \
|
-DHAVE_SETRESUGID=1 -DHAVE_SETGROUPS=1 -DHAVE_STRCASESTR=1 \
|
||||||
|
4
check.t
4
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.85 2007/01/18 01:10:55 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.86 2007/01/18 15:50:32 tg Exp $
|
||||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas 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: 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 $
|
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||||
@ -7,7 +7,7 @@
|
|||||||
# http://www.research.att.com/~gsf/public/ifs.sh
|
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R29 2007/01/17
|
@(#)MIRBSD KSH R29 2007/01/18
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
category: pdksh
|
category: pdksh
|
||||||
|
4
misc.c
4
misc.c
@ -2,11 +2,11 @@
|
|||||||
/* $OpenBSD: path.c,v 1.12 2005/03/30 17:16:37 deraadt Exp $ */
|
/* $OpenBSD: path.c,v 1.12 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
#if HAVE_SETGROUPS
|
#if HAVE_GRP_H
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.46 2007/01/18 01:01:25 tg Exp $\t"
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.47 2007/01/18 15:50:32 tg Exp $\t"
|
||||||
MKSH_SH_H_ID);
|
MKSH_SH_H_ID);
|
||||||
|
|
||||||
#undef USE_CHVT
|
#undef USE_CHVT
|
||||||
|
34
sh.h
34
sh.h
@ -8,8 +8,8 @@
|
|||||||
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
/* $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 $ */
|
/* $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.107 2007/01/18 01:03:10 tg Exp $"
|
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.108 2007/01/18 15:50:32 tg Exp $"
|
||||||
#define MKSH_VERSION "R29 2007/01/17"
|
#define MKSH_VERSION "R29 2007/01/18"
|
||||||
|
|
||||||
#if HAVE_SYS_PARAM_H
|
#if HAVE_SYS_PARAM_H
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -41,6 +41,9 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#if HAVE_SYS_MKDEV_H
|
||||||
|
#include <sys/mkdev.h>
|
||||||
|
#endif
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -55,7 +58,7 @@
|
|||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#endif
|
#endif
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#if !defined(__sun__)
|
#if HAVE_PATHS_H
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
#endif
|
#endif
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
@ -71,17 +74,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#if HAVE_ULIMIT_H
|
||||||
|
|
||||||
/* extra headers */
|
|
||||||
|
|
||||||
#if defined(__sun__) || defined(__INTERIX)
|
|
||||||
#include <sys/mkdev.h>
|
|
||||||
#endif
|
|
||||||
#if !defined(__OpenBSD__) && !defined(__CYGWIN__)
|
|
||||||
#include <ulimit.h>
|
#include <ulimit.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(__sun__) || defined(__gnu_linux__)
|
#include <unistd.h>
|
||||||
|
#if HAVE_VALUES_H
|
||||||
#include <values.h>
|
#include <values.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -91,6 +88,10 @@
|
|||||||
typedef long rlim_t;
|
typedef long rlim_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !HAVE_SIG_T
|
||||||
|
typedef void (*sig_t)(int);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !HAVE_STDBOOL_H
|
#if !HAVE_STDBOOL_H
|
||||||
/* kludge, but enough for mksh */
|
/* kludge, but enough for mksh */
|
||||||
typedef int bool;
|
typedef int bool;
|
||||||
@ -166,7 +167,7 @@ typedef int bool;
|
|||||||
|
|
||||||
/* OS-dependent additions */
|
/* OS-dependent additions */
|
||||||
|
|
||||||
#if !HAVE_SETMODE && !defined(MKSH_SMALL)
|
#if !HAVE_SETMODE
|
||||||
mode_t getmode(const void *, mode_t);
|
mode_t getmode(const void *, mode_t);
|
||||||
void *setmode(const char *);
|
void *setmode(const char *);
|
||||||
#endif
|
#endif
|
||||||
@ -182,7 +183,7 @@ size_t confstr(int, char *, size_t);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __INTERIX
|
#ifdef __INTERIX
|
||||||
#define makedev(x,y) mkdev((x),(y))
|
#define makedev mkdev
|
||||||
extern int __cdecl seteuid(uid_t);
|
extern int __cdecl seteuid(uid_t);
|
||||||
extern int __cdecl setegid(gid_t);
|
extern int __cdecl setegid(gid_t);
|
||||||
#endif
|
#endif
|
||||||
@ -373,10 +374,6 @@ struct temp {
|
|||||||
#define shl_out (&shf_iob[2])
|
#define shl_out (&shf_iob[2])
|
||||||
EXTERN int shl_stdout_ok;
|
EXTERN int shl_stdout_ok;
|
||||||
|
|
||||||
#if !HAVE_SIG_T
|
|
||||||
typedef void (*sig_t)(int);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* trap handlers
|
* trap handlers
|
||||||
*/
|
*/
|
||||||
@ -742,6 +739,7 @@ extern const struct builtin shbuiltins [], kshbuiltins [];
|
|||||||
#define V_OPTIND 4
|
#define V_OPTIND 4
|
||||||
#define V_RANDOM 8
|
#define V_RANDOM 8
|
||||||
#define V_HISTSIZE 9
|
#define V_HISTSIZE 9
|
||||||
|
/* this is defined when we support persistent history, undefined otherwise */
|
||||||
#if !defined(__sun__) && !defined(MKSH_SMALL)
|
#if !defined(__sun__) && !defined(MKSH_SMALL)
|
||||||
#define V_HISTFILE 10
|
#define V_HISTFILE 10
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user