configure.ac | 2 ++ meson.build | 2 +- src/meson.build | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) New commits: commit c573497f327a222e5f1daf28b7545d0d7d2a4771 Author: Sam James <sam@xxxxxxxxxx> Date: Wed Feb 14 18:12:46 2024 +0000 build: detect-and-use `-lm` for `fabs` in fcmatch We had a bug report in Gentoo of a sparc64 build failure with -O0: ``` FAILED: src/libfontconfig.so.1.13.0 sparc64-unknown-linux-gnu-gcc -o src/libfontconfig.so.1.13.0 src/libfontconfig.so.1.13.0.p/fcatomic.c.o src/libfontconfig.so.1.13.0.p/fccache.c.o src/libfontconfig.so.1.13.0.p/fccfg.c.o src/libfontconfig.so.1.13.0.p/fccharset.c.o src/libfontconfig.so.1.13.0.p/fccompat.c.o src/libfontconfig.so.1.13.0.p/fcdbg.c.o src/libfontconfig.so.1.13.0.p/fcdefault.c.o src/libfontconfig.so.1.13.0.p/fcdir.c.o src/libfontconfig.so.1.13.0.p/fcformat.c.o src/libfontconfig.so.1.13.0.p/fcfreetype.c.o src/libfontconfig.so.1.13.0.p/fcfs.c.o src/libfontconfig.so.1.13.0.p/fcptrlist.c.o src/libfontconfig.so.1.13.0.p/fchash.c.o src/libfontconfig.so.1.13.0.p/fcinit.c.o src/libfontconfig.so.1.13.0.p/fclang.c.o src/libfontconfig.so.1.13.0.p/fclist.c.o src/libfontconfig.so.1.13.0.p/fcmatch.c.o src/libfontconfig.so.1.13.0.p/fcmatrix.c.o src/libfontconfig.so.1.13.0.p/fcname.c.o src/libfontconfig.so.1.13.0.p/fcobjs.c.o src/libfontconfig.so.1.13.0.p/fcpat.c.o src/libfontconfig.so.1.13.0.p/fcrange.c.o src/libfontc onfig.so.1.13.0.p/fcserialize.c.o src/libfontconfig.so.1.13.0.p/fcstat.c.o src/libfontconfig.so.1.13.0.p/fcstr.c.o src/libfontconfig.so.1.13.0.p/fcweight.c.o src/libfontconfig.so.1.13.0.p/fcxml.c.o src/libfontconfig.so.1.13.0.p/ftglue.c.o -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,--start-group -Wl,-soname,libfontconfig.so.1 -m64 -g -O0 -mno-app-regs -mcpu=ultrasparc -mtune=ultrasparc -mno-vis -mno-vis2 -mno-vis3 -mno-vis4 -mno-vis4b -mno-cbcond -mno-fmaf -mno-fsmuld -mno-popc -mno-subxc -fno-builtin -fno-fast-math -Wl,-O1 -Wl,--as-needed -Wl,--no-keep-memory /usr/lib64/libfreetype.so /usr/lib64/libexpat.so -Wl,--end-group -pthread /usr/lib/gcc/sparc64-unknown-linux-gnu/12/../../../../sparc64-unknown-linux-gnu/bin/ld: src/libfontconfig.so.1.13.0.p/fcmatch.c.o: in function `FcCompareRange': /var/tmp/portage/media-libs/fontconfig-2.14.2-r3/work/fontconfig-2.14.2-.sparc64/../fontconfig-2.14.2/src/fcmatch.c:220: undefined reference to `fabs' ``` Ask autotools & meson to detect `-lm` and add the missing `-lm` for `fabs` usage. Signed-off-by: Sam James <sam@xxxxxxxxxx> diff --git a/configure.ac b/configure.ac index c476420..56c7fa9 100644 --- a/configure.ac +++ b/configure.ac @@ -180,6 +180,8 @@ AC_FUNC_VPRINTF AC_FUNC_MMAP AC_CHECK_FUNCS([link mkstemp mkostemp _mktemp_s mkdtemp getopt getopt_long getprogname getexecname rand random lrand48 random_r rand_r readlink fstatvfs fstatfs lstat strerror strerror_r]) +AC_SEARCH_LIBS([fabs], [m], [], [AC_MSG_ERROR([unable to find the fabs() function])]) + dnl AC_CHECK_FUNCS doesn't check for header files. dnl posix_fadvise() may be not available in older libc. AC_CHECK_SYMBOL([posix_fadvise], [fcntl.h], [fc_func_posix_fadvise=1], [fc_func_posix_fadvise=0]) diff --git a/meson.build b/meson.build index 05fd7d1..d8955b4 100644 --- a/meson.build +++ b/meson.build @@ -23,7 +23,7 @@ freetype_req = '>= 21.0.15' freetype_req_cmake = '>= 2.8.1' cc = meson.get_compiler('c') - +math_dep = cc.find_library('m', required: false) freetype_dep = dependency('freetype2', method: 'pkg-config', version: freetype_req, required: false) diff --git a/src/meson.build b/src/meson.build index 365f19a..8430c65 100644 --- a/src/meson.build +++ b/src/meson.build @@ -65,7 +65,7 @@ libfontconfig = library('fontconfig', fc_sources, alias_headers, ft_alias_headers, fclang_h, fccase_h, fcobjshash_h, c_args: c_args + fc_extra_c_args, include_directories: incbase, - dependencies: deps, + dependencies: [deps, math_dep], install: true, soversion: soversion, version: libversion,