Skip to content

Commit

Permalink
Fix detection of -lm in configure
Browse files Browse the repository at this point in the history
On mingw-w64, libm.a is a dummy library. The existing link test would
pass, but pointlessly add -lm to the linking list. Use AC_SEARCH_LIBS
instead, so that -lm is only added when strictly needed.
  • Loading branch information
dra27 committed May 24, 2023
1 parent e725047 commit 0c81148
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 27 deletions.
3 changes: 2 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,8 @@ OCaml 5.1.0
(Xavier Leroy, review by David Allsopp, report by Fabrice Le Fessant)

- #12265: Stop adding -lexecinfo to cclibs (leftover debugging code from the
multicore project).
multicore project). Harden the feature probe for -lm in configure so -lm is
only added if strictly necessary.
(David Allsopp, review by Sébastien Hinderer)

### Bug fixes:
Expand Down
62 changes: 39 additions & 23 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -966,9 +966,11 @@ AC_PROG_INSTALL
# Checks for libraries

## Mathematical library
AC_CHECK_LIB([m],[cos])

AS_IF([test "x$ac_cv_lib_m_cos" = xyes ], [mathlib="-lm"], [mathlib=""])
AC_SEARCH_LIBS([cos], [m],
[AS_CASE([$ac_cv_search_cos],
[no], [AC_MSG_ERROR([Could not locate C math functions])],
['none required'], [mathlib=""],
[mathlib="$ac_cv_search_cos"])])

# Checks for header files

Expand Down

0 comments on commit 0c81148

Please sign in to comment.