Commit 655cc676 authored by sw897's avatar sw897

update to 1.4.0

parent 43eed2f7
Frank Warmerdam <warmerdam@pobox.com> et al.
# Top-level CMakeLists.txt for the CMake-based build and test system
# of the shapelib software.
# Copyright (C) 2012-2013 Alan W. Irwin
# See README.CMake
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; version 2 of the License.
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with this file; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# It is a fatal error if no working C compiler is available to build
# the shapelib library and utilities
project(shapelib C)
message(STATUS "CMake version = ${CMAKE_VERSION}")
message(STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}")
# Version 2.8.5 or above of cmake is currently required for all platforms.
cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR)
# libraries are all shared by default.
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
# Use rpath?
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# No rpath on Darwin. Setting it will only cause trouble.
else(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
option(USE_RPATH "Use -rpath when linking libraries, executables" ON)
endif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# In windows all created dlls are gathered in the dll directory
# if you add this directory to your PATH all shared libraries are available
if(BUILD_SHARED_LIBS AND WIN32 AND NOT CYGWIN)
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dll)
endif(BUILD_SHARED_LIBS AND WIN32 AND NOT CYGWIN)
set(PACKAGE shp)
# Set up install locations.
set(
CMAKE_INSTALL_BINDIR
${CMAKE_INSTALL_PREFIX}/bin
CACHE PATH "install location for user executables"
)
set(
CMAKE_INSTALL_LIBDIR
${CMAKE_INSTALL_PREFIX}/lib
CACHE PATH "install location for object code libraries"
)
set(
CMAKE_INSTALL_INCLUDEDIR
${CMAKE_INSTALL_PREFIX}/include
CACHE PATH "install location for C header files"
)
set(
CMAKE_INSTALL_SHP_DATADIR
${CMAKE_INSTALL_PREFIX}/share/${PACKAGE}
CACHE PATH "install location for read-only architecture-independent shp data"
)
# Export build information to help other projects link installed
# shapelib software. Only one of these signatures is required
# for the export_shp name.
install(EXPORT export_shp DESTINATION ${CMAKE_INSTALL_SHP_DATADIR})
# Initial boilerplate done, now build library and executables.
set(lib_SRC
shpopen.c
dbfopen.c
safileio.c
shptree.c
sbnsearch.c
)
option(SHP_DROP_UNABLE_TO_OPEN_MSG "Drop \"unable to open\" error messages" ON)
if(SHP_DROP_UNABLE_TO_OPEN_MSG)
#define the SHP_DROP_UNABLE_TO_OPEN_MSG C macro for this source file.
set_source_files_properties(shpopen.c
PROPERTIES
COMPILE_DEFINITIONS SHP_DROP_UNABLE_TO_OPEN_MSG
)
endif(SHP_DROP_UNABLE_TO_OPEN_MSG)
add_library(shp ${lib_SRC})
if(WIN32 AND NOT CYGWIN)
set_target_properties(shp
PROPERTIES
COMPILE_DEFINITIONS SHAPELIB_DLLEXPORT
)
endif(WIN32 AND NOT CYGWIN)
if(UNIX)
find_library(M_LIB m)
if(M_LIB)
TARGET_LINK_LIBRARIES(shp -lm)
endif()
endif(UNIX)
set(shp_SOVERSION 1)
set(shp_VERSION 1.4.0)
set_target_properties(shp
PROPERTIES
SOVERSION ${shp_SOVERSION}
VERSION ${shp_VERSION}
INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}"
)
if(USE_RPATH)
set_target_properties(shp
PROPERTIES
INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}"
)
endif(USE_RPATH)
install(TARGETS shp
EXPORT export_shp
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
# executables to be built and installed.
set(executables
shpcreate
shpadd
shpdump
shprewind
dbfcreate
dbfadd
dbfdump
shptreedump
)
find_program(BASH_EXECUTABLE bash)
find_program(SED_EXECUTABLE sed)
if(BASH_EXECUTABLE AND SED_EXECUTABLE)
set(BUILD_TEST ON)
else(BASH_EXECUTABLE AND SED_EXECUTABLE)
message(STATUS "WARNING: sed or bash not available so disabling testing")
endif(BASH_EXECUTABLE AND SED_EXECUTABLE)
# For the first series of tests, the user needs to have downloaded
# from http://dl.maptools.org/dl/shapelib/shape_eg_data.zip, unpacked
# that file, and specified the location of that directory with
# the cmake option, -DEG_DATA:PATH=whatever
if(BUILD_TEST)
if(EG_DATA)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/script.sed "s?/u/www/projects/shapelib/eg_data?${EG_DATA}?\n")
else(EG_DATA)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/script.sed "")
message(STATUS "WARNING: EG_DATA:PATH not set to point to downloaded eg_data directory so the eg_data part of testing will be ignored.")
endif(EG_DATA)
endif(BUILD_TEST)
foreach(executable ${executables})
add_executable(${executable} ${executable}.c)
target_link_libraries(${executable} shp)
if(USE_RPATH)
set_target_properties(${executable}
PROPERTIES
INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}"
)
endif(USE_RPATH)
if(BUILD_TEST)
get_target_property(${executable}_LOC ${executable} LOCATION)
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/script.sed "s?\\./${executable}?${${executable}_LOC}?\n")
endif(BUILD_TEST)
install(TARGETS ${executable} DESTINATION ${CMAKE_INSTALL_BINDIR})
endforeach(executable ${executables})
# Install header
install(FILES shapefil.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if(BUILD_TEST)
# Set up tests:
enable_testing()
# Other executables to be built to facilitate tests.
foreach(executable shptest shputils)
add_executable(${executable} ${executable}.c)
target_link_libraries(${executable} shp)
get_target_property(${executable}_LOC ${executable} LOCATION)
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/script.sed "s?\\./${executable}?${${executable}_LOC}?\n")
endforeach(executable shptest shputils)
# Write this as a shell script since execute_process cannot handle
# anything like redirection.
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/script.sh "${SED_EXECUTABLE} -f script.sed < $1 >| $2")
execute_process(
COMMAND
${BASH_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/script.sh ${CMAKE_CURRENT_SOURCE_DIR}/tests/test1.sh ${CMAKE_CURRENT_BINARY_DIR}/sed_scripted_test1.sh
)
execute_process(
COMMAND
${BASH_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/script.sh ${CMAKE_CURRENT_SOURCE_DIR}/tests/test2.sh ${CMAKE_CURRENT_BINARY_DIR}/sed_scripted_test2.sh
)
execute_process(
COMMAND
${BASH_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/script.sh ${CMAKE_CURRENT_SOURCE_DIR}/tests/test3.sh ${CMAKE_CURRENT_BINARY_DIR}/sed_scripted_test3.sh
)
if(EG_DATA)
# These tests correspond to everything in test1.sh
add_test(
NAME test1
COMMAND ${BASH_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/sed_scripted_test1.sh
)
endif(EG_DATA)
# These tests correspond to everything in test2.sh
add_test(
NAME test2
COMMAND ${BASH_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/sed_scripted_test2.sh
)
# These tests correspond to everything in test3.sh
add_test(
NAME test3
COMMAND ${BASH_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/sed_scripted_test3.sh
)
endif(BUILD_TEST)
2016-12-09 Even Rouault <even.rouault at spatialys.com>
* Makefile.am: install web/maptools.css
* Shapelib 1.4.0 released
2016-12-06 Even Rouault <even.rouault at spatialys.com>
* configure.ac: change soname to 2:1:0 to be in sync with Debian soname.
http://bugzilla.maptools.org/show_bug.cgi?id=2628
Patch by Bas Couwenberg
* contrib/doc/Shape_PointInPoly_README.txt, contrib/shpgeo.c: typo fixes.
http://bugzilla.maptools.org/show_bug.cgi?id=2629
Patch by Bas Couwenberg
* web/*: use a local .css file to avoid a privacy breach issue reported
by the lintian QA tool.
http://bugzilla.maptools.org/show_bug.cgi?id=2630
Patch by Bas Couwenberg
2016-12-06 Even Rouault <even.rouault at spatialys.com>
* web/release.html, HOWTO-RELEASE, configure.ac, CMakeLists.txt: prepare
for 1.4.0 release.
2016-12-05 Even Rouault <even.rouault at spatialys.com>
* dbfopen.c, shapefil.h: write DBF end-of-file character 0x1A by default.
This behaviour can be controlled with the DBFSetWriteEndOfFileChar()
function.
2016-12-05 Even Rouault <even.rouault at spatialys.com>
* Major overhaul of Makefile build system to use autoconf/automake.
Contributed by Sandro Mani: https://github.com/manisandro/shapelib/tree/autotools
* Warning fixes in contrib/
2016-12-04 Even Rouault <even.rouault at spatialys.com>
* shpopen.c, dbfopen.c, shptree.c, shapefil.h: resync with
GDAL Shapefile driver. Mostly cleanups. SHPObject and DBFInfo
structures extended with new members. New functions:
DBFSetLastModifiedDate, SHPOpenLLEx, SHPRestoreSHX,
SHPSetFastModeReadObject
* sbnsearch.c: new file to implement original ESRI .sbn spatial
index reading. (no write support). New functions:
SBNOpenDiskTree, SBNCloseDiskTree, SBNSearchDiskTree,
SBNSearchDiskTreeInteger, SBNSearchFreeIds
* Makefile, makefile.vc, CMakeLists.txt, shapelib.def: updates
with new file and symbols.
* commit: helper script to cvs commit
2013-11-26 Frank Warmerdam <warmerdam@pobox.com>
* CMakeLists.txt: CMake support from Alan W. Irwin.
* dbfdump.c: untested reporting for deleted records.
2012-04-10 Frank Warmerdam <warmerdam@google.com>
* Shapelib 1.3.0 released.
2012-01-27 Frank Warmerdam <warmerdam@pobox.com>
* shptree.c: optimize quadtree generation (gdal #4472)
......
Producing Shapelib Releases
===========================
1) Update web/release.html with change notes on the new release and commit.
2) Build the release files.
./mkrelease.sh 1.3.0
3) Upload:
scp shapelib-1.3.0{.tar.gz,.zip} warmerdam@upload.osgeo.org:/osgeo/download/shapelib
... add upload notes to maptools.org ...
4) Announce on shapelib mailing list.
This diff is collapsed.
## Process this file with automake to produce Makefile.in
SUBDIRS = . contrib
ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = dist-zip
if PLATFORM_WIN32
no_undefined = -no-undefined
endif
# Extra files to distribute in the source tarball
EXTRA_DIST = makefile.vc CMakeLists.txt autogen.sh \
tests/test1.sh tests/test2.sh tests/test3.sh \
tests/stream1.out tests/stream1.out tests/stream1.out \
web/maptools.css \
web/codepage.html \
web/index.html \
web/shapelib-tools.html \
web/shp_api.html \
web/release.html \
web/dbf_api.html \
web/license.html \
web/manifest.html \
README.tree README.CMake
# pkg-config file
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = shapelib.pc
# Library
lib_LTLIBRARIES = libshp.la
libshp_la_includedir = $(includedir)
libshp_la_include_HEADERS = shapefil.h
libshp_la_SOURCES = shpopen.c dbfopen.c safileio.c shptree.c sbnsearch.c
libshp_la_LDFLAGS = -version-info $(SHAPELIB_SO_VERSION) $(no_undefined) $(LIBM)
# Installed executables
bin_PROGRAMS = dbfadd dbfcreate dbfdump shpadd shpcreate shpdump shprewind shptreedump shputils
dbfadd_SOURCES = dbfadd.c
dbfadd_LDADD = $(top_builddir)/libshp.la
dbfcreate_SOURCES = dbfcreate.c
dbfcreate_LDADD = $(top_builddir)/libshp.la
dbfdump_SOURCES = dbfdump.c
dbfdump_LDADD = $(top_builddir)/libshp.la
shpadd_SOURCES = shpadd.c
shpadd_LDADD = $(top_builddir)/libshp.la
shpcreate_SOURCES = shpcreate.c
shpcreate_LDADD = $(top_builddir)/libshp.la
shpdump_SOURCES = shpdump.c
shpdump_LDADD = $(top_builddir)/libshp.la
shprewind_SOURCES = shprewind.c
shprewind_LDADD = $(top_builddir)/libshp.la
shptreedump_SOURCES = shptreedump.c
shptreedump_LDADD = $(top_builddir)/libshp.la
shputils_SOURCES = shputils.c
shputils_LDADD = $(top_builddir)/libshp.la
# Non-installed executables
noinst_PROGRAMS = shptest
shptest_SOURCES = shptest.c
shptest_LDADD = $(top_builddir)/libshp.la
# Tests
TESTS_ENVIRONMENT = top_builddir=$(abs_top_builddir)
# tests/test1.sh requires ftp://gdal.velocet.ca/pub/outgoing/shape_eg_data.zip
TESTS = tests/test2.sh tests/test3.sh
This diff is collapsed.
See ChangeLog
Building on Unix
----------------
1) run ./configure to generate build scripts
Note: type ./configure --help for a list of fine-tuning options
2) type "make"
3) type "make check" to perform self-tests
4) type "make install" to install
Building on Windows
-------------------
If you have run the VC++ VCVARS32.BAT, you should be able to type the
following in a command window to build the code and executables:
C:> nmake /f makefile.vc
Otherwise create your own VC++ project. There aren't many files to deal with
here!
The CMakeLists.txt file in the current directory is a complete build
system for shapelib which does everything that the shapelib Makefile
does and Linux and the shapelib makefile.vc file does on Windows with
a lot more flexibility. For example, full testing can be done with
the present CMake-based approach because an optional and configurable
location is used for the downloadable (for example, wget
http://dl.maptools.org/dl/shapelib/shape_eg_data.zip) eg_data tree
that is used for all the "stream1" tests.
To use this build system on Unix or MinGW/MSYS/Windows:
(1) (Optional) Download eg_data from the location above.
(2) Download shapelib-1.3.0.tar.gz from http://download.osgeo.org/shapelib
and unpack it
(3) Copy the CMakeLists.txt file into the top-level of the unpacked
shapelib-1.3.0 source tree.
(4) Apply shapelib.patch (which optionally quiets error messages when
shapelib is unable to open shapefiles). First change directory
to the top-level of the shapelib-1.3.0 source tree, then
patch -p1 < <full path to shapelib.patch>
(5) Create a separate empty build tree and use it to configure, build,
install and test shapelib. For example (you will need to tailor the
compiler, compile options, install prefix, eg_data location, and source tree location to your own
needs):
mkdir build_dir
cd build_dir
# Configure with the compiler and compiler options of your choice.
# N.B. the gcc -fvisibility=hidden option not (yet) supported by shapelib.
env CC=gcc CFLAGS="-O3 -Wuninitialized" \
cmake \
-G "Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX=/home/software/shapelib/install \
-DEG_DATA:PATH=/home/software/shapefile/eg_data/ \
../shapelib-1.3.0 >& cmake.out
# Build and install
make VERBOSE=1 -j4 install >& install.out
# Test
ctest
The -DEG_DATA:PATH option is optional, but if you don't specify
the eg_data directory that way the stream1 tests will be dropped.
Note the above procedure is what you should do on a Unix platform like
Linux where the generator -G "Unix Makefiles" works well. On
MINGW/MSYS the procedure is essentially the same except you should use
the -G "MSYS Makefiles" cmake option instead to specify a good generator
for that platform.
I have used variants of the above procedure to create, test, and
install shapelib on both the Linux and MinGW/MSYS/Wine platforms.
Furthermore, on both platforms I have built and tested PLplot using
the installed versions created by the above procedure. No issues were
discovered with PLplot example 19 (which demos PLplot map capabilities with
map shapefiles) for these two separate platform tests.
This diff is collapsed.
#! /bin/sh
# Wrapper for Microsoft lib.exe
me=ar-lib
scriptversion=2012-03-01.08; # UTC
# Copyright (C) 2010-2014 Free Software Foundation, Inc.
# Written by Peter Rosin <peda@lysator.liu.se>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
# func_error message
func_error ()
{
echo "$me: $1" 1>&2
exit 1
}
file_conv=
# func_file_conv build_file
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv in
mingw)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin)
file=`cygpath -m "$file" || echo "$file"`
;;
wine)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_at_file at_file operation archive
# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE
# for each of them.
# When interpreting the content of the @FILE, do NOT use func_file_conv,
# since the user would need to supply preconverted file names to
# binutils ar, at least for MinGW.
func_at_file ()
{
operation=$2
archive=$3
at_file_contents=`cat "$1"`
eval set x "$at_file_contents"
shift
for member
do
$AR -NOLOGO $operation:"$member" "$archive" || exit $?
done
}
case $1 in
'')
func_error "no command. Try '$0 --help' for more information."
;;
-h | --h*)
cat <<EOF
Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...]
Members may be specified in a file named with @FILE.
EOF
exit $?
;;
-v | --v*)
echo "$me, version $scriptversion"
exit $?
;;
esac
if test $# -lt 3; then
func_error "you must specify a program, an action and an archive"
fi
AR=$1
shift
while :
do
if test $# -lt 2; then
func_error "you must specify a program, an action and an archive"
fi
case $1 in
-lib | -LIB \
| -ltcg | -LTCG \
| -machine* | -MACHINE* \
| -subsystem* | -SUBSYSTEM* \
| -verbose | -VERBOSE \
| -wx* | -WX* )
AR="$AR $1"
shift
;;
*)
action=$1
shift
break
;;
esac
done
orig_archive=$1
shift
func_file_conv "$orig_archive"
archive=$file
# strip leading dash in $action
action=${action#-}
delete=
extract=
list=
quick=
replace=
index=
create=
while test -n "$action"
do
case $action in
d*) delete=yes ;;
x*) extract=yes ;;
t*) list=yes ;;
q*) quick=yes ;;
r*) replace=yes ;;
s*) index=yes ;;
S*) ;; # the index is always updated implicitly
c*) create=yes ;;
u*) ;; # TODO: don't ignore the update modifier
v*) ;; # TODO: don't ignore the verbose modifier
*)
func_error "unknown action specified"
;;
esac
action=${action#?}
done
case $delete$extract$list$quick$replace,$index in
yes,* | ,yes)
;;
yesyes*)
func_error "more than one action specified"
;;
*)
func_error "no action specified"
;;
esac
if test -n "$delete"; then
if test ! -f "$orig_archive"; then
func_error "archive not found"
fi
for member
do
case $1 in
@*)
func_at_file "${1#@}" -REMOVE "$archive"
;;
*)
func_file_conv "$1"
$AR -NOLOGO -REMOVE:"$file" "$archive" || exit $?
;;
esac
done
elif test -n "$extract"; then
if test ! -f "$orig_archive"; then
func_error "archive not found"
fi
if test $# -gt 0; then
for member
do
case $1 in
@*)
func_at_file "${1#@}" -EXTRACT "$archive"
;;
*)
func_file_conv "$1"
$AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $?
;;
esac
done
else
$AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
do
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
done
fi
elif test -n "$quick$replace"; then
if test ! -f "$orig_archive"; then
if test -z "$create"; then
echo "$me: creating $orig_archive"
fi
orig_archive=
else
orig_archive=$archive
fi
for member
do
case $1 in
@*)
func_file_conv "${1#@}"
set x "$@" "@$file"
;;
*)
func_file_conv "$1"
set x "$@" "$file"
;;
esac
shift
shift
done
if test -n "$orig_archive"; then
$AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $?
else
$AR -NOLOGO -OUT:"$archive" "$@" || exit $?
fi
elif test -n "$list"; then
if test ! -f "$orig_archive"; then
func_error "archive not found"
fi
$AR -NOLOGO -LIST "$archive" || exit $?
fi
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir="$(dirname "$(readlink -f $0)")"
(test -f $srcdir/configure.ac) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level package directory"
echo
exit 1
}
(libtool --version) < /dev/null > /dev/null 2>&1 || {
echo "**Error**: You must have \`libtool' installed."
echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
echo
exit 1
}
(autoreconf --version) < /dev/null > /dev/null 2>&1 || {
echo "**Error**: You must have \`autoreconf' installed."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
echo
exit 1
}
(
cd "$srcdir"
echo "Running autoreconf..."
autoreconf -fiv
)
if test x$NOCONFIGURE = x; then
echo Running $srcdir/configure "$@" ...
$srcdir/configure "$@" \
&& echo Now type \`make\' to compile. || exit 1
else
echo Skipping configure process.
fi
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
dnl Process this file with autoconf to produce a configure script.
m4_define(shapelib_version_major, 1)
m4_define(shapelib_version_minor, 4)
m4_define(shapelib_version_micro, 0)
AC_PREREQ(2.62)
AC_INIT(shapelib, shapelib_version_major.shapelib_version_minor.shapelib_version_micro)
AC_CONFIG_MACRO_DIR(m4)
AC_CONFIG_SRCDIR(shapefil.h)
AM_INIT_AUTOMAKE([-Wall])
AM_SILENT_RULES([yes])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
dnl See http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
AC_SUBST([SHAPELIB_SO_VERSION], [2:1:0])
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O
AC_LANG([C])
AC_LANG([C++])
dnl ************************** Libtool initialization *************************
LT_INIT
dnl ********************************* Modules *********************************
AC_ARG_WITH([proj-cflags],
[AS_HELP_STRING([--with-proj-cflags], [CFLAGS for the PROJ.4 headers])],
[if test "$withval" != ""; then PROJ_CFLAGS="$withval"; else PROJ_CFLAGS=""; fi],
[PROJ_CFLAGS='-DPROJ4'])
AC_SUBST([PROJ_CFLAGS])
AC_ARG_WITH([proj-libs],
[AS_HELP_STRING([--with-proj-libs], [LIBS for the PROJ.4 libraries])],
[PROJ_LIBS="$withval"],
[PROJ_LIBS='-lproj'])
AC_SUBST([PROJ_LIBS])
dnl ****************************** Detect libm *******************************
AC_CHECK_LIB(m,floor,LIBM=-lm)
AC_SUBST([LIBM])
dnl ****************************** Detect Win32 *******************************
AC_MSG_CHECKING([for some Win32 platform])
case "$host" in
*-*-mingw*|*-*-cygwin*)
platform_win32=yes
;;
*)
platform_win32=no
;;
esac
AC_MSG_RESULT([$platform_win32])
AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
dnl ********************************* Summary *********************************
echo
echo "Configuration summary for $PACKAGE $VERSION:"
echo " - Host: ${host}"
echo " - PROJ flags: $PROJ_CFLAGS $PROJ_LIBS"
echo
AC_CONFIG_FILES([Makefile contrib/Makefile shapelib.pc])
AC_OUTPUT
CONTRIB_CFLAGS = -I$(top_srcdir) -DDEBUG -DDEBUG2
# Extra files to distribute in the source tarball
EXTRA_DIST = makefile.vc tests/shpproj.sh doc/Shape_PointInPoly_README.txt doc/shpproj.txt doc/shpsort.txt ShapeFileII.pas
# Installed executables
bin_PROGRAMS = dbfcat dbfinfo shpcat shpdxf shpfix shpsort Shape_PointInPoly shpcentrd shpdata shpinfo shpproj shpwkb
dbfcat_SOURCES = dbfcat.c
dbfcat_CPPFLAGS = $(CONTRIB_CFLAGS)
dbfcat_LDADD = $(top_builddir)/libshp.la
dbfinfo_SOURCES = dbfinfo.c
dbfinfo_CPPFLAGS = $(CONTRIB_CFLAGS)
dbfinfo_LDADD = $(top_builddir)/libshp.la
shpcat_SOURCES = shpcat.c
shpcat_CPPFLAGS = $(CONTRIB_CFLAGS)
shpcat_LDADD = $(top_builddir)/libshp.la
shpdxf_SOURCES = shpdxf.c
shpdxf_CPPFLAGS = $(CONTRIB_CFLAGS)
shpdxf_LDADD = $(top_builddir)/libshp.la
shpfix_SOURCES = shpfix.c
shpfix_CPPFLAGS = $(CONTRIB_CFLAGS)
shpfix_LDADD = $(top_builddir)/libshp.la
shpsort_SOURCES = shpsort.c
shpsort_CPPFLAGS = $(CONTRIB_CFLAGS)
shpsort_LDADD = $(top_builddir)/libshp.la -lm
Shape_PointInPoly_SOURCES = Shape_PointInPoly.cpp
Shape_PointInPoly_CPPFLAGS = $(CONTRIB_CFLAGS)
Shape_PointInPoly_LDADD = $(top_builddir)/libshp.la
shpcentrd_SOURCES = shpcentrd.c shpgeo.c shpgeo.h
shpcentrd_CPPFLAGS = $(CONTRIB_CFLAGS) $(PROJ_CFLAGS)
shpcentrd_LDADD = $(top_builddir)/libshp.la $(PROJ_LIBS) -lm
shpdata_SOURCES = shpdata.c shpgeo.c shpgeo.h
shpdata_CPPFLAGS = $(CONTRIB_CFLAGS) $(PROJ_CFLAGS)
shpdata_LDADD = $(top_builddir)/libshp.la $(PROJ_LIBS) -lm
shpinfo_SOURCES = shpinfo.c shpgeo.c shpgeo.h
shpinfo_CPPFLAGS = $(CONTRIB_CFLAGS) $(PROJ_CFLAGS)
shpinfo_LDADD = $(top_builddir)/libshp.la $(PROJ_LIBS) -lm
shpproj_SOURCES = shpproj.c shpgeo.c shpgeo.h
shpproj_CPPFLAGS = $(CONTRIB_CFLAGS) $(PROJ_CFLAGS)
shpproj_LDADD = $(top_builddir)/libshp.la $(PROJ_LIBS) -lm
shpwkb_SOURCES = shpwkb.c shpgeo.c shpgeo.h
shpwkb_CPPFLAGS = $(CONTRIB_CFLAGS) $(PROJ_CFLAGS)
shpwkb_LDADD = $(top_builddir)/libshp.la $(PROJ_LIBS) -lm
# Tests
TESTS_ENVIRONMENT = top_builddir=$(abs_top_builddir)
TESTS = tests/shpproj.sh
This diff is collapsed.
{
/******************************************************************************
* $Id: ShapeFileII.pas,v 1.3 2003-05-14 20:04:51 warmerda Exp $
* $Id: ShapeFileII.pas,v 1.4 2016-12-05 12:44:07 erouault Exp $
*
* Project: Shapelib
* Purpose: Delphi Pascal interface to Shapelib.
......@@ -10,7 +10,7 @@
* Copyright (c) 2002, Keven Meyer (Kevin@CyberTracker.co.za)
*
* This software is available under the following "MIT Style" license,
* or at the option of the licensee under the LGPL (see LICENSE.LGPL). This
* or at the option of the licensee under the LGPL (see COPYING). This
* option is discussed in more detail in shapelib.html.
*
* --
......@@ -35,6 +35,11 @@
******************************************************************************
*
* $Log: ShapeFileII.pas,v $
* Revision 1.4 2016-12-05 12:44:07 erouault
* * Major overhaul of Makefile build system to use autoconf/automake.
*
* * Warning fixes in contrib/
*
* Revision 1.3 2003-05-14 20:04:51 warmerda
* Changed fpSHP and fpSHX to integer at suggestion of Ivan Lucena.
*
......
/******************************************************************************
* $Id: Shape_PointInPoly.cpp,v 1.1 2004-01-09 16:47:57 fwarmerdam Exp $
* $Id: Shape_PointInPoly.cpp,v 1.2 2016-12-05 12:44:07 erouault Exp $
*
* Project: Shapelib
* Purpose: Commandline program to generate points-in-polygons from a
......@@ -10,7 +10,7 @@
* Copyright (c) 2004, Marko Podgorsek, d-mon@siol.net
*
* This software is available under the following "MIT Style" license,
* or at the option of the licensee under the LGPL (see LICENSE.LGPL). This
* or at the option of the licensee under the LGPL (see COPYING). This
* option is discussed in more detail in shapelib.html.
*
* --
......@@ -35,13 +35,18 @@
******************************************************************************
*
* $Log: Shape_PointInPoly.cpp,v $
* Revision 1.2 2016-12-05 12:44:07 erouault
* * Major overhaul of Makefile build system to use autoconf/automake.
*
* * Warning fixes in contrib/
*
* Revision 1.1 2004-01-09 16:47:57 fwarmerdam
* New
*
*/
static char rcsid[] =
"$Id: Shape_PointInPoly.cpp,v 1.1 2004-01-09 16:47:57 fwarmerdam Exp $";
"$Id: Shape_PointInPoly.cpp,v 1.2 2016-12-05 12:44:07 erouault Exp $";
#include <string.h>
#include <stdlib.h>
......
This diff is collapsed.
......@@ -10,6 +10,11 @@
*
*
* $Log: dbfinfo.c,v $
* Revision 1.4 2016-12-05 12:44:07 erouault
* * Major overhaul of Makefile build system to use autoconf/automake.
*
* * Warning fixes in contrib/
*
* Revision 1.3 2011-07-24 03:17:46 fwarmerdam
* include string.h and stdlib.h where needed in contrib (#2146)
*
......@@ -29,7 +34,7 @@ int main( int argc, char ** argv )
DBFHandle hDBF;
int *panWidth, i, iRecord;
char szFormat[32], szField[1024];
char ftype[15], cTitle[32], nTitle[32];
char ftype[32], cTitle[32], nTitle[32];
int nWidth, nDecimals;
int cnWidth, cnDecimals;
DBFHandle cDBF;
......@@ -61,7 +66,7 @@ int main( int argc, char ** argv )
/* If there is no data in this file let the user know. */
/* -------------------------------------------------------------------- */
i = DBFGetFieldCount(hDBF);
printf ("%ld Columns, %ld Records in file\n",i,DBFGetRecordCount(hDBF));
printf ("%d Columns, %d Records in file\n",i,DBFGetRecordCount(hDBF));
/* -------------------------------------------------------------------- */
/* Compute offsets to use when printing each of the field */
......
......@@ -23,7 +23,7 @@ I wrote this function for the Autodesk Autocad 2004 MPolygon, because there was
no function to do this in the Object Arx SDK (the Acad programming SDK). Well,
it will be in the 2005 release...but, still. There is a function in the
Autodesk Map 2004 version...in the menu.
Not usefull when you need the coordinates, not the point on the screen...
Not useful when you need the coordinates, not the point on the screen...
So when the Acad version was done I was thinking of doing it on the Shape files,
too. A little bit of changing the structures and variable
types (so they're not using Object Arx) and I was done.
......
============================= ABOUT ===========================================
The program "shpsort" is a standalone program for sorting shapefiles
on one or more fields (including the pseudofield "SHAPE") and outputing
the results. People may find it useful for forcing drawing order.
============================= AUTHOR ==========================================
Eric G. Miller
California Department of Fish and Game
2004-06-30
============================= USAGE ===========================================
shpsort <INFILE> <OUTFILE> <SORT_FIELD;SORT_FIELD...> {SORT_ORDER;SORT_ORDER...}
============================= DETAILS =========================================
INFILE The input shapefile
OUTFILE The output shapefile
SORT_FIELD Any attribute field of the shapefile, including "SHAPE"
SORT_ORDER Specify "ASCENDING" or "DESCENDING" for each SORT_FIELD.
This field is optional, and is assumed to be ASCENDING
unless the exact word "DESCENDING" is specified (case
matters).
When sorting on the "SHAPE" the records are sorted as follows:
* Null shapes are treated as any other null field and will
sort to the top in ASCENDING mode. A warning is issued
for each null shape encountered.
* POINT, POINTM, POINTZ, MULTIPOINT, MULTIPOINTM, MULTIPOINTZ
and MULTIPATCH are all sorted by the maximum "Y" value of
their envelopes (not particularly useful).
* POLYLINE, POLYLINEZ and POLYLINEM are sorted by total 2d
shape length.
* POLYGON, POLYGONZ and POLYGONM are sorted by the 2d shape
area. Shapes are assumed to be in canonical ordering, so that
the area of interior rings (if any) is subtracted from the
area of exterior rings.
============================= ABOUT ===========================================
The program "shpsort" is a standalone program for sorting shapefiles
on one or more fields (including the pseudofield "SHAPE") and outputing
the results. People may find it useful for forcing drawing order.
============================= AUTHOR ==========================================
Eric G. Miller
California Department of Fish and Game
2004-06-30
============================= USAGE ===========================================
shpsort <INFILE> <OUTFILE> <SORT_FIELD;SORT_FIELD...> {SORT_ORDER;SORT_ORDER...}
============================= DETAILS =========================================
INFILE The input shapefile
OUTFILE The output shapefile
SORT_FIELD Any attribute field of the shapefile, including "SHAPE"
SORT_ORDER Specify "ASCENDING" or "DESCENDING" for each SORT_FIELD.
This field is optional, and is assumed to be ASCENDING
unless the exact word "DESCENDING" is specified (case
matters).
When sorting on the "SHAPE" the records are sorted as follows:
* Null shapes are treated as any other null field and will
sort to the top in ASCENDING mode. A warning is issued
for each null shape encountered.
* POINT, POINTM, POINTZ, MULTIPOINT, MULTIPOINTM, MULTIPOINTZ
and MULTIPATCH are all sorted by the maximum "Y" value of
their envelopes (not particularly useful).
* POLYLINE, POLYLINEZ and POLYLINEM are sorted by total 2d
shape length.
* POLYGON, POLYGONZ and POLYGONM are sorted by the 2d shape
area. Shapes are assumed to be in canonical ordering, so that
the area of interior rings (if any) is subtracted from the
area of exterior rings.
/* `NAN' constant for IEEE 754 machines.
Copyright (C) 1992, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _GNU_NAN_H
#define _GNU_NAN_H 1
/* hacked to define NAN on Solaris 2.7 if it wasn't defined */
/* IEEE Not A Number. */
#ifdef _BIG_ENDIAN
# define __nan_bytes { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 }
#endif
#ifdef _LITTLE_ENDIAN
# define __nan_bytes { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }
#endif
#ifdef __GNUC__
# define NAN \
(__extension__ ((union { unsigned char __c[8]; \
double __d; }) \
{ __nan_bytes }).__d)
#else /* Not GCC. */
static const char __nan[8] = __nan_bytes;
# define NAN (*(const double *) __nan)
#endif
#endif /* gnu_nan.h */
......@@ -26,6 +26,11 @@
*
*
* $Log: shpdata.c,v $
* Revision 1.3 2016-12-05 12:44:07 erouault
* * Major overhaul of Makefile build system to use autoconf/automake.
*
* * Warning fixes in contrib/
*
* Revision 1.2 1999-05-26 02:56:31 candrsn
* updates to shpdxf, dbfinfo, port from Shapelib 1.1.5 of dbfcat and shpinfo
*
......@@ -33,7 +38,7 @@
*
*/
#include <stdlib.h>
#include "shapefil.h"
#include "shpgeo.h"
......
......@@ -138,7 +138,7 @@ FILE *df;
default: fprintf(df, "POINT\r\n");
}
fprintf( df, " 8\r\n", df);
fprintf( df, " 8\r\n");
fprintf( df, "%s\r\n", id );
switch ( dxf_type ) {
case SHPT_ARC:
......@@ -190,7 +190,7 @@ int dxf_type;
FILE *df;
{
if ((dxf_type == SHPT_ARC) || ( dxf_type == SHPT_POLYGON))
fprintf( df, " 0\r\nSEQEND\r\n 8\r\n0\r\n", df);
fprintf( df, " 0\r\nSEQEND\r\n 8\r\n0\r\n");
}
......
......@@ -32,6 +32,28 @@
* use -DPROJ4 to compile in Projection support
*
* $Log: shpgeo.c,v $
* Revision 1.15 2016-12-06 21:13:33 erouault
* * configure.ac: change soname to 2:1:0 to be in sync with Debian soname.
* http://bugzilla.maptools.org/show_bug.cgi?id=2628
* Patch by Bas Couwenberg
*
* * contrib/doc/Shape_PointInPoly_README.txt, contrib/shpgeo.c: typo fixes.
* http://bugzilla.maptools.org/show_bug.cgi?id=2629
* Patch by Bas Couwenberg
*
* * web/*: use a local .css file to avoid a privacy breach issue reported
* by the lintian QA tool.
* http://bugzilla.maptools.org/show_bug.cgi?id=2630
* Patch by Bas Couwenberg
*
*
* Contributed by Sandro Mani: https://github.com/manisandro/shapelib/tree/autotools
*
* Revision 1.14 2016-12-05 12:44:07 erouault
* * Major overhaul of Makefile build system to use autoconf/automake.
*
* * Warning fixes in contrib/
*
* Revision 1.13 2011-07-24 03:17:46 fwarmerdam
* include string.h and stdlib.h where needed in contrib (#2146)
*
......@@ -72,12 +94,9 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "shapefil.h"
#ifndef NAN
#include "my_nan.h"
#endif
#include "shpgeo.h"
......@@ -205,7 +224,14 @@ projPJ SHPSetProjection ( int param_cnt, char **params ) {
projPJ *p = NULL;
if ( param_cnt > 0 && params[0] )
{ p = pj_init ( param_cnt, params ); }
{
p = pj_init ( param_cnt, params );
}
else
{
char* params_local[] = { "+proj=longlat", NULL };
p = pj_init ( 1, params_local );
}
return ( p );
#else
......@@ -335,7 +361,7 @@ int use_M = 0;
* **************************************************************************/
int SHPWriteSHPStream ( WKBStreamObj *stream_obj, SHPObject *psCShape ) {
int obj_storage = 0;
/*int obj_storage = 0;*/
int need_swap = 0, my_order, GeoType;
int use_Z = 0;
int use_M = 0;
......@@ -343,7 +369,7 @@ int use_M = 0;
need_swap = 1;
need_swap = ((char*) (&need_swap))[0];
realloc (stream_obj, obj_storage );
/*realloc (stream_obj, obj_storage );*/
if ( need_swap ) {
......@@ -479,9 +505,9 @@ int SHPWriteOGisWKB ( WKBStreamObj* stream_obj, SHPObject *psCShape ) {
#ifdef DEBUG2
printf (" I just allocated %d bytes to wkbObj \n",
sizeof (int) + sizeof (int) + sizeof(int) +
(int)(sizeof (int) + sizeof (int) + sizeof(int) +
( sizeof(int) * psCShape->nParts + 1 ) +
( sizeof(double) * 2 * psCShape->nVertices ) + 10 );
( sizeof(double) * 2 * psCShape->nVertices ) + 10) );
#endif
my_order = 1;
......@@ -499,7 +525,7 @@ int SHPWriteOGisWKB ( WKBStreamObj* stream_obj, SHPObject *psCShape ) {
WKBStreamWrite ( stream_obj, & LSB, 1, sizeof(char) );
#ifdef DEBUG2
printf ("this system in (%d) LSB \n");
printf ("this system in LSB \n");
#endif
......@@ -1450,7 +1476,7 @@ SHPObject* SHPClone ( SHPObject *psCShape, int lowPart, int highPart ) {
highPart = psCShape->nParts ;
#ifdef DEBUG
printf (" cloning SHP (%d parts) from ring %d upto ring %d \n",
printf (" cloning SHP (%d parts) from ring %d to ring %d \n",
psCShape->nParts, lowPart, highPart);
#endif
......
......@@ -27,6 +27,11 @@
*
*
* $Log: shpgeo.h,v $
* Revision 1.4 2016-12-05 12:44:07 erouault
* * Major overhaul of Makefile build system to use autoconf/automake.
*
* * Warning fixes in contrib/
*
* Revision 1.3 2002-01-15 14:36:56 warmerda
* upgrade to use proj_api.h
*
......@@ -67,8 +72,11 @@
extern "C" {
#endif
#ifdef PROJ4
#include "proj_api.h"
#else
typedef void* projPJ;
#endif
#define SHPD_POINT 1
#define SHPD_LINE 2
......
......@@ -27,6 +27,11 @@
*
*
* $Log: shpinfo.c,v $
* Revision 1.5 2016-12-05 12:44:07 erouault
* * Major overhaul of Makefile build system to use autoconf/automake.
*
* * Warning fixes in contrib/
*
* Revision 1.4 2011-07-24 03:17:46 fwarmerdam
* include string.h and stdlib.h where needed in contrib (#2146)
*
......@@ -99,7 +104,7 @@ int main( int argc, char ** argv )
/* -------------------------------------------------------------------- */
printf ("Info for %s\n",argv[1]);
printf ("%s(%d), %ld Records in file\n",sType,nShapeType,nEntities);
printf ("%s(%d), %d Records in file\n",sType,nShapeType,nEntities);
/* -------------------------------------------------------------------- */
/* Print out the file bounds. */
......
......@@ -26,6 +26,11 @@
*
*
* $Log: shpwkb.c,v $
* Revision 1.2 2016-12-05 12:44:07 erouault
* * Major overhaul of Makefile build system to use autoconf/automake.
*
* * Warning fixes in contrib/
*
* Revision 1.1 1999-05-26 02:29:36 candrsn
* OGis Well Known Binary test program (output only)
*
......@@ -33,6 +38,7 @@
*
*/
#include <stdlib.h>
#include "shapefil.h"
#include "shpgeo.h"
......
#!/bin/sh
#!/bin/bash
cd tests
testdir="$(dirname "$(readlink -f $0)")"
rm test*
shpcreate test point
rm -f "$testdir/test*"
$top_builddir/shpcreate "$testdir/test" point
shpadd test -83.54949956 34.992401
shpadd test -83.52162155 34.99276748
shpadd test -84.01681518 34.67275985
shpadd test -84.15596023 34.64862437
shpadd test -83.61951463 34.54927047
$top_builddir/shpadd "$testdir/test" -83.54949956 34.992401
$top_builddir/shpadd "$testdir/test" -83.52162155 34.99276748
$top_builddir/shpadd "$testdir/test" -84.01681518 34.67275985
$top_builddir/shpadd "$testdir/test" -84.15596023 34.64862437
$top_builddir/shpadd "$testdir/test" -83.61951463 34.54927047
dbfcreate test -s fd 30
dbfadd test "1"
dbfadd test "2"
dbfadd test "3"
dbfadd test "4"
dbfadd test "5"
$top_builddir/dbfcreate "$testdir/test" -s fd 30
$top_builddir/dbfadd "$testdir/test" "1"
$top_builddir/dbfadd "$testdir/test" "2"
$top_builddir/dbfadd "$testdir/test" "3"
$top_builddir/dbfadd "$testdir/test" "4"
$top_builddir/dbfadd "$testdir/test" "5"
../shpproj test test_1 -i=geographic -o="init=nad83:1002 units=us-ft"
../shpproj test_1 test_2 -o="proj=utm zone=16 units=m"
../shpproj test_2 test_3 -o=geographic
$top_builddir/contrib/shpproj "$testdir/test" "$testdir/test_1" -i=geographic -o="init=nad83:1002 units=us-ft"
$top_builddir/contrib/shpproj "$testdir/test_1" "$testdir/test_2" -o="proj=utm zone=16 units=m"
$top_builddir/contrib/shpproj "$testdir/test_2" "$testdir/test_3" -o=geographic
shpdump test > test.out
shpdump test_3 > test_3.out
result=`diff test.out test_3.out`
$top_builddir/shpdump -precision 8 "$testdir/test" > "$testdir/test.out"
$top_builddir/shpdump -precision 8 "$testdir/test_3" > "$testdir/test_3.out"
if [ -z "${result}" ]; then
echo success...
result="$(diff "$testdir/test.out" "$testdir/test_3.out")"
if [ "$result" == "" ]; then
echo "******* Test Succeeded *********"
rm -f "$testdir/test*"
exit 0
else
echo failure...
echo "******* Test Failed *********"
echo "$result"
rm -f "$testdir/test*"
exit 1
fi
rm test*
cd ..
/******************************************************************************
* $Id: dbfadd.c,v 1.9 2004-09-26 20:09:35 fwarmerdam Exp $
* $Id: dbfadd.c,v 1.10 2016-12-05 12:44:05 erouault Exp $
*
* Project: Shapelib
* Purpose: Sample application for adding a record to an existing .dbf file.
......@@ -9,7 +9,7 @@
* Copyright (c) 1999, Frank Warmerdam
*
* This software is available under the following "MIT Style" license,
* or at the option of the licensee under the LGPL (see LICENSE.LGPL). This
* or at the option of the licensee under the LGPL (see COPYING). This
* option is discussed in more detail in shapelib.html.
*
* --
......@@ -34,6 +34,11 @@
******************************************************************************
*
* $Log: dbfadd.c,v $
* Revision 1.10 2016-12-05 12:44:05 erouault
* * Major overhaul of Makefile build system to use autoconf/automake.
*
* * Warning fixes in contrib/
*
* Revision 1.9 2004-09-26 20:09:35 fwarmerdam
* avoid rcsid warnings
*
......@@ -66,7 +71,7 @@
#include "shapefil.h"
SHP_CVSID("$Id: dbfadd.c,v 1.9 2004-09-26 20:09:35 fwarmerdam Exp $")
SHP_CVSID("$Id: dbfadd.c,v 1.10 2016-12-05 12:44:05 erouault Exp $")
int main( int argc, char ** argv )
......
/******************************************************************************
* $Id: dbfcreate.c,v 1.7 2004-09-26 20:09:35 fwarmerdam Exp $
* $Id: dbfcreate.c,v 1.8 2016-12-05 12:44:05 erouault Exp $
*
* Project: Shapelib
* Purpose: Sample application for creating a new .dbf file.
......@@ -9,7 +9,7 @@
* Copyright (c) 1999, Frank Warmerdam
*
* This software is available under the following "MIT Style" license,
* or at the option of the licensee under the LGPL (see LICENSE.LGPL). This
* or at the option of the licensee under the LGPL (see COPYING). This
* option is discussed in more detail in shapelib.html.
*
* --
......@@ -34,6 +34,11 @@
******************************************************************************
*
* $Log: dbfcreate.c,v $
* Revision 1.8 2016-12-05 12:44:05 erouault
* * Major overhaul of Makefile build system to use autoconf/automake.
*
* * Warning fixes in contrib/
*
* Revision 1.7 2004-09-26 20:09:35 fwarmerdam
* avoid rcsid warnings
*
......@@ -58,7 +63,7 @@
#include <string.h>
#include "shapefil.h"
SHP_CVSID("$Id: dbfcreate.c,v 1.7 2004-09-26 20:09:35 fwarmerdam Exp $")
SHP_CVSID("$Id: dbfcreate.c,v 1.8 2016-12-05 12:44:05 erouault Exp $")
int main( int argc, char ** argv )
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
datarootdir=@datarootdir@
datadir=@datadir@
includedir=@includedir@
Name: shapelib
Description: C API for processing ESRI Shapefiles
Version: @VERSION@
Libs.private: @PROJ_LIBS@
Cflags.private: @PROJ_CFLAGS@
Libs: -L${libdir} -lshp
Cflags: -I${includedir}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment