diff --git a/src/cavern.h b/src/cavern.h
index 59ad9456..b68bd465 100644
--- a/src/cavern.h
+++ b/src/cavern.h
@@ -33,6 +33,8 @@
 #include <math.h>
 #include <float.h>
 
+#include <proj.h>
+#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1
 #include <proj_api.h>
 
 #include "img_hosted.h"
diff --git a/src/commands.c b/src/commands.c
index fb82ff9a..05ea3ea0 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -26,6 +26,8 @@
 #include <stddef.h> /* for offsetof */
 #include <string.h>
 
+#include <proj.h>
+#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1
 #include <proj_api.h>
 
 #include "cavern.h"
@@ -1706,11 +1708,11 @@ cmd_declination(void)
 	/* Invalidate cached declination. */
 	pcs->declination = HUGE_REAL;
 	{
-	    projLP lp = { x, y };
-	    struct FACTORS factors;
-	    memset(&factors, 0, sizeof(factors));
-	    pj_factors(lp, proj_out, 0.0, &factors);
-	    pcs->convergence = factors.conv;
+	    PJ_COORD lp;
+	    lp.lp.lam = x;
+	    lp.lp.phi = y;
+	    PJ_FACTORS factors = proj_factors(proj_out, lp);
+	    pcs->convergence = factors.meridian_convergence;
 	}
     } else {
 	/* *declination D UNITS */
diff --git a/src/gfxcore.cc b/src/gfxcore.cc
index 0dfd1522..a9ec171f 100644
--- a/src/gfxcore.cc
+++ b/src/gfxcore.cc
@@ -47,6 +47,7 @@
 #include <wx/image.h>
 #include <wx/zipstrm.h>
 
+#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1
 #include <proj_api.h>
 
 const unsigned long DEFAULT_HGT_DIM = 3601;
diff --git a/src/gpx.cc b/src/gpx.cc
index e082cfca..ad3cfdce 100644
--- a/src/gpx.cc
+++ b/src/gpx.cc
@@ -33,6 +33,7 @@
 #include <math.h>
 
 #include "useful.h"
+#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1
 #include <proj_api.h>
 
 #include "aven.h"
diff --git a/src/gpx.h b/src/gpx.h
index ca28f52a..3de66532 100644
--- a/src/gpx.h
+++ b/src/gpx.h
@@ -21,6 +21,7 @@
 
 #include "exportfilter.h"
 
+#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1
 #include <proj_api.h>
 
 class GPX : public ExportFilter {
diff --git a/src/kml.cc b/src/kml.cc
index 8cba3e3f..019f3673 100644
--- a/src/kml.cc
+++ b/src/kml.cc
@@ -32,6 +32,7 @@
 #include <math.h>
 
 #include "useful.h"
+#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1
 #include <proj_api.h>
 
 #include "aven.h"
diff --git a/src/kml.h b/src/kml.h
index 5c50661b..f1d83d5d 100644
--- a/src/kml.h
+++ b/src/kml.h
@@ -20,6 +20,7 @@
 
 #include "exportfilter.h"
 
+#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1
 #include <proj_api.h>
 
 #include "vector3.h"
diff --git a/src/message.h b/src/message.h
index 022747d0..1ab0a93f 100644
--- a/src/message.h
+++ b/src/message.h
@@ -36,6 +36,7 @@ extern "C" {
 #ifdef MSG_SETUP_PROJ_SEARCH_PATH
 /* We only support relocatable builds on these platforms. */
 # if OS_WIN32 || OS_UNIX_MACOSX
+#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1
 #  include <proj_api.h>
 #  define msg_init(ARGV) do {\
 	if (msg_init_(ARGV)) pj_set_finder(msg_proj_finder_);\
diff --git a/tests/cs.svx b/tests/cs.svx
index 0c7cd260..563196fd 100644
--- a/tests/cs.svx
+++ b/tests/cs.svx
@@ -1,6 +1,6 @@
 ; pos=yes warn=0
 *cs EPSG:4167
-*cs ESRI:104305
+*cs EPSG:4167 ; FIXME: +init=esri:nnnn broken in PROJ 6?
 *cs EUR79Z30
 *cs IJTSK
 *cs IJTSK03
diff --git a/tests/csbad.out b/tests/csbad.out
index 36480d24..098fb72c 100644
--- a/tests/csbad.out
+++ b/tests/csbad.out
@@ -65,8 +65,6 @@
 ./csbad.svx:24:9: error: Coordinate system unsuitable for output
  *cs out jtsk03
          ^~~~~~
-./csbad.svx:29: error: Failed to convert coordinates: latitude or longitude exceeded limits
- *fix 2 reference 179 -89 1000
 
 Removing trailing traverses...
 
@@ -89,4 +87,4 @@ Total length of survey legs =    0.00m (   0.00m adjusted)
 Total plan length of survey legs =    0.00m
 Total vertical length of survey legs =    0.00m
    2 0-nodes.
-There were 0 warning(s) and 24 error(s) - no output files produced.
+There were 0 warning(s) and 23 error(s) - no output files produced.
diff --git a/tests/csbad.svx b/tests/csbad.svx
index 103fe22a..2dda4914 100644
--- a/tests/csbad.svx
+++ b/tests/csbad.svx
@@ -1,4 +1,4 @@
-; pos=fail warn=0 error=24
+; pos=fail warn=0 error=23
 *fix 1 reference 0 0 0
 *cs EPSG:-1
 *cs ERSI:1234
@@ -26,4 +26,5 @@
 ; that cavern relays the error usefully.
 *cs out osgb:ha
 *cs long-lat
+; FIXME doesn't fail with PROJ6
 *fix 2 reference 179 -89 1000
