From: Darren Tucker Date: Tue, 15 Apr 2025 11:58:49 +0000 (+1000) Subject: Look for sqrt(), possibly in libm. X-Git-Tag: V_10_1_P1~336 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=849c2fd894aa87a7e40c71e8d5bda5392b1205be;p=thirdparty%2Fopenssh-portable.git Look for sqrt(), possibly in libm. The unit tests now use sqrt(), which in some platforms (notably DragonFlyBSD and Solaris) is not in libc but rather libm. Since only the unit tests use this, add TESTLIBS and if necessary put libm in it. --- diff --git a/Makefile.in b/Makefile.in index 5a7a1bd10..f15ac558a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -557,7 +557,7 @@ regress-prep: ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile REGRESSLIBS=libssh.a $(LIBCOMPAT) -TESTLIBS=$(LIBS) $(CHANNELLIBS) +TESTLIBS=$(LIBS) $(CHANNELLIBS) @TESTLIBS@ regress/modpipe$(EXEEXT): $(srcdir)/regress/modpipe.c $(REGRESSLIBS) $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(srcdir)/regress/modpipe.c \ diff --git a/configure.ac b/configure.ac index ee77a0484..bbddca009 100644 --- a/configure.ac +++ b/configure.ac @@ -1449,6 +1449,11 @@ AC_CHECK_FUNC([getspnam], , AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1], [Define if you have the basename function.])]) +dnl sqrt() only used in unit tests. +AC_CHECK_FUNC([sqrt], , + [AC_CHECK_LIB([m], [sqrt], [TESTLIBS="$TESTLIBS -lm"])]) +AC_SUBST([TESTLIBS]) + dnl zlib defaults to enabled zlib=yes AC_ARG_WITH([zlib],