Add option to include arch-specific code

This commit is contained in:
Alex Kotov 2021-12-19 08:12:46 +05:00
parent 029a031534
commit 324891b78b
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 20 additions and 2 deletions

View File

@ -27,7 +27,7 @@ jobs:
- name: autogen
run: ./autogen.sh
- name: configure
run: ./configure ${{matrix.assert}} ${{matrix.null_guard}} ${{matrix.werror.mb2}} CC='${{matrix.cc}}' CFLAGS='${{matrix.opt}} ${{matrix.werror.cflag}}'
run: ./configure --with-arch ${{matrix.assert}} ${{matrix.null_guard}} ${{matrix.werror.mb2}} CC='${{matrix.cc}}' CFLAGS='${{matrix.opt}} ${{matrix.werror.cflag}}'
- name: make
run: make
- name: check

View File

@ -77,6 +77,8 @@ are some non-default options:
doesn't have effect if your assetion function was set and ends execution of
application (kernel). However it prevents crashes because of NULL pointer
dereference in other cases.
* `--with-arch` - includes architecture-specific code (except assembly). May be
useful for testing.
* `--with-libc` - provides the replacement for some standard C functions. Useful
in freestanding environment, where no libc is present.
@ -96,7 +98,7 @@ environment.
```
./autogen.sh
./configure --enable-assert --enable-null-guard
./configure --enable-assert --enable-null-guard --with-arch
make
```

View File

@ -25,6 +25,9 @@ AC_ARG_WITH( [pfa], AS_HELP_STRING([--without-pfa], [without Pag
AC_ARG_WITH( [units], AS_HELP_STRING([--without-units], [without measurement units utils]))
dnl Packages (disabled by default)
AC_ARG_WITH( [arch], AS_HELP_STRING([--with-arch], [with architecture-specific code]))
AC_ARG_WITH( [arch-i386], AS_HELP_STRING([--with-arch-i386], [with i386-specific code]))
AC_ARG_WITH( [arch-x86-64], AS_HELP_STRING([--with_arch-x86-64], [with x86_64-specific code]))
AC_ARG_WITH( [libc], AS_HELP_STRING([--with-libc], [with libc replacement]))
AC_ARG_WITH( [libc-memset], AS_HELP_STRING([--with-libc-memset], [with memset replacement]))
AC_ARG_WITH( [libc-strcpy], AS_HELP_STRING([--with-libc-strcpy], [with strcpy replacement]))
@ -32,6 +35,13 @@ AC_ARG_WITH( [libc-strlen], AS_HELP_STRING([--with-libc-strlen], [with strlen
AC_DEFUN([do_with_arch],
[
if test -z "$with_arch_i386"; then with_arch_i386=yes; fi
if test -z "$with_arch_x86_64"; then with_arch_x86_64=yes; fi
])
AS_IF([test "$with_arch" = yes], do_with_arch)
AC_DEFUN([do_with_libc],
[
if test -z "$with_libc_memset"; then with_libc_memset=yes; fi
@ -59,6 +69,9 @@ AM_CONDITIONAL([WITH_PFA], [test "$with_pfa" != no])
AM_CONDITIONAL([WITH_UNITS], [test "$with_units" != no])
dnl Packages (disabled by default)
AM_CONDITIONAL([WITH_ARCH], [test "$with_arch" = yes])
AM_CONDITIONAL([WITH_ARCH_I386], [test "$with_arch_i386" = yes])
AM_CONDITIONAL([WITH_ARCH_X86_64], [test "$with_arch_x86_64" = yes])
AM_CONDITIONAL([WITH_LIBC], [test "$with_libc" = yes])
AM_CONDITIONAL([WITH_LIBC_MEMSET], [test "$with_libc_memset" = yes])
AM_CONDITIONAL([WITH_LIBC_STRCPY], [test "$with_libc_strcpy" = yes])
@ -83,6 +96,9 @@ AS_IF([test "$with_pfa" != no], [AC_DEFINE([WITH_PFA],
AS_IF([test "$with_units", != no], [AC_DEFINE([WITH_UNITS], [1], [with measurement units utils])])
dnl Packages (disabled by default)
AS_IF([test "$with_arch" = yes], [AC_DEFINE([WITH_ARCH], [1], [with architecture-specific code])])
AS_IF([test "$with_arch_i386" = yes], [AC_DEFINE([WITH_ARCH_I386], [1], [with i386-specific code])])
AS_IF([test "$with_arch_x86_64" = yes], [AC_DEFINE([WITH_ARCH_X86_64], [1], [with x86_64-specific code])])
AS_IF([test "$with_libc" = yes], [AC_DEFINE([WITH_LIBC], [1], [with libc replacement])])
AS_IF([test "$with_libc_memset" = yes], [AC_DEFINE([WITH_LIBC_MEMSET], [1], [with memset replacement])])
AS_IF([test "$with_libc_strcpy" = yes], [AC_DEFINE([WITH_LIBC_STRCPY], [1], [with strcpy replacement])])