--- src/foreign/levmar/compiler.h.orig	2010-12-02 04:30:11.000000000 -0600
+++ src/foreign/levmar/compiler.h	2022-02-03 08:12:52.000000000 -0600
@@ -20,6 +20,8 @@
 #ifndef _COMPILER_H_
 #define _COMPILER_H_
 
+#include <math.h>
+
 /* note: intel's icc defines both __ICC & __INTEL_COMPILER.
  * Also, some compilers other than gcc define __GNUC__,
  * therefore gcc should be checked last
@@ -33,9 +35,9 @@
 #ifdef _MSC_VER
 #define LM_FINITE _finite // MSVC
 #elif defined(__ICC) || defined(__INTEL_COMPILER) || defined(__GNUC__)
-#define LM_FINITE finite // ICC, GCC
+#define LM_FINITE isfinite // ICC, GCC
 #else
-#define LM_FINITE finite // other than MSVC, ICC, GCC, let's hope this will work
+#define LM_FINITE isfinite // other than MSVC, ICC, GCC, let's hope this will work
 #endif
 
 #ifdef _MSC_VER
