• arc4random, arc4random_push: use our own protos to check
XXX u_int32_t is not ISO C99, but seems to work well enough XXX if it fails anywhere, we'll see in the build logs XXX apple doesn't have the standard uint32_t and API doesn't specify it • sys_siglist_defn: rename to sys_siglist_decl as we're really checking for the declaration in the headers; change wording to “check if … does not need to be declared” since we don't need to declare if we don't use • scan for arc4random, arc4random_push, confstr declarations too • sh.h: confstr declaration is no longer #ifdef __sun__; sort
This commit is contained in:
parent
2cf5695f69
commit
1a0b51b697
37
Build.sh
37
Build.sh
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# $MirOS: src/bin/mksh/Build.sh,v 1.178 2007/04/23 22:33:20 tg Exp $
|
||||
# $MirOS: src/bin/mksh/Build.sh,v 1.179 2007/04/24 10:42:02 tg Exp $
|
||||
#-
|
||||
# Environment used: CC CFLAGS CPP CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS
|
||||
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NEED_MKNOD MKSH_NOPWNAM
|
||||
@ -548,12 +548,16 @@ EOF
|
||||
# Environment: library functions
|
||||
#
|
||||
ac_test arc4random <<-'EOF'
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
extern u_int32_t arc4random(void);
|
||||
int main(void) { return (arc4random()); }
|
||||
EOF
|
||||
|
||||
ac_test arc4random_push arc4random 0 <<-'EOF'
|
||||
#include <stdlib.h>
|
||||
extern void arc4random_push(int);
|
||||
int main(void) { arc4random_push(1); return (0); }
|
||||
EOF
|
||||
|
||||
@ -620,7 +624,32 @@ EOF
|
||||
#
|
||||
# checks for function definitions in headers
|
||||
#
|
||||
ac_test sys_siglist_defn sys_siglist 1 'if sys_siglist[] is defined' <<-'EOF'
|
||||
ac_test arc4random_decl arc4random 1 'if arc4random() does not need to be declared' <<-'EOF'
|
||||
#if 0
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#define MKSH_INCLUDES_ONLY
|
||||
#include "sh.h"
|
||||
#endif
|
||||
int main(void) { return (arc4random()); }
|
||||
EOF
|
||||
ac_test arc4random_push_decl arc4random_push 1 'if arc4random_push() does not need to be declared' <<-'EOF'
|
||||
#define MKSH_INCLUDES_ONLY
|
||||
#include "sh.h"
|
||||
int main(void) { arc4random_push(1); return (0); }
|
||||
EOF
|
||||
ac_test confstr_decl '' 'if confstr() does not need to be declared' <<-'EOF'
|
||||
#define MKSH_INCLUDES_ONLY
|
||||
#include "sh.h"
|
||||
int main(int ac, char *av[]) {
|
||||
#if !defined(_PATH_DEFPATH) && defined(_CS_PATH)
|
||||
return (confstr(ac, *av, 0));
|
||||
#else
|
||||
return (ac + **av);
|
||||
#endif
|
||||
}
|
||||
EOF
|
||||
ac_test sys_siglist_decl sys_siglist 1 'if sys_siglist[] does not need to be declared' <<-'EOF'
|
||||
#define MKSH_INCLUDES_ONLY
|
||||
#include "sh.h"
|
||||
int main(void) { return (sys_siglist[0][0]); }
|
||||
|
14
Makefile
14
Makefile
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/Makefile,v 1.37 2007/04/23 20:37:16 tg Exp $
|
||||
# $MirOS: src/bin/mksh/Makefile,v 1.38 2007/04/24 10:42:02 tg Exp $
|
||||
#-
|
||||
# use CPPFLAGS=-DDEBUG __CRAZY=Yes to check for certain more stuff
|
||||
|
||||
@ -17,11 +17,13 @@ CPPFLAGS+= -DMKSH_ASSUME_UTF8 \
|
||||
-DHAVE_ULIMIT_H=0 -DHAVE_VALUES_H=0 -DHAVE_RLIM_T=1 \
|
||||
-DHAVE_SIG_T=1 -DHAVE_MKSH_SIGNAME=0 -DHAVE_SYS_SIGNAME=1 \
|
||||
-DHAVE__SYS_SIGNAME=0 -DHAVE_SYS_SIGLIST=1 -DHAVE_STRSIGNAL=0 \
|
||||
-DHAVE_ARC4RANDOM=1 -DHAVE_ARC4RANDOM_PUSH=1 -DHAVE_FLOCK_EX=1 \
|
||||
-DHAVE_SETLOCALE_CTYPE=0 -DHAVE_LANGINFO_CODESET=0 \
|
||||
-DHAVE_REVOKE=1 -DHAVE_SETMODE=1 -DHAVE_SETRESUGID=1 \
|
||||
-DHAVE_SETGROUPS=1 -DHAVE_STRCASESTR=1 -DHAVE_STRLCPY=1 \
|
||||
-DHAVE_SYS_SIGLIST_DEFN=1 -DHAVE_PERSISTENT_HISTORY=1 \
|
||||
-DHAVE_ARC4RANDOM=1 -DHAVE_ARC4RANDOM_PUSH=1 \
|
||||
-DHAVE_FLOCK_EX=1 -DHAVE_SETLOCALE_CTYPE=0 \
|
||||
-DHAVE_LANGINFO_CODESET=0 -DHAVE_REVOKE=1 -DHAVE_SETMODE=1 \
|
||||
-DHAVE_SETRESUGID=1 -DHAVE_SETGROUPS=1 -DHAVE_STRCASESTR=1 \
|
||||
-DHAVE_STRLCPY=1 -DHAVE_ARC4RANDOM_DECL=1 \
|
||||
-DHAVE_ARC4RANDOM_PUSH_DECL=1 -DHAVE_CONFSTR_DECL=1 \
|
||||
-DHAVE_SYS_SIGLIST_DECL=1 -DHAVE_PERSISTENT_HISTORY=1 \
|
||||
-DHAVE_MULTI_IDSTRING=1
|
||||
COPTS+= -std=gnu99 -Wall
|
||||
.endif
|
||||
|
26
sh.h
26
sh.h
@ -8,7 +8,7 @@
|
||||
/* $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.126 2007/04/23 20:37:16 tg Exp $"
|
||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.127 2007/04/24 10:42:02 tg Exp $"
|
||||
#define MKSH_VERSION "R29 2007/04/17"
|
||||
|
||||
#if HAVE_SYS_PARAM_H
|
||||
@ -182,21 +182,35 @@ typedef int bool;
|
||||
|
||||
#undef BAD /* AIX defines that somewhere */
|
||||
|
||||
/* OS-dependent additions */
|
||||
/* OS-dependent additions (functions, variables, by OS) */
|
||||
|
||||
#if !HAVE_ARC4RANDOM_DECL
|
||||
extern u_int32_t arc4random(void);
|
||||
#endif
|
||||
|
||||
#if !HAVE_ARC4RANDOM_PUSH_DECL
|
||||
extern void arc4random_push(int);
|
||||
#endif
|
||||
|
||||
#if !HAVE_CONFSTR_DECL
|
||||
size_t confstr(int, char *, size_t);
|
||||
#endif
|
||||
|
||||
#if !HAVE_SETMODE
|
||||
mode_t getmode(const void *, mode_t);
|
||||
void *setmode(const char *);
|
||||
#endif
|
||||
|
||||
#if !HAVE_STRCASESTR
|
||||
const char *stristr(const char *, const char *);
|
||||
#endif
|
||||
|
||||
#if !HAVE_STRLCPY
|
||||
size_t strlcpy(char *, const char *, size_t);
|
||||
#endif
|
||||
|
||||
#if defined(__sun__) && !defined(_PATH_DEFPATH) && defined(_CS_PATH)
|
||||
size_t confstr(int, char *, size_t);
|
||||
#if !HAVE_SYS_SIGLIST_DECL
|
||||
extern const char *const sys_siglist[];
|
||||
#endif
|
||||
|
||||
#ifdef __INTERIX
|
||||
@ -205,10 +219,6 @@ extern int __cdecl seteuid(uid_t);
|
||||
extern int __cdecl setegid(gid_t);
|
||||
#endif
|
||||
|
||||
#if !HAVE_SYS_SIGLIST_DEFN
|
||||
extern const char *const sys_siglist[];
|
||||
#endif
|
||||
|
||||
/* some useful #defines */
|
||||
#ifdef EXTERN
|
||||
# define I__(i) = i
|
||||
|
Loading…
Reference in New Issue
Block a user