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 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 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 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 +#elif defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20200 #include #elif defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20100 #include 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