summaryrefslogtreecommitdiffstats
path: root/src/gdal-1-fixes.patch
blob: 0555bb102beff5a01011ff53dfc5afafec1f678f (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
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] Detect spatialite more effectively than just checking for
  headers in the system paths. PostgreSQL detection requires -lpthread when
  building statically. Added detection for openjpeg-2.2.


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"
@@ -2545,14 +2545,23 @@ elif test "$with_openjpeg" = "yes" -o "$with_openjpeg" = "" ; then
     if test "$HAVE_OPENJPEG" = "yes"; then
         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_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
+  fi
+
+  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
+  fi
+
+  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=20200
+      LIBS="-lopenjp2 $LIBS"
     fi
   fi
 else
@@ -2563,8 +2572,11 @@ else
   elif test -r $with_openjpeg/include/openjpeg-2.1/openjpeg.h ; then
     OPENJPEG_VERSION=20100
     EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES"
+  elif test -r $with_openjpeg/include/openjpeg-2.2/openjpeg.h ; then
+    OPENJPEG_VERSION=20200
+    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])
+    AC_MSG_ERROR([openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0, $with_openjpeg/include/openjpeg-2.1 or $with_openjpeg/include/openjpeg-2.2])
   fi
 
   AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,-L$with_openjpeg/lib)
@@ -3532,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/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 >= 20100
+#if 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>
 #else
 #include <stdio.h> /* openjpeg.h needs FILE* */
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],