From ae241e28052e2e94d47251277ee7919b106e40c0 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Thu, 23 Oct 2025 12:56:48 -0400 Subject: [PATCH 01/30] get rid of stupid macos debug files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a93ac932..7cb893a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.d *.o +*.dSYM Makefile TAGS tags From dd5304b258637cf0435b66213860bdbaf338c532 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Thu, 23 Oct 2025 14:25:24 -0400 Subject: [PATCH 02/30] cross compiling --- .gitignore | 1 + Makefile.in | 2 +- configure | 153 +++++++++++++++++++++++++++++++----------------- darwin-signum.h | 23 ++++++++ linux-signum.h | 23 ++++++++ 5 files changed, 146 insertions(+), 56 deletions(-) create mode 100644 darwin-signum.h create mode 100644 linux-signum.h diff --git a/.gitignore b/.gitignore index 7cb893a7..4ba83230 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ cscope.out /yash /makesignum /signum.h +/cross-signum.h /configm.h /config.h /config.log diff --git a/Makefile.in b/Makefile.in index 012d6502..ce61b8db 100644 --- a/Makefile.in +++ b/Makefile.in @@ -79,7 +79,7 @@ makesignum: $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $@.c $(LDLIBS) sig.o: signum.h signum.h: makesignum - ./makesignum > $@ + ./makesignum > $@ 2> /dev/null || cp cross-signum.h signum.h variable.o yash.o: configm.h configm.h: Makefile -@printf 'creating %s...' '$@' diff --git a/configure b/configure index 43090518..b5d87743 100755 --- a/configure +++ b/configure @@ -288,7 +288,11 @@ trylink () { -o "${tempout}" "${tempo}" "$@" ${LDLIBS-${ldlibs}} } tryexec () { - checkby "${tempout}" + if [ -z "$cross_compiling" ]; then + checkby "${tempout}" + else + return 0 + fi } checked () { if [ $# -ge 1 ] @@ -341,57 +345,6 @@ cscope="${CSCOPE-cscope}" confighdefs='' - -# check OS type -checking 'operating system' -ostype=$(uname -s | tr "[:upper:]" "[:lower:]") -checked "${ostype}" -case "${ostype}" in - darwin) - defconfigh "_DARWIN_C_SOURCE" - ;; - sunos) - defconfigh "__EXTENSIONS__" - ;; -esac - - -# check POSIX conformance -checking 'POSIX conformance' -posixver=$(getconf _POSIX_VERSION 2>/dev/null) -if [ -n "${posixver}" ] && [ x"${posixver}" != x"undefined" ] -then - checked "${posixver}" -else - checked "no" - posixver="" -fi - -checking 'SUS conformance' -xopenver=$(getconf _XOPEN_VERSION 2>/dev/null) -if [ -n "${xopenver}" ] && [ x"${xopenver}" != x"undefined" ] -then - checked "${xopenver}" -else - checked "no" - xopenver="" -fi - -case "${ostype}" in - freebsd) - # FreeBSD doesn't have a feature test macro to enable non-POSIX - # extensions. We don't define _POSIX_C_SOURCE or _XOPEN_SOURCE so that - # non-POSIX extensions are available. - posix= - xopen= - ;; - *) - posix=${posixver} - xopen=${xopenver} - ;; -esac - - # define options for debugging if ${debug} then @@ -407,13 +360,13 @@ cat >"${tempsrc}" <&2 + printf 'Define the $OS environment variable and try again.\n' >&2 + fail + fi +else + ostype="$OS" +fi + +if [ -n "$cross_compiling" ]; then + if [ -f "$ostype-signum.h" ]; then + cp "$ostype-signum.h" cross-signum.h + else + printf 'Could not find a signum.h for your target operating system!\n' >&2 + printf "You'll need to generate one yourself by compiling and running makesignum.c on your target.\n" >&2 + fail + fi +fi + +checked "${ostype}" +case "${ostype}" in + darwin) + defconfigh "_DARWIN_C_SOURCE" + ;; + sunos) + defconfigh "__EXTENSIONS__" + ;; +esac + +# check POSIX conformance +checking 'POSIX conformance' +if [ -z "$cross_compiling" ]; then + posixver=$(getconf _POSIX_VERSION 2>/dev/null) + if [ -n "${posixver}" ] && [ x"${posixver}" != x"undefined" ] + then + checked "${posixver}" + else + checked "no" + posixver="" + fi +else + checked "guessing 200112" + posixver="200112" +fi + +checking 'SUS conformance' +if [ -z "$cross_compiling" ]; then + xopenver=$(getconf _XOPEN_VERSION 2>/dev/null) + if [ -n "${xopenver}" ] && [ x"${xopenver}" != x"undefined" ] + then + checked "${xopenver}" + else + checked "no" + xopenver="" + fi +else + checked "guessing 600" + xopenver="600" +fi + +case "${ostype}" in + freebsd) + # FreeBSD doesn't have a feature test macro to enable non-POSIX + # extensions. We don't define _POSIX_C_SOURCE or _XOPEN_SOURCE so that + # non-POSIX extensions are available. + posix= + xopen= + ;; + *) + posix=${posixver} + xopen=${xopenver} + ;; +esac + # check if the compiler accepts the -O2 option if we are not debugging if ! ${debug} && [ x"${CFLAGS+set}" != x"set" ] then diff --git a/darwin-signum.h b/darwin-signum.h new file mode 100644 index 00000000..d54289a6 --- /dev/null +++ b/darwin-signum.h @@ -0,0 +1,23 @@ +/* signum.h: generated by makesignum */ + +#ifndef SIGNUM_H +#define SIGNUM_H + +#include + +/* an injective function that returns an array index + * corresponding to the given signal number, + * which must be a valid non-realtime signal number + * or zero. */ +__attribute__((const)) +static inline size_t sigindex(int signum) { + return (size_t) signum; +} + +/* max index returned by sigindex + 1 */ +#define MAXSIGIDX 32 + +/* number of realtime signals that can be handled by yash */ +#define RTSIZE 0 + +#endif diff --git a/linux-signum.h b/linux-signum.h new file mode 100644 index 00000000..3661cc04 --- /dev/null +++ b/linux-signum.h @@ -0,0 +1,23 @@ +/* signum.h: generated by makesignum */ + +#ifndef SIGNUM_H +#define SIGNUM_H + +#include + +/* an injective function that returns an array index + * corresponding to the given signal number, + * which must be a valid non-realtime signal number + * or zero. */ +__attribute__((const)) +static inline size_t sigindex(int signum) { + return (size_t) signum; +} + +/* max index returned by sigindex + 1 */ +#define MAXSIGIDX 32 + +/* number of realtime signals that can be handled by yash */ +#define RTSIZE 40 + +#endif From bffbe9f756d282fbb4008c2e01a62081a00aee58 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Thu, 23 Oct 2025 15:41:43 -0400 Subject: [PATCH 03/30] support --host option --- configure | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/configure b/configure index b5d87743..c12e5b20 100755 --- a/configure +++ b/configure @@ -121,6 +121,8 @@ do nocreate="true" ;; -d|--debug) debug="true" ;; + --host=*) + host="${i#--host=}" ;; --prefix=*) prefix="${i#--prefix=}" ;; --exec-prefix=*) @@ -171,6 +173,7 @@ Usage: sh $0 [options...] Available options: --no-create do not create output files --debug configure for debug build (GCC or Clang required) + --host=HOST sets the prefix for build tools to HOST Installation options: --prefix=PREFIX install architecture-independent files in PREFIX @@ -312,13 +315,13 @@ fail () { exit 1 } - -cc="${CC-c99}" +[ -n "$host" ] && _host="$host-" +cc="${CC-${_host}c99}" +ar="${AR-${_host}ar}" cflags="${CFLAGS--O1 -g}" cppflags="${CPPFLAGS-${null}}" ldflags="${LDFLAGS-${null}}" ldlibs="${LDLIBS-${null}}" -ar="${AR-ar}" arflags="${ARFLAGS--rc}" xgettext="${XGETTEXT-xgettext}" xgettextflags="${XGETTEXTFLAGS--kgt -kNgt -kngt:1,2 \ @@ -364,21 +367,21 @@ if then checked "yes" elif - [ x"${cc}" = x"c99" ] && [ x"${CC+set}" != x"set" ] && ( - cc='gcc' + [ x"${cc}" = x"${_host}c99" ] && [ x"${CC+set}" != x"set" ] && ( + cc="${_host}gcc" trymake ) then - checked "yes (using gcc)" - cc='gcc' + cc="${_host}gcc" + checked "yes (using $cc)" elif - [ x"${cc}" = x"c99" ] && [ x"${CC+set}" != x"set" ] && ( - cc='clang' + [ x"${cc}" = x"${_host}c99" ] && [ x"${CC+set}" != x"set" ] && ( + cc="${_host}clang" trymake ) then - checked "yes (using clang)" - cc='clang' + cc="${_host}clang" + checked "yes (using $cc)" else checked "no" printf 'Compiler "%s" not found or not working.\n' "${CC-${cc}}" >&2 From a3d33fcb40b8e333a25d32e83561bef81cf5a046 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Thu, 23 Oct 2025 16:26:48 -0400 Subject: [PATCH 04/30] make getcwd(NULL,0) check default to false, and provide variable to control result --- configure | 24 ++++++++++++++---------- path.c | 8 ++++---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/configure b/configure index c12e5b20..d29ef821 100755 --- a/configure +++ b/configure @@ -1458,9 +1458,10 @@ then defconfigh "HAVE_PATHS_H" fi -# check if getcwd accepts (NULL,0) as argument -checking "if getcwd(NULL,0) returns malloc'ed string" -cat >"${tempsrc}" <"${tempsrc}" < #include @@ -1485,19 +1486,22 @@ char *xgetcwd(void) { } int main(void) { char *wd1 = getcwd(NULL, 0); - if (!wd1) return 1; + if (!wd1) return 0; char *wd2 = xgetcwd(); - if (!wd2 || strcmp(wd1, wd2) != 0) return 1; + if (!wd2 || strcmp(wd1, wd2) != 0) return 0; char *wd11 = realloc(wd1, strlen(wd1) + 10); - if (!wd11 || strcmp(wd11, wd2) != 0) return 1; - free(wd11); free(wd2); return 0; + if (!wd11 || strcmp(wd11, wd2) != 0) return 0; + free(wd11); free(wd2); return 1; } END -trymake && tryexec -checked + trymake && tryexec + checked +else + checked "$YASH_GETCWD_NO_AUTO_MALLOC" +fi if [ x"${checkresult}" = x"yes" ] then - defconfigh "GETCWD_AUTO_MALLOC" + defconfigh "GETCWD_NO_AUTO_MALLOC" fi # check if ioctl supports TIOCGWINSZ diff --git a/path.c b/path.c index 57e935d9..17894d9f 100644 --- a/path.c +++ b/path.c @@ -229,10 +229,7 @@ bool is_normalized_path(const wchar_t *path) * On error, `errno' is set and NULL is returned. */ char *xgetcwd(void) { -#if GETCWD_AUTO_MALLOC - char *pwd = getcwd(NULL, 0); - return (pwd != NULL) ? xrealloc(pwd, add(strlen(pwd), 1)) : NULL; -#else +#if GETCWD_NO_AUTO_MALLOC size_t pwdlen = 40; char *pwd = xmalloc(pwdlen); while (getcwd(pwd, pwdlen) == NULL) { @@ -248,6 +245,9 @@ char *xgetcwd(void) } } return pwd; +#else + char *pwd = getcwd(NULL, 0); + return (pwd != NULL) ? xrealloc(pwd, add(strlen(pwd), 1)) : NULL; #endif } From 491d9f4e958e1d0542eab3d01fccce773120f572 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Thu, 23 Oct 2025 16:50:31 -0400 Subject: [PATCH 05/30] add freebsd signum --- freebsd-signum.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 freebsd-signum.h diff --git a/freebsd-signum.h b/freebsd-signum.h new file mode 100644 index 00000000..7e2d18e5 --- /dev/null +++ b/freebsd-signum.h @@ -0,0 +1,23 @@ +/* signum.h: generated by makesignum */ + +#ifndef SIGNUM_H +#define SIGNUM_H + +#include + +/* an injective function that returns an array index + * corresponding to the given signal number, + * which must be a valid non-realtime signal number + * or zero. */ +__attribute__((const)) +static inline size_t sigindex(int signum) { + return (size_t) signum; +} + +/* max index returned by sigindex + 1 */ +#define MAXSIGIDX 33 + +/* number of realtime signals that can be handled by yash */ +#define RTSIZE 71 + +#endif From 3cd3ceb7d53d8839fd3f96d3ee0f116ed4128502 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Thu, 23 Oct 2025 17:04:45 -0400 Subject: [PATCH 06/30] add openbsd signum --- openbsd-signum.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 openbsd-signum.h diff --git a/openbsd-signum.h b/openbsd-signum.h new file mode 100644 index 00000000..d54289a6 --- /dev/null +++ b/openbsd-signum.h @@ -0,0 +1,23 @@ +/* signum.h: generated by makesignum */ + +#ifndef SIGNUM_H +#define SIGNUM_H + +#include + +/* an injective function that returns an array index + * corresponding to the given signal number, + * which must be a valid non-realtime signal number + * or zero. */ +__attribute__((const)) +static inline size_t sigindex(int signum) { + return (size_t) signum; +} + +/* max index returned by sigindex + 1 */ +#define MAXSIGIDX 32 + +/* number of realtime signals that can be handled by yash */ +#define RTSIZE 0 + +#endif From 87f850797afd84026e359b93929c53d9a04300f5 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sun, 26 Oct 2025 13:54:29 -0400 Subject: [PATCH 07/30] add --build stub option for autoconf compatability --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index d29ef821..fb8555a3 100755 --- a/configure +++ b/configure @@ -123,6 +123,8 @@ do debug="true" ;; --host=*) host="${i#--host=}" ;; + --build=*) # included for autoconf compatibility, does nothing + ;; --prefix=*) prefix="${i#--prefix=}" ;; --exec-prefix=*) From fcbff8ba6bbbcd0cc6570541ae82554624723d44 Mon Sep 17 00:00:00 2001 From: Darin Morrison Date: Fri, 31 Oct 2025 12:58:07 -0600 Subject: [PATCH 08/30] determine target OS from --host --- configure | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/configure b/configure index fb8555a3..f9a13f6f 100755 --- a/configure +++ b/configure @@ -405,19 +405,22 @@ fi # check OS type checking 'operating system' -if [ -z "$OS" ]; then - if [ -z "$cross_compiling" ]; then - ostype=$(uname -s | tr "[:upper:]" "[:lower:]") - else +if [ -n "$OS" ]; then + ostype="$OS" +elif [ -n "$cross_compiling" ]; then + for signum in $(find . -maxdepth 1 -name '*-signum.h' | sed 's/\.\/\(.*\)-signum\.h/\1/') + do + if echo "$host" | grep -E "$signum" >/dev/null + then + ostype="$signum" + break; + fi + done + if [ -z "$ostype" ]; then printf 'Could not determine the target operating system!\n' >&2 printf 'Define the $OS environment variable and try again.\n' >&2 fail - fi -else - ostype="$OS" -fi - -if [ -n "$cross_compiling" ]; then + fi if [ -f "$ostype-signum.h" ]; then cp "$ostype-signum.h" cross-signum.h else @@ -425,6 +428,8 @@ if [ -n "$cross_compiling" ]; then printf "You'll need to generate one yourself by compiling and running makesignum.c on your target.\n" >&2 fail fi +else + ostype=$(uname -s | tr "[:upper:]" "[:lower:]") fi checked "${ostype}" From 86121d3a4c4d7f2c3e680b89e5091962faf2ec39 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sat, 1 Nov 2025 10:07:53 -0400 Subject: [PATCH 09/30] make $cross_compiling true/false --- configure | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/configure b/configure index fb8555a3..830024b4 100755 --- a/configure +++ b/configure @@ -293,10 +293,10 @@ trylink () { -o "${tempout}" "${tempo}" "$@" ${LDLIBS-${ldlibs}} } tryexec () { - if [ -z "$cross_compiling" ]; then - checkby "${tempout}" - else + if ${cross_compiling}; then return 0 + else + checkby "${tempout}" fi } checked () { @@ -398,26 +398,27 @@ if tryexec then checked "no" + cross_compiling=false else checked "yes" - cross_compiling=1 + cross_compiling=true fi # check OS type checking 'operating system' if [ -z "$OS" ]; then - if [ -z "$cross_compiling" ]; then - ostype=$(uname -s | tr "[:upper:]" "[:lower:]") - else + if ${cross_compiling}; then printf 'Could not determine the target operating system!\n' >&2 printf 'Define the $OS environment variable and try again.\n' >&2 fail + else + ostype=$(uname -s | tr "[:upper:]" "[:lower:]") fi else ostype="$OS" fi -if [ -n "$cross_compiling" ]; then +if ${cross_compiling}; then if [ -f "$ostype-signum.h" ]; then cp "$ostype-signum.h" cross-signum.h else @@ -439,7 +440,10 @@ esac # check POSIX conformance checking 'POSIX conformance' -if [ -z "$cross_compiling" ]; then +if ${cross_compiling}; then + checked "guessing 200112" + posixver="200112" +else posixver=$(getconf _POSIX_VERSION 2>/dev/null) if [ -n "${posixver}" ] && [ x"${posixver}" != x"undefined" ] then @@ -448,13 +452,13 @@ if [ -z "$cross_compiling" ]; then checked "no" posixver="" fi -else - checked "guessing 200112" - posixver="200112" fi checking 'SUS conformance' -if [ -z "$cross_compiling" ]; then +if ${cross_compiling}; then + checked "guessing 600" + xopenver="600" +else xopenver=$(getconf _XOPEN_VERSION 2>/dev/null) if [ -n "${xopenver}" ] && [ x"${xopenver}" != x"undefined" ] then @@ -463,9 +467,6 @@ if [ -z "$cross_compiling" ]; then checked "no" xopenver="" fi -else - checked "guessing 600" - xopenver="600" fi case "${ostype}" in From 1623f99cd5123a22b884c9cf81b51cc9f10c9866 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sat, 1 Nov 2025 10:21:55 -0400 Subject: [PATCH 10/30] change back some stuff with the getcwd check --- configure | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/configure b/configure index 830024b4..2cb7e43a 100755 --- a/configure +++ b/configure @@ -294,6 +294,7 @@ trylink () { } tryexec () { if ${cross_compiling}; then + checkresult="yes" return 0 else checkby "${tempout}" @@ -1461,9 +1462,9 @@ then defconfigh "HAVE_PATHS_H" fi -# check if getcwd doesn't accept (NULL,0) as argument -checking "if getcwd(NULL,0) doesn't return malloc'ed string" -if [ -z "$YASH_GETCWD_NO_AUTO_MALLOC" ]; then +# check if getcwd accepts (NULL,0) as argument +checking "if getcwd(NULL,0) returns malloc'ed string" +if [ -z "$YASH_GETCWD_AUTO_MALLOC" ]; then cat >"${tempsrc}" < @@ -1489,22 +1490,26 @@ char *xgetcwd(void) { } int main(void) { char *wd1 = getcwd(NULL, 0); - if (!wd1) return 0; + if (!wd1) return 1; char *wd2 = xgetcwd(); - if (!wd2 || strcmp(wd1, wd2) != 0) return 0; + if (!wd2 || strcmp(wd1, wd2) != 0) return 1; char *wd11 = realloc(wd1, strlen(wd1) + 10); - if (!wd11 || strcmp(wd11, wd2) != 0) return 0; - free(wd11); free(wd2); return 1; + if (!wd11 || strcmp(wd11, wd2) != 0) return 1; + free(wd11); free(wd2); return 0; } END - trymake && tryexec + if ${cross_compiling}; then + checkresult="no" + else + trymake && tryexec + fi checked else - checked "$YASH_GETCWD_NO_AUTO_MALLOC" + checked "$YASH_GETCWD_AUTO_MALLOC" fi if [ x"${checkresult}" = x"yes" ] then - defconfigh "GETCWD_NO_AUTO_MALLOC" + defconfigh "GETCWD_AUTO_MALLOC" fi # check if ioctl supports TIOCGWINSZ From b679f449661a890164245969ea5137a8ac761d92 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sat, 1 Nov 2025 10:49:02 -0400 Subject: [PATCH 11/30] nit --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 2cb7e43a..7bf0d215 100755 --- a/configure +++ b/configure @@ -1499,11 +1499,12 @@ int main(void) { } END if ${cross_compiling}; then + checked "assuming no" checkresult="no" else trymake && tryexec + checked fi - checked else checked "$YASH_GETCWD_AUTO_MALLOC" fi From 264c42e46ed8cca239ccffbeaada8c08310b4510 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sat, 8 Nov 2025 08:42:37 -0500 Subject: [PATCH 12/30] fix --- path.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/path.c b/path.c index 17894d9f..57e935d9 100644 --- a/path.c +++ b/path.c @@ -229,7 +229,10 @@ bool is_normalized_path(const wchar_t *path) * On error, `errno' is set and NULL is returned. */ char *xgetcwd(void) { -#if GETCWD_NO_AUTO_MALLOC +#if GETCWD_AUTO_MALLOC + char *pwd = getcwd(NULL, 0); + return (pwd != NULL) ? xrealloc(pwd, add(strlen(pwd), 1)) : NULL; +#else size_t pwdlen = 40; char *pwd = xmalloc(pwdlen); while (getcwd(pwd, pwdlen) == NULL) { @@ -245,9 +248,6 @@ char *xgetcwd(void) } } return pwd; -#else - char *pwd = getcwd(NULL, 0); - return (pwd != NULL) ? xrealloc(pwd, add(strlen(pwd), 1)) : NULL; #endif } From 4c9356b73255c8228e20a4b19d5fa84025556113 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sat, 8 Nov 2025 08:43:37 -0500 Subject: [PATCH 13/30] update env vars in --help --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 7bf0d215..7c27ed73 100755 --- a/configure +++ b/configure @@ -216,7 +216,8 @@ Influential environment variables: MSGMERGEFLAGS, MSGINIT, MSGCONV, MSGFILTER, ASCIIDOC, ASCIIDOCFLAGS, ASCIIDOCATTRS, A2X, A2XFLAGS, INSTALL, INSTALL_PROGRAM, INSTALL_DATA, INSTALL_DIR, - CTAGS, CTAGSARGS, ETAGS, ETAGSARGS, CSCOPE, CSCOPEARGS + CTAGS, CTAGSARGS, ETAGS, ETAGSARGS, CSCOPE, CSCOPEARGS, + YASH_GETCWD_AUTO_MALLOC END exit fi From 363a66335ca3711f923a9ddcb215537cfb56bd19 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sat, 8 Nov 2025 08:45:31 -0500 Subject: [PATCH 14/30] update line --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 7c27ed73..faa3d730 100755 --- a/configure +++ b/configure @@ -153,7 +153,7 @@ do term_lib="${i#--with-term-lib=}" ;; ?*=*) # parse variable assignment - if echo "$i" | grep -E "^[[:alpha:]][[:alnum:]]*=" >/dev/null + if printf '%s\n' "$i" | grep -Eq "^[[:alpha:]][[:alnum:]_]*=" then export "$i" else From 33894ca2a595fd593667393fd1b4280ced8f8c6c Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sat, 8 Nov 2025 15:35:05 -0500 Subject: [PATCH 15/30] style nits --- configure | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index e6f94b63..f5a5793e 100755 --- a/configure +++ b/configure @@ -411,9 +411,9 @@ checking 'operating system' if [ -n "$OS" ]; then ostype="$OS" elif [ -n "$cross_compiling" ]; then - for signum in $(find . -maxdepth 1 -name '*-signum.h' | sed 's/\.\/\(.*\)-signum\.h/\1/') + for signum in $(find . -maxdepth 1 -name '*-signum.h' | sed 's/\.\/\(.*\)-signum\.h/\1/') do - if echo "$host" | grep -E "$signum" >/dev/null + if echo "$host" | grep -Eq "$signum" then ostype="$signum" break; @@ -423,7 +423,7 @@ elif [ -n "$cross_compiling" ]; then printf 'Could not determine the target operating system!\n' >&2 printf 'Define the $OS environment variable and try again.\n' >&2 fail - fi + fi if [ -f "$ostype-signum.h" ]; then cp "$ostype-signum.h" cross-signum.h else From 6c28a8cea90aac39e55b4405909e928f73293f14 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sun, 9 Nov 2025 13:04:38 -0500 Subject: [PATCH 16/30] Update configure Co-authored-by: WATANABE Yuki --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index f5a5793e..5948356e 100755 --- a/configure +++ b/configure @@ -411,8 +411,9 @@ checking 'operating system' if [ -n "$OS" ]; then ostype="$OS" elif [ -n "$cross_compiling" ]; then - for signum in $(find . -maxdepth 1 -name '*-signum.h' | sed 's/\.\/\(.*\)-signum\.h/\1/') + for signum in *-signum.h do + signum="${signum%-signum.h}" if echo "$host" | grep -Eq "$signum" then ostype="$signum" From aa5dad97c85be3da4e0e4b2c6821acf147ae0ef0 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sun, 9 Nov 2025 13:04:47 -0500 Subject: [PATCH 17/30] Update configure Co-authored-by: WATANABE Yuki --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 5948356e..0b81edb5 100755 --- a/configure +++ b/configure @@ -410,7 +410,7 @@ fi checking 'operating system' if [ -n "$OS" ]; then ostype="$OS" -elif [ -n "$cross_compiling" ]; then +elif $cross_compiling; then for signum in *-signum.h do signum="${signum%-signum.h}" From a84326dbbe526886fbc39439244f224bfaacf98b Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sun, 9 Nov 2025 13:05:06 -0500 Subject: [PATCH 18/30] Update configure Co-authored-by: WATANABE Yuki --- configure | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 0b81edb5..ca11c08f 100755 --- a/configure +++ b/configure @@ -414,11 +414,11 @@ elif $cross_compiling; then for signum in *-signum.h do signum="${signum%-signum.h}" - if echo "$host" | grep -Eq "$signum" - then - ostype="$signum" - break; - fi + case "$host" in + *"$signum"*) + ostype="$signum" + break + esac done if [ -z "$ostype" ]; then printf 'Could not determine the target operating system!\n' >&2 From 5fcbb89a89e0449dc8374b80c1fa79168ed3d267 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sun, 9 Nov 2025 13:29:58 -0500 Subject: [PATCH 19/30] fix case where $OS was defined when cross compiling, signum wouldn't be copied --- configure | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/configure b/configure index ca11c08f..5e4eb850 100755 --- a/configure +++ b/configure @@ -425,6 +425,11 @@ elif $cross_compiling; then printf 'Define the $OS environment variable and try again.\n' >&2 fail fi +else + ostype=$(uname -s | tr "[:upper:]" "[:lower:]") +fi + +if $cross_compiling; then if [ -f "$ostype-signum.h" ]; then cp "$ostype-signum.h" cross-signum.h else @@ -432,8 +437,6 @@ elif $cross_compiling; then printf "You'll need to generate one yourself by compiling and running makesignum.c on your target.\n" >&2 fail fi -else - ostype=$(uname -s | tr "[:upper:]" "[:lower:]") fi checked "${ostype}" From 671b7c004b33a905c1fdd5bbe992ba467fd4fbad Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 12 Nov 2025 03:17:25 -0500 Subject: [PATCH 20/30] improve error messages --- configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure b/configure index b5474352..e4c7cc1c 100755 --- a/configure +++ b/configure @@ -425,7 +425,9 @@ elif $cross_compiling; then done if [ -z "$ostype" ]; then printf 'Could not determine the target operating system!\n' >&2 - printf 'Define the $OS environment variable and try again.\n' >&2 + printf 'Your target OS might not have a premade signum.h.\n' >&2 + printf "If this is the case you'll need to generate one yourself by compiling and running makesignum.c on your target." >&2 + printf "If this is not the case you'll need to define the \$OS environment variable and re-run configure.\n" >&2 fail fi else @@ -438,6 +440,7 @@ if $cross_compiling; then else printf 'Could not find a signum.h for your target operating system!\n' >&2 printf "You'll need to generate one yourself by compiling and running makesignum.c on your target.\n" >&2 + printf 'Place your signum.h in the root of the source directory with the name %s.\n' "$ostype-signum.h" >&2 fail fi fi From 768b695e0fcb6f48a6159da80009f523fc86dd88 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 12 Nov 2025 03:19:53 -0500 Subject: [PATCH 21/30] better wording --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index e4c7cc1c..92885047 100755 --- a/configure +++ b/configure @@ -440,7 +440,7 @@ if $cross_compiling; then else printf 'Could not find a signum.h for your target operating system!\n' >&2 printf "You'll need to generate one yourself by compiling and running makesignum.c on your target.\n" >&2 - printf 'Place your signum.h in the root of the source directory with the name %s.\n' "$ostype-signum.h" >&2 + printf 'Rename your signum.h to %s and place it in the root of the source directory.\n' "'$ostype-signum.h'" >&2 fail fi fi From 7da82a64d9c3e6032ff02665d342418621a2f485 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Thu, 13 Nov 2025 14:23:37 -0500 Subject: [PATCH 22/30] make linux signums arch dependent --- configure | 48 +++++++++++++------ darwin-signum.h => cross/darwin-signum.h | 0 freebsd-signum.h => cross/freebsd-signum.h | 0 cross/linux-aarch64-signum.h | 1 + cross/linux-arm-signum.h | 1 + cross/linux-arm64-signum.h | 1 + cross/linux-i386-signum.h | 23 +++++++++ cross/linux-i486-signum.h | 1 + cross/linux-i586-signum.h | 1 + cross/linux-i686-signum.h | 1 + cross/linux-loongarch64-signum.h | 1 + cross/linux-mips-signum.h | 23 +++++++++ cross/linux-mips64-signum.h | 1 + cross/linux-mips64el-signum.h | 1 + cross/linux-mipsel-signum.h | 1 + cross/linux-powerpc-signum.h | 1 + cross/linux-powerpc64-signum.h | 1 + cross/linux-powerpc64le-signum.h | 1 + cross/linux-powerpcle-signum.h | 1 + cross/linux-ppc-signum.h | 1 + cross/linux-ppc64-signum.h | 1 + cross/linux-ppc64le-signum.h | 1 + cross/linux-ppcle-signum.h | 1 + cross/linux-riscv32-signum.h | 1 + cross/linux-riscv64-signum.h | 1 + linux-signum.h => cross/linux-x86_64-signum.h | 0 openbsd-signum.h => cross/openbsd-signum.h | 0 27 files changed, 99 insertions(+), 15 deletions(-) rename darwin-signum.h => cross/darwin-signum.h (100%) rename freebsd-signum.h => cross/freebsd-signum.h (100%) create mode 120000 cross/linux-aarch64-signum.h create mode 120000 cross/linux-arm-signum.h create mode 120000 cross/linux-arm64-signum.h create mode 100644 cross/linux-i386-signum.h create mode 120000 cross/linux-i486-signum.h create mode 120000 cross/linux-i586-signum.h create mode 120000 cross/linux-i686-signum.h create mode 120000 cross/linux-loongarch64-signum.h create mode 100644 cross/linux-mips-signum.h create mode 120000 cross/linux-mips64-signum.h create mode 120000 cross/linux-mips64el-signum.h create mode 120000 cross/linux-mipsel-signum.h create mode 120000 cross/linux-powerpc-signum.h create mode 120000 cross/linux-powerpc64-signum.h create mode 120000 cross/linux-powerpc64le-signum.h create mode 120000 cross/linux-powerpcle-signum.h create mode 120000 cross/linux-ppc-signum.h create mode 120000 cross/linux-ppc64-signum.h create mode 120000 cross/linux-ppc64le-signum.h create mode 120000 cross/linux-ppcle-signum.h create mode 120000 cross/linux-riscv32-signum.h create mode 120000 cross/linux-riscv64-signum.h rename linux-signum.h => cross/linux-x86_64-signum.h (100%) rename openbsd-signum.h => cross/openbsd-signum.h (100%) diff --git a/configure b/configure index 92885047..a88097ea 100755 --- a/configure +++ b/configure @@ -220,7 +220,7 @@ Influential environment variables: ASCIIDOC, ASCIIDOCFLAGS, ASCIIDOCATTRS, A2X, A2XFLAGS, INSTALL, INSTALL_PROGRAM, INSTALL_DATA, INSTALL_DIR, CTAGS, CTAGSARGS, ETAGS, ETAGSARGS, CSCOPE, CSCOPEARGS, - YASH_GETCWD_AUTO_MALLOC + YASH_GETCWD_AUTO_MALLOC, OS, ARCH END exit fi @@ -414,19 +414,22 @@ checking 'operating system' if [ -n "$OS" ]; then ostype="$OS" elif $cross_compiling; then - for signum in *-signum.h - do - signum="${signum%-signum.h}" - case "$host" in - *"$signum"*) - ostype="$signum" - break - esac - done + if [ -n "$host" ]; then + for signum in *-signum.h + do + signum="${signum%-signum.h}" + case "$host" in + *"$signum"*) + ostype="$signum" + break + esac + done + fi if [ -z "$ostype" ]; then printf 'Could not determine the target operating system!\n' >&2 - printf 'Your target OS might not have a premade signum.h.\n' >&2 + printf 'Your target might not have a premade signum.h.\n' >&2 printf "If this is the case you'll need to generate one yourself by compiling and running makesignum.c on your target." >&2 + printf "Rename your signum.h to '-signum.h' and place it in the root of the source directory.\n" >&2 printf "If this is not the case you'll need to define the \$OS environment variable and re-run configure.\n" >&2 fail fi @@ -435,12 +438,27 @@ else fi if $cross_compiling; then - if [ -f "$ostype-signum.h" ]; then - cp "$ostype-signum.h" cross-signum.h + if [ "$ostype" = "linux" ]; then + if [ -n "$ARCH" ]; then + arch="$ARCH" + elif [ -n "$host" ]; then + arch="${host%%-*}" + else + printf 'Could not determine the target architecture!\n' >&2 + printf 'You must either use the --host option to configure or define the $ARCH environment variable.\n' >&2 + fail + fi + cross_signum="$ostype-$arch-signum.h" + else + cross_signum="$ostype-signum.h" + fi + + if [ -f "cross/$cross_signum" ]; then + cp "cross/$cross_signum" cross-signum.h else - printf 'Could not find a signum.h for your target operating system!\n' >&2 + printf 'Could not find a signum.h for your target!\n' >&2 printf "You'll need to generate one yourself by compiling and running makesignum.c on your target.\n" >&2 - printf 'Rename your signum.h to %s and place it in the root of the source directory.\n' "'$ostype-signum.h'" >&2 + printf "Rename your signum.h to %s and place it in the 'cross' directory.\n" "'$cross_signum'" >&2 fail fi fi diff --git a/darwin-signum.h b/cross/darwin-signum.h similarity index 100% rename from darwin-signum.h rename to cross/darwin-signum.h diff --git a/freebsd-signum.h b/cross/freebsd-signum.h similarity index 100% rename from freebsd-signum.h rename to cross/freebsd-signum.h diff --git a/cross/linux-aarch64-signum.h b/cross/linux-aarch64-signum.h new file mode 120000 index 00000000..47e37967 --- /dev/null +++ b/cross/linux-aarch64-signum.h @@ -0,0 +1 @@ +linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-arm-signum.h b/cross/linux-arm-signum.h new file mode 120000 index 00000000..47e37967 --- /dev/null +++ b/cross/linux-arm-signum.h @@ -0,0 +1 @@ +linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-arm64-signum.h b/cross/linux-arm64-signum.h new file mode 120000 index 00000000..d125bcaf --- /dev/null +++ b/cross/linux-arm64-signum.h @@ -0,0 +1 @@ +linux-aarch64-signum.h \ No newline at end of file diff --git a/cross/linux-i386-signum.h b/cross/linux-i386-signum.h new file mode 100644 index 00000000..8fba4514 --- /dev/null +++ b/cross/linux-i386-signum.h @@ -0,0 +1,23 @@ +/* signum.h: generated by makesignum */ + +#ifndef SIGNUM_H +#define SIGNUM_H + +#include + +/* an injective function that returns an array index + * corresponding to the given signal number, + * which must be a valid non-realtime signal number + * or zero. */ +__attribute__((const)) +static inline size_t sigindex(int signum) { + return (size_t) signum; +} + +/* max index returned by sigindex + 1 */ +#define MAXSIGIDX 32 + +/* number of realtime signals that can be handled by yash */ +#define RTSIZE 39 + +#endif diff --git a/cross/linux-i486-signum.h b/cross/linux-i486-signum.h new file mode 120000 index 00000000..47e37967 --- /dev/null +++ b/cross/linux-i486-signum.h @@ -0,0 +1 @@ +linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-i586-signum.h b/cross/linux-i586-signum.h new file mode 120000 index 00000000..c49ca2ba --- /dev/null +++ b/cross/linux-i586-signum.h @@ -0,0 +1 @@ +linux-i486-signum.h \ No newline at end of file diff --git a/cross/linux-i686-signum.h b/cross/linux-i686-signum.h new file mode 120000 index 00000000..f6d61573 --- /dev/null +++ b/cross/linux-i686-signum.h @@ -0,0 +1 @@ +linux-i586-signum.h \ No newline at end of file diff --git a/cross/linux-loongarch64-signum.h b/cross/linux-loongarch64-signum.h new file mode 120000 index 00000000..47e37967 --- /dev/null +++ b/cross/linux-loongarch64-signum.h @@ -0,0 +1 @@ +linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-mips-signum.h b/cross/linux-mips-signum.h new file mode 100644 index 00000000..7e9f39cf --- /dev/null +++ b/cross/linux-mips-signum.h @@ -0,0 +1,23 @@ +/* signum.h: generated by makesignum */ + +#ifndef SIGNUM_H +#define SIGNUM_H + +#include + +/* an injective function that returns an array index + * corresponding to the given signal number, + * which must be a valid non-realtime signal number + * or zero. */ +__attribute__((const)) +static inline size_t sigindex(int signum) { + return (size_t) signum; +} + +/* max index returned by sigindex + 1 */ +#define MAXSIGIDX 32 + +/* number of realtime signals that can be handled by yash */ +#define RTSIZE 102 + +#endif diff --git a/cross/linux-mips64-signum.h b/cross/linux-mips64-signum.h new file mode 120000 index 00000000..17ca2d47 --- /dev/null +++ b/cross/linux-mips64-signum.h @@ -0,0 +1 @@ +linux-mips-signum.h \ No newline at end of file diff --git a/cross/linux-mips64el-signum.h b/cross/linux-mips64el-signum.h new file mode 120000 index 00000000..b9e95d19 --- /dev/null +++ b/cross/linux-mips64el-signum.h @@ -0,0 +1 @@ +linux-mips64-signum.h \ No newline at end of file diff --git a/cross/linux-mipsel-signum.h b/cross/linux-mipsel-signum.h new file mode 120000 index 00000000..17ca2d47 --- /dev/null +++ b/cross/linux-mipsel-signum.h @@ -0,0 +1 @@ +linux-mips-signum.h \ No newline at end of file diff --git a/cross/linux-powerpc-signum.h b/cross/linux-powerpc-signum.h new file mode 120000 index 00000000..47e37967 --- /dev/null +++ b/cross/linux-powerpc-signum.h @@ -0,0 +1 @@ +linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-powerpc64-signum.h b/cross/linux-powerpc64-signum.h new file mode 120000 index 00000000..47e37967 --- /dev/null +++ b/cross/linux-powerpc64-signum.h @@ -0,0 +1 @@ +linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-powerpc64le-signum.h b/cross/linux-powerpc64le-signum.h new file mode 120000 index 00000000..47e37967 --- /dev/null +++ b/cross/linux-powerpc64le-signum.h @@ -0,0 +1 @@ +linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-powerpcle-signum.h b/cross/linux-powerpcle-signum.h new file mode 120000 index 00000000..47e37967 --- /dev/null +++ b/cross/linux-powerpcle-signum.h @@ -0,0 +1 @@ +linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-ppc-signum.h b/cross/linux-ppc-signum.h new file mode 120000 index 00000000..e272ea53 --- /dev/null +++ b/cross/linux-ppc-signum.h @@ -0,0 +1 @@ +linux-powerpc-signum.h \ No newline at end of file diff --git a/cross/linux-ppc64-signum.h b/cross/linux-ppc64-signum.h new file mode 120000 index 00000000..89ef821b --- /dev/null +++ b/cross/linux-ppc64-signum.h @@ -0,0 +1 @@ +linux-powerpc64-signum.h \ No newline at end of file diff --git a/cross/linux-ppc64le-signum.h b/cross/linux-ppc64le-signum.h new file mode 120000 index 00000000..f378152d --- /dev/null +++ b/cross/linux-ppc64le-signum.h @@ -0,0 +1 @@ +linux-powerpc64le-signum.h \ No newline at end of file diff --git a/cross/linux-ppcle-signum.h b/cross/linux-ppcle-signum.h new file mode 120000 index 00000000..d0e634b3 --- /dev/null +++ b/cross/linux-ppcle-signum.h @@ -0,0 +1 @@ +linux-powerpcle-signum.h \ No newline at end of file diff --git a/cross/linux-riscv32-signum.h b/cross/linux-riscv32-signum.h new file mode 120000 index 00000000..a1092eb5 --- /dev/null +++ b/cross/linux-riscv32-signum.h @@ -0,0 +1 @@ +linux-riscv64-signum.h \ No newline at end of file diff --git a/cross/linux-riscv64-signum.h b/cross/linux-riscv64-signum.h new file mode 120000 index 00000000..47e37967 --- /dev/null +++ b/cross/linux-riscv64-signum.h @@ -0,0 +1 @@ +linux-i386-signum.h \ No newline at end of file diff --git a/linux-signum.h b/cross/linux-x86_64-signum.h similarity index 100% rename from linux-signum.h rename to cross/linux-x86_64-signum.h diff --git a/openbsd-signum.h b/cross/openbsd-signum.h similarity index 100% rename from openbsd-signum.h rename to cross/openbsd-signum.h From 46e35ab0a4c8a77ace53c9e0cf568aba1e425ddf Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sat, 15 Nov 2025 01:25:23 -0500 Subject: [PATCH 23/30] remove changes to signum stuff --- .gitignore | 1 - Makefile.in | 2 +- configure | 55 +++++++++++--------------------- cross/darwin-signum.h | 23 ------------- cross/freebsd-signum.h | 23 ------------- cross/linux-aarch64-signum.h | 1 - cross/linux-arm-signum.h | 1 - cross/linux-arm64-signum.h | 1 - cross/linux-i386-signum.h | 23 ------------- cross/linux-i486-signum.h | 1 - cross/linux-i586-signum.h | 1 - cross/linux-i686-signum.h | 1 - cross/linux-loongarch64-signum.h | 1 - cross/linux-mips-signum.h | 23 ------------- cross/linux-mips64-signum.h | 1 - cross/linux-mips64el-signum.h | 1 - cross/linux-mipsel-signum.h | 1 - cross/linux-powerpc-signum.h | 1 - cross/linux-powerpc64-signum.h | 1 - cross/linux-powerpc64le-signum.h | 1 - cross/linux-powerpcle-signum.h | 1 - cross/linux-ppc-signum.h | 1 - cross/linux-ppc64-signum.h | 1 - cross/linux-ppc64le-signum.h | 1 - cross/linux-ppcle-signum.h | 1 - cross/linux-riscv32-signum.h | 1 - cross/linux-riscv64-signum.h | 1 - cross/linux-x86_64-signum.h | 23 ------------- cross/openbsd-signum.h | 23 ------------- 29 files changed, 19 insertions(+), 197 deletions(-) delete mode 100644 cross/darwin-signum.h delete mode 100644 cross/freebsd-signum.h delete mode 120000 cross/linux-aarch64-signum.h delete mode 120000 cross/linux-arm-signum.h delete mode 120000 cross/linux-arm64-signum.h delete mode 100644 cross/linux-i386-signum.h delete mode 120000 cross/linux-i486-signum.h delete mode 120000 cross/linux-i586-signum.h delete mode 120000 cross/linux-i686-signum.h delete mode 120000 cross/linux-loongarch64-signum.h delete mode 100644 cross/linux-mips-signum.h delete mode 120000 cross/linux-mips64-signum.h delete mode 120000 cross/linux-mips64el-signum.h delete mode 120000 cross/linux-mipsel-signum.h delete mode 120000 cross/linux-powerpc-signum.h delete mode 120000 cross/linux-powerpc64-signum.h delete mode 120000 cross/linux-powerpc64le-signum.h delete mode 120000 cross/linux-powerpcle-signum.h delete mode 120000 cross/linux-ppc-signum.h delete mode 120000 cross/linux-ppc64-signum.h delete mode 120000 cross/linux-ppc64le-signum.h delete mode 120000 cross/linux-ppcle-signum.h delete mode 120000 cross/linux-riscv32-signum.h delete mode 120000 cross/linux-riscv64-signum.h delete mode 100644 cross/linux-x86_64-signum.h delete mode 100644 cross/openbsd-signum.h diff --git a/.gitignore b/.gitignore index 4ba83230..7cb893a7 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ cscope.out /yash /makesignum /signum.h -/cross-signum.h /configm.h /config.h /config.log diff --git a/Makefile.in b/Makefile.in index 59055741..e9f15c19 100644 --- a/Makefile.in +++ b/Makefile.in @@ -80,7 +80,7 @@ makesignum: $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $@.c $(LDLIBS) sig.o: signum.h signum.h: makesignum - ./makesignum > $@ 2> /dev/null || cp cross-signum.h signum.h + ./makesignum > $@ variable.o yash.o: configm.h configm.h: Makefile -@printf 'creating %s...' '$@' diff --git a/configure b/configure index a88097ea..0b73a79b 100755 --- a/configure +++ b/configure @@ -220,7 +220,7 @@ Influential environment variables: ASCIIDOC, ASCIIDOCFLAGS, ASCIIDOCATTRS, A2X, A2XFLAGS, INSTALL, INSTALL_PROGRAM, INSTALL_DATA, INSTALL_DIR, CTAGS, CTAGSARGS, ETAGS, ETAGSARGS, CSCOPE, CSCOPEARGS, - YASH_GETCWD_AUTO_MALLOC, OS, ARCH + YASH_GETCWD_AUTO_MALLOC, OS END exit fi @@ -415,54 +415,35 @@ if [ -n "$OS" ]; then ostype="$OS" elif $cross_compiling; then if [ -n "$host" ]; then - for signum in *-signum.h + # this list will probably be good enough for 99% of people cross + # compiling, the remaining people can just define $OS + for os in linux darwin serenity cygwin aix haiku solaris minix do - signum="${signum%-signum.h}" case "$host" in - *"$signum"*) - ostype="$signum" + *"$os"*) + ostype="$os" break esac done fi if [ -z "$ostype" ]; then - printf 'Could not determine the target operating system!\n' >&2 - printf 'Your target might not have a premade signum.h.\n' >&2 - printf "If this is the case you'll need to generate one yourself by compiling and running makesignum.c on your target." >&2 - printf "Rename your signum.h to '-signum.h' and place it in the root of the source directory.\n" >&2 - printf "If this is not the case you'll need to define the \$OS environment variable and re-run configure.\n" >&2 - fail + case $host in + *bsd*) # theres like a million different BSDs and I don't wanna list them all in the os list + remove="${host%%bsd*}" + ostype="${host#"${remove%-*}"-}" + ostype="${ostype%"${ostype#*bsd}"}" + ;; + *) + printf 'Could not determine the target operating system!\n' >&2 + printf "You'll need to define the \$OS environment variable and re-run configure.\n" >&2 + fail + ;; + esac fi else ostype=$(uname -s | tr "[:upper:]" "[:lower:]") fi -if $cross_compiling; then - if [ "$ostype" = "linux" ]; then - if [ -n "$ARCH" ]; then - arch="$ARCH" - elif [ -n "$host" ]; then - arch="${host%%-*}" - else - printf 'Could not determine the target architecture!\n' >&2 - printf 'You must either use the --host option to configure or define the $ARCH environment variable.\n' >&2 - fail - fi - cross_signum="$ostype-$arch-signum.h" - else - cross_signum="$ostype-signum.h" - fi - - if [ -f "cross/$cross_signum" ]; then - cp "cross/$cross_signum" cross-signum.h - else - printf 'Could not find a signum.h for your target!\n' >&2 - printf "You'll need to generate one yourself by compiling and running makesignum.c on your target.\n" >&2 - printf "Rename your signum.h to %s and place it in the 'cross' directory.\n" "'$cross_signum'" >&2 - fail - fi -fi - checked "${ostype}" case "${ostype}" in darwin) diff --git a/cross/darwin-signum.h b/cross/darwin-signum.h deleted file mode 100644 index d54289a6..00000000 --- a/cross/darwin-signum.h +++ /dev/null @@ -1,23 +0,0 @@ -/* signum.h: generated by makesignum */ - -#ifndef SIGNUM_H -#define SIGNUM_H - -#include - -/* an injective function that returns an array index - * corresponding to the given signal number, - * which must be a valid non-realtime signal number - * or zero. */ -__attribute__((const)) -static inline size_t sigindex(int signum) { - return (size_t) signum; -} - -/* max index returned by sigindex + 1 */ -#define MAXSIGIDX 32 - -/* number of realtime signals that can be handled by yash */ -#define RTSIZE 0 - -#endif diff --git a/cross/freebsd-signum.h b/cross/freebsd-signum.h deleted file mode 100644 index 7e2d18e5..00000000 --- a/cross/freebsd-signum.h +++ /dev/null @@ -1,23 +0,0 @@ -/* signum.h: generated by makesignum */ - -#ifndef SIGNUM_H -#define SIGNUM_H - -#include - -/* an injective function that returns an array index - * corresponding to the given signal number, - * which must be a valid non-realtime signal number - * or zero. */ -__attribute__((const)) -static inline size_t sigindex(int signum) { - return (size_t) signum; -} - -/* max index returned by sigindex + 1 */ -#define MAXSIGIDX 33 - -/* number of realtime signals that can be handled by yash */ -#define RTSIZE 71 - -#endif diff --git a/cross/linux-aarch64-signum.h b/cross/linux-aarch64-signum.h deleted file mode 120000 index 47e37967..00000000 --- a/cross/linux-aarch64-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-arm-signum.h b/cross/linux-arm-signum.h deleted file mode 120000 index 47e37967..00000000 --- a/cross/linux-arm-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-arm64-signum.h b/cross/linux-arm64-signum.h deleted file mode 120000 index d125bcaf..00000000 --- a/cross/linux-arm64-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-aarch64-signum.h \ No newline at end of file diff --git a/cross/linux-i386-signum.h b/cross/linux-i386-signum.h deleted file mode 100644 index 8fba4514..00000000 --- a/cross/linux-i386-signum.h +++ /dev/null @@ -1,23 +0,0 @@ -/* signum.h: generated by makesignum */ - -#ifndef SIGNUM_H -#define SIGNUM_H - -#include - -/* an injective function that returns an array index - * corresponding to the given signal number, - * which must be a valid non-realtime signal number - * or zero. */ -__attribute__((const)) -static inline size_t sigindex(int signum) { - return (size_t) signum; -} - -/* max index returned by sigindex + 1 */ -#define MAXSIGIDX 32 - -/* number of realtime signals that can be handled by yash */ -#define RTSIZE 39 - -#endif diff --git a/cross/linux-i486-signum.h b/cross/linux-i486-signum.h deleted file mode 120000 index 47e37967..00000000 --- a/cross/linux-i486-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-i586-signum.h b/cross/linux-i586-signum.h deleted file mode 120000 index c49ca2ba..00000000 --- a/cross/linux-i586-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-i486-signum.h \ No newline at end of file diff --git a/cross/linux-i686-signum.h b/cross/linux-i686-signum.h deleted file mode 120000 index f6d61573..00000000 --- a/cross/linux-i686-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-i586-signum.h \ No newline at end of file diff --git a/cross/linux-loongarch64-signum.h b/cross/linux-loongarch64-signum.h deleted file mode 120000 index 47e37967..00000000 --- a/cross/linux-loongarch64-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-mips-signum.h b/cross/linux-mips-signum.h deleted file mode 100644 index 7e9f39cf..00000000 --- a/cross/linux-mips-signum.h +++ /dev/null @@ -1,23 +0,0 @@ -/* signum.h: generated by makesignum */ - -#ifndef SIGNUM_H -#define SIGNUM_H - -#include - -/* an injective function that returns an array index - * corresponding to the given signal number, - * which must be a valid non-realtime signal number - * or zero. */ -__attribute__((const)) -static inline size_t sigindex(int signum) { - return (size_t) signum; -} - -/* max index returned by sigindex + 1 */ -#define MAXSIGIDX 32 - -/* number of realtime signals that can be handled by yash */ -#define RTSIZE 102 - -#endif diff --git a/cross/linux-mips64-signum.h b/cross/linux-mips64-signum.h deleted file mode 120000 index 17ca2d47..00000000 --- a/cross/linux-mips64-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-mips-signum.h \ No newline at end of file diff --git a/cross/linux-mips64el-signum.h b/cross/linux-mips64el-signum.h deleted file mode 120000 index b9e95d19..00000000 --- a/cross/linux-mips64el-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-mips64-signum.h \ No newline at end of file diff --git a/cross/linux-mipsel-signum.h b/cross/linux-mipsel-signum.h deleted file mode 120000 index 17ca2d47..00000000 --- a/cross/linux-mipsel-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-mips-signum.h \ No newline at end of file diff --git a/cross/linux-powerpc-signum.h b/cross/linux-powerpc-signum.h deleted file mode 120000 index 47e37967..00000000 --- a/cross/linux-powerpc-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-powerpc64-signum.h b/cross/linux-powerpc64-signum.h deleted file mode 120000 index 47e37967..00000000 --- a/cross/linux-powerpc64-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-powerpc64le-signum.h b/cross/linux-powerpc64le-signum.h deleted file mode 120000 index 47e37967..00000000 --- a/cross/linux-powerpc64le-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-powerpcle-signum.h b/cross/linux-powerpcle-signum.h deleted file mode 120000 index 47e37967..00000000 --- a/cross/linux-powerpcle-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-ppc-signum.h b/cross/linux-ppc-signum.h deleted file mode 120000 index e272ea53..00000000 --- a/cross/linux-ppc-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-powerpc-signum.h \ No newline at end of file diff --git a/cross/linux-ppc64-signum.h b/cross/linux-ppc64-signum.h deleted file mode 120000 index 89ef821b..00000000 --- a/cross/linux-ppc64-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-powerpc64-signum.h \ No newline at end of file diff --git a/cross/linux-ppc64le-signum.h b/cross/linux-ppc64le-signum.h deleted file mode 120000 index f378152d..00000000 --- a/cross/linux-ppc64le-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-powerpc64le-signum.h \ No newline at end of file diff --git a/cross/linux-ppcle-signum.h b/cross/linux-ppcle-signum.h deleted file mode 120000 index d0e634b3..00000000 --- a/cross/linux-ppcle-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-powerpcle-signum.h \ No newline at end of file diff --git a/cross/linux-riscv32-signum.h b/cross/linux-riscv32-signum.h deleted file mode 120000 index a1092eb5..00000000 --- a/cross/linux-riscv32-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-riscv64-signum.h \ No newline at end of file diff --git a/cross/linux-riscv64-signum.h b/cross/linux-riscv64-signum.h deleted file mode 120000 index 47e37967..00000000 --- a/cross/linux-riscv64-signum.h +++ /dev/null @@ -1 +0,0 @@ -linux-i386-signum.h \ No newline at end of file diff --git a/cross/linux-x86_64-signum.h b/cross/linux-x86_64-signum.h deleted file mode 100644 index 3661cc04..00000000 --- a/cross/linux-x86_64-signum.h +++ /dev/null @@ -1,23 +0,0 @@ -/* signum.h: generated by makesignum */ - -#ifndef SIGNUM_H -#define SIGNUM_H - -#include - -/* an injective function that returns an array index - * corresponding to the given signal number, - * which must be a valid non-realtime signal number - * or zero. */ -__attribute__((const)) -static inline size_t sigindex(int signum) { - return (size_t) signum; -} - -/* max index returned by sigindex + 1 */ -#define MAXSIGIDX 32 - -/* number of realtime signals that can be handled by yash */ -#define RTSIZE 40 - -#endif diff --git a/cross/openbsd-signum.h b/cross/openbsd-signum.h deleted file mode 100644 index d54289a6..00000000 --- a/cross/openbsd-signum.h +++ /dev/null @@ -1,23 +0,0 @@ -/* signum.h: generated by makesignum */ - -#ifndef SIGNUM_H -#define SIGNUM_H - -#include - -/* an injective function that returns an array index - * corresponding to the given signal number, - * which must be a valid non-realtime signal number - * or zero. */ -__attribute__((const)) -static inline size_t sigindex(int signum) { - return (size_t) signum; -} - -/* max index returned by sigindex + 1 */ -#define MAXSIGIDX 32 - -/* number of realtime signals that can be handled by yash */ -#define RTSIZE 0 - -#endif From 5270f7a90ab803c2a74397c64122409ced222ca1 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sat, 15 Nov 2025 01:31:26 -0500 Subject: [PATCH 24/30] i dont think the test is needed --- configure | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 0b73a79b..24aa40bb 100755 --- a/configure +++ b/configure @@ -414,18 +414,16 @@ checking 'operating system' if [ -n "$OS" ]; then ostype="$OS" elif $cross_compiling; then - if [ -n "$host" ]; then - # this list will probably be good enough for 99% of people cross - # compiling, the remaining people can just define $OS - for os in linux darwin serenity cygwin aix haiku solaris minix - do - case "$host" in - *"$os"*) - ostype="$os" - break - esac - done - fi + # this list will probably be good enough for 99% of people cross + # compiling, the remaining people can just define $OS + for os in linux darwin serenity cygwin aix haiku solaris minix + do + case "$host" in + *"$os"*) + ostype="$os" + break + esac + done if [ -z "$ostype" ]; then case $host in *bsd*) # theres like a million different BSDs and I don't wanna list them all in the os list From cd9ee406909668d0013786bb1d4268973e1fe411 Mon Sep 17 00:00:00 2001 From: WATANABE Yuki Date: Sat, 15 Nov 2025 16:07:04 +0900 Subject: [PATCH 25/30] Generic cross-signum.h --- Makefile.in | 4 +- cross-signum.h | 247 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 249 insertions(+), 2 deletions(-) create mode 100644 cross-signum.h diff --git a/Makefile.in b/Makefile.in index e9f15c19..a0599b70 100644 --- a/Makefile.in +++ b/Makefile.in @@ -37,7 +37,7 @@ INSTALL_DIR = @INSTALL_DIR@ ARCHIVER = @ARCHIVER@ DIRS = @DIRS@ SOURCES = alias.c arith.c builtin.c exec.c expand.c hashtable.c history.c input.c job.c mail.c makesignum.c option.c parser.c path.c plist.c redir.c sig.c strbuf.c util.c variable.c xfnmatch.c xgetopt.c yash.c -HEADERS = alias.h arith.h builtin.h common.h exec.h expand.h hashtable.h history.h input.h job.h mail.h option.h parser.h path.h plist.h redir.h refcount.h sig.h siglist.h strbuf.h util.h variable.h xfnmatch.h xgetopt.h yash.h +HEADERS = alias.h arith.h builtin.h common.h cross-signum.h exec.h expand.h hashtable.h history.h input.h job.h mail.h option.h parser.h path.h plist.h redir.h refcount.h sig.h siglist.h strbuf.h util.h variable.h xfnmatch.h xgetopt.h yash.h MAIN_OBJS = alias.o arith.o builtin.o exec.o expand.o hashtable.o input.o job.o mail.o option.o parser.o path.o plist.o redir.o sig.o strbuf.o util.o variable.o xfnmatch.o xgetopt.o yash.o HISTORY_OBJS = history.o BUILTINS_ARCHIVE = builtins/builtins.a @@ -80,7 +80,7 @@ makesignum: $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $@.c $(LDLIBS) sig.o: signum.h signum.h: makesignum - ./makesignum > $@ + ./makesignum > $@ || cp cross-signum.h $@ variable.o yash.o: configm.h configm.h: Makefile -@printf 'creating %s...' '$@' diff --git a/cross-signum.h b/cross-signum.h new file mode 100644 index 00000000..8c8ecb6c --- /dev/null +++ b/cross-signum.h @@ -0,0 +1,247 @@ +/* Yash: yet another shell */ +/* cross-signum.h: signum.h for cross-compiling */ +/* (C) 2025 magicant */ + +/* This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + + +#ifndef CROSS_SIGNUM_H +#define CROSS_SIGNUM_H + +#include +#include +#include + +/* an injective function that returns an array index + * corresponding to the given signal number, + * which must be a valid non-realtime signal number + * or zero. */ +__attribute__((const)) +static size_t sigindex(int signum) { + // Not using the switch statement to avoid compiler errors that may happen + // if some signal names share the same numeric values. + if (signum == 0) + return 0; + if (signum == SIGHUP) + return 1; + if (signum == SIGINT) + return 2; + if (signum == SIGQUIT) + return 3; + if (signum == SIGILL) + return 4; +#ifdef SIGTRAP + if (signum == SIGTRAP) + return 5; +#endif + if (signum == SIGABRT) + return 6; + if (signum == SIGBUS) + return 7; + if (signum == SIGFPE) + return 8; + if (signum == SIGKILL) + return 9; + if (signum == SIGUSR1) + return 10; + if (signum == SIGSEGV) + return 11; + if (signum == SIGUSR2) + return 12; + if (signum == SIGPIPE) + return 13; + if (signum == SIGALRM) + return 14; + if (signum == SIGTERM) + return 15; +#ifdef SIGSTKFLT + if (signum == SIGSTKFLT) + return 16; +#endif + if (signum == SIGCHLD) + return 17; + if (signum == SIGCONT) + return 18; + if (signum == SIGSTOP) + return 19; + if (signum == SIGTSTP) + return 20; + if (signum == SIGTTIN) + return 21; + if (signum == SIGTTOU) + return 22; + if (signum == SIGURG) + return 23; +#ifdef SIGXCPU + if (signum == SIGXCPU) + return 24; +#endif +#ifdef SIGXFSZ + if (signum == SIGXFSZ) + return 25; +#endif +#ifdef SIGVTALRM + if (signum == SIGVTALRM) + return 26; +#endif +#ifdef SIGPROF + if (signum == SIGPROF) + return 27; +#endif +#ifdef SIGWINCH + if (signum == SIGWINCH) + return 28; +#endif +#ifdef SIGIO + if (signum == SIGIO) + return 29; +#endif +#ifdef SIGPWR + if (signum == SIGPWR) + return 30; +#endif +#ifdef SIGSYS + if (signum == SIGSYS) + return 31; +#endif +#ifdef SIGPOLL + if (signum == SIGPOLL) + return 32; +#endif +#ifdef SIGIOT + if (signum == SIGIOT) + return 33; +#endif +#ifdef SIGEMT + if (signum == SIGEMT) + return 34; +#endif +#ifdef SIGCLD + if (signum == SIGCLD) + return 35; +#endif +#ifdef SIGLOST + if (signum == SIGLOST) + return 36; +#endif +#ifdef SIGWINDOW + if (signum == SIGWINDOW) + return 37; +#endif +#ifdef SIGINFO + if (signum == SIGINFO) + return 38; +#endif +#ifdef SIGTHR + if (signum == SIGTHR) + return 39; +#endif +#ifdef SIGMSG + if (signum == SIGMSG) + return 40; +#endif +#ifdef SIGDANGER + if (signum == SIGDANGER) + return 41; +#endif +#ifdef SIGMIGRATE + if (signum == SIGMIGRATE) + return 42; +#endif +#ifdef SIGPRE + if (signum == SIGPRE) + return 43; +#endif +#ifdef SIGVIRT + if (signum == SIGVIRT) + return 44; +#endif +#ifdef SIGALRM1 + if (signum == SIGALRM1) + return 45; +#endif +#ifdef SIGWAITING + if (signum == SIGWAITING) + return 46; +#endif +#ifdef SIGKAP + if (signum == SIGKAP) + return 47; +#endif +#ifdef SIGGRANT + if (signum == SIGGRANT) + return 48; +#endif +#ifdef SIGRETRACT + if (signum == SIGRETRACT) + return 49; +#endif +#ifdef SIGSOUND + if (signum == SIGSOUND) + return 50; +#endif +#ifdef SIGSAK + if (signum == SIGSAK) + return 51; +#endif +#ifdef SIGLWP + if (signum == SIGLWP) + return 52; +#endif +#ifdef SIGFREEZE + if (signum == SIGFREEZE) + return 53; +#endif +#ifdef SIGTHAW + if (signum == SIGTHAW) + return 54; +#endif +#ifdef SIGCANCEL + if (signum == SIGCANCEL) + return 55; +#endif +#ifdef SIGXRES + if (signum == SIGXRES) + return 56; +#endif +#ifdef SIGRESERVE + if (signum == SIGRESERVE) + return 57; +#endif +#ifdef SIGDIL + if (signum == SIGDIL) + return 58; +#endif +#ifdef SIGUNUSED + if (signum == SIGUNUSED) + return 59; +#endif + + /* assert(false); */ + return 0; +} + +/* max index returned by sigindex + 1 */ +#define MAXSIGIDX 60 + +/* number of realtime signals that can be handled by yash */ +#if defined(NSIG_MAX) && NSIG_MAX > 0 +# define RTSIZE NSIG_MAX +#else +# define RTSIZE 100 +#endif + +#endif /* CROSS_SIGNUM_H */ + +/* vim: set ts=8 sts=4 sw=4 et tw=80: */ From 3f18f1ea9b012ffa70316ef42f1ed8a8a6c501e4 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sat, 15 Nov 2025 02:50:11 -0500 Subject: [PATCH 26/30] redirect stderr --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index a0599b70..fd314d4e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -80,7 +80,7 @@ makesignum: $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $@.c $(LDLIBS) sig.o: signum.h signum.h: makesignum - ./makesignum > $@ || cp cross-signum.h $@ + ./makesignum > $@ 2> /dev/null || cp cross-signum.h $@ variable.o yash.o: configm.h configm.h: Makefile -@printf 'creating %s...' '$@' From 92bef359db1ae3e4a580db0b51379ece4419b642 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sat, 15 Nov 2025 03:00:12 -0500 Subject: [PATCH 27/30] fix cross compiling detection the variable was unset when the first tryexec call happens which made it always return success --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 24aa40bb..649e1bca 100755 --- a/configure +++ b/configure @@ -399,11 +399,11 @@ fi # check if we are cross compiling checking 'whether we are cross compiling' +cross_compiling=false if tryexec then checked "no" - cross_compiling=false else checked "yes" cross_compiling=true From 3a9d1e58d586406d75387f00d40c4091d608a7a3 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sat, 15 Nov 2025 15:15:06 -0500 Subject: [PATCH 28/30] update --- cross-signum.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cross-signum.h b/cross-signum.h index 8c8ecb6c..994118eb 100644 --- a/cross-signum.h +++ b/cross-signum.h @@ -239,7 +239,7 @@ static size_t sigindex(int signum) { #if defined(NSIG_MAX) && NSIG_MAX > 0 # define RTSIZE NSIG_MAX #else -# define RTSIZE 100 +# define RTSIZE 255 #endif #endif /* CROSS_SIGNUM_H */ From febca70b3f756a51f56f8dae6b5e10dfa034d21d Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Mon, 17 Nov 2025 01:42:13 -0500 Subject: [PATCH 29/30] update list --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 649e1bca..73e4d671 100755 --- a/configure +++ b/configure @@ -416,7 +416,7 @@ if [ -n "$OS" ]; then elif $cross_compiling; then # this list will probably be good enough for 99% of people cross # compiling, the remaining people can just define $OS - for os in linux darwin serenity cygwin aix haiku solaris minix + for os in linux darwin serenity cygwin aix haiku solaris minix sunos do case "$host" in *"$os"*) From 6f76387136b7f84148cec21a01bf3d76c9809d57 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Mon, 17 Nov 2025 01:53:22 -0500 Subject: [PATCH 30/30] a better approach to os detection we dont actually *need* to always successfully detect an os for every target, most oses don't affect the build later so we can just check for every os that might affect the build and set the ostype to 'unknown' for all others --- configure | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/configure b/configure index 73e4d671..8225db40 100755 --- a/configure +++ b/configure @@ -220,7 +220,7 @@ Influential environment variables: ASCIIDOC, ASCIIDOCFLAGS, ASCIIDOCATTRS, A2X, A2XFLAGS, INSTALL, INSTALL_PROGRAM, INSTALL_DATA, INSTALL_DIR, CTAGS, CTAGSARGS, ETAGS, ETAGSARGS, CSCOPE, CSCOPEARGS, - YASH_GETCWD_AUTO_MALLOC, OS + YASH_GETCWD_AUTO_MALLOC END exit fi @@ -411,12 +411,12 @@ fi # check OS type checking 'operating system' -if [ -n "$OS" ]; then - ostype="$OS" -elif $cross_compiling; then - # this list will probably be good enough for 99% of people cross - # compiling, the remaining people can just define $OS - for os in linux darwin serenity cygwin aix haiku solaris minix sunos +if $cross_compiling; then + # this is a list of every os that affects the build, if you add a check like + # 'if [ "$ostype" = "foo" ]' to the configure script than 'foo' would need + # to be added to this list so it can be detected, otherwise we just set + # $ostype to 'unknown' and hope for the best. + for os in darwin freebsd sunos solaris do case "$host" in *"$os"*) @@ -424,20 +424,14 @@ elif $cross_compiling; then break esac done - if [ -z "$ostype" ]; then - case $host in - *bsd*) # theres like a million different BSDs and I don't wanna list them all in the os list - remove="${host%%bsd*}" - ostype="${host#"${remove%-*}"-}" - ostype="${ostype%"${ostype#*bsd}"}" - ;; - *) - printf 'Could not determine the target operating system!\n' >&2 - printf "You'll need to define the \$OS environment variable and re-run configure.\n" >&2 - fail - ;; - esac - fi + # sometimes there are common os names used for targets that differ from what + # 'uname -s' outputs, those are caught here and corrected. + case $ostype in + solaris) + ostype='sunos' + ;; + esac + [ -z "$ostype" ] && ostype='unknown' else ostype=$(uname -s | tr "[:upper:]" "[:lower:]") fi