summaryrefslogtreecommitdiffstats
path: root/src/gdal-1-fixes.patch
blob: dae453ec4c0affe35b226e2431c2fc593c568dd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
This file is part of MXE. See LICENSE.md for licensing information.

Contains ad hoc patches for cross building.

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luke Potgieter <fried.roadkill+ght@gmail.com>
Date: Tue, 29 Aug 2017 16:31:09 +0200
Subject: [PATCH 1/3] Detect spatialite more effectively than just checking for
 headers in the system paths. PostgreSQL detection requires -lpthread when
 building statically.


diff --git a/configure.ac b/configure.ac
index 1111111..2222222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1124,7 +1124,7 @@ else
 
   AC_MSG_RESULT([yes])
 
-  AC_CHECK_LIB(pq,PQconnectdb,HAVE_PG=yes,HAVE_PG=no,-L`$PG_CONFIG --libdir`)
+  AC_CHECK_LIB(pq,PQconnectdb,HAVE_PG=yes,HAVE_PG=no,-L`$PG_CONFIG --libdir` -lpthread)
 
   if test "${HAVE_PG}" = "yes" ; then
     LIBS=-L`$PG_CONFIG --libdir`" -lpq $LIBS"
@@ -3544,16 +3544,21 @@ AC_ARG_WITH(spatialite-soname,
 
 HAVE_SPATIALITE=no
 SPATIALITE_AMALGAMATION=no
+HAVE_SPAT_PKG=no
 
 if test -z "$with_spatialite" -o "$with_spatialite" = "no"; then
     AC_MSG_RESULT(disabled)
 elif test "$with_spatialite" = "yes"; then
     AC_CHECK_HEADERS(sqlite3.h)
     if test "$ac_cv_header_sqlite3_h" = "yes"; then
-        AC_MSG_CHECKING([for spatialite.h in /usr/include or /usr/local/include])
-        if test -f "/usr/include/spatialite.h" -o -f "/usr/local/include/spatialite.h"; then
-            AC_MSG_RESULT(found)
+        #AC_MSG_CHECKING([for spatialite.h in /usr/include or /usr/local/include])
+        #if test -f "/usr/include/spatialite.h" -o -f "/usr/local/include/spatialite.h"; then
+        PKG_CHECK_MODULES(SPATIALITE, spatialite, [HAVE_SPAT_PKG=yes], [HAVE_SPAT_PKG=no])
+        if test "$HAVE_SPAT_PKG" = "yes"; then
+            OLD_LIBS="$LIBS"
+            LIBS="$LIBS -lsqlite3 -lspatialite -lgeos_c -lgeos -lxml2 -liconv -llzma -lproj -lstdc++ -lws2_32 -lm -lz"
             AC_CHECK_LIB(spatialite,spatialite_init,SPATIALITE_INIT_FOUND=yes,SPATIALITE_INIT_FOUND=no,)
+            LIBS="$OLD_LIBS"
             if test "$SPATIALITE_INIT_FOUND" = "yes"; then
                 HAVE_SPATIALITE=yes
                 SPATIALITE_LIBS="-lspatialite -lsqlite3"
diff --git a/m4/geos.m4 b/m4/geos.m4
index 1111111..2222222 100644
--- a/m4/geos.m4
+++ b/m4/geos.m4
@@ -121,14 +121,14 @@ AC_DEFUN([GEOS_INIT],[
 
       HAVE_GEOS="no"
 
-      GEOS_LIBS="`${GEOS_CONFIG} --ldflags` -lgeos_c"
+      GEOS_LIBS="`${GEOS_CONFIG} --clibs`"
       GEOS_CFLAGS="`${GEOS_CONFIG} --cflags`"
       GEOS_VERSION="`${GEOS_CONFIG} --version`"
 
       ax_save_LIBS="${LIBS}"
-      LIBS=${GEOS_LIBS}
+      LIBS="${LIBS} ${GEOS_LIBS}"
       ax_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${GEOS_CFLAGS}"
+      CFLAGS="${CFLAGS} ${GEOS_CFLAGS}"
 
       AC_CHECK_LIB([geos_c],
         [GEOSversion],

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luke Potgieter <fried.roadkill+ght@gmail.com>
Date: Tue, 26 Sep 2017 14:56:19 +0200
Subject: [PATCH 2/3] Use the new proj dll version number for the latest proj.


diff --git a/ogr/ogrct.cpp b/ogr/ogrct.cpp
index 1111111..2222222 100644
--- a/ogr/ogrct.cpp
+++ b/ogr/ogrct.cpp
@@ -96,9 +96,9 @@ static bool      bProjLocaleSafe = false;
 // build) it can be named either way, so use PROJSO environment variable to
 // specify the right library name. By default assume that in Cygwin/MinGW all
 // components were built in the same way.
-#  define LIBNAME "libproj-9.dll"
+#  define LIBNAME "libproj-12.dll"
 #elif defined(__CYGWIN__)
-#  define LIBNAME "cygproj-9.dll"
+#  define LIBNAME "cygproj-12.dll"
 #elif defined(__APPLE__)
 #  define LIBNAME "libproj.dylib"
 #else

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Sun, 19 Nov 2017 12:01:30 +1100
Subject: [PATCH 3/3] Add support for openjpeg 2.3

taken from:
https://trac.osgeo.org/gdal/changeset/40330

diff --git a/configure b/configure
index 1111111..2222222 100755
--- a/configure
+++ b/configure
@@ -25116,19 +25116,20 @@ $as_echo "$as_me: OpenJPEG (JPEG2000) support disabled." >&6;}
 
 elif test "$with_openjpeg" = "yes" -o "$with_openjpeg" = "" ; then
 
-  for ac_header in openjpeg-2.2/openjpeg.h
+
+  for ac_header in openjpeg-2.3/openjpeg.h
 do :
-  ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.2/openjpeg.h" "ac_cv_header_openjpeg_2_2_openjpeg_h" "$ac_includes_default"
-if test "x$ac_cv_header_openjpeg_2_2_openjpeg_h" = xyes; then :
+  ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.3/openjpeg.h" "ac_cv_header_openjpeg_2_3_openjpeg_h" "$ac_includes_default"
+if test "x$ac_cv_header_openjpeg_2_3_openjpeg_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_OPENJPEG_2_2_OPENJPEG_H 1
+#define HAVE_OPENJPEG_2_3_OPENJPEG_H 1
 _ACEOF
 
 fi
 
 done
 
-  if test "$ac_cv_header_openjpeg_2_2_openjpeg_h" = "yes"; then
+  if test "$ac_cv_header_openjpeg_2_3_openjpeg_h" = "yes"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for opj_stream_set_user_data_length in -lopenjp2" >&5
 $as_echo_n "checking for opj_stream_set_user_data_length in -lopenjp2... " >&6; }
 if ${ac_cv_lib_openjp2_opj_stream_set_user_data_length+:} false; then :
@@ -25172,23 +25173,23 @@ else
 fi
 
     if test "$HAVE_OPENJPEG" = "yes"; then
-        OPENJPEG_VERSION=20200
+        OPENJPEG_VERSION=20300
         LIBS="-lopenjp2 $LIBS"
     fi
   else
-    for ac_header in openjpeg-2.1/openjpeg.h
+    for ac_header in openjpeg-2.2/openjpeg.h
 do :
-  ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.1/openjpeg.h" "ac_cv_header_openjpeg_2_1_openjpeg_h" "$ac_includes_default"
-if test "x$ac_cv_header_openjpeg_2_1_openjpeg_h" = xyes; then :
+  ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.2/openjpeg.h" "ac_cv_header_openjpeg_2_2_openjpeg_h" "$ac_includes_default"
+if test "x$ac_cv_header_openjpeg_2_2_openjpeg_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_OPENJPEG_2_1_OPENJPEG_H 1
+#define HAVE_OPENJPEG_2_2_OPENJPEG_H 1
 _ACEOF
 
 fi
 
 done
 
-    if test "$ac_cv_header_openjpeg_2_1_openjpeg_h" = "yes"; then
+    if test "$ac_cv_header_openjpeg_2_2_openjpeg_h" = "yes"; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for opj_stream_set_user_data_length in -lopenjp2" >&5
 $as_echo_n "checking for opj_stream_set_user_data_length in -lopenjp2... " >&6; }
 if ${ac_cv_lib_openjp2_opj_stream_set_user_data_length+:} false; then :
@@ -25232,23 +25233,23 @@ else
 fi
 
         if test "$HAVE_OPENJPEG" = "yes"; then
-            OPENJPEG_VERSION=20100
+            OPENJPEG_VERSION=20200
             LIBS="-lopenjp2 $LIBS"
         fi
     else
-        for ac_header in openjpeg-2.0/openjpeg.h
+        for ac_header in openjpeg-2.1/openjpeg.h
 do :
-  ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.0/openjpeg.h" "ac_cv_header_openjpeg_2_0_openjpeg_h" "$ac_includes_default"
-if test "x$ac_cv_header_openjpeg_2_0_openjpeg_h" = xyes; then :
+  ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.1/openjpeg.h" "ac_cv_header_openjpeg_2_1_openjpeg_h" "$ac_includes_default"
+if test "x$ac_cv_header_openjpeg_2_1_openjpeg_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_OPENJPEG_2_0_OPENJPEG_H 1
+#define HAVE_OPENJPEG_2_1_OPENJPEG_H 1
 _ACEOF
 
 fi
 
 done
 
-        if test "$ac_cv_header_openjpeg_2_0_openjpeg_h" = "yes"; then
+        if test "$ac_cv_header_openjpeg_2_1_openjpeg_h" = "yes"; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: checking for opj_stream_set_user_data_length in -lopenjp2" >&5
 $as_echo_n "checking for opj_stream_set_user_data_length in -lopenjp2... " >&6; }
 if ${ac_cv_lib_openjp2_opj_stream_set_user_data_length+:} false; then :
@@ -25292,8 +25293,69 @@ else
 fi
 
             if test "$HAVE_OPENJPEG" = "yes"; then
+                OPENJPEG_VERSION=20100
                 LIBS="-lopenjp2 $LIBS"
             fi
+        else
+            for ac_header in openjpeg-2.0/openjpeg.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.0/openjpeg.h" "ac_cv_header_openjpeg_2_0_openjpeg_h" "$ac_includes_default"
+if test "x$ac_cv_header_openjpeg_2_0_openjpeg_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_OPENJPEG_2_0_OPENJPEG_H 1
+_ACEOF
+
+fi
+
+done
+
+            if test "$ac_cv_header_openjpeg_2_0_openjpeg_h" = "yes"; then
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for opj_stream_set_user_data_length in -lopenjp2" >&5
+$as_echo_n "checking for opj_stream_set_user_data_length in -lopenjp2... " >&6; }
+if ${ac_cv_lib_openjp2_opj_stream_set_user_data_length+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lopenjp2  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opj_stream_set_user_data_length ();
+int
+main ()
+{
+return opj_stream_set_user_data_length ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_openjp2_opj_stream_set_user_data_length=yes
+else
+  ac_cv_lib_openjp2_opj_stream_set_user_data_length=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_openjp2_opj_stream_set_user_data_length" >&5
+$as_echo "$ac_cv_lib_openjp2_opj_stream_set_user_data_length" >&6; }
+if test "x$ac_cv_lib_openjp2_opj_stream_set_user_data_length" = xyes; then :
+  HAVE_OPENJPEG=yes
+else
+  HAVE_OPENJPEG=no
+fi
+
+                if test "$HAVE_OPENJPEG" = "yes"; then
+                    LIBS="-lopenjp2 $LIBS"
+                fi
+            fi
         fi
     fi
   fi
@@ -25308,8 +25370,11 @@ else
   elif test -r $with_openjpeg/include/openjpeg-2.2/openjpeg.h ; then
     OPENJPEG_VERSION=20200
     EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES"
+  elif test -r $with_openjpeg/include/openjpeg-2.3/openjpeg.h ; then
+    OPENJPEG_VERSION=20300
+    EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES"
   else
-    as_fn_error $? "openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0 or $with_openjpeg/include/openjpeg-2.1 or $with_openjpeg/include/openjpeg-2.2" "$LINENO" 5
+    as_fn_error $? "openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0 or $with_openjpeg/include/openjpeg-2.1 or $with_openjpeg/include/openjpeg-2.2 or $with_openjpeg/include/openjpeg-2.3" "$LINENO" 5
   fi
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for opj_stream_set_user_data_length in -lopenjp2" >&5
diff --git a/configure.ac b/configure.ac
index 1111111..2222222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2539,28 +2539,38 @@ if test "$with_openjpeg" = "no" ; then
 
 elif test "$with_openjpeg" = "yes" -o "$with_openjpeg" = "" ; then
 
-  AC_CHECK_HEADERS([openjpeg-2.2/openjpeg.h])
-  if test "$ac_cv_header_openjpeg_2_2_openjpeg_h" = "yes"; then
+
+  AC_CHECK_HEADERS([openjpeg-2.3/openjpeg.h])
+  if test "$ac_cv_header_openjpeg_2_3_openjpeg_h" = "yes"; then
     AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,)
     if test "$HAVE_OPENJPEG" = "yes"; then
-        OPENJPEG_VERSION=20200
+        OPENJPEG_VERSION=20300
         LIBS="-lopenjp2 $LIBS"
     fi
   else
-    AC_CHECK_HEADERS([openjpeg-2.1/openjpeg.h])
-    if test "$ac_cv_header_openjpeg_2_1_openjpeg_h" = "yes"; then
+    AC_CHECK_HEADERS([openjpeg-2.2/openjpeg.h])
+    if test "$ac_cv_header_openjpeg_2_2_openjpeg_h" = "yes"; then
         AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,)
         if test "$HAVE_OPENJPEG" = "yes"; then
-            OPENJPEG_VERSION=20100
+            OPENJPEG_VERSION=20200
             LIBS="-lopenjp2 $LIBS"
         fi
     else
-        AC_CHECK_HEADERS([openjpeg-2.0/openjpeg.h])
-        if test "$ac_cv_header_openjpeg_2_0_openjpeg_h" = "yes"; then
+        AC_CHECK_HEADERS([openjpeg-2.1/openjpeg.h])
+        if test "$ac_cv_header_openjpeg_2_1_openjpeg_h" = "yes"; then
             AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,)
             if test "$HAVE_OPENJPEG" = "yes"; then
+                OPENJPEG_VERSION=20100
                 LIBS="-lopenjp2 $LIBS"
             fi
+        else
+            AC_CHECK_HEADERS([openjpeg-2.0/openjpeg.h])
+            if test "$ac_cv_header_openjpeg_2_0_openjpeg_h" = "yes"; then
+                AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,)
+                if test "$HAVE_OPENJPEG" = "yes"; then
+                    LIBS="-lopenjp2 $LIBS"
+                fi
+            fi
         fi
     fi
   fi
@@ -2575,8 +2585,11 @@ else
   elif test -r $with_openjpeg/include/openjpeg-2.2/openjpeg.h ; then
     OPENJPEG_VERSION=20200
     EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES"
+  elif test -r $with_openjpeg/include/openjpeg-2.3/openjpeg.h ; then
+    OPENJPEG_VERSION=20300
+    EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES"
   else
-    AC_MSG_ERROR([openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0 or $with_openjpeg/include/openjpeg-2.1 or $with_openjpeg/include/openjpeg-2.2])
+    AC_MSG_ERROR([openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0 or $with_openjpeg/include/openjpeg-2.1 or $with_openjpeg/include/openjpeg-2.2 or $with_openjpeg/include/openjpeg-2.3])
   fi
 
   AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,-L$with_openjpeg/lib)
diff --git a/frmts/openjpeg/openjpegdataset.cpp b/frmts/openjpeg/openjpegdataset.cpp
index 1111111..2222222 100644
--- a/frmts/openjpeg/openjpegdataset.cpp
+++ b/frmts/openjpeg/openjpegdataset.cpp
@@ -34,7 +34,9 @@
 #pragma clang diagnostic ignored "-Wdocumentation"
 #endif
 
-#if defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20200
+#if defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20300
+#include <openjpeg-2.3/openjpeg.h>
+#elif defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20200
 #include <openjpeg-2.2/openjpeg.h>
 #elif defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20100
 #include <openjpeg-2.1/openjpeg.h>
diff --git a/nmake.opt b/nmake.opt
index 1111111..2222222 100644
--- a/nmake.opt
+++ b/nmake.opt
@@ -611,6 +611,8 @@ OCI_INCLUDE =	-I$(ORACLE_HOME)\oci\include
 #OPENJPEG_VERSION = 20100
 # For OpenJpeg 2.2.x, uncomment
 #OPENJPEG_VERSION = 20200
+# For OpenJpeg 2.3.x, uncomment
+#OPENJPEG_VERSION = 20300
 
 #if using an external zlib uncomment the following lines
 #ZLIB_EXTERNAL_LIB = 1