Differences From
Artifact [669569b504]:
20 20 ./clean.sh
21 21 fi
22 22
23 23 # TODO: make it possible for user to change
24 24 # default set with environment vars
25 25 modules=(kcore kmem kstr kio kgraft kfile)
26 26
27 +# compose an arch tuple. this is used in
28 +# places, mostly to select the correct
29 +# version of assembly files for a given
30 +# platform (each has an arch tuple in its
31 +# name, following the linkage specifier)
27 32 target=$arch.$os
28 33 if test "$bits" != ""; then
29 34 target=$target.$bits
30 35 fi
31 36
37 +# determine whether we have unix or posix
38 +# APIs depending on the operating system.
39 +# presumably if the user is running a bash
40 +# script there is some degree of posix
41 +# support available, but we might still be
42 +# building for windows from within cygwin
43 +# or whatever
32 44 case $os in
33 45 lin|?bsd|and|dar|osx) posix=yes; unix=yes;;
34 46 hai) posix=yes; unix=no;;
35 47 *) posix=no; unix=no;;
36 48 esac
37 49
38 50 case $os.$bits in
................................................................................
78 90
79 91 check cc "your C compiler of choice"
80 92 check asm "an assembler that takes Intel syntax and nasm-style-macros"
81 93 check m4 "the path to your m4 installation"
82 94
83 95 export build=$(global/build-id.sh)
84 96
85 -case $os in
86 - lin) p_headers_syscall=${p_headers_syscall:-/usr/include/asm/unistd_${bits}.h}
87 - p_headers_errno=${p_headers_errno:-/usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h};;
97 +if test "$p_headers_syscall" = ""; then
98 + case $os in
99 + lin) headers_syscall_search=(
100 + /usr/include/asm/unistd_${bits}.h
101 + /usr/include/asm-generic/unistd.h
102 + /usr/include/*-linux-gnu/asm/unistd_${bits}.h
103 + );;
88 104
89 - fbsd) p_headers_syscall=${p_headers_syscall:-/usr/include/sys/syscall.h}
90 - p_headers_errno=${p_headers_errno:-/usr/include/errno.h};;
91 -esac
105 + fbsd) p_headers_syscall_search=(
106 + /usr/include/sys/syscall.h
107 + );;
108 + esac
109 +fi
110 +
111 +if test "$p_headers_errno" = ""; then
112 + case $os in
113 + lin) p_headers_errno="${p_headers_errno:-/usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h}";;
114 +
115 + fbsd) p_headers_errno="${p_headers_errno:-/usr/include/errno.h}";;
116 + esac
117 +fi
118 +
119 +for f in "${headers_syscall_search[@]}"; do
120 + test -e "$f" || continue
121 + p_headers_syscall="$f"
122 + say "using syscall headers at $f"
123 + break;
124 +done
92 125
93 126 check p_headers_syscall \
94 127 'the location of a header defining your syscall numbers'
95 128 check p_headers_errno \
96 129 'the location of a header defining the values of each errno symbol'
97 130
98 131 macro_compile_env="-Datom_target_arch=$arch -Datom_target_os=$os -Dtarget_posix=$posix -Dtarget_unix=$unix"