aboutsummaryrefslogtreecommitdiff
path: root/src/geodesic.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/geodesic.c')
-rw-r--r--src/geodesic.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/geodesic.c b/src/geodesic.c
index 5504cb3b..887edb42 100644
--- a/src/geodesic.c
+++ b/src/geodesic.c
@@ -23,8 +23,19 @@
* https://geographiclib.sourceforge.io/
*/
+/* The PROJ_COMPILATION flag indicates that this is part of the compilation of
+ * the PROJ library (keyed off the presence of the PROJ_LIB macro which points
+ * to the data directory for PROJ). If this is set, we use the PROJ supplied
+ * implementations of the C99 math functions instead of the ones defined here.
+ */
+#if defined(PROJ_LIB)
+#define PROJ_COMPILATION 1
+#else
+#define PROJ_COMPILATION 0
+#endif
+
#include "geodesic.h"
-#ifdef PJ_LIB__
+#if PROJ_COMPILAION
#include "proj_math.h"
#else
#include <math.h>
@@ -122,7 +133,7 @@ enum captype {
};
static real sq(real x) { return x * x; }
-#if HAVE_C99_MATH
+#if HAVE_C99_MATH || PROJ_COMPILATION
#define atanhx atanh
#define copysignx copysign
#define hypotx hypot