Package: gdal
Version: 1.7.3-5
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu oneiric ubuntu-patch



In Ubuntu, the attached patch was applied to achieve the following:

If the linker is setup to use --as-needed, during configuration xerces
is not found, because it uses LDFLAGS instead of LIBS to compile the test
program. This patch adds dh_autoreconf and patches the m4 file to allow
configure to find Xerces and link it properly.


  * d/control, d/rules, d/patches/fix-xerces: Patching m4 macro to
    find xerces properly with --as-needed. (LP: #786790) Added
    dh_autoreconf to pickup patches m4 macro.


Thanks for considering the patch.


-- System Information:
Debian Release: wheezy/sid
  APT prefers oneiric-updates
  APT policy: (500, 'oneiric-updates'), (500, 'oneiric-security'), (500, 
'oneiric')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-8-generic (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
=== modified file '.pc/applied-patches'
--- .pc/applied-patches 2011-05-12 12:24:15 +0000
+++ .pc/applied-patches 2011-08-16 20:56:55 +0000
@@ -10,3 +10,4 @@
 ecw-plugin
 mrsid-plugin
 epsilon
+fix-xerces

=== added directory '.pc/fix-xerces'
=== added file '.pc/fix-xerces/.timestamp'
=== added directory '.pc/fix-xerces/m4'
=== added file '.pc/fix-xerces/m4/ax_xerces.m4'
--- .pc/fix-xerces/m4/ax_xerces.m4      1970-01-01 00:00:00 +0000
+++ .pc/fix-xerces/m4/ax_xerces.m4      2011-08-16 20:57:01 +0000
@@ -0,0 +1,268 @@
+dnl $Id: ax_xerces.m4 13277 2007-12-07 00:26:11Z mloskot $
+dnl
+dnl @synopsis AX_LIB_XERCES([MINIMUM-VERSION])
+dnl
+dnl This macro provides tests of availability of Apache Xerces C++ Parser 
+dnl of particular version or newer.
+dnl This macros checks for Apache Xerces C++ Parser headers and libraries 
+dnl and defines compilation flags
+dnl 
+dnl Macro supports following options and their values:
+dnl 1) Single-option usage:
+dnl --with-xerces - yes, no or path to Xerces C++ Parser installation prefix
+dnl 2) Three-options usage (all options are required):
+dnl --with-xerces=yes
+dnl --with-xerces-inc - path to base directory with Xerces headers
+dnl --with-xerces-lib - linker flags for Xerces
+dnl
+dnl This macro calls:
+dnl
+dnl   AC_SUBST(XERCES_CFLAGS)
+dnl   AC_SUBST(XERCES_LDFLAGS)
+dnl   AC_SUBST(XERCES_VERSION) - only if version requirement is used
+dnl
+dnl And sets:
+dnl
+dnl   HAVE_XERCES
+dnl
+dnl @category InstalledPackages
+dnl @category Cxx
+dnl @author Mateusz Loskot <mate...@loskot.net>
+dnl @version $Date: 2007-12-06 16:26:11 -0800 (Thu, 06 Dec 2007) $
+dnl @license AllPermissive
+dnl          Copying and distribution of this file, with or without 
modification,
+dnl          are permitted in any medium without royalty provided the 
copyright notice and
+dnl          this notice are preserved.
+dnl
+AC_DEFUN([AX_LIB_XERCES],
+[
+    AC_ARG_WITH([xerces],
+        AC_HELP_STRING([--with-xerces=@<:@ARG@:>@],
+            [use Xerces C++ Parser from given prefix (ARG=path); check 
standard prefixes (ARG=yes); disable (ARG=no)]
+        ),
+        [
+        if test "$withval" = "yes"; then
+            if test -d /usr/local/include/xercesc ; then 
+                xerces_prefix=/usr/local
+            elif test -d /usr/include/xercesc ; then
+                xerces_prefix=/usr
+            else
+                xerces_prefix=""
+            fi
+            xerces_requested="yes"
+        elif test -d "$withval"; then
+            xerces_prefix="$withval"
+            xerces_requested="yes"
+        else
+            xerces_prefix=""
+            xerces_requested="no"
+        fi
+        ],
+        [
+        dnl Default behavior is implicit yes
+        if test -d /usr/local/include/xercesc ; then 
+            xerces_prefix=/usr/local
+        elif test -d /usr/include/xercesc ; then
+            xerces_prefix=/usr
+        else
+            xerces_prefix="" 
+        fi
+        ]
+    )
+
+    AC_ARG_WITH([xerces-inc],
+        AC_HELP_STRING([--with-xerces-inc=@<:@DIR@:>@],
+            [path to Xerces C++ Parser headers]
+        ),
+        [xerces_include_dir="$withval"],
+        [xerces_include_dir=""]
+    )
+    AC_ARG_WITH([xerces-lib],
+        AC_HELP_STRING([--with-xerces-lib=@<:@ARG@:>@],
+            [link options for Xerces C++ Parser libraries]
+        ),
+        [xerces_lib_flags="$withval"],
+        [xerces_lib_flags=""]
+    )
+
+    XERCES_CFLAGS=""
+    XERCES_LDFLAGS=""
+    XERCES_VERSION=""
+
+    dnl
+    dnl Collect include/lib paths and flags
+    dnl 
+    run_xerces_test="no"
+
+    if test -n "$xerces_prefix"; then
+        xerces_include_dir="$xerces_prefix/include"
+        xerces_include_dir2="$xerces_prefix/include/xercesc"
+        xerces_lib_flags="-L$xerces_prefix/lib -lxerces-c -lpthread"
+        run_xerces_test="yes"
+    elif test "$xerces_requested" = "yes"; then
+        if test -n "$xerces_include_dir" -a -n "$xerces_lib_flags"; then
+            xerces_include_dir2="$xerces_include_dir/xercesc"
+            run_xerces_test="yes"
+        fi
+    else
+        run_xerces_test="no"
+    fi
+
+    dnl
+    dnl Check Xerces C++ Parser files
+    dnl
+    if test "$run_xerces_test" = "yes"; then
+
+        saved_CPPFLAGS="$CPPFLAGS"
+        CPPFLAGS="$CPPFLAGS -I$xerces_include_dir -I$xerces_include_dir2"
+
+        saved_LDFLAGS="$LDFLAGS"
+        LDFLAGS="$LDFLAGS $xerces_lib_flags"
+
+        dnl
+        dnl Check Xerces headers
+        dnl
+        AC_MSG_CHECKING([for Xerces C++ Parser headers in $xerces_include_dir 
and $xerces_include_dir2])
+
+        AC_LANG_PUSH([C++])
+        AC_COMPILE_IFELSE([
+            AC_LANG_PROGRAM(
+                [[
+@%:@include <xercesc/util/XercesDefs.hpp>
+@%:@include <xercesc/util/PlatformUtils.hpp>
+                ]],
+                [[]]
+            )],
+            [
+            XERCES_CFLAGS="-I$xerces_include_dir -I$xerces_include_dir2"
+            xerces_header_found="yes"
+            AC_MSG_RESULT([found])
+            ],
+            [
+            xerces_header_found="no"
+            AC_MSG_RESULT([not found])
+            ]
+        )
+        AC_LANG_POP([C++])
+        
+        dnl
+        dnl Check Xerces libraries
+        dnl
+        if test "$xerces_header_found" = "yes"; then
+
+            AC_MSG_CHECKING([for Xerces C++ Parser libraries])
+
+            AC_LANG_PUSH([C++])
+            AC_LINK_IFELSE([
+                AC_LANG_PROGRAM(
+                    [[
+@%:@include <xercesc/util/XercesDefs.hpp>
+@%:@include <xercesc/util/PlatformUtils.hpp>
+#if (_XERCES_VERSION >= 20200)
+XERCES_CPP_NAMESPACE_USE
+#endif
+                    ]],
+                    [[
+XMLPlatformUtils::Initialize();
+                    ]]
+                )],
+                [
+                XERCES_LDFLAGS="$xerces_lib_flags"
+                xerces_lib_found="yes"
+                AC_MSG_RESULT([found])
+                ],
+                [
+                xerces_lib_found="no"
+                AC_MSG_RESULT([not found])
+                ]
+            )
+            AC_LANG_POP([C++])
+        fi
+
+        CPPFLAGS="$saved_CPPFLAGS"
+        LDFLAGS="$saved_LDFLAGS"
+    fi
+
+    AC_MSG_CHECKING([for Xerces C++ Parser])
+
+    if test "$run_xerces_test" = "yes"; then
+        if test "$xerces_header_found" = "yes" -a "$xerces_lib_found" = "yes"; 
then
+
+            AC_SUBST([XERCES_CFLAGS])
+            AC_SUBST([XERCES_LDFLAGS])
+
+            HAVE_XERCES="yes"
+        else 
+            HAVE_XERCES="no"
+        fi
+
+        AC_MSG_RESULT([$HAVE_XERCES])
+
+        dnl
+        dnl Check Xerces version
+        dnl
+        if test "$HAVE_XERCES" = "yes"; then
+
+            xerces_version_req=ifelse([$1], [], [], [$1])
+            
+            if test  -n "$xerces_version_req"; then
+
+                AC_MSG_CHECKING([if Xerces C++ Parser version is >= 
$xerces_version_req])
+
+                if test -f "$xerces_include_dir2/util/XercesVersion.hpp"; then
+
+                    xerces_major=`cat 
$xerces_include_dir2/util/XercesVersion.hpp | \
+                                    grep 
'^#define.*XERCES_VERSION_MAJOR.*[0-9]$' | \
+                                    sed -e 's/#define XERCES_VERSION_MAJOR.//'`
+
+                    xerces_minor=`cat 
$xerces_include_dir2/util/XercesVersion.hpp | \
+                                    grep 
'^#define.*XERCES_VERSION_MINOR.*[0-9]$' | \
+                                    sed -e 's/#define XERCES_VERSION_MINOR.//'`
+
+                    xerces_revision=`cat 
$xerces_include_dir2/util/XercesVersion.hpp | \
+                                    grep 
'^#define.*XERCES_VERSION_REVISION.*[0-9]$' | \
+                                    sed -e 's/#define 
XERCES_VERSION_REVISION.//'`
+
+                    
XERCES_VERSION="$xerces_major.$xerces_minor.$xerces_revision"
+                    AC_SUBST([XERCES_VERSION])
+
+                    dnl Decompose required version string and calculate 
numerical representation
+                    xerces_version_req_major=`expr $xerces_version_req : 
'\([[0-9]]*\)'`
+                    xerces_version_req_minor=`expr $xerces_version_req : 
'[[0-9]]*\.\([[0-9]]*\)'`
+                    xerces_version_req_revision=`expr $xerces_version_req : 
'[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
+                    if test "x$xerces_version_req_revision" = "x"; then
+                        xerces_version_req_revision="0"
+                    fi
+                    
+                    xerces_version_req_number=`expr $xerces_version_req_major 
\* 10000 \
+                                               \+ $xerces_version_req_minor \* 
100 \
+                                               \+ $xerces_version_req_revision`
+
+                    dnl Calculate numerical representation of detected version
+                    xerces_version_number=`expr $xerces_major \* 10000 \
+                                          \+ $xerces_minor \* 100 \
+                                           \+ $xerces_revision`
+
+                    xerces_version_check=`expr $xerces_version_number \>\= 
$xerces_version_req_number`
+                    if test "$xerces_version_check" = "1"; then
+                        AC_MSG_RESULT([yes])
+                    else
+                        AC_MSG_RESULT([no])
+                        AC_MSG_WARN([Found Xerces C++ Parser $XERCES_VERSION, 
which is older than required. Possible compilation failure.])
+                    fi
+                else
+                    AC_MSG_RESULT([no])
+                    AC_MSG_WARN([Missing header XercesVersion.hpp. Unable to 
determine Xerces version.])
+                fi
+            fi
+        fi
+
+    else
+        HAVE_XERCES="no"
+        AC_MSG_RESULT([$HAVE_XERCES])
+
+        if test "$xerces_requested" = "yes"; then
+            AC_MSG_WARN([Xerces C++ Parser support requested but headers or 
library not found. Specify valid prefix of Xerces C++ using 
--with-xerces=@<:@DIR@:>@ or provide include directory and linker flags using 
--with-xerces-inc and --with-xerces-lib])
+        fi
+    fi
+])

=== modified file 'debian/changelog'

=== modified file 'debian/control'
--- debian/control      2011-07-13 23:15:03 +0000
+++ debian/control      2011-08-16 21:11:46 +0000
@@ -1,7 +1,8 @@
 Source: gdal
 Section: science
 Priority: extra
-Maintainer: Debian GIS Project <pkg-grass-devel@lists.alioth.debian.org>
+Maintainer: Ubuntu Developers <ubuntu-devel-disc...@lists.ubuntu.com>
+XSBC-Original-Maintainer: Debian GIS Project 
<pkg-grass-devel@lists.alioth.debian.org>
 Uploaders: Francesco Paolo Lovergine <fran...@debian.org>
 Build-Depends: debhelper (>= 8), zlib1g-dev, libnetcdf-dev (>= 1:4.0.0),
  libjasper-dev, libpng12-dev, libjpeg-dev, libgif-dev,
@@ -9,7 +10,8 @@
  python-dev, python-numpy, doxygen, d-shlibs, libgeos-dev, libmysqlclient-dev, 
python-all-dev (>= 2.3.5-11~), 
  python-central (>= 0.5), libcurl4-gnutls-dev, libsqlite3-dev, libogdi3.2-dev,
  ruby, ruby1.8-dev, chrpath, swig, libtool (>= 1.5.24-2), patch, 
libexpat1-dev, libproj-dev,
- libdap-dev, libxml2-dev, libspatialite-dev (>= 2.4.0~rc2-4), libepsilon-dev 
(>= 0.9.1)
+ libdap-dev, libxml2-dev, libspatialite-dev (>= 2.4.0~rc2-4), libepsilon-dev 
(>= 0.9.1),
+ dh-autoreconf
 Build-Conflicts: python-setuptools
 Standards-Version: 3.9.2
 XS-Python-Version: all

=== added file 'debian/patches/fix-xerces'
--- debian/patches/fix-xerces   1970-01-01 00:00:00 +0000
+++ debian/patches/fix-xerces   2011-08-16 21:08:04 +0000
@@ -0,0 +1,30 @@
+From: Clint Byrum <cl...@ubuntu.com>
+Subject: Use LIBS instead of LDFLAGS to link test program
+Bug: http://trac.osgeo.org/gdal/ticket/4195
+Bug-Ubuntu: https://launchpad.net/bugs/786790
+Forwarded: Yes
+
+Index: gdal/m4/ax_xerces.m4
+===================================================================
+--- gdal.orig/m4/ax_xerces.m4  2011-08-16 13:57:01.202891788 -0700
++++ gdal/m4/ax_xerces.m4       2011-08-16 13:57:28.721287397 -0700
+@@ -116,8 +116,8 @@
+         saved_CPPFLAGS="$CPPFLAGS"
+         CPPFLAGS="$CPPFLAGS -I$xerces_include_dir -I$xerces_include_dir2"
+ 
+-        saved_LDFLAGS="$LDFLAGS"
+-        LDFLAGS="$LDFLAGS $xerces_lib_flags"
++        saved_LIBS="$LIBS"
++        LIBS="$LIBS $xerces_lib_flags"
+ 
+         dnl
+         dnl Check Xerces headers
+@@ -180,7 +180,7 @@
+         fi
+ 
+         CPPFLAGS="$saved_CPPFLAGS"
+-        LDFLAGS="$saved_LDFLAGS"
++        LIBS="$saved_LIBS"
+     fi
+ 
+     AC_MSG_CHECKING([for Xerces C++ Parser])

=== modified file 'debian/patches/series'
--- debian/patches/series       2011-05-12 12:24:15 +0000
+++ debian/patches/series       2011-08-16 20:56:55 +0000
@@ -10,3 +10,4 @@
 ecw-plugin
 mrsid-plugin
 epsilon
+fix-xerces

=== modified file 'debian/rules'
--- debian/rules        2011-07-13 23:15:03 +0000
+++ debian/rules        2011-08-16 20:59:28 +0000
@@ -57,6 +57,7 @@
 configure: configure-stamp
 configure-stamp: 
        dh_testdir
+       dh_autoreconf sh -- ./autogen.sh
        
        for V in $(PYVERS); do \
                PYTHON=/usr/bin/python$$V ./configure --prefix=/usr \
@@ -125,7 +126,8 @@
        rm -f GDALmake.opt-*
        rm -rf $(CURDIR)/man/man1
        rm -rf $(CURDIR)/debian/tmp $(CURDIR)/debian/python-tmp
-       
+
+       dh_autoreconf_clean    
        dh_clean 
 
 install: build

=== modified file 'm4/ax_xerces.m4'
--- m4/ax_xerces.m4     2011-02-08 15:05:36 +0000
+++ m4/ax_xerces.m4     2011-08-16 20:57:28 +0000
@@ -116,8 +116,8 @@
         saved_CPPFLAGS="$CPPFLAGS"
         CPPFLAGS="$CPPFLAGS -I$xerces_include_dir -I$xerces_include_dir2"
 
-        saved_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS $xerces_lib_flags"
+        saved_LIBS="$LIBS"
+        LIBS="$LIBS $xerces_lib_flags"
 
         dnl
         dnl Check Xerces headers
@@ -180,7 +180,7 @@
         fi
 
         CPPFLAGS="$saved_CPPFLAGS"
-        LDFLAGS="$saved_LDFLAGS"
+        LIBS="$saved_LIBS"
     fi
 
     AC_MSG_CHECKING([for Xerces C++ Parser])

_______________________________________________
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel

Reply via email to