From b6b7f744e773062d27d9ad0f1c319dd997bdb2cb Mon Sep 17 00:00:00 2001 From: Mathias Anselmann Date: Fri, 2 Jan 2026 08:10:33 +0100 Subject: [PATCH 1/3] libsc: detect and link libm explicitly for math-using examples --- configure.ac | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configure.ac b/configure.ac index 9100367f1..4f7796576 100644 --- a/configure.ac +++ b/configure.ac @@ -90,6 +90,12 @@ echo "o---------------------------------------" echo "| Checking libraries" echo "o---------------------------------------" +dnl Some libsc example programs (e.g. the v4l2 example) use math functions +dnl such as sin(). On many systems these reside in libm, while on others +dnl they are provided by libc. Detect and add the required math library +dnl explicitly to avoid relying on transitive or toolchain-specific linking. +AC_SEARCH_LIBS([sin], [m]) + SC_CHECK_LIBRARIES([SC]) # Print summary. From e9440b14b57b0337a86056c5d80f6c0aa5140324 Mon Sep 17 00:00:00 2001 From: Mathias Anselmann Date: Mon, 5 Jan 2026 13:51:02 +0100 Subject: [PATCH 2/3] Undo previous change in configure.ac and make SC_CHECK_MATH more robust against sqrt builtin expansion to fix the libm linker issue. --- config/sc_include.m4 | 3 ++- configure.ac | 6 ------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/config/sc_include.m4 b/config/sc_include.m4 index d87987dbc..aea0297d0 100644 --- a/config/sc_include.m4 +++ b/config/sc_include.m4 @@ -175,7 +175,8 @@ AC_DEFUN([SC_CHECK_MATH], [[ /* make this so complex that the compiler cannot predict the result */ double a = 3.14149; -for (; sqrt (a) < a; a *= 1.000023) { putc ('1', stdout); } +double (*volatile fp)(double) = sqrt; +for (; fp (a) < a; a *= 1.000023) { putc ('1', stdout); } ]], [m], [AC_DEFINE([HAVE_MATH], [1], [Define to 1 if sqrt links successfully])], [AC_MSG_ERROR([unable to link with sqrt, cos, sin, both as is and with -lm])]) diff --git a/configure.ac b/configure.ac index 4f7796576..9100367f1 100644 --- a/configure.ac +++ b/configure.ac @@ -90,12 +90,6 @@ echo "o---------------------------------------" echo "| Checking libraries" echo "o---------------------------------------" -dnl Some libsc example programs (e.g. the v4l2 example) use math functions -dnl such as sin(). On many systems these reside in libm, while on others -dnl they are provided by libc. Detect and add the required math library -dnl explicitly to avoid relying on transitive or toolchain-specific linking. -AC_SEARCH_LIBS([sin], [m]) - SC_CHECK_LIBRARIES([SC]) # Print summary. From 63f41dd64293f48b244ee98c2b127d1964136dba Mon Sep 17 00:00:00 2001 From: Mathias Anselmann Date: Sun, 11 Jan 2026 23:39:45 +0100 Subject: [PATCH 3/3] Add author information file --- doc/author_anselmann.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/author_anselmann.txt diff --git a/doc/author_anselmann.txt b/doc/author_anselmann.txt new file mode 100644 index 000000000..a6ee43294 --- /dev/null +++ b/doc/author_anselmann.txt @@ -0,0 +1 @@ +I place my contributions to libsc under the FreeBSD license. Mathias Anselmann