From 324891b78bb6f4ee5570ccc0e76b13994e028c47 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Sun, 19 Dec 2021 08:12:46 +0500 Subject: [PATCH] Add option to include arch-specific code --- .github/workflows/test.yml | 2 +- README.md | 4 +++- configure.ac | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e2a5564..c25d23b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/README.md b/README.md index 0e467df..b62f3b3 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/configure.ac b/configure.ac index 3240843..1e6b010 100644 --- a/configure.ac +++ b/configure.ac @@ -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])])