[proj] 01/06: Imported Upstream version 4.9.2~rc1

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Tue Sep 8 17:48:13 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository proj.

commit 25370abd4b5b897f6af9d005009c870ee56dd16e
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Tue Sep 8 19:17:09 2015 +0200

    Imported Upstream version 4.9.2~rc1
---
 CMakeLists.txt                      |   6 +-
 ChangeLog                           |  73 +++-
 Makefile.in                         |   1 +
 cmake/Makefile.in                   |   1 +
 cmake/Proj4Config.cmake             |   3 +
 cmake/proj_config.cmake.in          |   3 +
 configure                           |  79 ++++-
 configure.in                        |  10 +-
 jniwrap/Makefile.in                 |   1 +
 jniwrap/org/Makefile.in             |   1 +
 jniwrap/org/proj4/Makefile.in       |   1 +
 jniwrap/org/proj4/PJ.java           |   2 -
 jniwrap/org/proj4/PJException.java  |   2 -
 jniwrap/org/proj4/package-info.java |   2 -
 makefile.vc                         |   1 -
 man/Makefile.in                     |   1 +
 man/man1/Makefile.in                |   1 +
 man/man1/geod.1                     |  23 +-
 man/man3/Makefile.in                |   1 +
 man/man3/geodesic.3                 |   6 +-
 mkinstalldirs                       |   2 -
 nad/CMakeLists.txt                  |   1 +
 nad/Makefile.am                     |  15 +-
 nad/Makefile.in                     |  16 +-
 nad/makefile.vc                     |   2 -
 nad/ntf_r93.gsb                     | Bin 0 -> 277424 bytes
 nad/ntv1_can.dat                    | Bin 0 -> 1113184 bytes
 nad/null.lla                        |   5 +
 nad/nzgd2kgrid0005.gsb              | Bin 0 -> 318464 bytes
 nad/proj_def.dat                    |  17 +
 nad/testflaky                       |  74 ++++
 nad/testvarious                     |  10 +
 nad/tf_out.dist                     |  13 +
 src/Makefile.am                     |   9 +-
 src/Makefile.in                     |  14 +-
 src/PJ_aea.c                        |   4 -
 src/PJ_aeqd.c                       |  76 ++--
 src/PJ_airy.c                       |   4 -
 src/PJ_aitoff.c                     |   4 -
 src/PJ_august.c                     |   1 +
 src/PJ_boggs.c                      |   1 +
 src/PJ_cc.c                         |   1 +
 src/PJ_cea.c                        |  11 +-
 src/PJ_collg.c                      |   1 +
 src/PJ_crast.c                      |   2 +
 src/PJ_denoy.c                      |   1 +
 src/PJ_eck1.c                       |   2 +
 src/PJ_eck2.c                       |   1 +
 src/PJ_eck4.c                       |   1 +
 src/PJ_eck5.c                       |   2 +
 src/PJ_fahey.c                      |   2 +
 src/PJ_gall.c                       |   2 +
 src/PJ_geos.c                       |   2 -
 src/PJ_gins8.c                      |   1 +
 src/PJ_hatano.c                     |   1 +
 src/PJ_healpix.c                    |   3 +-
 src/PJ_isea.c                       |  29 +-
 src/PJ_krovak.c                     |  16 +-
 src/PJ_larr.c                       |   1 +
 src/PJ_lask.c                       |   1 +
 src/PJ_lcca.c                       |   4 +-
 src/PJ_mbt_fps.c                    |   1 +
 src/PJ_mbtfpp.c                     |   1 +
 src/PJ_mbtfpq.c                     |   1 +
 src/PJ_mill.c                       |   2 +
 src/PJ_natearth.c                   |   2 +
 src/PJ_nell.c                       |   1 +
 src/PJ_nell_h.c                     |   2 +
 src/PJ_nocol.c                      |   2 +
 src/PJ_nzmg.c                       |   4 -
 src/PJ_putp2.c                      |   1 +
 src/PJ_qsc.c                        |  74 ++--
 src/PJ_robin.c                      |   1 +
 src/PJ_stere.c                      |   2 -
 src/PJ_sterea.c                     |   2 -
 src/PJ_vandg4.c                     |   1 +
 src/PJ_wag7.c                       |   1 +
 src/cs2cs.c                         |  22 +-
 src/dmstor.c                        |   2 +-
 src/gen_cheb.c                      |   4 +-
 src/geocent.c                       |   3 -
 src/geod.c                          |   2 +-
 src/geod_interface.c                |  29 +-
 src/geod_set.c                      |  10 +-
 src/geodesic.c                      | 672 ++++++++++++++++++++++--------------
 src/geodesic.h                      | 122 +++----
 src/jniproj.c                       |   5 -
 src/lib_proj.cmake                  |   2 +
 src/makefile.vc                     |  13 +-
 src/mk_cheby.c                      |   2 +-
 src/multistresstest.c               | 125 +++++--
 src/nad2bin.c                       |   2 +-
 src/nad_init.c                      |   6 +-
 src/pj_apply_gridshift.c            |   3 +-
 src/pj_apply_vgridshift.c           |   4 +-
 src/pj_ctx.c                        |   4 -
 src/pj_datum_set.c                  |   5 +-
 src/pj_datums.c                     |  69 ++--
 src/pj_ell_set.c                    |   7 +-
 src/pj_ellps.c                      |  88 ++---
 src/pj_fileapi.c                    |   6 +-
 src/pj_gauss.c                      |   3 +-
 src/pj_gc_reader.c                  |  21 +-
 src/pj_geocent.c                    |   6 +-
 src/pj_gridcatalog.c                |   6 +-
 src/pj_gridinfo.c                   |  10 +-
 src/pj_gridlist.c                   |   4 +-
 src/pj_init.c                       |  53 +--
 src/pj_initcache.c                  |   4 -
 src/pj_latlong.c                    |   2 -
 src/pj_log.c                        |   6 +-
 src/pj_mutex.c                      |   8 +-
 src/pj_open_lib.c                   |   4 -
 src/pj_param.c                      |   2 +-
 src/pj_pr_list.c                    |   3 +-
 src/pj_release.c                    |   2 +-
 src/pj_strerrno.c                   |   2 +-
 src/pj_strtod.c                     | 184 ++++++++++
 src/pj_transform.c                  |   8 +-
 src/pj_units.c                      |  44 +--
 src/pj_utils.c                      |  13 +-
 src/proj.def                        |   2 +
 src/proj_api.h                      |  10 +-
 src/proj_config.h.in                |  16 +
 src/proj_mdist.c                    |   2 -
 src/proj_rouss.c                    |   2 -
 src/projects.h                      |  16 +-
 src/test228.c                       |  14 +-
 128 files changed, 1456 insertions(+), 866 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6b3734b..8bd0f26 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,9 +31,9 @@ colormsg(_HIBLUE_ "Configuring PROJ:")
 #PROJ version information
 #################################################################################
 include(Proj4Version)
-proj_version(MAJOR 4 MINOR 9 PATCH 1)
-set(PROJ_API_VERSION "9")
-set(PROJ_BUILD_VERSION "9.0.0")
+proj_version(MAJOR 4 MINOR 9 PATCH 2)
+set(PROJ_API_VERSION "10")
+set(PROJ_BUILD_VERSION "10.0.1")
 
 #################################################################################
 # Build features and variants
diff --git a/ChangeLog b/ChangeLog
index 53db90f..ab3ece1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,14 +1,59 @@
+2015-05-25 Elliott Sales de Andrade <https://github.com/QuLogic>
+	* : Fix inverse stereo projection on an ellipsoid
+	https://github.com/OSGeo/proj.4/pull/277
+
+2015-09-08 Charles Karney <https://github.com/cffk>
+	* : Update Geodesic library from GeographicLib
+		* Improve accuracy of calculations by evaluating trigonometric
+		  functions more carefully and replacing the series for the reduced
+		  length with one with a smaller truncation error.
+		* The allowed ranges for longitudes and azimuths is now unlimited; it
+		  used to be [-540d, 540d).
+		* Enforce the restriction of latitude to [-90d, 90d] by returning NaNs
+		  if the latitude is outside this range.
+		* The inverse calculation sets s12 to zero for coincident points at
+		  pole (instead of returning a tiny quantity).
+		* This commit also includes a work-around for an inaccurate value for
+		  pi/180 in dmstor.c (see the definitions of DEG_IN and DEG_OUT in
+		  geod_interface.c).
+
+2015-09-06 Even Rouault <even.rouault at spatialys.com>
+	* re-add proj_def.dat which was missing from source distribution
+	https://github.com/OSGeo/proj.4/issues/274
+	https://github.com/OSGeo/proj.4/issues/296 and
+	https://github.com/OSGeo/proj.4/issues/297
+
+2015-06-01 Charles Karney <https://github.com/cffk>
+	Make PJ_aeqd.c use geodesics for inverse and forward projection
+	modification so that the geodesic structure is not global
+	https://github.com/OSGeo/proj.4/pull/281
+
+2015-07-27 Even Rouault <even.rouault at spatialys.com>
+	* : Remove setlocale() use in pj_init_ctx(), and replace uses of atof() &
+	strtod() by their locale safe variants pj_atof() and pj_strtod().
+	Proj versions from now advertize #define PJ_LOCALE_SAFE 1 in proj_api.h
+	and export pj_atof() & pj_strtod() (#226)
+
+2015-06-01 Charles Karney <https://github.com/cffk>
+	Make PJ_aeqd.c use geodesics for inverse and forward projection
+	modification so that the geodesic structure is not global
+	https://github.com/OSGeo/proj.4/pull/281
+
+2015-05-25 Elliott Sales de Andrade <https://github.com/QuLogic>
+	* : Fix inverse stereo projection on an ellipsoid
+	https://github.com/OSGeo/proj.4/pull/277
+
 2015-02-21 Even Rouault <even.rouault at spatialys.com>
 	* nad/epsg: regenerate nad/epsg with GDAL r28536 to avoid
 	precision loss in TOWGS84 parameters, e.g. on Amersfoort / RD
 	EPSG:4289 (#260)
 
 2015-02-21 Howard Butler <howard at hobu.co>
-	* cmake/Proj4Version.cmake src\lib_proj.cmake: Align 
+	* cmake/Proj4Version.cmake src\lib_proj.cmake: Align
 	SOVERSION CMake configuration with autotools #263
 
 2015-02-21 Howard Butler <howard at hobu.co>
-	* src/lib_proj.cmake: define PROJ_LIB as part 
+	* src/lib_proj.cmake: define PROJ_LIB as part
 	of the compilation defines #261
 
 2015-02-21 Even Rouault <even.rouault at spatialys.com>
@@ -48,9 +93,9 @@
 	files for dist-all target
 
 2015-02-20 Howard Butler <howard at hobu.co>
-	* CMakeLists.txt cmake/Proj4Mac.cmake 
-	man/CMakeLists.txt src/bin_cs2cs.cmake 
-	src/lib_proj.cmake: Adapt Charles Karney 
+	* CMakeLists.txt cmake/Proj4Mac.cmake
+	man/CMakeLists.txt src/bin_cs2cs.cmake
+	src/lib_proj.cmake: Adapt Charles Karney
 	CMake patches for smoother build #258
 
 2015-02-20 Howard Butler <howard at hobu.co>
@@ -58,24 +103,24 @@
 	and config.sub
 
 2015-02-17 Howard Butler <howard at hobu.co>
-	* src/PJ_aitoff.c: #250 Inverse solution for Winkel Tripel 
-	from Drazan Tutic 
+	* src/PJ_aitoff.c: #250 Inverse solution for Winkel Tripel
+	from Drazan Tutic
 
 2015-02-17 Howard Butler <howard at hobu.co>
-	* CMakeLists.txt cmake/policies.cmake src/lib_proj.cmake: #256 
-	CMake tweaks to shut off some noisy policies, fix installation 
-	of proj_config header, and shut off Framework building by 
+	* CMakeLists.txt cmake/policies.cmake src/lib_proj.cmake: #256
+	CMake tweaks to shut off some noisy policies, fix installation
+	of proj_config header, and shut off Framework building by
 	default on OSX
 
 2015-02-17 Howard Butler <howard at hobu.co>
 	* src/lib_proj.cmake CMakeLists: Fix #248 healpix compilation typo
 
 2015-02-16 Howard Butler <howard at hobu.co>
-	* src/pj_init.c: Fix #237 warning about initialization 
+	* src/pj_init.c: Fix #237 warning about initialization
 	ordering due to setlocale
 
 2015-02-16 Howard Butler <howard at hobu.co>
-	* nad/Makefile.am nad/Makefile.in and others in nad/: Fix #247 to 
+	* nad/Makefile.am nad/Makefile.in and others in nad/: Fix #247 to
 	allow out-of-tree autoconf builds
 
 2014-09-17 Even Rouault <even.rouault at spatialys.com>
@@ -85,9 +130,9 @@
 
 2014-09-16  Frank Warmerdam  <warmerdam at pobox.com>
 
-	* Generate 4.9.0 RC2. 
+	* Generate 4.9.0 RC2.
 
-	* nad/epsg: updated with Pulkova 1942(58) reverted, and vertical 
+	* nad/epsg: updated with Pulkova 1942(58) reverted, and vertical
 	coordinate system names coming through properly.
 
 	* src/pj_gridinfo.c, pj_apply_vgridshift.c, pj_apply_gridshift.c:
diff --git a/Makefile.in b/Makefile.in
index 5fe6be4..7d3fbcc 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -289,6 +289,7 @@ SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+THREAD_LIB = @THREAD_LIB@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/cmake/Makefile.in b/cmake/Makefile.in
index bd9b862..c7108fd 100644
--- a/cmake/Makefile.in
+++ b/cmake/Makefile.in
@@ -177,6 +177,7 @@ SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+THREAD_LIB = @THREAD_LIB@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/cmake/Proj4Config.cmake b/cmake/Proj4Config.cmake
index e9aa1de..fda9c9c 100644
--- a/cmake/Proj4Config.cmake
+++ b/cmake/Proj4Config.cmake
@@ -9,6 +9,7 @@
 ################################################################################
 include (CheckIncludeFiles)
 include (CheckLibraryExists) 
+include (CheckFunctionExists)
 
 # check needed include file
 check_include_files (dlfcn.h HAVE_DLFCN_H)
@@ -23,6 +24,8 @@ check_include_files (sys/types.h HAVE_SYS_TYPES_H)
 check_include_files (unistd.h HAVE_UNISTD_H)
 check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
 
+CHECK_FUNCTION_EXISTS(localeconv HAVE_LOCALECONV)
+
 # check libm need on unix 
 check_library_exists(m ceil "" HAVE_LIBM) 
 
diff --git a/cmake/proj_config.cmake.in b/cmake/proj_config.cmake.in
index 8f782a7..bbdf324 100644
--- a/cmake/proj_config.cmake.in
+++ b/cmake/proj_config.cmake.in
@@ -10,6 +10,9 @@
 /* Define to 1 if you have the `m' library (-lm). */
 #cmakedefine HAVE_LIBM 1
 
+/* Define to 1 if you have localeconv */
+#cmakedefine HAVE_LOCALECONV 1
+
 /* Define to 1 if you have the <memory.h> header file. */
 #cmakedefine HAVE_MEMORY_H 1
 
diff --git a/configure b/configure
index fbaf81d..a746a26 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for PROJ.4 Projections 4.9.1.
+# Generated by GNU Autoconf 2.69 for PROJ.4 Projections 4.9.2.
 #
 # Report bugs to <warmerdam at pobox.com>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='PROJ.4 Projections'
 PACKAGE_TARNAME='proj'
-PACKAGE_VERSION='4.9.1'
-PACKAGE_STRING='PROJ.4 Projections 4.9.1'
+PACKAGE_VERSION='4.9.2'
+PACKAGE_STRING='PROJ.4 Projections 4.9.2'
 PACKAGE_BUGREPORT='warmerdam at pobox.com'
 PACKAGE_URL=''
 
@@ -635,6 +635,7 @@ ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+THREAD_LIB
 MUTEX_SETTING
 JNI_INCLUDE
 CPP
@@ -1318,7 +1319,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures PROJ.4 Projections 4.9.1 to adapt to many kinds of systems.
+\`configure' configures PROJ.4 Projections 4.9.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1388,7 +1389,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of PROJ.4 Projections 4.9.1:";;
+     short | recursive ) echo "Configuration of PROJ.4 Projections 4.9.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1498,7 +1499,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-PROJ.4 Projections configure 4.9.1
+PROJ.4 Projections configure 4.9.2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1867,7 +1868,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by PROJ.4 Projections $as_me 4.9.1, which was
+It was created by PROJ.4 Projections $as_me 4.9.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2738,7 +2739,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='proj'
- VERSION='4.9.1'
+ VERSION='4.9.2'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -12477,6 +12478,14 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
 fi
 
 
+ac_fn_c_check_func "$LINENO" "localeconv" "ac_cv_func_localeconv"
+if test "x$ac_cv_func_localeconv" = xyes; then :
+
+$as_echo "#define HAVE_LOCALECONV 1" >>confdefs.h
+
+fi
+
+
 
 JNI_INCLUDE=
 export JNI_INCLUDE
@@ -12567,8 +12576,52 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mutexes" >&5
 $as_echo_n "checking for mutexes... " >&6; }
+THREAD_LIB=""
 if test "$with_mutex" = yes -o x"$with_mutex" = x ; then
     MUTEX_SETTING=pthread
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
+$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
+if ${ac_cv_lib_pthread_pthread_create+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpthread  $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 pthread_create ();
+int
+main ()
+{
+return pthread_create ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_pthread_pthread_create=yes
+else
+  ac_cv_lib_pthread_pthread_create=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_pthread_pthread_create" >&5
+$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
+if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then :
+  PTHREAD_EXISTS=YES
+fi
+
+    if test -n "$PTHREAD_EXISTS" ; then
+        THREAD_LIB="-lpthread"
+    fi
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutexattr_settype in -lpthread" >&5
 $as_echo_n "checking for pthread_mutexattr_settype in -lpthread... " >&6; }
 if ${ac_cv_lib_pthread_pthread_mutexattr_settype+:} false; then :
@@ -12624,6 +12677,8 @@ fi
 
 MUTEX_SETTING=$MUTEX_SETTING
 
+THREAD_LIB=$THREAD_LIB
+
 
 ac_config_files="$ac_config_files Makefile cmake/Makefile src/Makefile man/Makefile man/man1/Makefile man/man3/Makefile nad/Makefile jniwrap/Makefile jniwrap/org/Makefile jniwrap/org/proj4/Makefile"
 
@@ -13164,7 +13219,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by PROJ.4 Projections $as_me 4.9.1, which was
+This file was extended by PROJ.4 Projections $as_me 4.9.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -13230,7 +13285,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-PROJ.4 Projections config.status 4.9.1
+PROJ.4 Projections config.status 4.9.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -15549,7 +15604,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by PROJ.4 Projections $as_me 4.9.1, which was
+This file was extended by PROJ.4 Projections $as_me 4.9.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -15615,7 +15670,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-PROJ.4 Projections config.status 4.9.1
+PROJ.4 Projections config.status 4.9.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.in b/configure.in
index fd7f3c0..095a191 100644
--- a/configure.in
+++ b/configure.in
@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT([PROJ.4 Projections], 4.9.1, [warmerdam at pobox.com], proj)
+AC_INIT([PROJ.4 Projections], 4.9.2, [warmerdam at pobox.com], proj)
 AC_CONFIG_MACRO_DIR([m4])
 AC_LANG(C)
 
@@ -26,6 +26,8 @@ AC_CHECK_LIB(m,exp,,,)
 dnl We check for headers
 AC_HEADER_STDC
 
+AC_CHECK_FUNC(localeconv, [AC_DEFINE(HAVE_LOCALECONV,1,[Define to 1 if you have localeconv])])
+
 dnl ---------------------------------------------------------------------------
 dnl Check for JNI support.
 dnl ---------------------------------------------------------------------------
@@ -88,8 +90,13 @@ AC_ARG_WITH([mutex],
 	       [Disable real mutex locks (lacking pthreads)]),,)
 
 AC_MSG_CHECKING([for mutexes])
+THREAD_LIB=""
 if test "$with_mutex" = yes -o x"$with_mutex" = x ; then
     MUTEX_SETTING=pthread
+    AC_CHECK_LIB(pthread,pthread_create,PTHREAD_EXISTS=YES,,,)
+    if test -n "$PTHREAD_EXISTS" ; then
+        THREAD_LIB="-lpthread"
+    fi
     AC_CHECK_LIB(pthread,pthread_mutexattr_settype,,,)
     AC_MSG_RESULT([enabled, pthread])
 else
@@ -98,6 +105,7 @@ else
 fi
 
 AC_SUBST(MUTEX_SETTING,$MUTEX_SETTING)
+AC_SUBST(THREAD_LIB,$THREAD_LIB)
 
 AC_OUTPUT(Makefile cmake/Makefile src/Makefile man/Makefile man/man1/Makefile \
 	man/man3/Makefile nad/Makefile \
diff --git a/jniwrap/Makefile.in b/jniwrap/Makefile.in
index 07463d2..4b1dc5c 100644
--- a/jniwrap/Makefile.in
+++ b/jniwrap/Makefile.in
@@ -237,6 +237,7 @@ SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+THREAD_LIB = @THREAD_LIB@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/jniwrap/org/Makefile.in b/jniwrap/org/Makefile.in
index c5dc6a9..289f9b7 100644
--- a/jniwrap/org/Makefile.in
+++ b/jniwrap/org/Makefile.in
@@ -237,6 +237,7 @@ SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+THREAD_LIB = @THREAD_LIB@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/jniwrap/org/proj4/Makefile.in b/jniwrap/org/proj4/Makefile.in
index d2691e2..b3465be 100644
--- a/jniwrap/org/proj4/Makefile.in
+++ b/jniwrap/org/proj4/Makefile.in
@@ -177,6 +177,7 @@ SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+THREAD_LIB = @THREAD_LIB@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/jniwrap/org/proj4/PJ.java b/jniwrap/org/proj4/PJ.java
index 27b16d2..f82fe07 100644
--- a/jniwrap/org/proj4/PJ.java
+++ b/jniwrap/org/proj4/PJ.java
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: PJ.java 2092 2011-08-27 20:30:36Z desruisseaux $
- *
  * Project:  PROJ.4
  * Purpose:  Java/JNI wrappers for PROJ.4 API.
  * Author:   Martin Desruisseaux
diff --git a/jniwrap/org/proj4/PJException.java b/jniwrap/org/proj4/PJException.java
index 23bff25..18a5885 100644
--- a/jniwrap/org/proj4/PJException.java
+++ b/jniwrap/org/proj4/PJException.java
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: PJException.java 2092 2011-08-27 20:30:36Z desruisseaux $
- *
  * Project:  PROJ.4
  * Purpose:  Java/JNI wrappers for PROJ.4 API.
  * Author:   Martin Desruisseaux
diff --git a/jniwrap/org/proj4/package-info.java b/jniwrap/org/proj4/package-info.java
index c5d0144..8a6b75a 100644
--- a/jniwrap/org/proj4/package-info.java
+++ b/jniwrap/org/proj4/package-info.java
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: package-info.java 2092 2011-08-27 20:30:36Z desruisseaux $
- *
  * Project:  PROJ.4
  * Purpose:  Java/JNI wrappers for PROJ.4 API.
  * Author:   Martin Desruisseaux
diff --git a/makefile.vc b/makefile.vc
index b34d20d..6c9bb58 100644
--- a/makefile.vc
+++ b/makefile.vc
@@ -1,4 +1,3 @@
-# $Id: makefile.vc 1459 2008-07-21 21:39:44Z fwarmerdam $
 #
 # NMAKE Makefile to build PROJ.4 on Windows
 #
diff --git a/man/Makefile.in b/man/Makefile.in
index 835acba..178eeb4 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -237,6 +237,7 @@ SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+THREAD_LIB = @THREAD_LIB@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/man/man1/Makefile.in b/man/man1/Makefile.in
index 9652baa..aff916d 100644
--- a/man/man1/Makefile.in
+++ b/man/man1/Makefile.in
@@ -208,6 +208,7 @@ SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+THREAD_LIB = @THREAD_LIB@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/man/man1/geod.1 b/man/man1/geod.1
index 81a12e1..157996e 100644
--- a/man/man1/geod.1
+++ b/man/man1/geod.1
@@ -30,16 +30,22 @@ file[s]
 ]
 file[s]
 .SH DESCRIPTION
-.I Geod
+.I geod
 (direct) and
 .I invgeod
 (inverse)
-perform geodesic (\*(lqGreat Circle\*(rq) computations for determining
+perform geodesic ("Great Circle") computations for determining
 latitude, longitude and back azimuth of a terminus point
 given a initial point latitude, longitude, azimuth and distance (direct) or
 the forward and back azimuths and distance between an initial and
 terminus point latitudes and longitudes (inverse).  The results are
 accurate to round off for |\fIf\fR| < 1/50, where \fIf\fR is flattening.
+.B invgeod
+may not be available on all platforms; in this case call
+.B geod
+with the
+.B \-I
+option.
 .PP
 The following command-line options can appear in any order:
 .TP
@@ -120,12 +126,11 @@ input for the inverse mode and respective forward and back
 azimuth from the initial and terminus points are output along
 with the distance between the points.
 .PP
-Input geographic coordinates
-(latitude and longitude) and azimuthal data must be in DMS format and input
-distance data must be in units consistent with the ellipsoid
-major axis or sphere radius units.
-Output geographic coordinates will be in DMS
-(if the
+Input geographic coordinates (latitude and longitude) and azimuthal data
+must be in decimal degrees or DMS format and input distance data must be
+in units consistent with the ellipsoid major axis or sphere radius
+units.  The latitude must lie in the range [-90d,90d].  Output
+geographic coordinates will be in DMS (if the
 .B \-f
 switch is not employed) to 0.001"
 with trailing, zero-valued minute-second fields deleted.
@@ -220,4 +225,4 @@ The \fIonline geodesic bibliography\fR,
 .br
 http://geographiclib.sf.net/geodesic-papers/biblio.html
 .SH HOME PAGE
-http://proj.osgeo.org
+https://github.com/OSGeo/proj.4/wiki
diff --git a/man/man3/Makefile.in b/man/man3/Makefile.in
index bd5ebd6..24007b0 100644
--- a/man/man3/Makefile.in
+++ b/man/man3/Makefile.in
@@ -208,6 +208,7 @@ SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+THREAD_LIB = @THREAD_LIB@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/man/man3/geodesic.3 b/man/man3/geodesic.3
index 3c7668b..bf0d764 100644
--- a/man/man3/geodesic.3
+++ b/man/man3/geodesic.3
@@ -38,7 +38,7 @@ measure angles (latitudes, longitudes, and azimuths) in degrees, unlike
 the rest of the \fBproj\fR library, which uses radians.  The
 documentation for this library is included in geodesic.h.  A formatted
 version of the documentation is available at
-http://geographiclib.sf.net/1.40/C
+http://geographiclib.sf.net/1.44/C
 .SH EXAMPLE
 The following program reads in lines with the coordinates for two points
 in decimal degrees (\fIlat1\fR, \fIlon1\fR, \fIlat2\fR, \fIlon2\fR) and
@@ -72,7 +72,7 @@ libproj.a \- library of projections and support procedures
 .SH SEE ALSO
 Full online documentation for \fBgeodesic(3)\fR,
 .br
-http://geographiclib.sf.net/1.40/C
+http://geographiclib.sf.net/1.44/C
 .PP
 .B geod(1)
 .PP
@@ -94,4 +94,4 @@ The \fIonline geodesic bibliography\fR,
 .br
 http://geographiclib.sf.net/geodesic-papers/biblio.html
 .SH HOME PAGE
-http://proj.osgeo.org
+https://github.com/OSGeo/proj.4/wiki
diff --git a/mkinstalldirs b/mkinstalldirs
index 3e79669..5e17cd3 100755
--- a/mkinstalldirs
+++ b/mkinstalldirs
@@ -4,8 +4,6 @@
 # Created: 1993-05-16
 # Public domain
 
-# $Id: mkinstalldirs 791 2000-03-21 18:37:12Z warmerda $
-
 errstatus=0
 
 for file
diff --git a/nad/CMakeLists.txt b/nad/CMakeLists.txt
index df8a8c2..a9b08cb 100644
--- a/nad/CMakeLists.txt
+++ b/nad/CMakeLists.txt
@@ -12,6 +12,7 @@ set(PROJ_DICTIONARY  epsg
                      GL27
                      nad83
                      nad.lst
+                     proj_def.dat
                      CH )
 
 #
diff --git a/nad/Makefile.am b/nad/Makefile.am
index 206524b..705d65e 100644
--- a/nad/Makefile.am
+++ b/nad/Makefile.am
@@ -9,20 +9,21 @@ TEST27 = $(NADPATH)/test27
 TEST83 = $(NADPATH)/test83
 TESTNTV2 = $(NADPATH)/testntv2
 TESTVARIOUS = $(NADPATH)/testvarious
+TESTFLAKY = $(NADPATH)/testflaky
 TESTDATUMFILE = $(NADPATH)/testdatumfile
 TESTIGN = $(NADPATH)/testIGNF
 
-pkgdata_DATA = GL27 nad.lst nad27 nad83 world epsg esri \
+pkgdata_DATA = GL27 nad.lst proj_def.dat nad27 nad83 world epsg esri \
 		esri.extra other.extra \
-		CH IGNF
+		CH IGNF testIGNF proj_outIGNF.dist \
+		null.lla ntf_r93.gsb nzgd2kgrid0005.gsb ntv1_can.dat makefile.vc CMakeLists.txt
 
-EXTRA_DIST = GL27 nad.lst nad27 nad83 pj_out27.dist pj_out83.dist td_out.dist \
-		test27 test83 world epsg esri tv_out.dist \
-		testvarious testdatumfile testntv2 ntv2_out.dist \
+EXTRA_DIST = GL27 nad.lst proj_def.dat nad27 nad83 pj_out27.dist pj_out83.dist td_out.dist \
+		test27 test83 world epsg esri tv_out.dist tf_out.dist \
+		testflaky testvarious testdatumfile testntv2 ntv2_out.dist \
 		esri.extra other.extra \
 		CH IGNF testIGNF proj_outIGNF.dist \
-		makefile.vc CMakeLists.txt
-
+		null.lla ntf_r93.gsb nzgd2kgrid0005.gsb ntv1_can.dat makefile.vc CMakeLists.txt
 process-nad2bin:
 	@if [ -f $(NADPATH)/null.lla -a ! -f null ] || [ -f $(NADPATH)/conus.lla -a ! -f conus ] ; then \
 	  for x in $(NADPATH)/*.lla ; do \
diff --git a/nad/Makefile.in b/nad/Makefile.in
index 9443743..03c3d28 100644
--- a/nad/Makefile.in
+++ b/nad/Makefile.in
@@ -207,6 +207,7 @@ SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+THREAD_LIB = @THREAD_LIB@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
@@ -272,18 +273,20 @@ TEST27 = $(NADPATH)/test27
 TEST83 = $(NADPATH)/test83
 TESTNTV2 = $(NADPATH)/testntv2
 TESTVARIOUS = $(NADPATH)/testvarious
+TESTFLAKY = $(NADPATH)/testflaky
 TESTDATUMFILE = $(NADPATH)/testdatumfile
 TESTIGN = $(NADPATH)/testIGNF
-pkgdata_DATA = GL27 nad.lst nad27 nad83 world epsg esri \
+pkgdata_DATA = GL27 nad.lst proj_def.dat nad27 nad83 world epsg esri \
 		esri.extra other.extra \
-		CH IGNF
+		CH IGNF testIGNF proj_outIGNF.dist \
+		null.lla ntf_r93.gsb nzgd2kgrid0005.gsb ntv1_can.dat makefile.vc CMakeLists.txt
 
-EXTRA_DIST = GL27 nad.lst nad27 nad83 pj_out27.dist pj_out83.dist td_out.dist \
-		test27 test83 world epsg esri tv_out.dist \
-		testvarious testdatumfile testntv2 ntv2_out.dist \
+EXTRA_DIST = GL27 nad.lst proj_def.dat nad27 nad83 pj_out27.dist pj_out83.dist td_out.dist \
+		test27 test83 world epsg esri tv_out.dist tf_out.dist \
+		testflaky testvarious testdatumfile testntv2 ntv2_out.dist \
 		esri.extra other.extra \
 		CH IGNF testIGNF proj_outIGNF.dist \
-		makefile.vc CMakeLists.txt
+		null.lla ntf_r93.gsb nzgd2kgrid0005.gsb ntv1_can.dat makefile.vc CMakeLists.txt
 
 all: all-am
 
@@ -501,7 +504,6 @@ uninstall-am: uninstall-pkgdataDATA
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags-am uninstall uninstall-am uninstall-pkgdataDATA
 
-
 process-nad2bin:
 	@if [ -f $(NADPATH)/null.lla -a ! -f null ] || [ -f $(NADPATH)/conus.lla -a ! -f conus ] ; then \
 	  for x in $(NADPATH)/*.lla ; do \
diff --git a/nad/makefile.vc b/nad/makefile.vc
index 1166104..d2bba08 100644
--- a/nad/makefile.vc
+++ b/nad/makefile.vc
@@ -1,6 +1,4 @@
 #
-# $Id: makefile.vc 1635 2009-09-24 02:47:36Z warmerdam $
-#
 # makefile.vc - builds PROJ.4 library with Visual C++
 #
 
diff --git a/nad/ntf_r93.gsb b/nad/ntf_r93.gsb
new file mode 100644
index 0000000..07e34fc
Binary files /dev/null and b/nad/ntf_r93.gsb differ
diff --git a/nad/ntv1_can.dat b/nad/ntv1_can.dat
new file mode 100644
index 0000000..8acad07
Binary files /dev/null and b/nad/ntv1_can.dat differ
diff --git a/nad/null.lla b/nad/null.lla
new file mode 100644
index 0000000..eb25285
--- /dev/null
+++ b/nad/null.lla
@@ -0,0 +1,5 @@
+Null transform for whole world
+   3   3   1  -180.00000   180.00000   -90.00000   90.00000
+0: 0 0 0 0 0 0 
+1: 0 0 0 0 0 0 
+2: 0 0 0 0 0 0 
diff --git a/nad/nzgd2kgrid0005.gsb b/nad/nzgd2kgrid0005.gsb
new file mode 100644
index 0000000..840bd00
Binary files /dev/null and b/nad/nzgd2kgrid0005.gsb differ
diff --git a/nad/proj_def.dat b/nad/proj_def.dat
new file mode 100644
index 0000000..00dff28
--- /dev/null
+++ b/nad/proj_def.dat
@@ -0,0 +1,17 @@
+# Projection library defaults file
+# SCCSID--- @(#)proj_def.dat	4.3	94/02/23	GIE	REL"
+# very preliminary version
+<general>
+ellps=WGS84 
+<>
+<aea> # Conterminous U.S. map
+lat_1=29.5
+lat_2=45.5
+<>
+<lcc> # Conterminous U.S. map
+lat_1=33
+lat_2=45
+<>
+<lagrng>
+W=2
+<>
diff --git a/nad/testflaky b/nad/testflaky
new file mode 100755
index 0000000..0a28720
--- /dev/null
+++ b/nad/testflaky
@@ -0,0 +1,74 @@
+:
+# Script to do some testing of flaky transformation that do not depend
+# on datum files.
+#
+#
+NAD_DIR=`dirname $0`
+EXE=$1
+
+usage()
+{
+    echo "Usage: ${0} <path to 'cs2cs' program>"
+    echo
+    exit 1
+}
+
+if test -z "${EXE}"; then
+    EXE=../src/cs2cs
+fi
+
+if test ! -x ${EXE}; then
+    echo "*** ERROR: Can not find '${EXE}' program!"
+    exit 1
+fi
+
+echo "============================================"
+echo "Running ${0} using ${EXE}:"
+echo "============================================"
+
+OUT=tf_out
+#EXE=../src/cs2cs
+#
+echo "doing tests into file ${OUT}, please wait"
+rm -f ${OUT}
+#
+echo "Test healpix inverse projection on sphere" >> ${OUT}
+$EXE +proj=latlong +a=1 +lon_0=0 \
+ +to +proj=healpix +a=1 +lon_0=0  -f '%.'5'f' -I\
+ -E >>${OUT} <<EOF
+0 0.7853981633974483
+-1.5707963267948966 0
+EOF
+$EXE +proj=latlong +a=5 \
+ +to +proj=healpix +a=5 -f '%.'5'f' -I\
+ -E >>${OUT} <<EOF
+0.0 0.0
+0.0 3.9269908169872414
+0.0 -3.9269908169872414
+7.853981633974483 0.0
+-7.853981633974483 0.0
+-15.707963267948966 0.0
+-11.780972450961723 7.853981633974483
+-11.780972450961723 -7.853981633974483
+1.437378399445537 5.364369216432778
+1.437378399445537 -5.364369216432778
+EOF
+
+##############################################################################
+# Done!
+# do 'diff' with distribution results
+echo "diff ${OUT} with ${OUT}.dist"
+diff -b ${OUT} ${NAD_DIR}/${OUT}.dist
+if [ $? -ne 0 ] ; then
+	echo  ""
+	echo "PROBLEMS HAVE OCCURED"
+	echo "test file ${OUT} saved"
+    echo
+	exit 100
+else
+	echo "TEST OK"
+	echo "test file ${OUT} removed"
+    echo
+	/bin/rm -f ${OUT}
+	exit 0
+fi
diff --git a/nad/testvarious b/nad/testvarious
index a128eb5..694d0d1 100755
--- a/nad/testvarious
+++ b/nad/testvarious
@@ -22,6 +22,16 @@ if test ! -x ${EXE}; then
     exit 1
 fi
 
+# Would be great to have a universale way of selecting a locale with
+# a decimal separator that is not '.'
+if command locale >/dev/null 2>/dev/null; then
+    if test `locale -a | grep fr_FR.utf8`; then
+        echo "Using locale with comma as decimal separator"
+        export LC_ALL=fr_FR.UTF-8
+        export PROJ_USE_ENV_LOCALE=1
+    fi
+fi
+
 echo "============================================"
 echo "Running ${0} using ${EXE}:"
 echo "============================================"
diff --git a/nad/tf_out.dist b/nad/tf_out.dist
new file mode 100644
index 0000000..9f1778e
--- /dev/null
+++ b/nad/tf_out.dist
@@ -0,0 +1,13 @@
+Test healpix inverse projection on sphere
+0 0.7853981633974483	0.00000	41.81031 0.00000
+-1.5707963267948966 0	-90.00000	0.00000 0.00000
+0.0 0.0	0.00000	0.00000 0.00000
+0.0 3.9269908169872414	0.00000	41.81031 0.00000
+0.0 -3.9269908169872414	0.00000	-41.81031 0.00000
+7.853981633974483 0.0	90.00000	0.00000 0.00000
+-7.853981633974483 0.0	-90.00000	0.00000 0.00000
+-15.707963267948966 0.0	-180.00000	0.00000 0.00000
+-11.780972450961723 7.853981633974483	-180.00000	90.00000 0.00000
+-11.780972450961723 -7.853981633974483	-180.00000	-90.00000 0.00000
+1.437378399445537 5.364369216432778	0.00000	60.00000 0.00000
+1.437378399445537 -5.364369216432778	0.00000	-60.00000 0.00000
diff --git a/src/Makefile.am b/src/Makefile.am
index 2da16e7..3344a7e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,12 +24,12 @@ proj_LDADD = libproj.la
 cs2cs_LDADD = libproj.la
 nad2bin_LDADD = libproj.la
 geod_LDADD = libproj.la
-multistresstest_LDADD = libproj.la -lpthread
-test228_LDADD = libproj.la -lpthread
+multistresstest_LDADD = libproj.la @THREAD_LIB@
+test228_LDADD = libproj.la @THREAD_LIB@
 
 lib_LTLIBRARIES = libproj.la
 
-libproj_la_LDFLAGS = -no-undefined -version-info 9:0:0
+libproj_la_LDFLAGS = -no-undefined -version-info 10:0:1
 
 libproj_la_SOURCES = \
 	pj_list.h \
@@ -70,7 +70,8 @@ libproj_la_SOURCES = \
 	nad_cvt.c nad_init.c nad_intr.c emess.c emess.h \
 	pj_apply_gridshift.c pj_datums.c pj_datum_set.c pj_transform.c \
 	geocent.c geocent.h pj_utils.c pj_gridinfo.c pj_gridlist.c \
-	jniproj.c pj_mutex.c pj_initcache.c pj_apply_vgridshift.c geodesic.c
+	jniproj.c pj_mutex.c pj_initcache.c pj_apply_vgridshift.c geodesic.c \
+	pj_strtod.c
 
 install-exec-local:
 	rm -f $(DESTDIR)$(bindir)/invproj$(EXEEXT)
diff --git a/src/Makefile.in b/src/Makefile.in
index 8aa4143..fbc3b76 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -161,7 +161,8 @@ am_libproj_la_OBJECTS = PJ_aeqd.lo PJ_gnom.lo PJ_laea.lo \
 	nad_intr.lo emess.lo pj_apply_gridshift.lo pj_datums.lo \
 	pj_datum_set.lo pj_transform.lo geocent.lo pj_utils.lo \
 	pj_gridinfo.lo pj_gridlist.lo jniproj.lo pj_mutex.lo \
-	pj_initcache.lo pj_apply_vgridshift.lo geodesic.lo
+	pj_initcache.lo pj_apply_vgridshift.lo geodesic.lo \
+	pj_strtod.lo
 libproj_la_OBJECTS = $(am_libproj_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -323,6 +324,7 @@ SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+THREAD_LIB = @THREAD_LIB@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
@@ -397,10 +399,10 @@ proj_LDADD = libproj.la
 cs2cs_LDADD = libproj.la
 nad2bin_LDADD = libproj.la
 geod_LDADD = libproj.la
-multistresstest_LDADD = libproj.la -lpthread
-test228_LDADD = libproj.la -lpthread
+multistresstest_LDADD = libproj.la @THREAD_LIB@
+test228_LDADD = libproj.la @THREAD_LIB@
 lib_LTLIBRARIES = libproj.la
-libproj_la_LDFLAGS = -no-undefined -version-info 9:0:0
+libproj_la_LDFLAGS = -no-undefined -version-info 10:0:1
 libproj_la_SOURCES = \
 	pj_list.h \
 	PJ_aeqd.c PJ_gnom.c PJ_laea.c PJ_mod_ster.c \
@@ -440,7 +442,8 @@ libproj_la_SOURCES = \
 	nad_cvt.c nad_init.c nad_intr.c emess.c emess.h \
 	pj_apply_gridshift.c pj_datums.c pj_datum_set.c pj_transform.c \
 	geocent.c geocent.h pj_utils.c pj_gridinfo.c pj_gridlist.c \
-	jniproj.c pj_mutex.c pj_initcache.c pj_apply_vgridshift.c geodesic.c
+	jniproj.c pj_mutex.c pj_initcache.c pj_apply_vgridshift.c geodesic.c \
+	pj_strtod.c
 
 all: proj_config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -763,6 +766,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pj_qsfn.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pj_release.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pj_strerrno.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pj_strtod.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pj_transform.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pj_tsfn.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pj_units.Plo at am__quote@
diff --git a/src/PJ_aea.c b/src/PJ_aea.c
index 53f03b0..0881ba7 100644
--- a/src/PJ_aea.c
+++ b/src/PJ_aea.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: PJ_aea.c 1856 2010-06-11 03:26:04Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  Implementation of the aea (Albers Equal Area) projection.
  * Author:   Gerald Evenden
@@ -43,8 +41,6 @@
 #define PJ_LIB__
 #include <projects.h>
 
-PJ_CVSID("$Id: PJ_aea.c 1856 2010-06-11 03:26:04Z warmerdam $");
-
 # define EPS10	1.e-10
 # define TOL7	1.e-7
 
diff --git a/src/PJ_aeqd.c b/src/PJ_aeqd.c
index 0da1ea2..739dfdd 100644
--- a/src/PJ_aeqd.c
+++ b/src/PJ_aeqd.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: PJ_aeqd.c 2520 2014-09-13 20:19:37Z hobu $
- *
  * Project:  PROJ.4
  * Purpose:  Implementation of the aeqd (Azimuthal Equidistant) projection.
  * Author:   Gerald Evenden
@@ -36,21 +34,23 @@
 	double	Mp; \
 	double	He; \
 	double	G; \
-	int		mode;
+	int		mode; \
+	struct geod_geodesic g;
 #define PJ_LIB__
+#include	"geodesic.h"
 #include	<projects.h>
 
-PJ_CVSID("$Id: PJ_aeqd.c 2520 2014-09-13 20:19:37Z hobu $");
-
 PROJ_HEAD(aeqd, "Azimuthal Equidistant") "\n\tAzi, Sph&Ell\n\tlat_0 guam";
 
 #define EPS10 1.e-10
 #define TOL 1.e-14
+#define RHO 57.295779513082320876798154814105
 
 #define N_POLE	0
-#define S_POLE 1
+#define S_POLE	1
 #define EQUIT	2
 #define OBLIQ	3
+
 FORWARD(e_guam_fwd); /* Guam elliptical */
 	double  cosphi, sinphi, t;
 
@@ -63,7 +63,9 @@ FORWARD(e_guam_fwd); /* Guam elliptical */
 	return (xy);
 }
 FORWARD(e_forward); /* elliptical */
-	double  coslam, cosphi, sinphi, rho, s, H, H2, c, Az, t, ct, st, cA, sA;
+	double  coslam, cosphi, sinphi, rho;
+	double azi1, azi2, s12;
+	double lam1, phi1, lam2, phi2;
 
 	coslam = cos(lp.lam);
 	cosphi = cos(lp.phi);
@@ -82,22 +84,14 @@ FORWARD(e_forward); /* elliptical */
 			xy.x = xy.y = 0.;
 			break;
 		}
-		t = atan2(P->one_es * sinphi + P->es * P->N1 * P->sinph0 *
-			sqrt(1. - P->es * sinphi * sinphi), cosphi);
-		ct = cos(t); st = sin(t);
-		Az = atan2(sin(lp.lam) * ct, P->cosph0 * st - P->sinph0 * coslam * ct);
-		cA = cos(Az); sA = sin(Az);
-		s = aasin( P->ctx, fabs(sA) < TOL ?
-			(P->cosph0 * st - P->sinph0 * coslam * ct) / cA :
-			sin(lp.lam) * ct / sA );
-		H = P->He * cA;
-		H2 = H * H;
-		c = P->N1 * s * (1. + s * s * (- H2 * (1. - H2)/6. +
-			s * ( P->G * H * (1. - 2. * H2 * H2) / 8. +
-			s * ((H2 * (4. - 7. * H2) - 3. * P->G * P->G * (1. - 7. * H2)) /
-			120. - s * P->G * H / 48.))));
-		xy.x = c * sA;
-		xy.y = c * cA;
+
+		phi1 = P->phi0*RHO; lam1 = P->lam0*RHO;
+		phi2 = lp.phi*RHO;  lam2 = (lp.lam+P->lam0)*RHO;
+
+		geod_inverse(&P->g, phi1, lam1, phi2, lam2, &s12, &azi1, &azi2);
+		azi1 /= RHO;
+		xy.x = s12 * sin(azi1) / P->a;
+		xy.y = s12 * cos(azi1) / P->a;
 		break;
 	}
 	return (xy);
@@ -117,7 +111,7 @@ FORWARD(s_forward); /* spherical */
 oblcon:
 		if (fabs(fabs(xy.y) - 1.) < TOL)
 			if (xy.y < 0.)
-				F_ERROR 
+				F_ERROR
 			else
 				xy.x = xy.y = 0.;
 		else {
@@ -154,7 +148,8 @@ INVERSE(e_guam_inv); /* Guam elliptical */
 	return (lp);
 }
 INVERSE(e_inverse); /* elliptical */
-	double c, Az, cosAz, A, B, D, E, F, psi, t;
+	double c;
+	double azi1, azi2, s12, x2, y2, lat1, lon1, lat2, lon2;
 
 	if ((c = hypot(xy.x, xy.y)) < EPS10) {
 		lp.phi = P->phi0;
@@ -162,23 +157,17 @@ INVERSE(e_inverse); /* elliptical */
 		return (lp);
 	}
 	if (P->mode == OBLIQ || P->mode == EQUIT) {
-		cosAz = cos(Az = atan2(xy.x, xy.y));
-		t = P->cosph0 * cosAz;
-		B = P->es * t / P->one_es;
-		A = - B * t;
-		B *= 3. * (1. - A) * P->sinph0;
-		D = c / P->N1;
-		E = D * (1. - D * D * (A * (1. + A) / 6. + B * (1. + 3.*A) * D / 24.));
-		F = 1. - E * E * (A / 2. + B * E / 6.);
-		psi = aasin(P->ctx, P->sinph0 * cos(E) + t * sin(E));
-		lp.lam = aasin(P->ctx, sin(Az) * sin(E) / cos(psi));
-		if ((t = fabs(psi)) < EPS10)
-			lp.phi = 0.;
-		else if (fabs(t - HALFPI) < 0.)
-			lp.phi = HALFPI;
-		else
-			lp.phi = atan((1. - P->es * F * P->sinph0 / sin(psi)) * tan(psi) /
-				P->one_es);
+
+		x2 = xy.x * P->a;
+		y2 = xy.y * P->a;
+		lat1 = P->phi0 * RHO;
+		lon1 = P->lam0 * RHO;
+		azi1 = atan2(x2, y2) * RHO;
+		s12 = sqrt(x2 * x2 + y2 * y2);
+		geod_direct(&P->g, lat1, lon1, azi1, s12, &lat2, &lon2, &azi2);
+		lp.phi = lat2 / RHO;
+		lp.lam = lon2 / RHO;
+		lp.lam -= P->lam0;
 	} else { /* Polar */
 		lp.phi = pj_inv_mlfn(P->ctx, P->mode == N_POLE ? P->Mp - c : P->Mp + c,
 			P->es, P->en);
@@ -210,7 +199,7 @@ INVERSE(s_inverse); /* spherical */
 			xy.y = (cosc - P->sinph0 * sin(lp.phi)) * c_rh;
 			xy.x *= sinc * P->cosph0;
 		}
-		lp.lam = atan2(xy.x, xy.y);
+		lp.lam = xy.y == 0. ? 0. : atan2(xy.x, xy.y);
 	} else if (P->mode == N_POLE) {
 		lp.phi = HALFPI - c_rh;
 		lp.lam = atan2(xy.x, -xy.y);
@@ -228,6 +217,7 @@ FREEUP;
 	}
 }
 ENTRY1(aeqd, en)
+	geod_init(&P->g, P->a, P->es / (1 + sqrt(P->one_es)));
 	P->phi0 = pj_param(P->ctx, P->params, "rlat_0").f;
 	if (fabs(fabs(P->phi0) - HALFPI) < EPS10) {
 		P->mode = P->phi0 < 0. ? S_POLE : N_POLE;
diff --git a/src/PJ_airy.c b/src/PJ_airy.c
index abb4d12..73a51e5 100644
--- a/src/PJ_airy.c
+++ b/src/PJ_airy.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: PJ_airy.c 1856 2010-06-11 03:26:04Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  Implementation of the airy (Airy) projection.
  * Author:   Gerald Evenden
@@ -37,8 +35,6 @@
 #define PJ_LIB__
 #include <projects.h>
 
-PJ_CVSID("$Id: PJ_airy.c 1856 2010-06-11 03:26:04Z warmerdam $");
-
 PROJ_HEAD(airy, "Airy") "\n\tMisc Sph, no inv.\n\tno_cut lat_b=";
 
 # define EPS 1.e-10
diff --git a/src/PJ_aitoff.c b/src/PJ_aitoff.c
index 91e7f0a..d5350f2 100644
--- a/src/PJ_aitoff.c
+++ b/src/PJ_aitoff.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: PJ_aitoff.c 2623 2015-02-21 14:09:44Z rouault $
- *
  * Project:  PROJ.4
  * Purpose:  Implementation of the aitoff (Aitoff) and wintri (Winkel Tripel)
  *           projections.
@@ -41,8 +39,6 @@
 #  define M_PI_2 1.57079632679489661923
 #endif
 
-PJ_CVSID("$Id: PJ_aitoff.c 2623 2015-02-21 14:09:44Z rouault $");
-
 PROJ_HEAD(aitoff, "Aitoff") "\n\tMisc Sph";
 PROJ_HEAD(wintri, "Winkel Tripel") "\n\tMisc Sph\n\tlat_1";
 
diff --git a/src/PJ_august.c b/src/PJ_august.c
index 4e6dab9..496fc3c 100644
--- a/src/PJ_august.c
+++ b/src/PJ_august.c
@@ -4,6 +4,7 @@ PROJ_HEAD(august, "August Epicycloidal") "\n\tMisc Sph, no inv.";
 #define M 1.333333333333333
 FORWARD(s_forward); /* spheroid */
 	double t, c1, c, x1, x12, y1, y12;
+	(void) P;
 
 	t = tan(.5 * lp.phi);
 	c1 = sqrt(1. - t * t);
diff --git a/src/PJ_boggs.c b/src/PJ_boggs.c
index 48fdc9a..b22a25f 100644
--- a/src/PJ_boggs.c
+++ b/src/PJ_boggs.c
@@ -11,6 +11,7 @@ PROJ_HEAD(boggs, "Boggs Eumorphic") "\n\tPCyl., no inv., Sph.";
 FORWARD(s_forward); /* spheroid */
 	double theta, th1, c;
 	int i;
+	(void) P;
 
 	theta = lp.phi;
 	if (fabs(fabs(lp.phi) - HALFPI) < EPS)
diff --git a/src/PJ_cc.c b/src/PJ_cc.c
index be1191b..0f57392 100644
--- a/src/PJ_cc.c
+++ b/src/PJ_cc.c
@@ -11,6 +11,7 @@ FORWARD(s_forward); /* spheroid */
 	return (xy);
 }
 INVERSE(s_inverse); /* spheroid */
+	(void) P;
 	lp.phi = atan(xy.y);
 	lp.lam = xy.x;
 	return (lp);
diff --git a/src/PJ_cea.c b/src/PJ_cea.c
index f5b7883..44c0a88 100644
--- a/src/PJ_cea.c
+++ b/src/PJ_cea.c
@@ -40,11 +40,14 @@ FREEUP;
 	}
 }
 ENTRY1(cea, apa)
-	double t;
+	double t = 0.0;
 
-	if (pj_param(P->ctx, P->params, "tlat_ts").i &&
-	    (P->k0 = cos(t = pj_param(P->ctx, P->params, "rlat_ts").f)) < 0.)
-	  E_ERROR(-24);
+	if (pj_param(P->ctx, P->params, "tlat_ts").i) {
+		P->k0 = cos(t = pj_param(P->ctx, P->params, "rlat_ts").f);
+		if (P->k0 < 0.) {
+			E_ERROR(-24);
+		}
+	}
 	if (P->es) {
 		t = sin(t);
 		P->k0 /= sqrt(1. - P->es * t * t);
diff --git a/src/PJ_collg.c b/src/PJ_collg.c
index ca389a6..871dfc9 100644
--- a/src/PJ_collg.c
+++ b/src/PJ_collg.c
@@ -5,6 +5,7 @@ PROJ_HEAD(collg, "Collignon") "\n\tPCyl, Sph.";
 #define FYC	1.77245385090551602729
 #define ONEEPS	1.0000001
 FORWARD(s_forward); /* spheroid */
+	(void) P;
 	if ((xy.y = 1. - sin(lp.phi)) <= 0.)
 		xy.y = 0.;
 	else
diff --git a/src/PJ_crast.c b/src/PJ_crast.c
index 5351a39..3f251ac 100644
--- a/src/PJ_crast.c
+++ b/src/PJ_crast.c
@@ -8,12 +8,14 @@ PROJ_HEAD(crast, "Craster Parabolic (Putnins P4)")
 #define RYM	0.32573500793527994772
 #define THIRD	0.333333333333333333
 FORWARD(s_forward); /* spheroid */
+	(void) P;
 	lp.phi *= THIRD;
 	xy.x = XM * lp.lam * (2. * cos(lp.phi + lp.phi) - 1.);
 	xy.y = YM * sin(lp.phi);
 	return (xy);
 }
 INVERSE(s_inverse); /* spheroid */
+	(void) P;
 	lp.phi = 3. * asin(xy.y * RYM);
 	lp.lam = xy.x * RXM / (2. * cos((lp.phi + lp.phi) * THIRD) - 1);
 	return (lp);
diff --git a/src/PJ_denoy.c b/src/PJ_denoy.c
index 8b80031..b1a6fe8 100644
--- a/src/PJ_denoy.c
+++ b/src/PJ_denoy.c
@@ -7,6 +7,7 @@ PROJ_HEAD(denoy, "Denoyer Semi-Elliptical") "\n\tPCyl., no inv., Sph.";
 #define D1	0.9
 #define D5	0.03
 FORWARD(s_forward); /* spheroid */
+	(void) P;
 	xy.y = lp.phi;
 	xy.x = lp.lam;
 	lp.lam = fabs(lp.lam);
diff --git a/src/PJ_eck1.c b/src/PJ_eck1.c
index 9b31b09..b0b43da 100644
--- a/src/PJ_eck1.c
+++ b/src/PJ_eck1.c
@@ -4,11 +4,13 @@ PROJ_HEAD(eck1, "Eckert I") "\n\tPCyl., Sph.";
 #define FC	.92131773192356127802
 #define RP	.31830988618379067154
 FORWARD(s_forward); /* spheroid */
+	(void) P;
 	xy.x = FC * lp.lam * (1. - RP * fabs(lp.phi));
 	xy.y = FC * lp.phi;
 	return (xy);
 }
 INVERSE(s_inverse); /* spheroid */
+	(void) P;
 	lp.phi = xy.y / FC;
 	lp.lam = xy.x / (FC * (1. - RP * fabs(lp.phi)));
 	return (lp);
diff --git a/src/PJ_eck2.c b/src/PJ_eck2.c
index f8e0154..08b6559 100644
--- a/src/PJ_eck2.c
+++ b/src/PJ_eck2.c
@@ -6,6 +6,7 @@ PROJ_HEAD(eck2, "Eckert II") "\n\tPCyl. Sph.";
 #define C13	0.33333333333333333333
 #define ONEEPS	1.0000001
 FORWARD(s_forward); /* spheroid */
+	(void) P;
 	xy.x = FXC * lp.lam * (xy.y = sqrt(4. - 3. * sin(fabs(lp.phi))));
 	xy.y = FYC * (2. - xy.y);
 	if ( lp.phi < 0.) xy.y = -xy.y;
diff --git a/src/PJ_eck4.c b/src/PJ_eck4.c
index f90267d..0bedbbc 100644
--- a/src/PJ_eck4.c
+++ b/src/PJ_eck4.c
@@ -11,6 +11,7 @@ PROJ_HEAD(eck4, "Eckert IV") "\n\tPCyl, Sph.";
 FORWARD(s_forward); /* spheroid */
 	double p, V, s, c;
 	int i;
+	(void) P;
 
 	p = C_p * sin(lp.phi);
 	V = lp.phi * lp.phi;
diff --git a/src/PJ_eck5.c b/src/PJ_eck5.c
index 3eeb332..029c18e 100644
--- a/src/PJ_eck5.c
+++ b/src/PJ_eck5.c
@@ -6,11 +6,13 @@ PROJ_HEAD(eck5, "Eckert V") "\n\tPCyl, Sph.";
 #define YF	0.88202554344910296438
 #define RYF	1.13375401361911319568
 FORWARD(s_forward); /* spheroid */
+	(void) P;
 	xy.x = XF * (1. + cos(lp.phi)) * lp.lam;
 	xy.y = YF * lp.phi;
 	return (xy);
 }
 INVERSE(s_inverse); /* spheroid */
+	(void) P;
 	lp.lam = RXF * xy.x / (1. + cos( lp.phi = RYF * xy.y));
 	return (lp);
 }
diff --git a/src/PJ_fahey.c b/src/PJ_fahey.c
index 93e9b38..007fc90 100644
--- a/src/PJ_fahey.c
+++ b/src/PJ_fahey.c
@@ -3,11 +3,13 @@
 PROJ_HEAD(fahey, "Fahey") "\n\tPcyl, Sph.";
 #define TOL 1e-6
 FORWARD(s_forward); /* spheroid */
+	(void) P;
 	xy.y = 1.819152 * ( xy.x = tan(0.5 * lp.phi) );
 	xy.x = 0.819152 * lp.lam * asqrt(1 - xy.x * xy.x);
 	return (xy);
 }
 INVERSE(s_inverse); /* spheroid */
+	(void) P;
 	lp.phi = 2. * atan(xy.y /= 1.819152);
 	lp.lam = fabs(xy.y = 1. - xy.y * xy.y) < TOL ? 0. :
 		xy.x / (0.819152 * sqrt(xy.y));
diff --git a/src/PJ_gall.c b/src/PJ_gall.c
index 3c507bd..1acd7d0 100644
--- a/src/PJ_gall.c
+++ b/src/PJ_gall.c
@@ -6,11 +6,13 @@ PROJ_HEAD(gall, "Gall (Gall Stereographic)") "\n\tCyl, Sph";
 #define RYF	0.58578643762690495119
 #define RXF	1.41421356237309504880
 FORWARD(s_forward); /* spheroid */
+	(void) P;
 	xy.x = XF * lp.lam;
 	xy.y = YF * tan(.5 * lp.phi);
 	return (xy);
 }
 INVERSE(s_inverse); /* spheroid */
+	(void) P;
 	lp.lam = RXF * xy.x;
 	lp.phi = 2. * atan(xy.y * RYF);
 	return (lp);
diff --git a/src/PJ_geos.c b/src/PJ_geos.c
index 76fa1d9..09393ad 100644
--- a/src/PJ_geos.c
+++ b/src/PJ_geos.c
@@ -4,8 +4,6 @@
 ** Copyright (c) 2004   Gerald I. Evenden
 ** Copyright (c) 2012   Martin Raspaud
 */
-static const char
-LIBPROJ_ID[] = "$Id: PJ_geos.c 2411 2013-12-09 18:13:15Z warmerdam $";
 /*
 ** See also (section 4.4.3.2):
 **   http://www.eumetsat.int/en/area4/msg/news/us_doc/cgms_03_26.pdf
diff --git a/src/PJ_gins8.c b/src/PJ_gins8.c
index 0747d76..b7f38ad 100644
--- a/src/PJ_gins8.c
+++ b/src/PJ_gins8.c
@@ -6,6 +6,7 @@ PROJ_HEAD(gins8, "Ginsburg VIII (TsNIIGAiK)") "\n\tPCyl, Sph., no inv.";
 #define	C12 0.08333333333333333
 FORWARD(s_forward); /* spheroid */
 	double t = lp.phi * lp.phi;
+	(void) P;
 
 	xy.y = lp.phi * (1. + t * C12);
 	xy.x = lp.lam * (1. - Cp * t);
diff --git a/src/PJ_hatano.c b/src/PJ_hatano.c
index 8e0ff5c..7516ba6 100644
--- a/src/PJ_hatano.c
+++ b/src/PJ_hatano.c
@@ -17,6 +17,7 @@ PROJ_HEAD(hatano, "Hatano Asymmetrical Equal Area") "\n\tPCyl, Sph.";
 FORWARD(s_forward); /* spheroid */
 	double th1, c;
 	int i;
+	(void) P;
 
 	c = sin(lp.phi) * (lp.phi < 0. ? CS : CN);
 	for (i = NITER; i; --i) {
diff --git a/src/PJ_healpix.c b/src/PJ_healpix.c
index 2cc918b..12d57ff 100644
--- a/src/PJ_healpix.c
+++ b/src/PJ_healpix.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: PJ_healpix.c 1504 2011-10-18 14:58:57Z landcare $
- *
  * Project: PROJ.4
  * Purpose: Implementation of the HEALPix and rHEALPix projections.
  *          For background see <http://code.scenzgrid.org/index.php/p/scenzgrid-py/source/tree/master/docs/rhealpix_dggs.pdf>.
@@ -466,6 +464,7 @@ static XY combine_caps(double x, double y, int north_square, int south_square,
     }
 }
 FORWARD(s_healpix_forward); /* sphere  */
+    (void) P;
     (void) xy;
     return healpix_sphere(lp);
 }
diff --git a/src/PJ_isea.c b/src/PJ_isea.c
index c68861d..7c09189 100644
--- a/src/PJ_isea.c
+++ b/src/PJ_isea.c
@@ -59,7 +59,7 @@ int hex_iso(struct hex *h) {
 }
 
 ISEA_STATIC
-int hexbin2(int horizontal, double width, double x, double y,
+int hexbin2(double width, double x, double y,
                 int *i, int *j) {
 	double z, rx, ry, rz;
 	double abs_dx, abs_dy, abs_dz;
@@ -160,10 +160,10 @@ ISEA_STATIC
 struct snyder_constants constants[] = {
 	{23.80018260, 62.15458023, 60.0, 3.75, 1.033, 0.968, 5.09, 1.195, 1.0},
 	{20.07675127, 55.69063953, 54.0, 2.65, 1.030, 0.983, 3.59, 1.141, 1.027},
-	{0.0},
-	{0.0},
-	{0.0},
-	{0.0},
+	{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+	{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+	{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+	{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
 	{37.37736814, 36.0, 30.0, 17.27, 1.163, 0.860, 13.14, 1.584, 1.0},
 };
 
@@ -369,23 +369,14 @@ isea_snyder_forward(struct isea_geo * ll, struct isea_pt * out)
 		center = icostriangles[i];
 
 		/* step 1 */
-#if 0
-		z = sph_distance(center.lon, center.lat, ll->lon, ll->lat);
-#else
 		z = acos(sin(center.lat) * sin(ll->lat)
 			 + cos(center.lat) * cos(ll->lat) * cos(ll->lon - center.lon));
-#endif
-
 		/* not on this triangle */
 		if (z > g + 0.000005) { /* TODO DBL_EPSILON */
 			continue;
 		}
-		Az = sph_azimuth(ll->lon, ll->lat, center.lon, center.lat);
 
-		Az = atan2(cos(ll->lat) * sin(ll->lon - center.lon),
-			   cos(center.lat) * sin(ll->lat)
-		- sin(center.lat) * cos(ll->lat) * cos(ll->lon - center.lon)
-			);
+		Az = sph_azimuth(center.lon, center.lat, ll->lon, ll->lat);
 
 		/* step 2 */
 
@@ -735,7 +726,7 @@ isea_dddi_ap3odd(struct isea_dgg *g, int quad, struct isea_pt *pt, struct isea_p
 	maxcoord = (int) (sidelength * 2.0 + 0.5);
 
 	v = *pt;
-	hexbin2(0, hexwidth, v.x, v.y, &h.x, &h.y);
+	hexbin2(hexwidth, v.x, v.y, &h.x, &h.y);
 	h.iso = 0;
 	hex_iso(&h);
 
@@ -813,7 +804,7 @@ isea_dddi(struct isea_dgg *g, int quad, struct isea_pt *pt, struct isea_pt *di)
 
 	v = *pt;
 	isea_rotate(&v, -30.0);
-	hexbin2(0, hexwidth, v.x, v.y, &h.x, &h.y);
+	hexbin2(hexwidth, v.x, v.y, &h.x, &h.y);
 	h.iso = 0;
 	hex_iso(&h);
 
@@ -976,13 +967,11 @@ ISEA_STATIC
 struct isea_pt
 isea_forward(struct isea_dgg *g, struct isea_geo *in)
 {
-	int             tri, downtri;
+	int             tri;
 	struct isea_pt  out, coord;
 
 	tri = isea_transform(g, in, &out);
 
-	downtri = (((tri - 1) / 5) % 2 == 1);
-
 	if (g->output == ISEA_PLANE) {
 		isea_tri_plane(tri, &out, g->radius);
 		return out;
diff --git a/src/PJ_krovak.c b/src/PJ_krovak.c
index ac21df6..dd25013 100644
--- a/src/PJ_krovak.c
+++ b/src/PJ_krovak.c
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: PJ_krovak.c 1856 2010-06-11 03:26:04Z warmerdam $
+ * $Id$
  *
  * Project:  PROJ.4
  * Purpose:  Implementation of the krovak (Krovak) projection.
@@ -37,8 +37,6 @@
 #include <string.h>
 #include <stdio.h>
 
-PJ_CVSID("$Id: PJ_krovak.c 1856 2010-06-11 03:26:04Z warmerdam $");	
-
 PROJ_HEAD(krovak, "Krovak") "\n\tPCyl., Ellps.";
 
 /**
@@ -74,9 +72,9 @@ FORWARD(e_forward); /* ellipsoid */
 	double gfi, u, fi0, deltav, s, d, eps, ro;
 
 
-	s45 = 0.785398163397448;    /* 45� */
+	s45 = 0.785398163397448;    /* 45deg */
 	s90 = 2 * s45;
-	fi0 = P->phi0;    /* Latitude of projection centre 49� 30' */
+	fi0 = P->phi0;    /* Latitude of projection centre 49deg 30' */
 
    /* Ellipsoid is used as Parameter in for.c and inv.c, therefore a must 
       be set to 1 here.
@@ -98,7 +96,7 @@ FORWARD(e_forward); /* ellipsoid */
 
 	k1 = P->k0;
 	n0 = a * sqrt(1. - e2) / (1. - e2 * pow(sin(fi0), 2));
-	s0 = 1.37008346281555;       /* Latitude of pseudo standard parallel 78� 30'00" N */
+	s0 = 1.37008346281555;       /* Latitude of pseudo standard parallel 78deg 30'00" N */
 	n = sin(s0);
 	ro0 = k1 * n0 / tan(s0);
 	ad = s90 - uq;
@@ -140,9 +138,9 @@ INVERSE(e_inverse); /* ellipsoid */
 	double u, deltav, s, d, eps, ro, fi1, xy0;
 	int ok;
 
-	s45 = 0.785398163397448;    /* 45� */
+	s45 = 0.785398163397448;    /* 45deg */
 	s90 = 2 * s45;
-	fi0 = P->phi0;    /* Latitude of projection centre 49� 30' */
+	fi0 = P->phi0;    /* Latitude of projection centre 49deg 30' */
 
 
    /* Ellipsoid is used as Parameter in for.c and inv.c, therefore a must 
@@ -164,7 +162,7 @@ INVERSE(e_inverse); /* ellipsoid */
 
 	k1 = P->k0;
 	n0 = a * sqrt(1. - e2) / (1. - e2 * pow(sin(fi0), 2));
-	s0 = 1.37008346281555;       /* Latitude of pseudo standard parallel 78� 30'00" N */
+	s0 = 1.37008346281555;       /* Latitude of pseudo standard parallel 78deg 30'00" N */
 	n = sin(s0);
 	ro0 = k1 * n0 / tan(s0);
 	ad = s90 - uq;
diff --git a/src/PJ_larr.c b/src/PJ_larr.c
index 5bab2b0..118bef0 100644
--- a/src/PJ_larr.c
+++ b/src/PJ_larr.c
@@ -4,6 +4,7 @@
 PROJ_HEAD(larr, "Larrivee") "\n\tMisc Sph, no inv.";
 #define SIXTH .16666666666666666
 FORWARD(s_forward); /* sphere */
+	(void) P;
 	xy.x = 0.5 * lp.lam * (1. + sqrt(cos(lp.phi)));
 	xy.y = lp.phi / (cos(0.5 * lp.phi) * cos(SIXTH * lp.lam));
 	return (xy);
diff --git a/src/PJ_lask.c b/src/PJ_lask.c
index 05e80a1..797b580 100644
--- a/src/PJ_lask.c
+++ b/src/PJ_lask.c
@@ -14,6 +14,7 @@ PROJ_HEAD(lask, "Laskowski") "\n\tMisc Sph, no inv.";
 #define	b05	-0.0491032
 FORWARD(s_forward); /* sphere */
 	double l2, p2;
+	(void) P;
 
 	l2 = lp.lam * lp.lam;
 	p2 = lp.phi * lp.phi;
diff --git a/src/PJ_lcca.c b/src/PJ_lcca.c
index 0e3289f..320d52d 100644
--- a/src/PJ_lcca.c
+++ b/src/PJ_lcca.c
@@ -1,4 +1,3 @@
-static const char RCS_ID[] = "$Id: PJ_lcca.c 1856 2010-06-11 03:26:04Z warmerdam $";
 /* PROJ.4 Cartographic Projection System 
 */
 #define MAX_ITER 10
@@ -51,7 +50,7 @@ INVERSE(e_inverse); /* ellipsoid & spheroid */
 }
 FREEUP; if (P) { if (P->en) pj_dalloc(P->en); pj_dalloc(P); } }
 ENTRY0(lcca)
-	double s2p0, N0, R0, tan0, tan20;
+	double s2p0, N0, R0, tan0;
 
 	if (!(P->en = pj_enfn(P->es))) E_ERROR_0;
 	if (!pj_param(P->ctx, P->params, "tlat_0").i) E_ERROR(50);
@@ -63,7 +62,6 @@ ENTRY0(lcca)
 	N0 = sqrt(R0);
 	R0 *= P->one_es * N0;
 	tan0 = tan(P->phi0);
-	tan20 = tan0 * tan0;
 	P->r0 = N0 / tan0;
 	P->C = 1. / (6. * R0 * N0);
 	P->inv = e_inverse;
diff --git a/src/PJ_mbt_fps.c b/src/PJ_mbt_fps.c
index 57a96e7..3cd5e67 100644
--- a/src/PJ_mbt_fps.c
+++ b/src/PJ_mbt_fps.c
@@ -12,6 +12,7 @@ PROJ_HEAD(mbt_fps, "McBryde-Thomas Flat-Pole Sine (No. 2)") "\n\tCyl., Sph.";
 FORWARD(s_forward); /* spheroid */
 	double k, V, t;
 	int i;
+	(void) P;
 
 	k = C3 * sin(lp.phi);
 	for (i = MAX_ITER; i ; --i) {
diff --git a/src/PJ_mbtfpp.c b/src/PJ_mbtfpp.c
index 9549a23..433d3c8 100644
--- a/src/PJ_mbtfpp.c
+++ b/src/PJ_mbtfpp.c
@@ -8,6 +8,7 @@ PROJ_HEAD(mbtfpp, "McBride-Thomas Flat-Polar Parabolic") "\n\tCyl., Sph.";
 #define C13	.33333333333333333333
 #define ONEEPS	1.0000001
 FORWARD(s_forward); /* spheroid */
+	(void) P;
 	lp.phi = asin(CS * sin(lp.phi));
 	xy.x = FXC * lp.lam * (2. * cos(C23 * lp.phi) - 1.);
 	xy.y = FYC * sin(C13 * lp.phi);
diff --git a/src/PJ_mbtfpq.c b/src/PJ_mbtfpq.c
index 3298db4..0d343fa 100644
--- a/src/PJ_mbtfpq.c
+++ b/src/PJ_mbtfpq.c
@@ -13,6 +13,7 @@ PROJ_HEAD(mbtfpq, "McBryde-Thomas Flat-Polar Quartic") "\n\tCyl., Sph.";
 FORWARD(s_forward); /* spheroid */
 	double th1, c;
 	int i;
+	(void) P;
 
 	c = C * sin(lp.phi);
 	for (i = NITER; i; --i) {
diff --git a/src/PJ_mill.c b/src/PJ_mill.c
index 03c3559..c4cee7f 100644
--- a/src/PJ_mill.c
+++ b/src/PJ_mill.c
@@ -2,11 +2,13 @@
 # include	<projects.h>
 PROJ_HEAD(mill, "Miller Cylindrical") "\n\tCyl, Sph";
 FORWARD(s_forward); /* spheroid */
+	(void) P;
 	xy.x = lp.lam;
 	xy.y = log(tan(FORTPI + lp.phi * .4)) * 1.25;
 	return (xy);
 }
 INVERSE(s_inverse); /* spheroid */
+	(void) P;
 	lp.lam = xy.x;
 	lp.phi = 2.5 * (atan(exp(.8 * xy.y)) - FORTPI);
 	return (lp);
diff --git a/src/PJ_natearth.c b/src/PJ_natearth.c
index f83a3ff..0f28341 100644
--- a/src/PJ_natearth.c
+++ b/src/PJ_natearth.c
@@ -36,6 +36,7 @@ PROJ_HEAD(natearth, "Natural Earth") "\n\tPCyl., Sph.";
 
 FORWARD(s_forward); /* spheroid */
 	double phi2, phi4;
+	(void) P;
 
 	phi2 = lp.phi * lp.phi;
 	phi4 = phi2 * phi2;
@@ -45,6 +46,7 @@ FORWARD(s_forward); /* spheroid */
 }
 INVERSE(s_inverse); /* spheroid */
 	double yc, tol, y2, y4, f, fder;
+	(void) P;
 
         /* make sure y is inside valid range */
 	if (xy.y > MAX_Y) {
diff --git a/src/PJ_nell.c b/src/PJ_nell.c
index dd41b46..77983de 100644
--- a/src/PJ_nell.c
+++ b/src/PJ_nell.c
@@ -6,6 +6,7 @@ PROJ_HEAD(nell, "Nell") "\n\tPCyl., Sph.";
 FORWARD(s_forward); /* spheroid */
 	double k, V;
 	int i;
+	(void) P;
 
 	k = 2. * sin(lp.phi);
 	V = lp.phi * lp.phi;
diff --git a/src/PJ_nell_h.c b/src/PJ_nell_h.c
index 670dea8..22061ea 100644
--- a/src/PJ_nell_h.c
+++ b/src/PJ_nell_h.c
@@ -4,6 +4,7 @@ PROJ_HEAD(nell_h, "Nell-Hammer") "\n\tPCyl., Sph.";
 #define NITER 9
 #define EPS 1e-7
 FORWARD(s_forward); /* spheroid */
+	(void) P;
 	xy.x = 0.5 * lp.lam * (1. + cos(lp.phi));
 	xy.y = 2.0 * (lp.phi - tan(0.5 *lp.phi));
 	return (xy);
@@ -11,6 +12,7 @@ FORWARD(s_forward); /* spheroid */
 INVERSE(s_inverse); /* spheroid */
 	double V, c, p;
 	int i;
+	(void) P;
 
 	p = 0.5 * xy.y;
 	for (i = NITER; i ; --i) {
diff --git a/src/PJ_nocol.c b/src/PJ_nocol.c
index f129eb2..2b005e1 100644
--- a/src/PJ_nocol.c
+++ b/src/PJ_nocol.c
@@ -3,6 +3,8 @@
 PROJ_HEAD(nicol, "Nicolosi Globular") "\n\tMisc Sph, no inv.";
 #define EPS	1e-10
 FORWARD(s_forward); /* spheroid */
+	(void) P;
+
 	if (fabs(lp.lam) < EPS) {
 		xy.x = 0;
 		xy.y = lp.phi;
diff --git a/src/PJ_nzmg.c b/src/PJ_nzmg.c
index 5a28541..60df004 100644
--- a/src/PJ_nzmg.c
+++ b/src/PJ_nzmg.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: PJ_nzmg.c 1504 2009-01-06 02:11:57Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  Implementation of the nzmg (New Zealand Map Grid) projection.
  *           Very loosely based upon DMA code by Bradford W. Drew
@@ -31,8 +29,6 @@
 #define PJ_LIB__
 #include	<projects.h>
 
-PJ_CVSID("$Id: PJ_nzmg.c 1504 2009-01-06 02:11:57Z warmerdam $");
-
 PROJ_HEAD(nzmg, "New Zealand Map Grid") "\n\tfixed Earth";
 
 #define EPSLN 1e-10
diff --git a/src/PJ_putp2.c b/src/PJ_putp2.c
index 33bc67a..d6fcaea 100644
--- a/src/PJ_putp2.c
+++ b/src/PJ_putp2.c
@@ -10,6 +10,7 @@ PROJ_HEAD(putp2, "Putnins P2") "\n\tPCyl., Sph.";
 FORWARD(s_forward); /* spheroid */
 	double p, c, s, V;
 	int i;
+	(void) P;
 
 	p = C_p * sin(lp.phi);
 	s = lp.phi * lp.phi;
diff --git a/src/PJ_qsc.c b/src/PJ_qsc.c
index 1c7a443..12cb9d6 100644
--- a/src/PJ_qsc.c
+++ b/src/PJ_qsc.c
@@ -105,11 +105,8 @@ qsc_shift_lon_origin(double lon, double offset) {
 /* Forward projection, ellipsoid */
 FORWARD(e_forward);
         double lat, lon;
-        double sinlat, coslat;
-        double sinlon, coslon;
-        double q, r, s;
         double theta, phi;
-        double t, mu, nu;
+        double t, mu; /* nu; */
         int area;
 
         /* Convert the geodetic latitude to a geocentric latitude.
@@ -127,35 +124,7 @@ FORWARD(e_forward);
          * directly from phi, lam. For the other faces, we must use
          * unit sphere cartesian coordinates as an intermediate step. */
         lon = lp.lam;
-        if (P->face != FACE_TOP && P->face != FACE_BOTTOM) {
-            if (P->face == FACE_RIGHT) {
-                lon = qsc_shift_lon_origin(lon, +HALFPI);
-            } else if (P->face == FACE_BACK) {
-                lon = qsc_shift_lon_origin(lon, +PI);
-            } else if (P->face == FACE_LEFT) {
-                lon = qsc_shift_lon_origin(lon, -HALFPI);
-            }
-            sinlat = sin(lat);
-            coslat = cos(lat);
-            sinlon = sin(lon);
-            coslon = cos(lon);
-            q = coslat * coslon;
-            r = coslat * sinlon;
-            s = sinlat;
-        }
-        if (P->face == FACE_FRONT) {
-            phi = acos(q);
-            theta = qsc_fwd_equat_face_theta(phi, s, r, &area);
-        } else if (P->face == FACE_RIGHT) {
-            phi = acos(r);
-            theta = qsc_fwd_equat_face_theta(phi, s, -q, &area);
-        } else if (P->face == FACE_BACK) {
-            phi = acos(-q);
-            theta = qsc_fwd_equat_face_theta(phi, s, -r, &area);
-        } else if (P->face == FACE_LEFT) {
-            phi = acos(-r);
-            theta = qsc_fwd_equat_face_theta(phi, s, q, &area);
-        } else if (P->face == FACE_TOP) {
+        if (P->face == FACE_TOP) {
             phi = HALFPI - lat;
             if (lon >= FORTPI && lon <= HALFPI + FORTPI) {
                 area = AREA_0;
@@ -170,7 +139,7 @@ FORWARD(e_forward);
                 area = AREA_3;
                 theta = lon;
             }
-        } else /* P->face == FACE_BOTTOM */ {
+        } else if (P->face == FACE_BOTTOM) {
             phi = HALFPI + lat;
             if (lon >= FORTPI && lon <= HALFPI + FORTPI) {
                 area = AREA_0;
@@ -185,6 +154,43 @@ FORWARD(e_forward);
                 area = AREA_3;
                 theta = (lon > 0.0 ? -lon + PI : -lon - PI);
             }
+        } else {
+            double q, r, s;
+            double sinlat, coslat;
+            double sinlon, coslon;
+
+            if (P->face == FACE_RIGHT) {
+                lon = qsc_shift_lon_origin(lon, +HALFPI);
+            } else if (P->face == FACE_BACK) {
+                lon = qsc_shift_lon_origin(lon, +PI);
+            } else if (P->face == FACE_LEFT) {
+                lon = qsc_shift_lon_origin(lon, -HALFPI);
+            }
+            sinlat = sin(lat);
+            coslat = cos(lat);
+            sinlon = sin(lon);
+            coslon = cos(lon);
+            q = coslat * coslon;
+            r = coslat * sinlon;
+            s = sinlat;
+
+            if (P->face == FACE_FRONT) {
+                phi = acos(q);
+                theta = qsc_fwd_equat_face_theta(phi, s, r, &area);
+            } else if (P->face == FACE_RIGHT) {
+                phi = acos(r);
+                theta = qsc_fwd_equat_face_theta(phi, s, -q, &area);
+            } else if (P->face == FACE_BACK) {
+                phi = acos(-q);
+                theta = qsc_fwd_equat_face_theta(phi, s, -r, &area);
+            } else if (P->face == FACE_LEFT) {
+                phi = acos(-r);
+                theta = qsc_fwd_equat_face_theta(phi, s, q, &area);
+            } else {
+                /* Impossible */
+                phi = theta = 0.0;
+                area = AREA_0;
+            }
         }
 
         /* Compute mu and nu for the area of definition.
diff --git a/src/PJ_robin.c b/src/PJ_robin.c
index 39513e2..e8572ae 100644
--- a/src/PJ_robin.c
+++ b/src/PJ_robin.c
@@ -69,6 +69,7 @@ static const struct COEFS Y[] = {
 FORWARD(s_forward); /* spheroid */
 	int i;
 	double dphi;
+	(void) P;
 
 	i = floor((dphi = fabs(lp.phi)) * C1);
 	if (i >= NODES) i = NODES - 1;
diff --git a/src/PJ_stere.c b/src/PJ_stere.c
index 52ec1df..a052462 100644
--- a/src/PJ_stere.c
+++ b/src/PJ_stere.c
@@ -192,8 +192,6 @@ setup(PJ *P) { /* general initialization */
 			}
 			break;
 		case EQUIT:
-			P->akm1 = 2. * P->k0;
-			break;
 		case OBLIQ:
 			t = sin(P->phi0);
 			X = 2. * atan(ssfn_(P->phi0, t, P->e)) - HALFPI;
diff --git a/src/PJ_sterea.c b/src/PJ_sterea.c
index 7e52e15..fff2e95 100644
--- a/src/PJ_sterea.c
+++ b/src/PJ_sterea.c
@@ -3,8 +3,6 @@
 **
 ** Copyright (c) 2003   Gerald I. Evenden
 */
-static const char
-LIBPROJ_ID[] = "$Id: PJ_sterea.c 2022 2011-05-20 13:04:08Z warmerdam $";
 /*
 ** Permission is hereby granted, free of charge, to any person obtaining
 ** a copy of this software and associated documentation files (the
diff --git a/src/PJ_vandg4.c b/src/PJ_vandg4.c
index d670503..0229042 100644
--- a/src/PJ_vandg4.c
+++ b/src/PJ_vandg4.c
@@ -5,6 +5,7 @@ PROJ_HEAD(vandg4, "van der Grinten IV") "\n\tMisc Sph, no inv.";
 #define TWORPI	0.63661977236758134308
 FORWARD(s_forward); /* spheroid */
 	double x1, t, bt, ct, ft, bt2, ct2, dt, dt2;
+	(void) P;
 
 	if (fabs(lp.phi) < TOL) {
 		xy.x = lp.lam;
diff --git a/src/PJ_wag7.c b/src/PJ_wag7.c
index 5f6f1bb..db29ffb 100644
--- a/src/PJ_wag7.c
+++ b/src/PJ_wag7.c
@@ -3,6 +3,7 @@
 PROJ_HEAD(wag7, "Wagner VII") "\n\tMisc Sph, no inv.";
 FORWARD(s_forward); /* sphere */
 	double theta, ct, D;
+	(void) P;
 
 	theta = asin(xy.y = 0.90630778703664996 * sin(lp.phi));
 	xy.x = 2.66723 * (ct = cos(theta)) * sin(lp.lam /= 3.);
diff --git a/src/cs2cs.c b/src/cs2cs.c
index c848977..9036932 100644
--- a/src/cs2cs.c
+++ b/src/cs2cs.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: cs2cs.c 2388 2013-10-20 17:56:49Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  Mainline program sort of like ``proj'' for converting between
  *           two coordinate systems.
@@ -35,6 +33,7 @@
 #include <string.h>
 #include <math.h>
 #include "emess.h"
+#include <locale.h>
 
 #define MAX_LINE 1000
 #define MAX_PARGS 100
@@ -53,7 +52,6 @@ tag = '#';	/* beginning of line tag character */
 "%s\nusage: %s [ -eEfIlrstvwW [args] ] [ +opts[=arg] ]\n"
 "                   [+to [+opts[=arg] [ files ]\n";
 
-static struct FACTORS facs;
 static double (*informat)(const char *, 
                           char **); /* input data deformatter function */
 
@@ -170,6 +168,12 @@ int main(int argc, char **argv)
     FILE *fid;
     int from_argc=0, to_argc=0, eargc = 0, c, mon = 0;
     int have_to_flag = 0, inverse = 0, i;
+    int use_env_locale = 0;
+
+    /* This is just to check that pj_init() is locale-safe */
+    /* Used by nad/testvarious */
+    if( getenv("PROJ_USE_ENV_LOCALE") != NULL )
+        use_env_locale = 1;
 
     if ((emess_dat.Prog_name = strrchr(*argv,DIR_CHAR)) != NULL)
         ++emess_dat.Prog_name;
@@ -339,6 +343,12 @@ int main(int argc, char **argv)
         to_argc = argcount;
     }
 
+    if( use_env_locale )
+    {
+        /* Set locale from environment */
+        setlocale(LC_ALL, "");
+    }
+
     if( from_argc == 0 && to_argc != 0 )
     {
         /* we will generate the from proj as the latlong of the +to in a bit */
@@ -392,6 +402,12 @@ int main(int argc, char **argv)
         }   
     }
 
+    if( use_env_locale )
+    {
+        /* Restore C locale to avoid issues in parsing/outputing numbers*/
+        setlocale(LC_ALL, "C");
+    }
+
     if (mon) {
         printf( "%c ---- From Coordinate System ----\n", tag );
         pj_pr_list(fromProj);
diff --git a/src/dmstor.c b/src/dmstor.c
index f1da537..62c06f3 100644
--- a/src/dmstor.c
+++ b/src/dmstor.c
@@ -108,6 +108,6 @@ proj_strtod(char *nptr, char **endptr)
 
     /* no offending characters, just handle normally */
 
-    return strtod(nptr, endptr);
+    return pj_strtod(nptr, endptr);
 }
 
diff --git a/src/gen_cheb.c b/src/gen_cheb.c
index 82cd926..f06a744 100644
--- a/src/gen_cheb.c
+++ b/src/gen_cheb.c
@@ -10,7 +10,7 @@
 #endif
 	void
 gen_cheb(int inverse, projUV (*proj)(projUV), char *s, PJ *P, int iargc, char **iargv) {
-	int NU = 15, NV = 15, i, res = -1, errin = 0, pwr;
+	int NU = 15, NV = 15, res = -1, errin = 0, pwr;
 	char *arg, fmt[15];
 	projUV low, upp, resid;
 	Tseries *F;
@@ -33,7 +33,7 @@ gen_cheb(int inverse, projUV (*proj)(projUV), char *s, PJ *P, int iargc, char **
 	if (iargc > 0) { /* proj execution audit trail */
 		int n = 0, L;
 
-		for( i = 0 ; iargc ; --iargc) {
+		for ( ; iargc ; --iargc) {
 			arg = *iargv++;
 			if (*arg != '+') {
 				if (!n) { putchar('#'); ++n; }
diff --git a/src/geocent.c b/src/geocent.c
index d95a778..6ac6c40 100644
--- a/src/geocent.c
+++ b/src/geocent.c
@@ -362,10 +362,8 @@ void pj_Convert_Geocentric_To_Geodetic (GeocentricInfo *gi,
     double CPHI;     /* cos of searched geodetic latitude */
     double SPHI;     /* sin of searched geodetic latitude */
     double SDPHI;    /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */
-    int At_Pole;     /* indicates location is in polar region */
     int iter;        /* # of continous iteration, max. 30 is always enough (s.a.) */
 
-    At_Pole = FALSE;
     P = sqrt(X*X+Y*Y);
     RR = sqrt(X*X+Y*Y+Z*Z);
 
@@ -373,7 +371,6 @@ void pj_Convert_Geocentric_To_Geodetic (GeocentricInfo *gi,
     if (P/gi->Geocent_a < genau) {
 
 /*  special case, if P=0. (X=0., Y=0.) */
-        At_Pole = TRUE;
 	*Longitude = 0.;
 
 /*  if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis
diff --git a/src/geod.c b/src/geod.c
index f597b13..c429c51 100644
--- a/src/geod.c
+++ b/src/geod.c
@@ -55,7 +55,7 @@ do_geod(void) {
 	}
 	printLL(phil, laml); putchar('\n');
 }
-	void static	/* file processing function */
+	static void	/* file processing function */
 process(FILE *fid) {
 	char line[MAXLINE+3], *s;
 
diff --git a/src/geod_interface.c b/src/geod_interface.c
index dc75728..63b16b1 100644
--- a/src/geod_interface.c
+++ b/src/geod_interface.c
@@ -1,34 +1,39 @@
 #include "projects.h"
 #include "geod_interface.h"
 
+/* DEG_IN is a crock to work around the problem that dmstor.c uses the wrong
+ * value for pi/180 (namely .0174532925199433 which is an inaccurately
+ * truncated version of DEG_TO_RAD).
+ */
+#define DEG_IN .0174532925199433
+#define DEG_OUT DEG_TO_RAD;
+
 void geod_ini(void) {
   geod_init(&GlobalGeodesic, geod_a, geod_f);
 }
 
 void geod_pre(void) {
   double
-    degree = PI/180,
-    lat1 = phi1 / degree, lon1 = lam1 /degree, azi1 = al12 / degree;
-  geod_lineinit(&GlobalGeodesicLine, &GlobalGeodesic,
-		   lat1, lon1, azi1, 0U);
+    lat1 = phi1 / DEG_IN, lon1 = lam1 / DEG_IN, azi1 = al12 / DEG_IN;
+  geod_lineinit(&GlobalGeodesicLine, &GlobalGeodesic, lat1, lon1, azi1, 0U);
 }
 
 void geod_for(void) {
-  double degree = PI/180, s12 = geod_S, lat2, lon2, azi2;
+  double
+    s12 = geod_S, lat2, lon2, azi2;
   geod_position(&GlobalGeodesicLine, s12, &lat2, &lon2, &azi2);
   azi2 += azi2 >= 0 ? -180 : 180; /* Compute back azimuth */
-  phi2 = lat2 * degree;
-  lam2 = lon2 * degree;
-  al21 = azi2 * degree;
+  phi2 = lat2 * DEG_OUT;
+  lam2 = lon2 * DEG_OUT;
+  al21 = azi2 * DEG_OUT;
 }
 
 void geod_inv(void) {
   double
-    degree = PI / 180,
-    lat1 = phi1 / degree, lon1 = lam1 / degree,
-    lat2 = phi2 / degree, lon2 = lam2 / degree,
+    lat1 = phi1 / DEG_IN, lon1 = lam1 / DEG_IN,
+    lat2 = phi2 / DEG_IN, lon2 = lam2 / DEG_IN,
     azi1, azi2, s12;
   geod_inverse(&GlobalGeodesic, lat1, lon1, lat2, lon2, &s12, &azi1, &azi2);
   azi2 += azi2 >= 0 ? -180 : 180; /* Compute back azimuth */
-  al12 = azi1 * degree; al21 = azi2 * degree; geod_S = s12;
+  al12 = azi1 * DEG_OUT; al21 = azi2 * DEG_OUT; geod_S = s12;
 }
diff --git a/src/geod_set.c b/src/geod_set.c
index eaadce5..e687c51 100644
--- a/src/geod_set.c
+++ b/src/geod_set.c
@@ -15,11 +15,11 @@ geod_set(int argc, char **argv) {
     /* put arguments into internal linked list */
 	if (argc <= 0)
 		emess(1, "no arguments in initialization list");
-	for (i = 0; i < argc; ++i)
-		if (i)
-			curr = curr->next = pj_mkparam(argv[i]);
-		else
-			start = curr = pj_mkparam(argv[i]);
+	start = curr = pj_mkparam(argv[0]);
+	for (i = 1; i < argc; ++i) {
+		curr->next = pj_mkparam(argv[i]);
+		curr = curr->next;
+	}
 	/* set elliptical parameters */
 	if (pj_ell_set(pj_get_default_ctx(),start, &geod_a, &es)) emess(1,"ellipse setup failure");
 	/* set units */
diff --git a/src/geodesic.c b/src/geodesic.c
index fd0214c..2dee45e 100644
--- a/src/geodesic.c
+++ b/src/geodesic.c
@@ -18,7 +18,7 @@
  *
  * See the comments in geodesic.h for documentation.
  *
- * Copyright (c) Charles Karney (2012-2014) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2012-2015) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  */
@@ -27,8 +27,10 @@
 #include <math.h>
 
 #define GEOGRAPHICLIB_GEODESIC_ORDER 6
+#define nA1   GEOGRAPHICLIB_GEODESIC_ORDER
 #define nC1   GEOGRAPHICLIB_GEODESIC_ORDER
 #define nC1p  GEOGRAPHICLIB_GEODESIC_ORDER
+#define nA2   GEOGRAPHICLIB_GEODESIC_ORDER
 #define nC2   GEOGRAPHICLIB_GEODESIC_ORDER
 #define nA3   GEOGRAPHICLIB_GEODESIC_ORDER
 #define nA3x  nA3
@@ -36,6 +38,7 @@
 #define nC3x  ((nC3 * (nC3 - 1)) / 2)
 #define nC4   GEOGRAPHICLIB_GEODESIC_ORDER
 #define nC4x  ((nC4 * (nC4 + 1)) / 2)
+#define nC    (GEOGRAPHICLIB_GEODESIC_ORDER + 1)
 
 typedef double real;
 typedef int boolx;
@@ -137,6 +140,12 @@ static real sumx(real u, real v, real* t) {
   return s;
 }
 
+static real polyval(int N, const real p[], real x) {
+  real y = N < 0 ? 0 : *p++;
+  while (--N >= 0) y = y * x + *p++;
+  return y;
+}
+
 static real minx(real x, real y)
 { return x < y ? x : y; }
 
@@ -146,24 +155,29 @@ static real maxx(real x, real y)
 static void swapx(real* x, real* y)
 { real t = *x; *x = *y; *y = t; }
 
-static void SinCosNorm(real* sinx, real* cosx) {
+static void norm2(real* sinx, real* cosx) {
   real r = hypotx(*sinx, *cosx);
   *sinx /= r;
   *cosx /= r;
 }
 
-static real AngNormalize(real x)
-{ return x >= 180 ? x - 360 : (x < -180 ? x + 360 : x); }
-static real AngNormalize2(real x)
-{ return AngNormalize(fmod(x, (real)(360))); }
+static real AngNormalize(real x) {
+  x = fmod(x, (real)(360));
+  return x < -180 ? x + 360 : (x < 180 ? x : x - 360);
+}
+
+static real LatFix(real x)
+{ return fabs(x) > 90 ? NaN : x; }
 
 static real AngDiff(real x, real y) {
-  real t, d = sumx(-x, y, &t);
-  if ((d - (real)(180)) + t > (real)(0))       /* y - x > 180 */
-    d -= (real)(360);                          /* exact */
-  else if ((d + (real)(180)) + t <= (real)(0)) /* y - x <= -180 */
-    d += (real)(360);                          /* exact */
-  return d + t;
+  real t, d = - AngNormalize(sumx(AngNormalize(x), AngNormalize(-y), &t));
+  /* Here y - x = d - t (mod 360), exactly, where d is in (-180,180] and
+   * abs(t) <= eps (eps = 2^-45 for doubles).  The only case where the
+   * addition of t takes the result outside the range (-180,180] is d = 180
+   * and t < 0.  The case, d = -180 + eps, t = eps, can't happen, since
+   * sum would have returned the exact result in such a case (i.e., given t
+   * = 0). */
+  return (d == 180 && t < 0 ? -180 : d) - t;
 }
 
 static real AngRound(real x) {
@@ -171,7 +185,49 @@ static real AngRound(real x) {
   volatile real y = fabs(x);
   /* The compiler mustn't "simplify" z - (z - y) to y */
   y = y < z ? z - (z - y) : y;
-  return x < 0 ? -y : y;
+  return x < 0 ? 0 - y : y;
+}
+
+static void sincosdx(real x, real* sinx, real* cosx) {
+  /* In order to minimize round-off errors, this function exactly reduces
+   * the argument to the range [-45, 45] before converting it to radians. */
+  real r, s, c; int q;
+  r = fmod(x, (real)(360));
+  q = (int)(floor(r / 90 + (real)(0.5)));
+  r -= 90 * q;
+  /* now abs(r) <= 45 */
+  r *= degree;
+  /* Possibly could call the gnu extension sincos */
+  s = sin(r); c = cos(r);
+  switch ((unsigned)q & 3U) {
+  case 0U: *sinx =     s; *cosx =     c; break;
+  case 1U: *sinx =     c; *cosx = 0 - s; break;
+  case 2U: *sinx = 0 - s; *cosx = 0 - c; break;
+  default: *sinx = 0 - c; *cosx =     s; break; /* case 3U */
+  }
+}
+
+static real atan2dx(real y, real x) {
+  /* In order to minimize round-off errors, this function rearranges the
+   * arguments so that result of atan2 is in the range [-pi/4, pi/4] before
+   * converting it to degrees and mapping the result to the correct
+   * quadrant. */
+  int q = 0; real ang;
+  if (fabs(y) > fabs(x)) { swapx(&x, &y); q = 2; }
+  if (x < 0) { x = -x; ++q; }
+  /* here x >= 0 and x >= abs(y), so angle is in [-pi/4, pi/4] */
+  ang = atan2(y, x) / degree;
+  switch (q) {
+    /* Note that atan2d(-0.0, 1.0) will return -0.  However, we expect that
+     * atan2d will not be called with y = -0.  If need be, include
+     *
+     *   case 0: ang = 0 + ang; break;
+     */
+  case 1: ang = (y > 0 ? 180 : -180) - ang; break;
+  case 2: ang =  90 - ang; break;
+  case 3: ang = -90 + ang; break;
+  }
+  return ang;
 }
 
 static void A3coeff(struct geod_geodesic* g);
@@ -186,9 +242,9 @@ static void Lengths(const struct geod_geodesic* g,
                     real ssig2, real csig2, real dn2,
                     real cbet1, real cbet2,
                     real* ps12b, real* pm12b, real* pm0,
-                    boolx scalep, real* pM12, real* pM21,
-                    /* Scratch areas of the right size */
-                    real C1a[], real C2a[]);
+                    real* pM12, real* pM21,
+                    /* Scratch area of the right size */
+                    real Ca[]);
 static real Astroid(real x, real y);
 static real InverseStart(const struct geod_geodesic* g,
                          real sbet1, real cbet1, real dn1,
@@ -199,8 +255,8 @@ static real InverseStart(const struct geod_geodesic* g,
                          real* psalp2, real* pcalp2,
                          /* Only updated for short lines */
                          real* pdnm,
-                         /* Scratch areas of the right size */
-                         real C1a[], real C2a[]);
+                         /* Scratch area of the right size */
+                         real Ca[]);
 static real Lambda12(const struct geod_geodesic* g,
                      real sbet1, real cbet1, real dn1,
                      real sbet2, real cbet2, real dn2,
@@ -211,8 +267,8 @@ static real Lambda12(const struct geod_geodesic* g,
                      real* pssig2, real* pcsig2,
                      real* peps, real* pdomg12,
                      boolx diffp, real* pdlam12,
-                     /* Scratch areas of the right size */
-                     real C1a[], real C2a[], real C3a[]);
+                     /* Scratch area of the right size */
+                     real Ca[]);
 static real A3f(const struct geod_geodesic* g, real eps);
 static void C3f(const struct geod_geodesic* g, real eps, real c[]);
 static void C4f(const struct geod_geodesic* g, real eps, real c[]);
@@ -262,7 +318,7 @@ void geod_init(struct geod_geodesic* g, real a, real f) {
 void geod_lineinit(struct geod_geodesicline* l,
                    const struct geod_geodesic* g,
                    real lat1, real lon1, real azi1, unsigned caps) {
-  real alp1, cbet1, sbet1, phi, eps;
+  real cbet1, sbet1, eps;
   l->a = g->a;
   l->f = g->f;
   l->b = g->b;
@@ -270,23 +326,18 @@ void geod_lineinit(struct geod_geodesicline* l,
   l->f1 = g->f1;
   /* If caps is 0 assume the standard direct calculation */
   l->caps = (caps ? caps : GEOD_DISTANCE_IN | GEOD_LONGITUDE) |
-    GEOD_LATITUDE | GEOD_AZIMUTH; /* Always allow latitude and azimuth */
+    /* always allow latitude and azimuth and unrolling of longitude */
+    GEOD_LATITUDE | GEOD_AZIMUTH | GEOD_LONG_UNROLL;
 
-  l->lat1 = lat1;
+  l->lat1 = LatFix(lat1);
   l->lon1 = lon1;
+  l->azi1 = AngNormalize(azi1);
   /* Guard against underflow in salp0 */
-  l->azi1 = AngRound(AngNormalize(azi1));
-  /* alp1 is in [0, pi] */
-  alp1 = l->azi1 * degree;
-  /* Enforce sin(pi) == 0 and cos(pi/2) == 0.  Better to face the ensuing
-   * problems directly than to skirt them. */
-  l->salp1 =      l->azi1  == -180 ? 0 : sin(alp1);
-  l->calp1 = fabs(l->azi1) ==   90 ? 0 : cos(alp1);
-  phi = lat1 * degree;
+  sincosdx(AngRound(l->azi1), &l->salp1, &l->calp1);
+
+  sincosdx(AngRound(l->lat1), &sbet1, &cbet1); sbet1 *= l->f1;
   /* Ensure cbet1 = +epsilon at poles */
-  sbet1 = l->f1 * sin(phi);
-  cbet1 = fabs(lat1) == 90 ? tiny : cos(phi);
-  SinCosNorm(&sbet1, &cbet1);
+  norm2(&sbet1, &cbet1); cbet1 = maxx(tiny, cbet1);
   l->dn1 = sqrt(1 + g->ep2 * sq(sbet1));
 
   /* Evaluate alp0 from sin(alp1) * cos(bet1) = sin(alp0), */
@@ -305,8 +356,8 @@ void geod_lineinit(struct geod_geodesicline* l,
    * With alp0 = 0, omg1 = 0 for alp1 = 0, omg1 = pi for alp1 = pi. */
   l->ssig1 = sbet1; l->somg1 = l->salp0 * sbet1;
   l->csig1 = l->comg1 = sbet1 != 0 || l->calp1 != 0 ? cbet1 * l->calp1 : 1;
-  SinCosNorm(&l->ssig1, &l->csig1); /* sig1 in (-pi, pi] */
-  /* SinCosNorm(somg1, comg1); -- don't need to normalize! */
+  norm2(&l->ssig1, &l->csig1); /* sig1 in (-pi, pi] */
+  /* norm2(somg1, comg1); -- don't need to normalize! */
 
   l->k2 = sq(l->calp0) * g->ep2;
   eps = l->k2 / (2 * (1 + sqrt(1 + l->k2)) + l->k2);
@@ -375,13 +426,9 @@ real geod_genposition(const struct geod_geodesicline* l,
     return NaN;
 
   if (flags & GEOD_ARCMODE) {
-    real s12a;
     /* Interpret s12_a12 as spherical arc length */
     sig12 = s12_a12 * degree;
-    s12a = fabs(s12_a12);
-    s12a -= 180 * floor(s12a / 180);
-    ssig12 = s12a ==  0 ? 0 : sin(sig12);
-    csig12 = s12a == 90 ? 0 : cos(sig12);
+    sincosdx(s12_a12, &ssig12, &csig12);
   } else {
     /* Interpret s12_a12 as distance */
     real
@@ -452,30 +499,29 @@ real geod_genposition(const struct geod_geodesicline* l,
     s12 = flags & GEOD_ARCMODE ? l->b * ((1 + l->A1m1) * sig12 + AB1) : s12_a12;
 
   if (outmask & GEOD_LONGITUDE) {
+    int E = l->salp0 < 0 ? -1 : 1; /* east or west going? */
     /* tan(omg2) = sin(alp0) * tan(sig2) */
     somg2 = l->salp0 * ssig2; comg2 = csig2;  /* No need to normalize */
     /* omg12 = omg2 - omg1 */
-    omg12 = flags & GEOD_LONG_NOWRAP ? sig12
-      - (atan2(ssig2, csig2) - atan2(l->ssig1, l->csig1))
-      + (atan2(somg2, comg2) - atan2(l->somg1, l->comg1))
+    omg12 = flags & GEOD_LONG_UNROLL
+      ? E * (sig12
+             - (atan2(    ssig2, csig2) - atan2(    l->ssig1, l->csig1))
+             + (atan2(E * somg2, comg2) - atan2(E * l->somg1, l->comg1)))
       : atan2(somg2 * l->comg1 - comg2 * l->somg1,
               comg2 * l->comg1 + somg2 * l->somg1);
     lam12 = omg12 + l->A3c *
       ( sig12 + (SinCosSeries(TRUE, ssig2, csig2, l->C3a, nC3-1)
                  - l->B31));
     lon12 = lam12 / degree;
-    /* Use AngNormalize2 because longitude might have wrapped multiple
-     * times. */
-    lon2 = flags & GEOD_LONG_NOWRAP ? l->lon1 + lon12 :
-      AngNormalize(AngNormalize(l->lon1) + AngNormalize2(lon12));
+    lon2 = flags & GEOD_LONG_UNROLL ? l->lon1 + lon12 :
+      AngNormalize(AngNormalize(l->lon1) + AngNormalize(lon12));
   }
 
   if (outmask & GEOD_LATITUDE)
-    lat2 = atan2(sbet2, l->f1 * cbet2) / degree;
+    lat2 = atan2dx(sbet2, l->f1 * cbet2);
 
   if (outmask & GEOD_AZIMUTH)
-    /* minus signs give range [-180, 180). 0- converts -0 to +0. */
-    azi2 = 0 - atan2(-salp2, calp2) / degree;
+    azi2 = atan2dx(salp2, calp2);
 
   if (outmask & (GEOD_REDUCEDLENGTH | GEOD_GEODESICSCALE)) {
     real
@@ -499,7 +545,7 @@ real geod_genposition(const struct geod_geodesicline* l,
       B42 = SinCosSeries(FALSE, ssig2, csig2, l->C4a, nC4);
     real salp12, calp12;
     if (l->calp0 == 0 || l->salp0 == 0) {
-      /* alp12 = alp2 - alp1, used in atan2 so no need to normalized */
+      /* alp12 = alp2 - alp1, used in atan2 so no need to normalize */
       salp12 = salp2 * l->calp1 - calp2 * l->salp1;
       calp12 = calp2 * l->calp1 + salp2 * l->salp1;
       /* The right thing appears to happen if alp1 = +/-180 and alp2 = 0, viz
@@ -591,11 +637,10 @@ real geod_geninverse(const struct geod_geodesic* g,
   real s12 = 0, azi1 = 0, azi2 = 0, m12 = 0, M12 = 0, M21 = 0, S12 = 0;
   real lon12;
   int latsign, lonsign, swapp;
-  real phi, sbet1, cbet1, sbet2, cbet2, s12x = 0, m12x = 0;
+  real sbet1, cbet1, sbet2, cbet2, s12x = 0, m12x = 0;
   real dn1, dn2, lam12, slam12, clam12;
   real a12 = 0, sig12, calp1 = 0, salp1 = 0, calp2 = 0, salp2 = 0;
-  /* index zero elements of these arrays are unused */
-  real C1a[nC1 + 1], C2a[nC2 + 1], C3a[nC3];
+  real Ca[nC];
   boolx meridian;
   real omg12 = 0;
 
@@ -610,15 +655,14 @@ real geod_geninverse(const struct geod_geodesic* g,
   /* Compute longitude difference (AngDiff does this carefully).  Result is
    * in [-180, 180] but -180 is only for west-going geodesics.  180 is for
    * east-going and meridional geodesics. */
-  lon12 = AngDiff(AngNormalize(lon1), AngNormalize(lon2));
   /* If very close to being on the same half-meridian, then make it so. */
-  lon12 = AngRound(lon12);
+  lon12 = AngRound(AngDiff(lon1, lon2));
   /* Make longitude difference positive. */
   lonsign = lon12 >= 0 ? 1 : -1;
   lon12 *= lonsign;
   /* If really close to the equator, treat as on equator. */
-  lat1 = AngRound(lat1);
-  lat2 = AngRound(lat2);
+  lat1 = AngRound(LatFix(lat1));
+  lat2 = AngRound(LatFix(lat2));
   /* Swap points so that point with higher (abs) latitude is point 1 */
   swapp = fabs(lat1) >= fabs(lat2) ? 1 : -1;
   if (swapp < 0) {
@@ -641,17 +685,13 @@ real geod_geninverse(const struct geod_geodesic* g,
    * check, e.g., on verifying quadrants in atan2.  In addition, this
    * enforces some symmetries in the results returned. */
 
-  phi = lat1 * degree;
+  sincosdx(lat1, &sbet1, &cbet1); sbet1 *= g->f1;
   /* Ensure cbet1 = +epsilon at poles */
-  sbet1 = g->f1 * sin(phi);
-  cbet1 = lat1 == -90 ? tiny : cos(phi);
-  SinCosNorm(&sbet1, &cbet1);
+  norm2(&sbet1, &cbet1); cbet1 = maxx(tiny, cbet1);
 
-  phi = lat2 * degree;
+  sincosdx(lat2, &sbet2, &cbet2); sbet2 *= g->f1;
   /* Ensure cbet2 = +epsilon at poles */
-  sbet2 = g->f1 * sin(phi);
-  cbet2 = fabs(lat2) == 90 ? tiny : cos(phi);
-  SinCosNorm(&sbet2, &cbet2);
+  norm2(&sbet2, &cbet2); cbet2 = maxx(tiny, cbet2);
 
   /* If cbet1 < -sbet1, then cbet2 - cbet1 is a sensitive measure of the
    * |bet1| - |bet2|.  Alternatively (cbet1 >= -sbet1), abs(sbet2) + sbet1 is
@@ -673,8 +713,7 @@ real geod_geninverse(const struct geod_geodesic* g,
   dn2 = sqrt(1 + g->ep2 * sq(sbet2));
 
   lam12 = lon12 * degree;
-  slam12 = lon12 == 180 ? 0 : sin(lam12);
-  clam12 = cos(lam12);      /* lon12 == 90 isn't interesting */
+  sincosdx(lon12, &slam12, &clam12);
 
   meridian = lat1 == -90 || slam12 == 0;
 
@@ -694,12 +733,11 @@ real geod_geninverse(const struct geod_geodesic* g,
     /* sig12 = sig2 - sig1 */
     sig12 = atan2(maxx(csig1 * ssig2 - ssig1 * csig2, (real)(0)),
                   csig1 * csig2 + ssig1 * ssig2);
-    {
-      real dummy;
-      Lengths(g, g->n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2,
-              cbet1, cbet2, &s12x, &m12x, &dummy,
-              (outmask & GEOD_GEODESICSCALE) != 0U, &M12, &M21, C1a, C2a);
-    }
+    Lengths(g, g->n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2,
+            cbet1, cbet2, &s12x, &m12x, 0,
+            outmask & GEOD_GEODESICSCALE ? &M12 : 0,
+            outmask & GEOD_GEODESICSCALE ? &M21 : 0,
+            Ca);
     /* Add the check for sig12 since zero length geodesics might yield m12 <
      * 0.  Test case was
      *
@@ -708,6 +746,9 @@ real geod_geninverse(const struct geod_geodesic* g,
      * In fact, we will have sig12 > pi/2 for meridional geodesic which is
      * not a shortest path. */
     if (sig12 < 1 || m12x >= 0) {
+      /* Need at least 2, to handle 90 0 90 180 */
+      if (sig12 < 3 * tiny)
+        sig12 = m12x = s12x = 0;
       m12x *= g->b;
       s12x *= g->b;
       a12 = sig12 / degree;
@@ -740,7 +781,7 @@ real geod_geninverse(const struct geod_geodesic* g,
     sig12 = InverseStart(g, sbet1, cbet1, dn1, sbet2, cbet2, dn2,
                          lam12,
                          &salp1, &calp1, &salp2, &calp2, &dnm,
-                         C1a, C2a);
+                         Ca);
 
     if (sig12 >= 0) {
       /* Short lines (InverseStart sets salp2, calp2, dnm) */
@@ -771,10 +812,10 @@ real geod_geninverse(const struct geod_geodesic* g,
       for (tripn = FALSE, tripb = FALSE; numit < maxit2; ++numit) {
         /* the WGS84 test set: mean = 1.47, sd = 1.25, max = 16
          * WGS84 and random input: mean = 2.85, sd = 0.60 */
-        real dv,
+        real dv = 0,
           v = (Lambda12(g, sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1,
                         &salp2, &calp2, &sig12, &ssig1, &csig1, &ssig2, &csig2,
-                        &eps, &omg12, numit < maxit1, &dv, C1a, C2a, C3a)
+                        &eps, &omg12, numit < maxit1, &dv, Ca)
                - lam12);
         /* 2 * tol0 is approximately 1 ulp for a number in [0, pi]. */
         /* Reversed test to allow escape with NaNs */
@@ -793,7 +834,7 @@ real geod_geninverse(const struct geod_geodesic* g,
           if (nsalp1 > 0 && fabs(dalp1) < pi) {
             calp1 = calp1 * cdalp1 - salp1 * sdalp1;
             salp1 = nsalp1;
-            SinCosNorm(&salp1, &calp1);
+            norm2(&salp1, &calp1);
             /* In some regimes we don't get quadratic convergence because
              * slope -> 0.  So use convergence conditions based on epsilon
              * instead of sqrt(epsilon). */
@@ -811,17 +852,15 @@ real geod_geninverse(const struct geod_geodesic* g,
          * WGS84 and random input: mean = 4.74, sd = 0.99 */
         salp1 = (salp1a + salp1b)/2;
         calp1 = (calp1a + calp1b)/2;
-        SinCosNorm(&salp1, &calp1);
+        norm2(&salp1, &calp1);
         tripn = FALSE;
         tripb = (fabs(salp1a - salp1) + (calp1a - calp1) < tolb ||
                  fabs(salp1 - salp1b) + (calp1 - calp1b) < tolb);
       }
-      {
-        real dummy;
-        Lengths(g, eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2,
-                cbet1, cbet2, &s12x, &m12x, &dummy,
-                (outmask & GEOD_GEODESICSCALE) != 0U, &M12, &M21, C1a, C2a);
-      }
+      Lengths(g, eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2,
+              cbet1, cbet2, &s12x, &m12x, 0,
+              outmask & GEOD_GEODESICSCALE ? &M12 : 0,
+              outmask & GEOD_GEODESICSCALE ? &M21 : 0, Ca);
       m12x *= g->b;
       s12x *= g->b;
       a12 = sig12 / degree;
@@ -850,13 +889,12 @@ real geod_geninverse(const struct geod_geodesic* g,
         eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2),
         /* Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0). */
         A4 = sq(g->a) * calp0 * salp0 * g->e2;
-      real C4a[nC4];
       real B41, B42;
-      SinCosNorm(&ssig1, &csig1);
-      SinCosNorm(&ssig2, &csig2);
-      C4f(g, eps, C4a);
-      B41 = SinCosSeries(FALSE, ssig1, csig1, C4a, nC4);
-      B42 = SinCosSeries(FALSE, ssig2, csig2, C4a, nC4);
+      norm2(&ssig1, &csig1);
+      norm2(&ssig2, &csig2);
+      C4f(g, eps, Ca);
+      B41 = SinCosSeries(FALSE, ssig1, csig1, Ca, nC4);
+      B42 = SinCosSeries(FALSE, ssig2, csig2, Ca, nC4);
       S12 = A4 * (B42 - B41);
     } else
       /* Avoid problems with indeterminate sig1, sig2 on equator */
@@ -907,8 +945,8 @@ real geod_geninverse(const struct geod_geodesic* g,
 
   if (outmask & GEOD_AZIMUTH) {
     /* minus signs give range [-180, 180). 0- converts -0 to +0. */
-    azi1 = 0 - atan2(-salp1, calp1) / degree;
-    azi2 = 0 - atan2(-salp2, calp2) / degree;
+    azi1 = atan2dx(salp1, calp1);
+    azi2 = atan2dx(salp2, calp2);
   }
 
   if (outmask & GEOD_DISTANCE)
@@ -964,42 +1002,58 @@ void Lengths(const struct geod_geodesic* g,
              real ssig2, real csig2, real dn2,
              real cbet1, real cbet2,
              real* ps12b, real* pm12b, real* pm0,
-             boolx scalep, real* pM12, real* pM21,
-             /* Scratch areas of the right size */
-             real C1a[], real C2a[]) {
-  real s12b = 0, m12b = 0, m0 = 0, M12 = 0, M21 = 0;
-  real A1m1, AB1, A2m1, AB2, J12;
+             real* pM12, real* pM21,
+             /* Scratch area of the right size */
+             real Ca[]) {
+  real m0 = 0, J12 = 0, A1 = 0, A2 = 0;
+  real Cb[nC];
 
   /* Return m12b = (reduced length)/b; also calculate s12b = distance/b,
    * and m0 = coefficient of secular term in expression for reduced length. */
-  C1f(eps, C1a);
-  C2f(eps, C2a);
-  A1m1 = A1m1f(eps);
-  AB1 = (1 + A1m1) * (SinCosSeries(TRUE, ssig2, csig2, C1a, nC1) -
-                      SinCosSeries(TRUE, ssig1, csig1, C1a, nC1));
-  A2m1 = A2m1f(eps);
-  AB2 = (1 + A2m1) * (SinCosSeries(TRUE, ssig2, csig2, C2a, nC2) -
-                      SinCosSeries(TRUE, ssig1, csig1, C2a, nC2));
-  m0 = A1m1 - A2m1;
-  J12 = m0 * sig12 + (AB1 - AB2);
-  /* Missing a factor of b.
-   * Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure accurate
-   * cancellation in the case of coincident points. */
-  m12b = dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) - csig1 * csig2 * J12;
-  /* Missing a factor of b */
-  s12b = (1 + A1m1) * sig12 + AB1;
-  if (scalep) {
+  boolx redlp = pm12b || pm0 || pM12 || pM21;
+  if (ps12b || redlp) {
+    A1 = A1m1f(eps);
+    C1f(eps, Ca);
+    if (redlp) {
+      A2 = A2m1f(eps);
+      C2f(eps, Cb);
+      m0 = A1 - A2;
+      A2 = 1 + A2;
+    }
+    A1 = 1 + A1;
+  }
+  if (ps12b) {
+    real B1 = SinCosSeries(TRUE, ssig2, csig2, Ca, nC1) -
+      SinCosSeries(TRUE, ssig1, csig1, Ca, nC1);
+    /* Missing a factor of b */
+    *ps12b = A1 * (sig12 + B1);
+    if (redlp) {
+      real B2 = SinCosSeries(TRUE, ssig2, csig2, Cb, nC2) -
+        SinCosSeries(TRUE, ssig1, csig1, Cb, nC2);
+      J12 = m0 * sig12 + (A1 * B1 - A2 * B2);
+    }
+  } else if (redlp) {
+    /* Assume here that nC1 >= nC2 */
+    int l;
+    for (l = 1; l <= nC2; ++l)
+      Cb[l] = A1 * Ca[l] - A2 * Cb[l];
+    J12 = m0 * sig12 + (SinCosSeries(TRUE, ssig2, csig2, Cb, nC2) -
+                        SinCosSeries(TRUE, ssig1, csig1, Cb, nC2));
+  }
+  if (pm0) *pm0 = m0;
+  if (pm12b)
+    /* Missing a factor of b.
+     * Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure
+     * accurate cancellation in the case of coincident points. */
+    *pm12b = dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) -
+      csig1 * csig2 * J12;
+  if (pM12 || pM21) {
     real csig12 = csig1 * csig2 + ssig1 * ssig2;
     real t = g->ep2 * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2);
-    M12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1;
-    M21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2;
-  }
-  *ps12b = s12b;
-  *pm12b = m12b;
-  *pm0 = m0;
-  if (scalep) {
-    *pM12 = M12;
-    *pM21 = M21;
+    if (pM12)
+      *pM12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1;
+    if (pM21)
+      *pM21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2;
   }
 }
 
@@ -1018,7 +1072,7 @@ real Astroid(real x, real y) {
       S = p * q / 4,            /* S = r^3 * s */
       r2 = sq(r),
       r3 = r * r2,
-      /* The discrimant of the quadratic equation for T3.  This is zero on
+      /* The discriminant of the quadratic equation for T3.  This is zero on
        * the evolute curve p^(1/3)+q^(1/3) = 1 */
       disc = S * (S + 2 * r3);
     real u = r;
@@ -1064,8 +1118,8 @@ real InverseStart(const struct geod_geodesic* g,
                   real* psalp2, real* pcalp2,
                   /* Only updated for short lines */
                   real* pdnm,
-                  /* Scratch areas of the right size */
-                  real C1a[], real C2a[]) {
+                  /* Scratch area of the right size */
+                  real Ca[]) {
   real salp1 = 0, calp1 = 0, salp2 = 0, calp2 = 0, dnm = 0;
 
   /* Return a starting point for Newton's method in salp1 and calp1 (function
@@ -1076,6 +1130,10 @@ real InverseStart(const struct geod_geodesic* g,
     /* bet12 = bet2 - bet1 in [0, pi); bet12a = bet2 + bet1 in (-pi, 0] */
     sbet12 = sbet2 * cbet1 - cbet2 * sbet1,
     cbet12 = cbet2 * cbet1 + sbet2 * sbet1;
+  real sbet12a;
+  boolx shortline = cbet12 >= 0 && sbet12 < (real)(0.5) &&
+    cbet2 * lam12 < (real)(0.5);
+  real omg12 = lam12, somg12, comg12, ssig12, csig12;
 #if defined(__GNUC__) && __GNUC__ == 4 &&       \
   (__GNUC_MINOR__ < 6 || defined(__MINGW32__))
   /* Volatile declaration needed to fix inverse cases
@@ -1084,18 +1142,14 @@ real InverseStart(const struct geod_geodesic* g,
    * 89.333123580033 0 -89.333123580032997687 179.99295812360148422
    * which otherwise fail with g++ 4.4.4 x86 -O3 (Linux)
    * and g++ 4.4.0 (mingw) and g++ 4.6.1 (tdm mingw). */
-  real sbet12a;
   {
     volatile real xx1 = sbet2 * cbet1;
     volatile real xx2 = cbet2 * sbet1;
     sbet12a = xx1 + xx2;
   }
 #else
-  real sbet12a = sbet2 * cbet1 + cbet2 * sbet1;
+  sbet12a = sbet2 * cbet1 + cbet2 * sbet1;
 #endif
-  boolx shortline = cbet12 >= 0 && sbet12 < (real)(0.5) &&
-    cbet2 * lam12 < (real)(0.5);
-  real omg12 = lam12, somg12, comg12, ssig12, csig12;
   if (shortline) {
     real sbetm2 = sq(sbet1 + sbet2);
     /* sin((bet1+bet2)/2)^2
@@ -1119,7 +1173,7 @@ real InverseStart(const struct geod_geodesic* g,
     salp2 = cbet1 * somg12;
     calp2 = sbet12 - cbet1 * sbet2 *
       (comg12 >= 0 ? sq(somg12) / (1 + comg12) : 1 - comg12);
-    SinCosNorm(&salp2, &calp2);
+    norm2(&salp2, &calp2);
     /* Set return value */
     sig12 = atan2(ssig12, csig12);
   } else if (fabs(g->n) > (real)(0.1) || /* No astroid calc if too eccentric */
@@ -1151,13 +1205,12 @@ real InverseStart(const struct geod_geodesic* g,
       real
         cbet12a = cbet2 * cbet1 - sbet2 * sbet1,
         bet12a = atan2(sbet12a, cbet12a);
-      real m12b, m0, dummy;
+      real m12b, m0;
       /* In the case of lon12 = 180, this repeats a calculation made in
        * Inverse. */
       Lengths(g, g->n, pi + bet12a,
               sbet1, -cbet1, dn1, sbet2, cbet2, dn2,
-              cbet1, cbet2, &dummy, &m12b, &m0, FALSE,
-              &dummy, &dummy, C1a, C2a);
+              cbet1, cbet2, 0, &m12b, &m0, 0, 0, Ca);
       x = -1 + m12b / (cbet1 * cbet2 * m0 * pi);
       betscale = x < -(real)(0.01) ? sbet12a / x :
         -g->f * sq(cbet1) * pi;
@@ -1219,7 +1272,7 @@ real InverseStart(const struct geod_geodesic* g,
   }
   /* Sanity check on starting guess.  Backwards check allows NaN through. */
   if (!(salp1 <= 0))
-    SinCosNorm(&salp1, &calp1);
+    norm2(&salp1, &calp1);
   else {
     salp1 = 1; calp1 = 0;
   }
@@ -1245,8 +1298,8 @@ real Lambda12(const struct geod_geodesic* g,
               real* pssig2, real* pcsig2,
               real* peps, real* pdomg12,
               boolx diffp, real* pdlam12,
-              /* Scratch areas of the right size */
-              real C1a[], real C2a[], real C3a[]) {
+              /* Scratch area of the right size */
+              real Ca[]) {
   real salp2 = 0, calp2 = 0, sig12 = 0,
     ssig1 = 0, csig1 = 0, ssig2 = 0, csig2 = 0, eps = 0, domg12 = 0, dlam12 = 0;
   real salp0, calp0;
@@ -1266,8 +1319,8 @@ real Lambda12(const struct geod_geodesic* g,
    * tan(omg1) = sin(alp0) * tan(sig1) = tan(omg1)=tan(alp1)*sin(bet1) */
   ssig1 = sbet1; somg1 = salp0 * sbet1;
   csig1 = comg1 = calp1 * cbet1;
-  SinCosNorm(&ssig1, &csig1);
-  /* SinCosNorm(&somg1, &comg1); -- don't need to normalize! */
+  norm2(&ssig1, &csig1);
+  /* norm2(&somg1, &comg1); -- don't need to normalize! */
 
   /* Enforce symmetries in the case abs(bet2) = -bet1.  Need to be careful
    * about this case, since this can yield singularities in the Newton
@@ -1288,8 +1341,8 @@ real Lambda12(const struct geod_geodesic* g,
    * tan(omg2) = sin(alp0) * tan(sig2). */
   ssig2 = sbet2; somg2 = salp0 * sbet2;
   csig2 = comg2 = calp2 * cbet2;
-  SinCosNorm(&ssig2, &csig2);
-  /* SinCosNorm(&somg2, &comg2); -- don't need to normalize! */
+  norm2(&ssig2, &csig2);
+  /* norm2(&somg2, &comg2); -- don't need to normalize! */
 
   /* sig12 = sig2 - sig1, limit to [0, pi] */
   sig12 = atan2(maxx(csig1 * ssig2 - ssig1 * csig2, (real)(0)),
@@ -1300,9 +1353,9 @@ real Lambda12(const struct geod_geodesic* g,
                 comg1 * comg2 + somg1 * somg2);
   k2 = sq(calp0) * g->ep2;
   eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2);
-  C3f(g, eps, C3a);
-  B312 = (SinCosSeries(TRUE, ssig2, csig2, C3a, nC3-1) -
-          SinCosSeries(TRUE, ssig1, csig1, C3a, nC3-1));
+  C3f(g, eps, Ca);
+  B312 = (SinCosSeries(TRUE, ssig2, csig2, Ca, nC3-1) -
+          SinCosSeries(TRUE, ssig1, csig1, Ca, nC3-1));
   h0 = -g->f * A3f(g, eps);
   domg12 = salp0 * h0 * (sig12 + B312);
   lam12 = omg12 + domg12;
@@ -1311,10 +1364,8 @@ real Lambda12(const struct geod_geodesic* g,
     if (calp2 == 0)
       dlam12 = - 2 * g->f1 * dn1 / sbet1;
     else {
-      real dummy;
       Lengths(g, eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2,
-              cbet1, cbet2, &dummy, &dlam12, &dummy,
-              FALSE, &dummy, &dummy, C1a, C2a);
+              cbet1, cbet2, 0, &dlam12, 0, 0, 0, Ca);
       dlam12 *= g->f1 / (calp2 * cbet2);
     }
   }
@@ -1335,177 +1386,264 @@ real Lambda12(const struct geod_geodesic* g,
 }
 
 real A3f(const struct geod_geodesic* g, real eps) {
-  /* Evaluate sum(A3x[k] * eps^k, k, 0, nA3x-1) by Horner's method */
-  real v = 0;
-  int i;
-  for (i = nA3x; i; )
-    v = eps * v + g->A3x[--i];
-  return v;
+  /* Evaluate A3 */
+  return polyval(nA3 - 1, g->A3x, eps);
 }
 
 void C3f(const struct geod_geodesic* g, real eps, real c[]) {
-  /* Evaluate C3 coeffs by Horner's method
+  /* Evaluate C3 coeffs
    * Elements c[1] thru c[nC3 - 1] are set */
-  int i, j, k;
   real mult = 1;
-  for (j = nC3x, k = nC3 - 1; k; ) {
-    real t = 0;
-    for (i = nC3 - k; i; --i)
-      t = eps * t + g->C3x[--j];
-    c[k--] = t;
-  }
-
-  for (k = 1; k < nC3; ) {
+  int o = 0, l;
+  for (l = 1; l < nC3; ++l) {   /* l is index of C3[l] */
+    int m = nC3 - l - 1;        /* order of polynomial in eps */
     mult *= eps;
-    c[k++] *= mult;
+    c[l] = mult * polyval(m, g->C3x + o, eps);
+    o += m + 1;
   }
 }
 
 void C4f(const struct geod_geodesic* g, real eps, real c[]) {
-  /* Evaluate C4 coeffs by Horner's method
+  /* Evaluate C4 coeffs
    * Elements c[0] thru c[nC4 - 1] are set */
-  int i, j, k;
   real mult = 1;
-  for (j = nC4x, k = nC4; k; ) {
-    real t = 0;
-    for (i = nC4 - k + 1; i; --i)
-      t = eps * t + g->C4x[--j];
-    c[--k] = t;
-  }
-
-  for (k = 1; k < nC4; ) {
+  int o = 0, l;
+  for (l = 0; l < nC4; ++l) {   /* l is index of C4[l] */
+    int m = nC4 - l - 1;        /* order of polynomial in eps */
+    c[l] = mult * polyval(m, g->C4x + o, eps);
+    o += m + 1;
     mult *= eps;
-    c[k++] *= mult;
   }
 }
 
-/* Generated by Maxima on 2010-09-04 10:26:17-04:00 */
-
 /* The scale factor A1-1 = mean value of (d/dsigma)I1 - 1 */
 real A1m1f(real eps)  {
-  real
-    eps2 = sq(eps),
-    t = eps2*(eps2*(eps2+4)+64)/256;
+  static const real coeff[] = {
+    /* (1-eps)*A1-1, polynomial in eps2 of order 3 */
+    1, 4, 64, 0, 256,
+  };
+  int m = nA1/2;
+  real t = polyval(m, coeff, sq(eps)) / coeff[m + 1];
   return (t + eps) / (1 - eps);
 }
 
 /* The coefficients C1[l] in the Fourier expansion of B1 */
 void C1f(real eps, real c[])  {
+  static const real coeff[] = {
+    /* C1[1]/eps^1, polynomial in eps2 of order 2 */
+    -1, 6, -16, 32,
+    /* C1[2]/eps^2, polynomial in eps2 of order 2 */
+    -9, 64, -128, 2048,
+    /* C1[3]/eps^3, polynomial in eps2 of order 1 */
+    9, -16, 768,
+    /* C1[4]/eps^4, polynomial in eps2 of order 1 */
+    3, -5, 512,
+    /* C1[5]/eps^5, polynomial in eps2 of order 0 */
+    -7, 1280,
+    /* C1[6]/eps^6, polynomial in eps2 of order 0 */
+    -7, 2048,
+  };
   real
     eps2 = sq(eps),
     d = eps;
-  c[1] = d*((6-eps2)*eps2-16)/32;
-  d *= eps;
-  c[2] = d*((64-9*eps2)*eps2-128)/2048;
-  d *= eps;
-  c[3] = d*(9*eps2-16)/768;
-  d *= eps;
-  c[4] = d*(3*eps2-5)/512;
-  d *= eps;
-  c[5] = -7*d/1280;
-  d *= eps;
-  c[6] = -7*d/2048;
+  int o = 0, l;
+  for (l = 1; l <= nC1; ++l) {  /* l is index of C1p[l] */
+    int m = (nC1 - l) / 2;      /* order of polynomial in eps^2 */
+    c[l] = d * polyval(m, coeff + o, eps2) / coeff[o + m + 1];
+    o += m + 2;
+    d *= eps;
+  }
 }
 
 /* The coefficients C1p[l] in the Fourier expansion of B1p */
 void C1pf(real eps, real c[])  {
+  static const real coeff[] = {
+    /* C1p[1]/eps^1, polynomial in eps2 of order 2 */
+    205, -432, 768, 1536,
+    /* C1p[2]/eps^2, polynomial in eps2 of order 2 */
+    4005, -4736, 3840, 12288,
+    /* C1p[3]/eps^3, polynomial in eps2 of order 1 */
+    -225, 116, 384,
+    /* C1p[4]/eps^4, polynomial in eps2 of order 1 */
+    -7173, 2695, 7680,
+    /* C1p[5]/eps^5, polynomial in eps2 of order 0 */
+    3467, 7680,
+    /* C1p[6]/eps^6, polynomial in eps2 of order 0 */
+    38081, 61440,
+  };
   real
     eps2 = sq(eps),
     d = eps;
-  c[1] = d*(eps2*(205*eps2-432)+768)/1536;
-  d *= eps;
-  c[2] = d*(eps2*(4005*eps2-4736)+3840)/12288;
-  d *= eps;
-  c[3] = d*(116-225*eps2)/384;
-  d *= eps;
-  c[4] = d*(2695-7173*eps2)/7680;
-  d *= eps;
-  c[5] = 3467*d/7680;
-  d *= eps;
-  c[6] = 38081*d/61440;
+  int o = 0, l;
+  for (l = 1; l <= nC1p; ++l) { /* l is index of C1p[l] */
+    int m = (nC1p - l) / 2;     /* order of polynomial in eps^2 */
+    c[l] = d * polyval(m, coeff + o, eps2) / coeff[o + m + 1];
+    o += m + 2;
+    d *= eps;
+  }
 }
 
 /* The scale factor A2-1 = mean value of (d/dsigma)I2 - 1 */
 real A2m1f(real eps)  {
-  real
-    eps2 = sq(eps),
-    t = eps2*(eps2*(25*eps2+36)+64)/256;
-  return t * (1 - eps) - eps;
+  static const real coeff[] = {
+    /* (eps+1)*A2-1, polynomial in eps2 of order 3 */
+    -11, -28, -192, 0, 256,
+  };
+  int m = nA2/2;
+  real t = polyval(m, coeff, sq(eps)) / coeff[m + 1];
+  return (t - eps) / (1 + eps);
 }
 
 /* The coefficients C2[l] in the Fourier expansion of B2 */
 void C2f(real eps, real c[])  {
+  static const real coeff[] = {
+    /* C2[1]/eps^1, polynomial in eps2 of order 2 */
+    1, 2, 16, 32,
+    /* C2[2]/eps^2, polynomial in eps2 of order 2 */
+    35, 64, 384, 2048,
+    /* C2[3]/eps^3, polynomial in eps2 of order 1 */
+    15, 80, 768,
+    /* C2[4]/eps^4, polynomial in eps2 of order 1 */
+    7, 35, 512,
+    /* C2[5]/eps^5, polynomial in eps2 of order 0 */
+    63, 1280,
+    /* C2[6]/eps^6, polynomial in eps2 of order 0 */
+    77, 2048,
+  };
   real
     eps2 = sq(eps),
     d = eps;
-  c[1] = d*(eps2*(eps2+2)+16)/32;
-  d *= eps;
-  c[2] = d*(eps2*(35*eps2+64)+384)/2048;
-  d *= eps;
-  c[3] = d*(15*eps2+80)/768;
-  d *= eps;
-  c[4] = d*(7*eps2+35)/512;
-  d *= eps;
-  c[5] = 63*d/1280;
-  d *= eps;
-  c[6] = 77*d/2048;
+  int o = 0, l;
+  for (l = 1; l <= nC2; ++l) { /* l is index of C2[l] */
+    int m = (nC2 - l) / 2;     /* order of polynomial in eps^2 */
+    c[l] = d * polyval(m, coeff + o, eps2) / coeff[o + m + 1];
+    o += m + 2;
+    d *= eps;
+  }
 }
 
 /* The scale factor A3 = mean value of (d/dsigma)I3 */
 void A3coeff(struct geod_geodesic* g) {
-  g->A3x[0] = 1;
-  g->A3x[1] = (g->n-1)/2;
-  g->A3x[2] = (g->n*(3*g->n-1)-2)/8;
-  g->A3x[3] = ((-g->n-3)*g->n-1)/16;
-  g->A3x[4] = (-2*g->n-3)/64;
-  g->A3x[5] = -3/(real)(128);
+  static const real coeff[] = {
+    /* A3, coeff of eps^5, polynomial in n of order 0 */
+    -3, 128,
+    /* A3, coeff of eps^4, polynomial in n of order 1 */
+    -2, -3, 64,
+    /* A3, coeff of eps^3, polynomial in n of order 2 */
+    -1, -3, -1, 16,
+    /* A3, coeff of eps^2, polynomial in n of order 2 */
+    3, -1, -2, 8,
+    /* A3, coeff of eps^1, polynomial in n of order 1 */
+    1, -1, 2,
+    /* A3, coeff of eps^0, polynomial in n of order 0 */
+    1, 1,
+  };
+  int o = 0, k = 0, j;
+  for (j = nA3 - 1; j >= 0; --j) {             /* coeff of eps^j */
+    int m = nA3 - j - 1 < j ? nA3 - j - 1 : j; /* order of polynomial in n */
+    g->A3x[k++] = polyval(m, coeff + o, g->n) / coeff[o + m + 1];
+    o += m + 2;
+  }
 }
 
 /* The coefficients C3[l] in the Fourier expansion of B3 */
 void C3coeff(struct geod_geodesic* g) {
-  g->C3x[0] = (1-g->n)/4;
-  g->C3x[1] = (1-g->n*g->n)/8;
-  g->C3x[2] = ((3-g->n)*g->n+3)/64;
-  g->C3x[3] = (2*g->n+5)/128;
-  g->C3x[4] = 3/(real)(128);
-  g->C3x[5] = ((g->n-3)*g->n+2)/32;
-  g->C3x[6] = ((-3*g->n-2)*g->n+3)/64;
-  g->C3x[7] = (g->n+3)/128;
-  g->C3x[8] = 5/(real)(256);
-  g->C3x[9] = (g->n*(5*g->n-9)+5)/192;
-  g->C3x[10] = (9-10*g->n)/384;
-  g->C3x[11] = 7/(real)(512);
-  g->C3x[12] = (7-14*g->n)/512;
-  g->C3x[13] = 7/(real)(512);
-  g->C3x[14] = 21/(real)(2560);
+  static const real coeff[] = {
+    /* C3[1], coeff of eps^5, polynomial in n of order 0 */
+    3, 128,
+    /* C3[1], coeff of eps^4, polynomial in n of order 1 */
+    2, 5, 128,
+    /* C3[1], coeff of eps^3, polynomial in n of order 2 */
+    -1, 3, 3, 64,
+    /* C3[1], coeff of eps^2, polynomial in n of order 2 */
+    -1, 0, 1, 8,
+    /* C3[1], coeff of eps^1, polynomial in n of order 1 */
+    -1, 1, 4,
+    /* C3[2], coeff of eps^5, polynomial in n of order 0 */
+    5, 256,
+    /* C3[2], coeff of eps^4, polynomial in n of order 1 */
+    1, 3, 128,
+    /* C3[2], coeff of eps^3, polynomial in n of order 2 */
+    -3, -2, 3, 64,
+    /* C3[2], coeff of eps^2, polynomial in n of order 2 */
+    1, -3, 2, 32,
+    /* C3[3], coeff of eps^5, polynomial in n of order 0 */
+    7, 512,
+    /* C3[3], coeff of eps^4, polynomial in n of order 1 */
+    -10, 9, 384,
+    /* C3[3], coeff of eps^3, polynomial in n of order 2 */
+    5, -9, 5, 192,
+    /* C3[4], coeff of eps^5, polynomial in n of order 0 */
+    7, 512,
+    /* C3[4], coeff of eps^4, polynomial in n of order 1 */
+    -14, 7, 512,
+    /* C3[5], coeff of eps^5, polynomial in n of order 0 */
+    21, 2560,
+  };
+  int o = 0, k = 0, l, j;
+  for (l = 1; l < nC3; ++l) {                    /* l is index of C3[l] */
+    for (j = nC3 - 1; j >= l; --j) {             /* coeff of eps^j */
+      int m = nC3 - j - 1 < j ? nC3 - j - 1 : j; /* order of polynomial in n */
+      g->C3x[k++] = polyval(m, coeff + o, g->n) / coeff[o + m + 1];
+      o += m + 2;
+    }
+  }
 }
 
-/* Generated by Maxima on 2012-10-19 08:02:34-04:00 */
-
 /* The coefficients C4[l] in the Fourier expansion of I4 */
 void C4coeff(struct geod_geodesic* g) {
-  g->C4x[0] = (g->n*(g->n*(g->n*(g->n*(100*g->n+208)+572)+3432)-12012)+30030)/
-    45045;
-  g->C4x[1] = (g->n*(g->n*(g->n*(64*g->n+624)-4576)+6864)-3003)/15015;
-  g->C4x[2] = (g->n*((14144-10656*g->n)*g->n-4576)-858)/45045;
-  g->C4x[3] = ((-224*g->n-4784)*g->n+1573)/45045;
-  g->C4x[4] = (1088*g->n+156)/45045;
-  g->C4x[5] = 97/(real)(15015);
-  g->C4x[6] = (g->n*(g->n*((-64*g->n-624)*g->n+4576)-6864)+3003)/135135;
-  g->C4x[7] = (g->n*(g->n*(5952*g->n-11648)+9152)-2574)/135135;
-  g->C4x[8] = (g->n*(5792*g->n+1040)-1287)/135135;
-  g->C4x[9] = (468-2944*g->n)/135135;
-  g->C4x[10] = 1/(real)(9009);
-  g->C4x[11] = (g->n*((4160-1440*g->n)*g->n-4576)+1716)/225225;
-  g->C4x[12] = ((4992-8448*g->n)*g->n-1144)/225225;
-  g->C4x[13] = (1856*g->n-936)/225225;
-  g->C4x[14] = 8/(real)(10725);
-  g->C4x[15] = (g->n*(3584*g->n-3328)+1144)/315315;
-  g->C4x[16] = (1024*g->n-208)/105105;
-  g->C4x[17] = -136/(real)(63063);
-  g->C4x[18] = (832-2560*g->n)/405405;
-  g->C4x[19] = -128/(real)(135135);
-  g->C4x[20] = 128/(real)(99099);
+  static const real coeff[] = {
+    /* C4[0], coeff of eps^5, polynomial in n of order 0 */
+    97, 15015,
+    /* C4[0], coeff of eps^4, polynomial in n of order 1 */
+    1088, 156, 45045,
+    /* C4[0], coeff of eps^3, polynomial in n of order 2 */
+    -224, -4784, 1573, 45045,
+    /* C4[0], coeff of eps^2, polynomial in n of order 3 */
+    -10656, 14144, -4576, -858, 45045,
+    /* C4[0], coeff of eps^1, polynomial in n of order 4 */
+    64, 624, -4576, 6864, -3003, 15015,
+    /* C4[0], coeff of eps^0, polynomial in n of order 5 */
+    100, 208, 572, 3432, -12012, 30030, 45045,
+    /* C4[1], coeff of eps^5, polynomial in n of order 0 */
+    1, 9009,
+    /* C4[1], coeff of eps^4, polynomial in n of order 1 */
+    -2944, 468, 135135,
+    /* C4[1], coeff of eps^3, polynomial in n of order 2 */
+    5792, 1040, -1287, 135135,
+    /* C4[1], coeff of eps^2, polynomial in n of order 3 */
+    5952, -11648, 9152, -2574, 135135,
+    /* C4[1], coeff of eps^1, polynomial in n of order 4 */
+    -64, -624, 4576, -6864, 3003, 135135,
+    /* C4[2], coeff of eps^5, polynomial in n of order 0 */
+    8, 10725,
+    /* C4[2], coeff of eps^4, polynomial in n of order 1 */
+    1856, -936, 225225,
+    /* C4[2], coeff of eps^3, polynomial in n of order 2 */
+    -8448, 4992, -1144, 225225,
+    /* C4[2], coeff of eps^2, polynomial in n of order 3 */
+    -1440, 4160, -4576, 1716, 225225,
+    /* C4[3], coeff of eps^5, polynomial in n of order 0 */
+    -136, 63063,
+    /* C4[3], coeff of eps^4, polynomial in n of order 1 */
+    1024, -208, 105105,
+    /* C4[3], coeff of eps^3, polynomial in n of order 2 */
+    3584, -3328, 1144, 315315,
+    /* C4[4], coeff of eps^5, polynomial in n of order 0 */
+    -128, 135135,
+    /* C4[4], coeff of eps^4, polynomial in n of order 1 */
+    -2560, 832, 405405,
+    /* C4[5], coeff of eps^5, polynomial in n of order 0 */
+    128, 99099,
+  };
+  int o = 0, k = 0, l, j;
+  for (l = 0; l < nC4; ++l) {        /* l is index of C4[l] */
+    for (j = nC4 - 1; j >= l; --j) { /* coeff of eps^j */
+      int m = nC4 - j - 1;           /* order of polynomial in n */
+      g->C4x[k++] = polyval(m, coeff + o, g->n) / coeff[o + m + 1];
+      o += m + 2;
+    }
+  }
 }
 
 int transit(real lon1, real lon2) {
@@ -1594,7 +1732,7 @@ void geod_polygon_addedge(const struct geod_geodesic* g,
                           real azi, real s) {
   if (p->num) {                 /* Do nothing is num is zero */
     real lat, lon, S12;
-    geod_gendirect(g, p->lat, p->lon, azi, GEOD_LONG_NOWRAP, s,
+    geod_gendirect(g, p->lat, p->lon, azi, GEOD_LONG_UNROLL, s,
                    &lat, &lon, 0,
                    0, 0, 0, 0, p->polyline ? 0 : &S12);
     accadd(p->P, s);
@@ -1731,7 +1869,7 @@ unsigned geod_polygon_testedge(const struct geod_geodesic* g,
   crossings = p->crossings;
   {
     real lat, lon, s12, S12;
-    geod_gendirect(g, p->lat, p->lon, azi, GEOD_LONG_NOWRAP, s,
+    geod_gendirect(g, p->lat, p->lon, azi, GEOD_LONG_UNROLL, s,
                    &lat, &lon, 0,
                    0, 0, 0, 0, &S12);
     tempsum += S12;
diff --git a/src/geodesic.h b/src/geodesic.h
index 6b2afc5..7bd8270 100644
--- a/src/geodesic.h
+++ b/src/geodesic.h
@@ -108,12 +108,12 @@
  * twice about restructuring the internals of the C code since this may make
  * porting fixes from the C++ code more difficult.
  *
- * Copyright (c) Charles Karney (2012-2014) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2012-2015) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
  * This library was distributed with
- * <a href="../index.html">GeographicLib</a> 1.40.
+ * <a href="../index.html">GeographicLib</a> 1.44.
  **********************************************************************/
 
 #if !defined(GEODESIC_H)
@@ -128,13 +128,36 @@
  * The minor version of the geodesic library.  (This tracks the version of
  * GeographicLib.)
  **********************************************************************/
-#define GEODESIC_VERSION_MINOR 40
+#define GEODESIC_VERSION_MINOR 44
 /**
  * The patch level of the geodesic library.  (This tracks the version of
  * GeographicLib.)
  **********************************************************************/
 #define GEODESIC_VERSION_PATCH 0
 
+/**
+ * Pack the version components into a single integer.  Users should not rely on
+ * this particular packing of the components of the version number; see the
+ * documentation for GEODESIC_VERSION, below.
+ **********************************************************************/
+#define GEODESIC_VERSION_NUM(a,b,c) ((((a) * 10000 + (b)) * 100) + (c))
+
+/**
+ * The version of the geodesic library as a single integer, packed as MMmmmmpp
+ * where MM is the major version, mmmm is the minor version, and pp is the
+ * patch level.  Users should not rely on this particular packing of the
+ * components of the version number.  Instead they should use a test such as
+ * @code{.c}
+   #if GEODESIC_VERSION >= GEODESIC_VERSION_NUM(1,40,0)
+   ...
+   #endif
+ * @endcode
+ **********************************************************************/
+#define GEODESIC_VERSION \
+ GEODESIC_VERSION_NUM(GEODESIC_VERSION_MAJOR, \
+                      GEODESIC_VERSION_MINOR, \
+                      GEODESIC_VERSION_PATCH)
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
@@ -214,8 +237,7 @@ extern "C" {
    *   geod_genposition().
    *
    * \e g must have been initialized with a call to geod_init().  \e lat1
-   * should be in the range [−90°, 90°]; \e lon1 and \e azi1
-   * should be in the range [−540°, 540°).
+   * should be in the range [−90°, 90°].
    *
    * The geod_mask values are [see geod_mask()]:
    * - \e caps |= GEOD_LATITUDE for the latitude \e lat2; this is
@@ -255,8 +277,7 @@ extern "C" {
    * @param[out] pazi2 pointer to the (forward) azimuth at point 2 (degrees).
    *
    * \e g must have been initialized with a call to geod_init().  \e lat1
-   * should be in the range [−90°, 90°]; \e lon1 and \e azi1
-   * should be in the range [−540°, 540°).  The values of \e lon2
+   * should be in the range [−90°, 90°].  The values of \e lon2
    * and \e azi2 returned are in the range [−180°, 180°).  Any of
    * the "return" arguments \e plat2, etc., may be replaced by 0, if you do not
    * need some quantities computed.
@@ -269,7 +290,7 @@ extern "C" {
    * longitudinal extent must not exceed of 180°.)
    *
    * Example, determine the point 10000 km NE of JFK:
-   @code
+   @code{.c}
    struct geod_geodesic g;
    double lat, lon;
    geod_init(&g, 6378137, 1/298.257223563);
@@ -295,11 +316,10 @@ extern "C" {
    * @param[out] pazi1 pointer to the azimuth at point 1 (degrees).
    * @param[out] pazi2 pointer to the (forward) azimuth at point 2 (degrees).
    *
-   * \e g must have been initialized with a call to geod_init().  \e lat1
-   * and \e lat2 should be in the range [−90°, 90°]; \e lon1 and
-   * \e lon2 should be in the range [−540°, 540°).  The values of
+   * \e g must have been initialized with a call to geod_init().  \e lat1 and
+   * \e lat2 should be in the range [−90°, 90°].  The values of
    * \e azi1 and \e azi2 returned are in the range [−180°, 180°).
-   * Any of the "return" arguments \e ps12, etc., may be replaced by 0, if you
+   * Any of the "return" arguments, \e ps12, etc., may be replaced by 0, if you
    * do not need some quantities computed.
    *
    * If either point is at a pole, the azimuth is defined by keeping the
@@ -312,7 +332,7 @@ extern "C" {
    * is used to refine the solution.
    *
    * Example, determine the distance between JFK and Singapore Changi Airport:
-   @code
+   @code{.c}
    struct geod_geodesic g;
    double s12;
    geod_init(&g, 6378137, 1/298.257223563);
@@ -344,7 +364,7 @@ extern "C" {
    *
    * Example, compute way points between JFK and Singapore Changi Airport
    * the "obvious" way using geod_direct():
-   @code
+   @code{.c}
    struct geod_geodesic g;
    double s12, azi1, lat[101],lon[101];
    int i;
@@ -356,7 +376,7 @@ extern "C" {
    }
    @endcode
    * A faster way using geod_position():
-   @code
+   @code{.c}
    struct geod_geodesic g;
    struct geod_geodesicline l;
    double s12, azi1, lat[101],lon[101];
@@ -383,8 +403,7 @@ extern "C" {
    * @param[in] azi1 azimuth at point 1 (degrees).
    * @param[in] flags bitor'ed combination of geod_flags(); \e flags &
    *   GEOD_ARCMODE determines the meaning of \e s12_a12 and \e flags &
-   *   GEOD_LONG_NOWRAP prevents the value of \e lon2 being wrapped into
-   *   the range [−180°, 180°).
+   *   GEOD_LONG_UNROLL "unrolls" \e lon2.
    * @param[in] s12_a12 if \e flags & GEOD_ARCMODE is 0, this is the distance
    *   between point 1 and point 2 (meters); otherwise it is the arc length
    *   between point 1 and point 2 (degrees); it can be negative.
@@ -403,18 +422,14 @@ extern "C" {
    * @return \e a12 arc length of between point 1 and point 2 (degrees).
    *
    * \e g must have been initialized with a call to geod_init().  \e lat1
-   * should be in the range [−90°, 90°]; \e lon1 and \e azi1
-   * should be in the range [−540°, 540°).  The function
-   * value \e a12 equals \e s12_a12 if \e flags & GEOD_ARCMODE.  Any of the
-   * "return" arguments \e plat2, etc., may be replaced by 0, if you do not
-   * need some quantities computed.
-   *
-   * With \e flags & GEOD_LONG_NOWRAP bit set, the quantity \e lon2 −
-   * \e lon1 indicates how many times the geodesic wrapped around the
-   * ellipsoid.  Because \e lon2 might be outside the normal allowed range
-   * for longitudes, [−540°, 540°), be sure to normalize it,
-   * e.g., with fmod(\e lon2, 360.0) before using it in subsequent
-   * calculations
+   * should be in the range [−90°, 90°].  The function value \e
+   * a12 equals \e s12_a12 if \e flags & GEOD_ARCMODE.  Any of the "return"
+   * arguments, \e plat2, etc., may be replaced by 0, if you do not need some
+   * quantities computed.
+   *
+   * With \e flags & GEOD_LONG_UNROLL bit set, the longitude is "unrolled" so
+   * that the quantity \e lon2 − \e lon1 indicates how many times and in
+   * what sense the geodesic encircles the ellipsoid.
    **********************************************************************/
   double geod_gendirect(const struct geod_geodesic* g,
                         double lat1, double lon1, double azi1,
@@ -445,9 +460,8 @@ extern "C" {
    *   (meters<sup>2</sup>).
    * @return \e a12 arc length of between point 1 and point 2 (degrees).
    *
-   * \e g must have been initialized with a call to geod_init().  \e lat1
-   * and \e lat2 should be in the range [−90°, 90°]; \e lon1 and
-   * \e lon2 should be in the range [−540°, 540°).  Any of the
+   * \e g must have been initialized with a call to geod_init().  \e lat1 and
+   * \e lat2 should be in the range [−90°, 90°].  Any of the
    * "return" arguments \e ps12, etc., may be replaced by 0, if you do not need
    * some quantities computed.
    **********************************************************************/
@@ -464,10 +478,8 @@ extern "C" {
    *   geodesic line.
    * @param[in] flags bitor'ed combination of geod_flags(); \e flags &
    *   GEOD_ARCMODE determines the meaning of \e s12_a12 and \e flags &
-   *   GEOD_LONG_NOWRAP prevents the value of \e lon2 being wrapped into
-   *   the range [−180°, 180°); if \e flags & GEOD_ARCMODE is
-   *   0, then \e l must have been initialized with \e caps |=
-   *   GEOD_DISTANCE_IN.
+   *   GEOD_LONG_UNROLL "unrolls" \e lon2; if \e flags & GEOD_ARCMODE is 0,
+   *   then \e l must have been initialized with \e caps |= GEOD_DISTANCE_IN.
    * @param[in] s12_a12 if \e flags & GEOD_ARCMODE is 0, this is the
    *   distance between point 1 and point 2 (meters); otherwise it is the
    *   arc length between point 1 and point 2 (degrees); it can be
@@ -499,19 +511,16 @@ extern "C" {
    * computed.  Requesting a value which \e l is not capable of computing
    * is not an error; the corresponding argument will not be altered.
    *
-   * With \e flags & GEOD_LONG_NOWRAP bit set, the quantity \e lon2 −
-   * \e lon1 indicates how many times the geodesic wrapped around the
-   * ellipsoid.  Because \e lon2 might be outside the normal allowed range
-   * for longitudes, [−540°, 540°), be sure to normalize it,
-   * e.g., with fmod(\e lon2, 360.0) before using it in subsequent
-   * calculations
+   * With \e flags & GEOD_LONG_UNROLL bit set, the longitude is "unrolled" so
+   * that the quantity \e lon2 − \e lon1 indicates how many times and in
+   * what sense the geodesic encircles the ellipsoid.
    *
    * Example, compute way points between JFK and Singapore Changi Airport
    * using geod_genposition().  In this example, the points are evenly space in
    * arc length (and so only approximately equally space in distance).  This is
    * faster than using geod_position() would be appropriate if drawing the path
    * on a map.
-   @code
+   @code{.c}
    struct geod_geodesic g;
    struct geod_geodesicline l;
    double a12, azi1, lat[101], lon[101];
@@ -568,8 +577,7 @@ extern "C" {
    * \e g and \e p must have been initialized with calls to geod_init() and
    * geod_polygon_init(), respectively.  The same \e g must be used for all the
    * points and edges in a polygon.  \e lat should be in the range
-   * [−90°, 90°] and \e lon should be in the range
-   * [−540°, 540°).
+   * [−90°, 90°].
    *
    * An example of the use of this function is given in the documentation for
    * geod_polygon_compute().
@@ -590,10 +598,9 @@ extern "C" {
    *
    * \e g and \e p must have been initialized with calls to geod_init() and
    * geod_polygon_init(), respectively.  The same \e g must be used for all the
-   * points and edges in a polygon.  \e azi should be in the range
-   * [−540°, 540°).  This does nothing if no points have been
-   * added yet.  The \e lat and \e lon fields of \e p give the location of
-   * the new vertex.
+   * points and edges in a polygon.  This does nothing if no points have been
+   * added yet.  The \e lat and \e lon fields of \e p give the location of the
+   * new vertex.
    **********************************************************************/
   void geod_polygon_addedge(const struct geod_geodesic* g,
                             struct geod_polygon* p,
@@ -625,7 +632,7 @@ extern "C" {
    *
    * Example, compute the perimeter and area of the geodesic triangle with
    * vertices (0°N,0°E), (0°N,90°E), (90°N,0°E).
-   @code
+   @code{.c}
    double A, P;
    int n;
    struct geod_geodesic g;
@@ -669,8 +676,7 @@ extern "C" {
    *   polyline (meters).
    * @return the number of points.
    *
-   * \e lat should be in the range [−90°, 90°] and \e
-   * lon should be in the range [−540°, 540°).
+   * \e lat should be in the range [−90°, 90°].
    **********************************************************************/
   unsigned geod_polygon_testpoint(const struct geod_geodesic* g,
                                   const struct geod_polygon* p,
@@ -702,8 +708,6 @@ extern "C" {
    * @param[out] pP pointer to the perimeter of the polygon or length of the
    *   polyline (meters).
    * @return the number of points.
-   *
-   * \e azi should be in the range [−540°, 540°).
    **********************************************************************/
   unsigned geod_polygon_testedge(const struct geod_geodesic* g,
                                  const struct geod_polygon* p,
@@ -722,8 +726,7 @@ extern "C" {
    * @param[out] pA pointer to the area of the polygon (meters<sup>2</sup>).
    * @param[out] pP pointer to the perimeter of the polygon (meters).
    *
-   * \e lats should be in the range [−90°, 90°]; \e lons should
-   * be in the range [−540°, 540°).
+   * \e lats should be in the range [−90°, 90°].
    *
    * Only simple polygons (which are not self-intersecting) are allowed.
    * There's no need to "close" the polygon by repeating the first vertex.  The
@@ -731,7 +734,7 @@ extern "C" {
    * positive.
    *
    * Example, compute the area of Antarctica:
-   @code
+   @code{.c}
    double
      lats[] = {-72.9, -71.9, -74.9, -74.3, -77.5, -77.4, -71.7, -65.9, -65.7,
                -66.6, -66.9, -69.8, -70.0, -71.0, -77.3, -77.9, -74.7},
@@ -771,7 +774,10 @@ extern "C" {
   enum geod_flags {
     GEOD_NOFLAGS      = 0U,     /**< No flags */
     GEOD_ARCMODE      = 1U<<0,  /**< Position given in terms of arc distance */
-    GEOD_LONG_NOWRAP  = 1U<<15  /**< Don't wrap longitude */
+    GEOD_LONG_UNROLL  = 1U<<15, /**< Unroll the longitude */
+    /**< @cond SKIP */
+    GEOD_LONG_NOWRAP  = GEOD_LONG_UNROLL /* For backward compatibility only */
+    /**< @endcond */
   };
 
 #if defined(__cplusplus)
diff --git a/src/jniproj.c b/src/jniproj.c
index 6900270..6094d57 100644
--- a/src/jniproj.c
+++ b/src/jniproj.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: jniproj.c 2213 2012-06-01 13:06:41Z desruisseaux $
- *
  * Project:  PROJ.4
  * Purpose:  Java/JNI wrappers for PROJ.4 API.
  * Author:   Antonello Andrea
@@ -58,9 +56,6 @@
 /* The PJ_MAX_DIMENSION value appears also in quoted strings.
    Please perform a search-and-replace if this value is changed. */
 
-PJ_CVSID("$Id: jniproj.c 2213 2012-06-01 13:06:41Z desruisseaux $");
-
-
 /*!
  * \brief
  * Internal method returning the address of the PJ structure wrapped by the given Java object.
diff --git a/src/lib_proj.cmake b/src/lib_proj.cmake
index 8111c7a..8a6349d 100644
--- a/src/lib_proj.cmake
+++ b/src/lib_proj.cmake
@@ -200,6 +200,7 @@ SET(SRC_LIBPROJ_CORE
         proj_rouss.c
         rtodms.c
         vector1.c
+        pj_strtod.c
         ${CMAKE_CURRENT_BINARY_DIR}/proj_config.h
  )
 
@@ -213,6 +214,7 @@ set(HEADERS_LIBPROJ
 source_group("Header Files" FILES ${HEADERS_LIBPROJ})
 source_group("Source Files\\Core" FILES ${SRC_LIBPROJ_CORE})
 source_group("Source Files\\PJ" FILES ${SRC_LIBPROJ_PJ})
+include_directories( ${CMAKE_CURRENT_BINARY_DIR})
 source_group("CMake Files" FILES CMakeLists.txt)
 
 
diff --git a/src/makefile.vc b/src/makefile.vc
index 7f17f0d..41b7dca 100644
--- a/src/makefile.vc
+++ b/src/makefile.vc
@@ -1,4 +1,3 @@
-# $Id: makefile.vc 2409 2013-12-06 03:12:39Z warmerdam $
 #
 # makefile.vc - builds PROJ.4 library with Visual C++
 #
@@ -55,21 +54,25 @@ support = \
 	nad_cvt.obj nad_init.obj nad_intr.obj \
 	pj_utils.obj pj_gridlist.obj pj_gridinfo.obj \
 	proj_mdist.obj pj_mutex.obj pj_initcache.obj \
-	pj_ctx.obj pj_fileapi.obj pj_log.obj pj_apply_vgridshift.obj
+	pj_ctx.obj pj_fileapi.obj pj_log.obj pj_apply_vgridshift.obj \
+	pj_strtod.obj
+
 geodesic = geodesic.obj
 LIBOBJ	=	$(support) $(pseudo) $(azimuthal) $(conic) $(cylinder) $(misc) \
 	$(geodesic)
 PROJEXE_OBJ	= proj.obj gen_cheb.obj p_series.obj emess.obj
 CS2CSEXE_OBJ	= cs2cs.obj gen_cheb.obj p_series.obj emess.obj
 GEODEXE_OBJ	= geod.obj geod_set.obj geod_interface.obj emess.obj
+MULTISTRESSTEST_OBJ = multistresstest.obj
 PROJ_DLL 	= proj$(VERSION).dll
 PROJ_EXE    = proj.exe
 CS2CS_EXE   = cs2cs.exe
 GEOD_EXE    = geod.exe
 NAD2BIN_EXE = nad2bin.exe
+MULTISTRESSTEST_EXE = multistresstest.exe
 
 CFLAGS	=	/nologo -I. -DPROJ_LIB=\"$(PROJ_LIB_DIR)\" \
-		-DHAVE_STRERROR=1 $(OPTFLAGS)
+		-DHAVE_STRERROR=1 -DHAVE_LOCALECONV=1 $(OPTFLAGS)
 
 default:	all
 
@@ -101,6 +104,10 @@ $(GEOD_EXE):	$(GEODEXE_OBJ) $(EXE_PROJ)
 $(NAD2BIN_EXE):	nad2bin.obj emess.obj $(EXE_PROJ)
 	cl nad2bin.obj emess.obj $(EXE_PROJ)
 
+$(MULTISTRESSTEST_EXE): $(MULTISTRESSTEST_OBJ)
+	cl $(MULTISTRESSTEST_OBJ) $(EXE_PROJ)
+	if exist $(MULTISTRESSTEST_EXE).manifest mt -manifest $(MULTISTRESSTEST_EXE).manifest -outputresource:$(MULTISTRESSTEST_EXE);1
+
 nadshift:	nad2bin.exe
 	cd ..\nad
 	..\src\nad2bin.exe < conus.lla conus
diff --git a/src/mk_cheby.c b/src/mk_cheby.c
index 0ff0a22..32f22f1 100644
--- a/src/mk_cheby.c
+++ b/src/mk_cheby.c
@@ -36,7 +36,7 @@ Tseries *
 mk_cheby(projUV a, projUV b, double res, projUV *resid, projUV (*func)(projUV), 
          int nu, int nv, int power) {
     int j, i, nru, nrv, *ncu, *ncv;
-    Tseries *T;
+    Tseries *T = NULL;
     projUV **w;
     double cutres;
 
diff --git a/src/multistresstest.c b/src/multistresstest.c
index 8ad35e3..8c5df18 100644
--- a/src/multistresstest.c
+++ b/src/multistresstest.c
@@ -28,6 +28,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include "proj_api.h"
 
 #ifdef _WIN32
@@ -39,7 +40,8 @@
 
 #define num_threads    10
 #define num_iterations 1000000
-#define reinit_every_iteration 0
+static int reinit_every_iteration=0;
+static int add_no_defs = 0;
 
 typedef struct {
     const char *src_def;
@@ -138,6 +140,19 @@ TestItem test_list[] = {
 
 static volatile int active_thread_count = 0;
 
+static projPJ* custom_pj_init_plus_ctx(projCtx ctx, const char* def)
+{
+    if( add_no_defs )
+    {
+        char szBuffer[256];
+        strcpy(szBuffer, def);
+        strcat(szBuffer, " +no_defs");
+        return pj_init_plus_ctx(ctx, szBuffer);
+    }
+    else
+        return pj_init_plus_ctx(ctx, def);
+}
+
 /************************************************************************/
 /*                             TestThread()                             */
 /************************************************************************/
@@ -159,15 +174,16 @@ static void TestThread()
     src_pj_list = (projPJ *) calloc(test_count,sizeof(projPJ));
     dst_pj_list = (projPJ *) calloc(test_count,sizeof(projPJ));
                                 
-#if reinit_every_iteration == 0
-    for( i = 0; i < test_count; i++ )
+    if(!reinit_every_iteration)
     {
-        TestItem *test = test_list + i;
+        for( i = 0; i < test_count; i++ )
+        {
+            TestItem *test = test_list + i;
 
-        src_pj_list[i] = pj_init_plus_ctx( ctx, test->src_def );
-        dst_pj_list[i] = pj_init_plus_ctx( ctx, test->dst_def );
+            src_pj_list[i] = custom_pj_init_plus_ctx( ctx, test->src_def );
+            dst_pj_list[i] = custom_pj_init_plus_ctx( ctx, test->dst_def );
+        }
     }
-#endif
     
 /* -------------------------------------------------------------------- */
 /*      Perform tests - over and over.                                  */
@@ -180,30 +196,30 @@ static void TestThread()
             TestItem *test = test_list + i;
             double x, y, z;
             int error;
-            int skipTest = test->skip;
-            
+
             x = test->src_x;
             y = test->src_y;
             z = test->src_z;
 
-#if reinit_every_iteration == 1
-            src_pj_list[i] = pj_init_plus_ctx( ctx, test->src_def );
-            dst_pj_list[i] = pj_init_plus_ctx( ctx, test->dst_def );
-
+            if( reinit_every_iteration )
             {
-                int skipTest = (src_pj_list[i] == NULL || dst_pj_list[i] == NULL);
-			
-                if ( skipTest != test->skip )
-                    fprintf( stderr, "Threaded projection initialization does not match unthreaded initialization\n" );
+                src_pj_list[i] = custom_pj_init_plus_ctx( ctx, test->src_def );
+                dst_pj_list[i] = custom_pj_init_plus_ctx( ctx, test->dst_def );
 
-                if (skipTest)
                 {
-                    pj_free( src_pj_list[i] );
-                    pj_free( dst_pj_list[i] );
-                    continue;
+                    int skipTest = (src_pj_list[i] == NULL || dst_pj_list[i] == NULL);
+                            
+                    if ( skipTest != test->skip )
+                        fprintf( stderr, "Threaded projection initialization does not match unthreaded initialization\n" );
+
+                    if (skipTest)
+                    {
+                        pj_free( src_pj_list[i] );
+                        pj_free( dst_pj_list[i] );
+                        continue;
+                    }
                 }
             }
-#endif
 
             if ( test->skip )
                 continue;
@@ -222,28 +238,32 @@ static void TestThread()
             {
                 fprintf( stderr, 
                          "Got %.15g,%.15g,%.15g\n"
-                         "Expected %.15g,%.15g,%.15g\n",
+                         "Expected %.15g,%.15g,%.15g\n"
+                         "Diff %.15g,%.15g,%.15g\n",
                          x, y, z, 
-                         test->dst_x, test->dst_y, test->dst_z );
+                         test->dst_x, test->dst_y, test->dst_z,
+                         x-test->dst_x, y-test->dst_y, z-test->dst_z);
             }
 
-#if reinit_every_iteration == 1
-            pj_free( src_pj_list[i] );
-            pj_free( dst_pj_list[i] );
-#endif
+            if( reinit_every_iteration )
+            {
+                pj_free( src_pj_list[i] );
+                pj_free( dst_pj_list[i] );
+            }
         }
     }
 
 /* -------------------------------------------------------------------- */
 /*      Cleanup                                                         */
 /* -------------------------------------------------------------------- */
-#if reinit_every_iteration == 0
-    for( i = 0; i < test_count; i++ )
+    if( !reinit_every_iteration )
     {
-        pj_free( src_pj_list[i] );
-        pj_free( dst_pj_list[i] );
+        for( i = 0; i < test_count; i++ )
+        {
+            pj_free( src_pj_list[i] );
+            pj_free( dst_pj_list[i] );
+        }
     }
-#endif
     
     free( src_pj_list );
     free( dst_pj_list );
@@ -285,8 +305,11 @@ static void *PosixTestThread( void *pData )
 /************************************************************************/
 /*                                main()                                */
 /************************************************************************/
-int main( int argc, char **argv )
-
+#ifdef _WIN32
+static DWORD WINAPI do_main( LPVOID unused )
+#else
+int do_main(void)
+#endif
 {
 /* -------------------------------------------------------------------- */
 /*      Our first pass is to establish the correct answers for all      */
@@ -300,8 +323,8 @@ int main( int argc, char **argv )
 
         projPJ src_pj, dst_pj;
 
-        src_pj = pj_init_plus( test->src_def );
-        dst_pj = pj_init_plus( test->dst_def );
+        src_pj = custom_pj_init_plus_ctx( pj_get_default_ctx(), test->src_def );
+        dst_pj = custom_pj_init_plus_ctx( pj_get_default_ctx(), test->dst_def );
 
         if( src_pj == NULL )
         {
@@ -391,3 +414,31 @@ int main( int argc, char **argv )
 
     return 0;
 }
+
+
+int main( int argc, char **argv )
+{
+    int i;
+    for(i=0;i<argc;i++)
+    {
+        if( strcmp(argv[i], "-reinit") == 0 )
+            reinit_every_iteration = 1;
+        else if( strcmp(argv[i], "-add_no_defs") == 0 )
+            add_no_defs = 1;
+    }
+
+#ifdef _WIN32
+    /* This is an incredible weirdness but with mingw cross-compiler */
+    /* 1. - b/a; where double a = 6378206.4; and double b = 6356583.8; */
+    /* does not evaluate the same in the main thread or in a thread forked */
+    /* by CreateThread(), so run the main in a thread... */
+    {
+        HANDLE thread = CreateThread(NULL, 0, do_main, NULL, 0, NULL);
+        WaitForSingleObject(thread, INFINITE);
+        CloseHandle( thread );
+    }
+#else
+    do_main();
+#endif
+    return 0;
+}
diff --git a/src/nad2bin.c b/src/nad2bin.c
index 6951552..6587c63 100644
--- a/src/nad2bin.c
+++ b/src/nad2bin.c
@@ -359,7 +359,7 @@ int main(int argc, char **argv) {
                     swap_words( row_buf, 4, ct.lim.lam * 4 );
 
                 if( fwrite( row_buf, sizeof(float), ct.lim.lam*4, fp ) 
-                    != 4 * ct.lim.lam )
+                    != (size_t)( 4 * ct.lim.lam ) )
                 {
                     perror( "write()" );
                     exit( 2 );
diff --git a/src/nad_init.c b/src/nad_init.c
index 6c2787c..3b35ea6 100644
--- a/src/nad_init.c
+++ b/src/nad_init.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: nad_init.c 2345 2013-06-22 07:54:57Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  Load datum shift files into memory.
  * Author:   Frank Warmerdam, warmerdam at pobox.com
@@ -85,7 +83,7 @@ static void swap_words( void *data_in, int word_size, int word_count )
 int nad_ctable_load( projCtx ctx, struct CTABLE *ct, PAFile fid )
 
 {
-    int  a_size;
+    size_t a_size;
 
     pj_ctx_fseek( ctx, fid, sizeof(struct CTABLE), SEEK_SET );
 
@@ -158,7 +156,7 @@ struct CTABLE *nad_ctable_init( projCtx ctx, PAFile fid )
 int nad_ctable2_load( projCtx ctx, struct CTABLE *ct, PAFile fid )
 
 {
-    int  a_size;
+    size_t a_size;
 
     pj_ctx_fseek( ctx, fid, 160, SEEK_SET );
 
diff --git a/src/pj_apply_gridshift.c b/src/pj_apply_gridshift.c
index 4e7681a..d614190 100644
--- a/src/pj_apply_gridshift.c
+++ b/src/pj_apply_gridshift.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: pj_apply_gridshift.c 2548 2014-09-17 06:21:09Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  Apply datum shifts based on grid shift files (normally NAD27 to
  *           NAD83 or the reverse).  This module is responsible for keeping
@@ -119,6 +117,7 @@ int pj_apply_gridshift_3( projCtx ctx, PJ_GRIDINFO **tables, int grid_count,
 {
     int  i;
     static int debug_count = 0;
+    (void) z;
 
     if( tables == NULL || grid_count == 0 )
     {
diff --git a/src/pj_apply_vgridshift.c b/src/pj_apply_vgridshift.c
index d26e902..7f82d83 100644
--- a/src/pj_apply_vgridshift.c
+++ b/src/pj_apply_vgridshift.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: pj_apply_gridshift.c 1831 2010-03-16 12:44:36Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  Apply vertical datum shifts based on grid shift files, normally
  *           geoid grids mapping WGS84 to NAVD88 or something similar.
@@ -153,7 +151,7 @@ int pj_apply_vgridshift( PJ *defn, const char *listname,
                 + cvs[grid_ix + 1 + (grid_iy+1) * ct->lim.lam] 
                 * (grid_x) * (grid_y);
 
-            if( value > 1000 || value < -1000 ) /* nodata? */
+            if( value == -88.88880f ) /* nodata? */
                 value = HUGE_VAL;
             else
             {
diff --git a/src/pj_ctx.c b/src/pj_ctx.c
index 048baf4..43d1225 100644
--- a/src/pj_ctx.c
+++ b/src/pj_ctx.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id$
- *
  * Project:  PROJ.4
  * Purpose:  Implementation of the projCtx thread context object.
  * Author:   Frank Warmerdam, warmerdam at pobox.com
@@ -30,8 +28,6 @@
 #include <projects.h>
 #include <string.h>
 
-PJ_CVSID("$Id$");
-
 static projCtx_t default_context;
 static volatile int       default_context_initialized = 0;
 
diff --git a/src/pj_datum_set.c b/src/pj_datum_set.c
index b47e469..194bfe5 100644
--- a/src/pj_datum_set.c
+++ b/src/pj_datum_set.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: pj_datum_set.c 2219 2012-06-19 04:18:00Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  Apply datum definition to PJ structure from initialization string.
  * Author:   Frank Warmerdam, warmerda at home.com
@@ -118,10 +116,9 @@ int pj_datum_set(projCtx ctx, paralist *pl, PJ *projdef)
         memset( projdef->datum_params, 0, sizeof(double) * 7);
 
         /* parse out the parameters */
-        s = towgs84;
         for( s = towgs84; *s != '\0' && parm_count < 7; ) 
         {
-            projdef->datum_params[parm_count++] = atof(s);
+            projdef->datum_params[parm_count++] = pj_atof(s);
             while( *s != '\0' && *s != ',' )
                 s++;
             if( *s == ',' )
diff --git a/src/pj_datums.c b/src/pj_datums.c
index 114b88c..c9655cd 100644
--- a/src/pj_datums.c
+++ b/src/pj_datums.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: pj_datums.c 2553 2014-09-17 09:07:29Z rouault $
- *
  * Project:  PROJ.4
  * Purpose:  Built in datum list.
  * Author:   Frank Warmerdam, warmerda at home.com
@@ -40,21 +38,30 @@
 C_NAMESPACE_VAR struct PJ_DATUMS pj_datums[] = {
 /* id       definition                               ellipse  comments */
 /* --       ----------                               -------  -------- */
-"WGS84",    "towgs84=0,0,0", 		             "WGS84", "",
-"GGRS87",   "towgs84=-199.87,74.79,246.62",          "GRS80", 
-				"Greek_Geodetic_Reference_System_1987",
-"NAD83",    "towgs84=0,0,0",                         "GRS80", 
-				"North_American_Datum_1983",
-"NAD27",    "nadgrids=@conus, at alaska, at ntv2_0.gsb, at ntv1_can.dat",           
-                                                     "clrk66", 
-				"North_American_Datum_1927",
-"potsdam",  "towgs84=598.1,73.7,418.2,0.202,0.045,-2.455,6.7",  "bessel",  "Potsdam Rauenberg 1950 DHDN",
-"carthage",  "towgs84=-263.0,6.0,431.0",  "clrk80ign",  "Carthage 1934 Tunisia",
-"hermannskogel", "towgs84=577.326,90.129,463.919,5.137,1.474,5.297,2.4232",  "bessel",  "Hermannskogel",
-"ire65",  "towgs84=482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",  "mod_airy",  "Ireland 1965",
-"nzgd49",    "towgs84=59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993", "intl", "New Zealand Geodetic Datum 1949",
-"OSGB36",    "towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894", "airy", "Airy 1830",
-NULL,       NULL,                                    NULL,    NULL 
+{"WGS84",   "towgs84=0,0,0",                         "WGS84", ""},
+{"GGRS87",  "towgs84=-199.87,74.79,246.62",          "GRS80",
+                                                              "Greek_Geodetic_Reference_System_1987"},
+{"NAD83",   "towgs84=0,0,0",                         "GRS80",
+                                                              "North_American_Datum_1983"},
+{"NAD27",   "nadgrids=@conus, at alaska, at ntv2_0.gsb, at ntv1_can.dat",
+                                                     "clrk66",
+                                                              "North_American_Datum_1927"},
+{"potsdam", "towgs84=598.1,73.7,418.2,0.202,0.045,-2.455,6.7",
+                                                     "bessel",
+                                                              "Potsdam Rauenberg 1950 DHDN"},
+{"carthage","towgs84=-263.0,6.0,431.0",              "clrk80ign",
+                                                              "Carthage 1934 Tunisia"},
+{"hermannskogel",  "towgs84=577.326,90.129,463.919,5.137,1.474,5.297,2.4232",
+                                                     "bessel",
+                                                              "Hermannskogel"},
+{"ire65",   "towgs84=482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
+                                                     "mod_airy",
+                                                              "Ireland 1965"},
+{"nzgd49",  "towgs84=59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",
+                                                     "intl",  "New Zealand Geodetic Datum 1949"},
+{"OSGB36",  "towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",
+                                                     "airy",  "Airy 1830"},
+{NULL,      NULL,                                    NULL,    NULL}
 };
 
 struct PJ_DATUMS *pj_get_datums_ref()
@@ -66,20 +73,20 @@ struct PJ_DATUMS *pj_get_datums_ref()
 C_NAMESPACE_VAR struct PJ_PRIME_MERIDIANS pj_prime_meridians[] = {
     /* id        definition                         */
     /* --        ----------                         */
-    "greenwich", "0dE",
-    "lisbon",    "9d07'54.862\"W",
-    "paris",     "2d20'14.025\"E",
-    "bogota",    "74d04'51.3\"W",
-    "madrid",    "3d41'16.58\"W",
-    "rome",      "12d27'8.4\"E",
-    "bern",      "7d26'22.5\"E",
-    "jakarta",   "106d48'27.79\"E",
-    "ferro",     "17d40'W",
-    "brussels",  "4d22'4.71\"E",
-    "stockholm", "18d3'29.8\"E",
-    "athens",    "23d42'58.815\"E",
-    "oslo",      "10d43'22.5\"E",
-    NULL,        NULL 
+    {"greenwich", "0dE"},
+    {"lisbon",    "9d07'54.862\"W"},
+    {"paris",     "2d20'14.025\"E"},
+    {"bogota",    "74d04'51.3\"W"},
+    {"madrid",    "3d41'16.58\"W"},
+    {"rome",      "12d27'8.4\"E"},
+    {"bern",      "7d26'22.5\"E"},
+    {"jakarta",   "106d48'27.79\"E"},
+    {"ferro",     "17d40'W"},
+    {"brussels",  "4d22'4.71\"E"},
+    {"stockholm", "18d3'29.8\"E"},
+    {"athens",    "23d42'58.815\"E"},
+    {"oslo",      "10d43'22.5\"E"},
+    {NULL,        NULL}
 };
 
 struct PJ_PRIME_MERIDIANS *pj_get_prime_meridians_ref()
diff --git a/src/pj_ell_set.c b/src/pj_ell_set.c
index 857bd78..af825be 100644
--- a/src/pj_ell_set.c
+++ b/src/pj_ell_set.c
@@ -11,7 +11,7 @@ pj_ell_set(projCtx ctx, paralist *pl, double *a, double *es) {
 	int i;
 	double b=0.0, e;
 	char *name;
-	paralist *start = 0, *curr;
+	paralist *start = 0;
 
         /* clear any previous error */
         pj_ctx_set_errno(ctx,0);
@@ -28,11 +28,10 @@ pj_ell_set(projCtx ctx, paralist *pl, double *a, double *es) {
 			char *s;
 
 			for (start = pl; start && start->next ; start = start->next) ;
-			curr = start;
 			for (i = 0; (s = pj_ellps[i].id) && strcmp(name, s) ; ++i) ;
 			if (!s) { pj_ctx_set_errno( ctx, -9); return 1; }
-			curr = curr->next = pj_mkparam(pj_ellps[i].major);
-			curr = curr->next = pj_mkparam(pj_ellps[i].ell);
+			start->next = pj_mkparam(pj_ellps[i].major);
+			start->next->next = pj_mkparam(pj_ellps[i].ell);
 		}
 		*a = pj_param(ctx,pl, "da").f;
 		if (pj_param(ctx,pl, "tes").i) /* eccentricity squared */
diff --git a/src/pj_ellps.c b/src/pj_ellps.c
index 3da162b..32fbbd4 100644
--- a/src/pj_ellps.c
+++ b/src/pj_ellps.c
@@ -4,50 +4,50 @@
 
 C_NAMESPACE_VAR struct PJ_ELLPS
 pj_ellps[] = {
-"MERIT",	"a=6378137.0", "rf=298.257", "MERIT 1983",
-"SGS85",	"a=6378136.0", "rf=298.257",  "Soviet Geodetic System 85",
-"GRS80",	"a=6378137.0", "rf=298.257222101", "GRS 1980(IUGG, 1980)",
-"IAU76",	"a=6378140.0", "rf=298.257", "IAU 1976",
-"airy",		"a=6377563.396", "b=6356256.910", "Airy 1830",
-"APL4.9",	"a=6378137.0.",  "rf=298.25", "Appl. Physics. 1965",
-"NWL9D",	"a=6378145.0.",  "rf=298.25", "Naval Weapons Lab., 1965",
-"mod_airy",	"a=6377340.189", "b=6356034.446", "Modified Airy",
-"andrae",	"a=6377104.43",  "rf=300.0", 	"Andrae 1876 (Den., Iclnd.)",
-"aust_SA",	"a=6378160.0", "rf=298.25", "Australian Natl & S. Amer. 1969",
-"GRS67",	"a=6378160.0", "rf=298.2471674270", "GRS 67(IUGG 1967)",
-"bessel",	"a=6377397.155", "rf=299.1528128", "Bessel 1841",
-"bess_nam",	"a=6377483.865", "rf=299.1528128", "Bessel 1841 (Namibia)",
-"clrk66",	"a=6378206.4", "b=6356583.8", "Clarke 1866",
-"clrk80",	"a=6378249.145", "rf=293.4663", "Clarke 1880 mod.",
-"clrk80ign","a=6378249.2", "rf=293.4660212936269", "Clarke 1880 (IGN).",
-"CPM",  	"a=6375738.7", "rf=334.29", "Comm. des Poids et Mesures 1799",
-"delmbr",	"a=6376428.",  "rf=311.5", "Delambre 1810 (Belgium)",
-"engelis",	"a=6378136.05", "rf=298.2566", "Engelis 1985",
-"evrst30",  "a=6377276.345", "rf=300.8017",  "Everest 1830",
-"evrst48",  "a=6377304.063", "rf=300.8017",  "Everest 1948",
-"evrst56",  "a=6377301.243", "rf=300.8017",  "Everest 1956",
-"evrst69",  "a=6377295.664", "rf=300.8017",  "Everest 1969",
-"evrstSS",  "a=6377298.556", "rf=300.8017",  "Everest (Sabah & Sarawak)",
-"fschr60",  "a=6378166.",   "rf=298.3", "Fischer (Mercury Datum) 1960",
-"fschr60m", "a=6378155.",   "rf=298.3", "Modified Fischer 1960",
-"fschr68",  "a=6378150.",   "rf=298.3", "Fischer 1968",
-"helmert",  "a=6378200.",   "rf=298.3", "Helmert 1906",
-"hough",	"a=6378270.0", "rf=297.", "Hough",
-"intl",		"a=6378388.0", "rf=297.", "International 1909 (Hayford)",
-"krass",	"a=6378245.0", "rf=298.3", "Krassovsky, 1942",
-"kaula",	"a=6378163.",  "rf=298.24", "Kaula 1961",
-"lerch",	"a=6378139.",  "rf=298.257", "Lerch 1979",
-"mprts",	"a=6397300.",  "rf=191.", "Maupertius 1738",
-"new_intl",	"a=6378157.5", "b=6356772.2", "New International 1967",
-"plessis",	"a=6376523.",  "b=6355863.", "Plessis 1817 (France)",
-"SEasia",	"a=6378155.0", "b=6356773.3205", "Southeast Asia",
-"walbeck",	"a=6376896.0", "b=6355834.8467", "Walbeck",
-"WGS60",    "a=6378165.0",  "rf=298.3", "WGS 60",
-"WGS66",	"a=6378145.0", "rf=298.25", "WGS 66",
-"WGS72",	"a=6378135.0", "rf=298.26", "WGS 72",
-"WGS84",    "a=6378137.0",  "rf=298.257223563", "WGS 84",
-"sphere",   "a=6370997.0",  "b=6370997.0", "Normal Sphere (r=6370997)",
-0,0,0,0
+{"MERIT",	"a=6378137.0",		"rf=298.257",		"MERIT 1983"},
+{"SGS85",	"a=6378136.0",		"rf=298.257",		"Soviet Geodetic System 85"},
+{"GRS80",	"a=6378137.0",		"rf=298.257222101",	"GRS 1980(IUGG, 1980)"},
+{"IAU76",	"a=6378140.0",		"rf=298.257",		"IAU 1976"},
+{"airy",	"a=6377563.396",	"b=6356256.910",	"Airy 1830"},
+{"APL4.9",	"a=6378137.0.",		"rf=298.25",		"Appl. Physics. 1965"},
+{"NWL9D",	"a=6378145.0.",		"rf=298.25",		"Naval Weapons Lab., 1965"},
+{"mod_airy",	"a=6377340.189",	"b=6356034.446",	"Modified Airy"},
+{"andrae",	"a=6377104.43",		"rf=300.0",		"Andrae 1876 (Den., Iclnd.)"},
+{"aust_SA",	"a=6378160.0",		"rf=298.25",		"Australian Natl & S. Amer. 1969"},
+{"GRS67",	"a=6378160.0",		"rf=298.2471674270",	"GRS 67(IUGG 1967)"},
+{"bessel",	"a=6377397.155",	"rf=299.1528128",	"Bessel 1841"},
+{"bess_nam",	"a=6377483.865",	"rf=299.1528128",	"Bessel 1841 (Namibia)"},
+{"clrk66",	"a=6378206.4",		"b=6356583.8",		"Clarke 1866"},
+{"clrk80",	"a=6378249.145",	"rf=293.4663",		"Clarke 1880 mod."},
+{"clrk80ign",	"a=6378249.2",		"rf=293.4660212936269",	"Clarke 1880 (IGN)."},
+{"CPM", 	"a=6375738.7",		"rf=334.29",		"Comm. des Poids et Mesures 1799"},
+{"delmbr",	"a=6376428.",		"rf=311.5",		"Delambre 1810 (Belgium)"},
+{"engelis",	"a=6378136.05",		"rf=298.2566",		"Engelis 1985"},
+{"evrst30",	"a=6377276.345",	"rf=300.8017",		"Everest 1830"},
+{"evrst48",	"a=6377304.063",	"rf=300.8017",		"Everest 1948"},
+{"evrst56",	"a=6377301.243",	"rf=300.8017",		"Everest 1956"},
+{"evrst69",	"a=6377295.664",	"rf=300.8017",		"Everest 1969"},
+{"evrstSS",	"a=6377298.556",	"rf=300.8017",		"Everest (Sabah & Sarawak)"},
+{"fschr60",	"a=6378166.",		"rf=298.3",		"Fischer (Mercury Datum) 1960"},
+{"fschr60m",	"a=6378155.",		"rf=298.3",		"Modified Fischer 1960"},
+{"fschr68",	"a=6378150.",		"rf=298.3",		"Fischer 1968"},
+{"helmert",	"a=6378200.",		"rf=298.3",		"Helmert 1906"},
+{"hough",	"a=6378270.0",		"rf=297.",		"Hough"},
+{"intl",	"a=6378388.0",		"rf=297.",		"International 1909 (Hayford)"},
+{"krass",	"a=6378245.0",		"rf=298.3",		"Krassovsky, 1942"},
+{"kaula",	"a=6378163.",		"rf=298.24",		"Kaula 1961"},
+{"lerch",	"a=6378139.",		"rf=298.257",		"Lerch 1979"},
+{"mprts",	"a=6397300.",		"rf=191.",		"Maupertius 1738"},
+{"new_intl",	"a=6378157.5",		"b=6356772.2",		"New International 1967"},
+{"plessis",	"a=6376523.",		"b=6355863.", 		"Plessis 1817 (France)"},
+{"SEasia",	"a=6378155.0",		"b=6356773.3205",	"Southeast Asia"},
+{"walbeck",	"a=6376896.0",		"b=6355834.8467",	"Walbeck"},
+{"WGS60",	"a=6378165.0",		"rf=298.3",		"WGS 60"},
+{"WGS66",	"a=6378145.0",		"rf=298.25",		"WGS 66"},
+{"WGS72",	"a=6378135.0",		"rf=298.26", 		"WGS 72"},
+{"WGS84",	"a=6378137.0",		"rf=298.257223563",	"WGS 84"},
+{"sphere",	"a=6370997.0",		"b=6370997.0",		"Normal Sphere (r=6370997)"},
+{NULL,		NULL,			NULL,			NULL}
 };
 
 struct PJ_ELLPS *pj_get_ellps_ref()
diff --git a/src/pj_fileapi.c b/src/pj_fileapi.c
index c0b3369..fa35f30 100644
--- a/src/pj_fileapi.c
+++ b/src/pj_fileapi.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id$
- *
  * Project:  PROJ.4
  * Purpose:  Implementation of the pj_ctx_* file api, and the default stdio
  *           based implementation.
@@ -31,8 +29,6 @@
 #include <projects.h>
 #include <string.h>
 
-PJ_CVSID("$Id$");
-
 static PAFile pj_stdio_fopen(projCtx ctx, const char *filename, 
                              const char *access);
 static size_t pj_stdio_fread(void *buffer, size_t size, size_t nmemb, 
@@ -185,7 +181,7 @@ char *pj_ctx_fgets(projCtx ctx, char *line, int size, PAFile file)
     bytes_read = pj_ctx_fread(ctx, line, 1, size-1, file);
     if(bytes_read == 0)
         return NULL;
-    if(bytes_read < size) 
+    if(bytes_read < (size_t)size)
     {
         line[bytes_read] = '\0';
     }
diff --git a/src/pj_gauss.c b/src/pj_gauss.c
index 1d2e2ab..b4b965f 100644
--- a/src/pj_gauss.c
+++ b/src/pj_gauss.c
@@ -3,8 +3,6 @@
 **
 ** Copyright (c) 2003   Gerald I. Evenden
 */
-static const char
-LIBPROJ_ID[] = "$Id: pj_gauss.c 1856 2010-06-11 03:26:04Z warmerdam $";
 /*
 ** Permission is hereby granted, free of charge, to any person obtaining
 ** a copy of this software and associated documentation files (the
@@ -66,6 +64,7 @@ pj_gauss_ini(double e, double phi0, double *chi, double *rc) {
 	LP
 pj_gauss(projCtx ctx, LP elp, const void *en) {
 	LP slp;
+	(void) ctx;
 
 	slp.phi = 2. * atan( EN->K *
 		pow(tan(.5 * elp.phi + FORTPI), EN->C) *
diff --git a/src/pj_gc_reader.c b/src/pj_gc_reader.c
index 1845fca..458737c 100644
--- a/src/pj_gc_reader.c
+++ b/src/pj_gc_reader.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id$
- *
  * Project:  PROJ.4
  * Purpose:  Code to read a grid catalog from a .cvs file.
  * Author:   Frank Warmerdam, warmerdam at pobox.com
@@ -34,7 +32,6 @@
 #include <ctype.h>
 
 static int pj_gc_readentry(projCtx ctx, PAFile fid, PJ_GridCatalogEntry *entry);
-static void pj_gc_sortcatalog( projCtx ctx, PJ_GridCatalog *catalog );
 
 /************************************************************************/
 /*                         pj_gc_readcatalog()                          */
@@ -82,24 +79,10 @@ PJ_GridCatalog *pj_gc_readcatalog( projCtx ctx, const char *catalog_name )
         }
     }
 
-    pj_gc_sortcatalog( ctx, catalog );
-
     return catalog;
 }
 
 /************************************************************************/
-/*                         pj_gc_sortcatalog()                          */
-/*                                                                      */
-/*      Sort all the entries in ascending date and within a date in     */
-/*      descending priority order.                                      */
-/************************************************************************/
-
-static void pj_gc_sortcatalog( projCtx ctx, PJ_GridCatalog *catalog )
-
-{
-}
-
-/************************************************************************/
 /*                        pj_gc_read_csv_line()                         */
 /*                                                                      */
 /*      Simple csv line splitter with fixed maximum line size and       */
@@ -155,6 +138,8 @@ static int pj_gc_read_csv_line( projCtx ctx, PAFile fid,
 
 double pj_gc_parsedate( projCtx ctx, const char *date_string )
 {
+    (void) ctx;
+
     if( strlen(date_string) == 10 
         && date_string[4] == '-' && date_string[7] == '-' ) 
     {
@@ -167,7 +152,7 @@ double pj_gc_parsedate( projCtx ctx, const char *date_string )
     }
     else 
     {
-        return atof(date_string);
+        return pj_atof(date_string);
     }
 }
 
diff --git a/src/pj_geocent.c b/src/pj_geocent.c
index e94730f..6b2f302 100644
--- a/src/pj_geocent.c
+++ b/src/pj_geocent.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: pj_geocent.c 1504 2009-01-06 02:11:57Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  Stub projection for geocentric.  The transformation isn't
  *           really done here since this code is 2D.  The real transformation
@@ -32,16 +30,16 @@
 #define PJ_LIB__
 #include <projects.h>
 
-PJ_CVSID("$Id: pj_geocent.c 1504 2009-01-06 02:11:57Z warmerdam $");
-
 PROJ_HEAD(geocent, "Geocentric")  "\n\t";
 
 FORWARD(forward);
+	(void) P;
         xy.x = lp.lam;
         xy.y = lp.phi;
         return xy;
 }
 INVERSE(inverse);
+	(void) P;
         lp.phi = xy.y;
         lp.lam = xy.x;
         return lp;
diff --git a/src/pj_gridcatalog.c b/src/pj_gridcatalog.c
index 76f52c8..7954318 100644
--- a/src/pj_gridcatalog.c
+++ b/src/pj_gridcatalog.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id$
- *
  * Project:  PROJ.4
  * Purpose:  Code in support of grid catalogs
  * Author:   Frank Warmerdam, warmerdam at pobox.com
@@ -43,8 +41,9 @@ static PJ_GridCatalog *grid_catalog_list = NULL;
 /************************************************************************/
 
 void pj_gc_unloadall( projCtx ctx )
-
 {
+    (void) ctx;
+
     while( grid_catalog_list != NULL )
     {
         int i;
@@ -105,6 +104,7 @@ int pj_gc_apply_gridshift( PJ *defn, int inverse,
 
 {
     int i;
+    (void) z;
 
     if( defn->catalog == NULL ) 
     {
diff --git a/src/pj_gridinfo.c b/src/pj_gridinfo.c
index 29b846e..3d34dd7 100644
--- a/src/pj_gridinfo.c
+++ b/src/pj_gridinfo.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: pj_gridinfo.c 2624 2015-02-21 14:10:46Z rouault $
- *
  * Project:  PROJ.4
  * Purpose:  Functions for handling individual PJ_GRIDINFO's.  Includes
  *           loaders for all formats but CTABLE (in nad_init.c).
@@ -52,7 +50,7 @@
 /************************************************************************/
 
 static int  byte_order_test = 1;
-#define IS_LSB	(((unsigned char *) (&byte_order_test))[0] == 1)
+#define IS_LSB	(1 == ((unsigned char *) (&byte_order_test))[0])
 
 static void swap_words( unsigned char *data, int word_size, int word_count )
 
@@ -227,7 +225,7 @@ int pj_gridinfo_load( projCtx ctx, PJ_GRIDINFO *gi )
 
             if( pj_ctx_fread( ctx, row_buf,
                               sizeof(double), gi->ct->lim.lam * 2, fid )
-                != 2 * gi->ct->lim.lam )
+                != (size_t)( 2 * gi->ct->lim.lam ) )
             {
                 pj_dalloc( row_buf );
                 pj_dalloc( ct_tmp.cvs );
@@ -305,7 +303,7 @@ int pj_gridinfo_load( projCtx ctx, PJ_GRIDINFO *gi )
 
             if( pj_ctx_fread( ctx, row_buf, sizeof(float),
                               gi->ct->lim.lam*4, fid )
-                != 4 * gi->ct->lim.lam )
+                != (size_t)( 4 * gi->ct->lim.lam ) )
             {
                 pj_dalloc( row_buf );
                 pj_dalloc( ct_tmp.cvs );
@@ -370,7 +368,7 @@ int pj_gridinfo_load( projCtx ctx, PJ_GRIDINFO *gi )
         }
 
         if( pj_ctx_fread( ctx, ct_tmp.cvs, sizeof(float), words, fid )
-            != words )
+            != (size_t)words )
         {
             pj_dalloc( ct_tmp.cvs );
             pj_release_lock();
diff --git a/src/pj_gridlist.c b/src/pj_gridlist.c
index dae859a..0cfab76 100644
--- a/src/pj_gridlist.c
+++ b/src/pj_gridlist.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: pj_gridlist.c 1990 2011-03-28 18:06:43Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  Code to manage the list of currently loaded (cached) PJ_GRIDINFOs
  *           See pj_gridinfo.c for details of loading individual grids.
@@ -178,7 +176,7 @@ PJ_GRIDINFO **pj_gridlist_from_nadgrids( projCtx ctx, const char *nadgrids,
 /* -------------------------------------------------------------------- */
     for( s = nadgrids; *s != '\0'; )
     {
-        int   end_char;
+        size_t end_char;
         int   required = 1;
         char  name[128];
 
diff --git a/src/pj_init.c b/src/pj_init.c
index a40ab39..13d469d 100644
--- a/src/pj_init.c
+++ b/src/pj_init.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: pj_init.c 2604 2015-02-16 17:49:22Z hobu $
- *
  * Project:  PROJ.4
  * Purpose:  Initialize projection object from string definition.  Includes
  *           pj_init(), pj_init_plus() and pj_free() function.
@@ -34,11 +32,8 @@
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
-#include <locale.h>
 #include <ctype.h>
 
-PJ_CVSID("$Id: pj_init.c 2604 2015-02-16 17:49:22Z hobu $");
-
 typedef struct {
     projCtx ctx;
     PAFile fid;
@@ -54,7 +49,7 @@ typedef struct {
 static const char *fill_buffer(pj_read_state *state, const char *last_char)
 {
     size_t bytes_read;
-    int char_remaining, char_requested;
+    size_t char_remaining, char_requested;
 
 /* -------------------------------------------------------------------- */
 /*      Don't bother trying to read more if we are at eof, or if the    */
@@ -312,7 +307,7 @@ pj_init_plus_ctx( projCtx ctx, const char *definition )
     char	*argv[MAX_ARG];
     char	*defn_copy;
     int		argc = 0, i, blank_count = 0;
-    PJ	    *result;
+    PJ	    *result = NULL;
     
     /* make a copy that we can manipulate */
     defn_copy = (char *) pj_malloc( strlen(definition)+1 );
@@ -337,7 +332,7 @@ pj_init_plus_ctx( projCtx ctx, const char *definition )
                 if( argc+1 == MAX_ARG )
                 {
                     pj_ctx_set_errno( ctx, -44 );
-                    return NULL;
+                    goto bum_call;
                 }
                 
                 argv[argc++] = defn_copy + i + 1;
@@ -365,6 +360,7 @@ pj_init_plus_ctx( projCtx ctx, const char *definition )
     /* perform actual initialization */
     result = pj_init_ctx( ctx, argc, argv );
 
+bum_call:
     pj_dalloc( defn_copy );
 
     return result;
@@ -392,37 +388,21 @@ pj_init_ctx(projCtx ctx, int argc, char **argv) {
     paralist *curr;
     int i;
     PJ *PIN = 0;
-    char *old_locale;
 
     ctx->last_errno = 0;
     start = NULL;
 
-    /*
-    ** MS Visual Studio 2012+ may have problems in multithreaded cases
-    ** as discussed in this ticket:
-    ** http://trac.osgeo.org/proj/ticket/226
-    */
-    old_locale = setlocale(LC_NUMERIC, NULL);
-    if (old_locale != NULL) {
-       if (strcmp(old_locale,"C") != 0) {
-	  old_locale = strdup(old_locale);
-	  setlocale(LC_NUMERIC,"C");
-       }else
-	  old_locale = NULL;
-    }
-
     /* put arguments into internal linked list */
     if (argc <= 0) { pj_ctx_set_errno( ctx, -1 ); goto bum_call; }
-    for (i = 0; i < argc; ++i)
-        if (i)
-            curr = curr->next = pj_mkparam(argv[i]);
-        else
-            start = curr = pj_mkparam(argv[i]);
+    start = curr = pj_mkparam(argv[0]);
+    for (i = 1; i < argc; ++i) {
+        curr->next = pj_mkparam(argv[i]);
+        curr = curr->next;
+    }
     if (ctx->last_errno) goto bum_call;
 
     /* check if +init present */
     if (pj_param(ctx, start, "tinit").i) {
-        paralist *last = curr;
         int found_def = 0;
 
         if (!(curr = get_init(ctx,&start, curr,
@@ -558,9 +538,9 @@ pj_init_ctx(projCtx ctx, int argc, char **argv) {
         s = pj_units[i].to_meter;
     }
     if (s || (s = pj_param(ctx, start, "sto_meter").s)) {
-        PIN->to_meter = strtod(s, &s);
+        PIN->to_meter = pj_strtod(s, &s);
         if (*s == '/') /* ratio number */
-            PIN->to_meter /= strtod(++s, 0);
+            PIN->to_meter /= pj_strtod(++s, 0);
         PIN->fr_meter = 1. / PIN->to_meter;
     } else
         PIN->to_meter = PIN->fr_meter = 1.;
@@ -573,9 +553,9 @@ pj_init_ctx(projCtx ctx, int argc, char **argv) {
         s = pj_units[i].to_meter;
     }
     if (s || (s = pj_param(ctx, start, "svto_meter").s)) {
-        PIN->vto_meter = strtod(s, &s);
+        PIN->vto_meter = pj_strtod(s, &s);
         if (*s == '/') /* ratio number */
-            PIN->vto_meter /= strtod(++s, 0);
+            PIN->vto_meter /= pj_strtod(++s, 0);
         PIN->vfr_meter = 1. / PIN->vto_meter;
     } else {
         PIN->vto_meter = PIN->to_meter;
@@ -621,11 +601,6 @@ pj_init_ctx(projCtx ctx, int argc, char **argv) {
         PIN = 0;
     }
 
-    if (old_locale != NULL) {
-       setlocale(LC_NUMERIC,old_locale);
-       free( (char*)old_locale );
-    }
-
     return PIN;
 }
 
@@ -642,7 +617,7 @@ pj_init_ctx(projCtx ctx, int argc, char **argv) {
 void
 pj_free(PJ *P) {
     if (P) {
-        paralist *t = P->params, *n;
+        paralist *t, *n;
 
         /* free parameter list elements */
         for (t = P->params; t; t = n) {
diff --git a/src/pj_initcache.c b/src/pj_initcache.c
index 71036f2..e36b0ab 100644
--- a/src/pj_initcache.c
+++ b/src/pj_initcache.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: pj_transform.c 1504 2009-01-06 02:11:57Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  init file definition cache.
  * Author:   Frank Warmerdam, warmerdam at pobox.com
@@ -30,8 +28,6 @@
 #include <projects.h>
 #include <string.h>
 
-PJ_CVSID("$Id: pj_transform.c 1504 2009-01-06 02:11:57Z warmerdam $");
-
 static int cache_count = 0;
 static int cache_alloc = 0;
 static char **cache_key = NULL;
diff --git a/src/pj_latlong.c b/src/pj_latlong.c
index 1ade364..b7a771a 100644
--- a/src/pj_latlong.c
+++ b/src/pj_latlong.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: pj_latlong.c 1504 2009-01-06 02:11:57Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  Stub projection implementation for lat/long coordinates. We 
  *           don't actually change the coordinates, but we want proj=latlong
diff --git a/src/pj_log.c b/src/pj_log.c
index 630a3cf..54b83a0 100644
--- a/src/pj_log.c
+++ b/src/pj_log.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id$
- *
  * Project:  PROJ.4
  * Purpose:  Implementation of pj_log() function.
  * Author:   Frank Warmerdam, warmerdam at pobox.com
@@ -31,8 +29,6 @@
 #include <string.h>
 #include <stdarg.h>
 
-PJ_CVSID("$Id$");
-
 /************************************************************************/
 /*                          pj_stderr_logger()                          */
 /************************************************************************/
@@ -40,6 +36,8 @@ PJ_CVSID("$Id$");
 void pj_stderr_logger( void *app_data, int level, const char *msg )
 
 {
+    (void) app_data;
+    (void) level;
     fprintf( stderr, "%s\n", msg );
 }
 
diff --git a/src/pj_mutex.c b/src/pj_mutex.c
index ee5a655..349537c 100644
--- a/src/pj_mutex.c
+++ b/src/pj_mutex.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: pj_transform.c 1504 2009-01-06 02:11:57Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  Mutex (thread lock) functions.
  * Author:   Frank Warmerdam, warmerdam at pobox.com
@@ -30,9 +28,13 @@
 
 /* projects.h and windows.h conflict - avoid this! */
 
+#if defined(MUTEX_pthread) && !defined(_XOPEN_SOURCE)
+// For pthread_mutexattr_settype
+#define _XOPEN_SOURCE 500
+#endif
+
 #ifndef _WIN32
 #include <projects.h>
-PJ_CVSID("$Id: pj_transform.c 1504 2009-01-06 02:11:57Z warmerdam $");
 #else
 #include <proj_api.h>
 #endif
diff --git a/src/pj_open_lib.c b/src/pj_open_lib.c
index db4dcab..0a2e7fe 100644
--- a/src/pj_open_lib.c
+++ b/src/pj_open_lib.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: pj_open_lib.c 2372 2013-06-26 21:44:00Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  Implementation of pj_open_lib(), and pj_set_finder().  These
  *           provide a standard interface for opening projections support
@@ -36,8 +34,6 @@
 #include <string.h>
 #include <errno.h>
 
-PJ_CVSID("$Id: pj_open_lib.c 2372 2013-06-26 21:44:00Z warmerdam $");
-
 static const char *(*pj_finder)(const char *) = NULL;
 static int path_count = 0;
 static char **search_path = NULL;
diff --git a/src/pj_param.c b/src/pj_param.c
index 119006e..ed6ce27 100644
--- a/src/pj_param.c
+++ b/src/pj_param.c
@@ -61,7 +61,7 @@ pj_param(projCtx ctx, paralist *pl, const char *opt) {
 			value.i = atoi(opt);
 			break;
 		case 'd':	/* simple real input */
-			value.f = atof(opt);
+			value.f = pj_atof(opt);
 			break;
 		case 'r':	/* degrees input */
 			value.f = dmstor_ctx(ctx, opt, 0);
diff --git a/src/pj_pr_list.c b/src/pj_pr_list.c
index e14b20d..95aab4a 100644
--- a/src/pj_pr_list.c
+++ b/src/pj_pr_list.c
@@ -58,7 +58,8 @@ char *pj_get_def( PJ *P, int options )
     paralist *t;
     int l;
     char *definition;
-    int  def_max = 10;
+    size_t def_max = 10;
+    (void) options;
 
     definition = (char *) pj_malloc(def_max);
     definition[0] = '\0';
diff --git a/src/pj_release.c b/src/pj_release.c
index f60b220..c3736b4 100644
--- a/src/pj_release.c
+++ b/src/pj_release.c
@@ -2,7 +2,7 @@
 
 #include <projects.h>
 
-char const pj_release[]="Rel. 4.9.1, 04 March 2015";
+char const pj_release[]="Rel. 4.9.2, 08 September 2015";
 
 const char *pj_get_release()
 
diff --git a/src/pj_strerrno.c b/src/pj_strerrno.c
index 9d23703..b46f143 100644
--- a/src/pj_strerrno.c
+++ b/src/pj_strerrno.c
@@ -71,7 +71,7 @@ pj_strerrno(int err)
     }
 #endif
     else if (err < 0) {
-        int adjusted_err = - err - 1;
+        size_t adjusted_err = - err - 1;
         if (adjusted_err < (sizeof(pj_err_list) / sizeof(char *)))
             return(pj_err_list[adjusted_err]);
         else
diff --git a/src/pj_strtod.c b/src/pj_strtod.c
new file mode 100644
index 0000000..9aac07e
--- /dev/null
+++ b/src/pj_strtod.c
@@ -0,0 +1,184 @@
+/******************************************************************************
+ *
+ * Derived from GDAL port/cpl_strtod.cpp
+ * Purpose:  Functions to convert ASCII string to floating point number.
+ * Author:   Andrey Kiselev, dron at ak4719.spb.edu.
+ *
+ ******************************************************************************
+ * Copyright (c) 2006, Andrey Kiselev
+ * Copyright (c) 2008-2012, Even Rouault <even dot rouault at mines-paris dot org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ****************************************************************************/
+
+#include "projects.h"
+
+/* Windows nmake build doesn't have a proj_config.h, but HAVE_LOCALECONV */
+/* is defined in the compilation line */
+#ifndef HAVE_LOCALECONV
+#include "proj_config.h"
+#endif
+
+#include <stdlib.h>
+#include <locale.h>
+#include <errno.h>
+
+#define PJ_STRTOD_WORK_BUFFER_SIZE 64
+
+/************************************************************************/
+/*                              pj_atof()                               */
+/************************************************************************/
+
+/**
+ * Converts ASCII string to floating point number.
+ *
+ * This function converts the initial portion of the string pointed to
+ * by nptr to double floating point representation. The behaviour is the
+ * same as
+ *
+ *   pj_strtod(nptr, (char **)NULL);
+ *
+ * This function does the same as standard atof(3), but does not take
+ * locale in account. That means, the decimal delimiter is always '.'
+ * (decimal point).
+ *
+ * @param nptr Pointer to string to convert.
+ *
+ * @return Converted value.
+ */
+double pj_atof( const char* nptr )
+{
+    return pj_strtod(nptr, NULL);
+}
+
+
+/************************************************************************/
+/*                     pj_replace_point_by_locale_point()               */
+/************************************************************************/
+
+static char* pj_replace_point_by_locale_point(const char* pszNumber, char point,
+                                              char* pszWorkBuffer)
+{
+#if !defined(HAVE_LOCALECONV) || defined(_WIN32_WCE)
+#warning "localeconv not available"
+    static char byPoint = 0;
+    if (byPoint == 0)
+    {
+        char szBuf[16];
+        sprintf(szBuf, "%.1f", 1.0);
+        byPoint = szBuf[1];
+    }
+    if (point != byPoint)
+    {
+        const char* pszPoint = strchr(pszNumber, point);
+        if (pszPoint)
+        {
+            char* pszNew;
+            if( strlen(pszNumber) < PJ_STRTOD_WORK_BUFFER_SIZE )
+            {
+                strcpy(pszWorkBuffer, pszNumber);
+                pszNew = pszWorkBuffer;
+            }
+            else
+                pszNew = strdup(pszNumber);
+            pszNew[pszPoint - pszNumber] = byPoint;
+            return pszNew;
+        }
+    }
+#else
+    struct lconv *poLconv = localeconv();
+    if ( poLconv
+         && poLconv->decimal_point
+         && poLconv->decimal_point[0] != '\0' )
+    {
+        char    byPoint = poLconv->decimal_point[0];
+
+        if (point != byPoint)
+        {
+            const char* pszLocalePoint = strchr(pszNumber, byPoint);
+            const char* pszPoint = strchr(pszNumber, point);
+            if (pszPoint || pszLocalePoint)
+            {
+                char* pszNew;
+                if( strlen(pszNumber) < PJ_STRTOD_WORK_BUFFER_SIZE )
+                {
+                    strcpy(pszWorkBuffer, pszNumber);
+                    pszNew = pszWorkBuffer;
+                }
+                else
+                    pszNew = strdup(pszNumber);
+                if( pszLocalePoint )
+                    pszNew[pszLocalePoint - pszNumber] = ' ';
+                if( pszPoint )
+                    pszNew[pszPoint - pszNumber] = byPoint;
+                return pszNew;
+            }
+        }
+    }
+#endif
+    return (char*) pszNumber;
+}
+
+/************************************************************************/
+/*                            pj_strtod()                               */
+/************************************************************************/
+
+/**
+ * Converts ASCII string to floating point number.
+ *
+ * This function converts the initial portion of the string pointed to
+ * by nptr to double floating point representation. This function does the
+ * same as standard strtod(3), but does not take locale in account and use
+ * decimal point.
+ *
+ * @param nptr Pointer to string to convert.
+ * @param endptr If is not NULL, a pointer to the character after the last
+ * character used in the conversion is stored in the location referenced
+ * by endptr.
+ * @param point Decimal delimiter.
+ *
+ * @return Converted value.
+ */
+double pj_strtod( const char *nptr, char **endptr )
+{
+/* -------------------------------------------------------------------- */
+/*  We are implementing a simple method here: copy the input string     */
+/*  into the temporary buffer, replace the specified decimal delimiter  */
+/*  with the one, taken from locale settings and use standard strtod()  */
+/*  on that buffer.                                                     */
+/* -------------------------------------------------------------------- */
+    double      dfValue;
+    int         nError;
+    char        szWorkBuffer[PJ_STRTOD_WORK_BUFFER_SIZE];
+
+    char*       pszNumber = pj_replace_point_by_locale_point(nptr, '.', szWorkBuffer);
+
+    dfValue = strtod( pszNumber, endptr );
+    nError = errno;
+
+    if ( endptr )
+        *endptr = (char *)nptr + (*endptr - pszNumber);
+
+    if (pszNumber != (char*) nptr && pszNumber != szWorkBuffer )
+        free( pszNumber );
+
+    errno = nError;
+    return dfValue;
+}
+
diff --git a/src/pj_transform.c b/src/pj_transform.c
index afd3db3..6fe571c 100644
--- a/src/pj_transform.c
+++ b/src/pj_transform.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: pj_transform.c 2000 2011-05-10 17:06:33Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  Perform overall coordinate system to coordinate system 
  *           transformations (pj_transform() function) including reprojection
@@ -34,8 +32,6 @@
 #include <math.h>
 #include "geocent.h"
 
-PJ_CVSID("$Id: pj_transform.c 2000 2011-05-10 17:06:33Z warmerdam $");
-
 static int pj_adjust_axis( projCtx ctx, const char *axis, int denormalize_flag,
                            long point_count, int point_offset, 
                            double *x, double *y, double *z );
@@ -212,7 +208,7 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset,
 /*      Do we need to translate from geoid to ellipsoidal vertical      */
 /*      datum?                                                          */
 /* -------------------------------------------------------------------- */
-    if( srcdefn->has_geoid_vgrids )
+    if( srcdefn->has_geoid_vgrids && z != NULL )
     {
         if( pj_apply_vgridshift( srcdefn, "sgeoidgrids", 
                                  &(srcdefn->vgridlist_geoid), 
@@ -237,7 +233,7 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset,
 /*      Do we need to translate from geoid to ellipsoidal vertical      */
 /*      datum?                                                          */
 /* -------------------------------------------------------------------- */
-    if( dstdefn->has_geoid_vgrids )
+    if( dstdefn->has_geoid_vgrids && z != NULL )
     {
         if( pj_apply_vgridshift( dstdefn, "sgeoidgrids", 
                                  &(dstdefn->vgridlist_geoid), 
diff --git a/src/pj_units.c b/src/pj_units.c
index bb39f91..c6b5ae3 100644
--- a/src/pj_units.c
+++ b/src/pj_units.c
@@ -6,28 +6,28 @@
 ** numerator/denomenator values (e.g. 1/1000) */
 C_NAMESPACE_VAR struct PJ_UNITS
 pj_units[] = {
-	"km",	"1000.",	"Kilometer",
-	"m",	"1.",		"Meter",
-	"dm",	"1/10",		"Decimeter",
-	"cm",	"1/100",	"Centimeter",
-	"mm",	"1/1000",	"Millimeter",
-	"kmi",	"1852.0",	"International Nautical Mile",
-	"in",	"0.0254",	"International Inch",
-	"ft",	"0.3048",	"International Foot",
-	"yd",	"0.9144",	"International Yard",
-	"mi",	"1609.344",	"International Statute Mile",
-	"fath",	"1.8288",	"International Fathom",
-	"ch",	"20.1168",	"International Chain",
-	"link",	"0.201168",	"International Link",
-	"us-in",	"1./39.37",	"U.S. Surveyor's Inch",
-	"us-ft",	"0.304800609601219",	"U.S. Surveyor's Foot",
-	"us-yd",	"0.914401828803658",	"U.S. Surveyor's Yard",
-	"us-ch",	"20.11684023368047",	"U.S. Surveyor's Chain",
-	"us-mi",	"1609.347218694437",	"U.S. Surveyor's Statute Mile",
-	"ind-yd",	"0.91439523",	"Indian Yard",
-	"ind-ft",	"0.30479841",	"Indian Foot",
-	"ind-ch",	"20.11669506",	"Indian Chain",
-(char *)0, (char *)0, (char *)0
+	{"km",		"1000.",		"Kilometer"},
+	{"m",		"1.",			"Meter"},
+	{"dm",		"1/10",			"Decimeter"},
+	{"cm",		"1/100",		"Centimeter"},
+	{"mm",		"1/1000",		"Millimeter"},
+	{"kmi",		"1852.0",		"International Nautical Mile"},
+	{"in",		"0.0254",		"International Inch"},
+	{"ft",		"0.3048",		"International Foot"},
+	{"yd",		"0.9144",		"International Yard"},
+	{"mi",		"1609.344",		"International Statute Mile"},
+	{"fath",	"1.8288",		"International Fathom"},
+	{"ch",		"20.1168",		"International Chain"},
+	{"link",	"0.201168",		"International Link"},
+	{"us-in",	"1./39.37",		"U.S. Surveyor's Inch"},
+	{"us-ft",	"0.304800609601219",	"U.S. Surveyor's Foot"},
+	{"us-yd",	"0.914401828803658",	"U.S. Surveyor's Yard"},
+	{"us-ch",	"20.11684023368047",	"U.S. Surveyor's Chain"},
+	{"us-mi",	"1609.347218694437",	"U.S. Surveyor's Statute Mile"},
+	{"ind-yd",	"0.91439523",		"Indian Yard"},
+	{"ind-ft",	"0.30479841",		"Indian Foot"},
+	{"ind-ch",	"20.11669506",		"Indian Chain"},
+	{NULL,		NULL,			NULL}
 };
 
 struct PJ_UNITS *pj_get_units_ref()
diff --git a/src/pj_utils.c b/src/pj_utils.c
index c485de9..f11081f 100644
--- a/src/pj_utils.c
+++ b/src/pj_utils.c
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: pj_utils.c 2160 2012-02-15 23:51:45Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  Some utility functions we don't want to bother putting in
  *           their own source files.
@@ -103,8 +101,15 @@ PJ *pj_latlong_from_proj( PJ *pj_in )
             sprintf( defn+strlen(defn), " +f=%s", 
                      pj_param(pj_in->ctx,pj_in->params,"sf").s );
         else
-            sprintf( defn+strlen(defn), " +es=%.16g", 
-                     pj_in->es );
+        {
+            char* ptr = defn+strlen(defn);
+            sprintf( ptr, " +es=%.16g",  pj_in->es );
+            for(; *ptr; ptr++)
+            {
+                if( *ptr == ',' )
+                    *ptr = '.';
+            }
+        }
     }
     else
     {
diff --git a/src/proj.def b/src/proj.def
index bfcf9f9..f314655 100644
--- a/src/proj.def
+++ b/src/proj.def
@@ -72,3 +72,5 @@ EXPORTS
 	pj_ctx_ftell            @70
 	pj_ctx_fclose           @71
 	pj_open_lib             @72
+	pj_atof                 @73
+	pj_strtod               @74
diff --git a/src/proj_api.h b/src/proj_api.h
index ddef9e0..99faeaf 100644
--- a/src/proj_api.h
+++ b/src/proj_api.h
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: proj_api.h 2610 2015-02-17 21:52:14Z hobu $
- *
  * Project:  PROJ.4
  * Purpose:  Public (application) include file for PROJ.4 API, and constants.
  * Author:   Frank Warmerdam, <warmerdam at pobox.com>
@@ -40,7 +38,11 @@ extern "C" {
 #endif
 
 /* Try to update this every version! */
-#define PJ_VERSION 491
+#define PJ_VERSION 492
+
+/* pj_init() and similar functions can be used with a non-C locale */
+/* Can be detected too at runtime if the symbol pj_atof exists */
+#define PJ_LOCALE_SAFE 1
 
 extern char const pj_release[]; /* global release id string */
 
@@ -89,7 +91,7 @@ int pj_geodetic_to_geocentric( double a, double es,
                                long point_count, int point_offset,
                                double *x, double *y, double *z );
 int pj_compare_datums( projPJ srcdefn, projPJ dstdefn );
-int pj_apply_gridshift( projCtx, const char *, int, 
+int pj_apply_gridshift( projCtx, const char *, int,
                         long point_count, int point_offset,
                         double *x, double *y, double *z );
 void pj_deallocate_grids(void);
diff --git a/src/proj_config.h.in b/src/proj_config.h.in
index e4992e2..7a8d694 100644
--- a/src/proj_config.h.in
+++ b/src/proj_config.h.in
@@ -6,9 +6,18 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the <jni.h> header file. */
+#undef HAVE_JNI_H
+
 /* Define to 1 if you have the `m' library (-lm). */
 #undef HAVE_LIBM
 
+/* Define to 1 if you have the `pthread' library (-lpthread). */
+#undef HAVE_LIBPTHREAD
+
+/* Define to 1 if you have localeconv */
+#undef HAVE_LOCALECONV
+
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
@@ -36,6 +45,10 @@
 /* Enabled for Java/JNI Support */
 #undef JNI_ENABLED
 
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#undef LT_OBJDIR
+
 /* Name of package */
 #undef PACKAGE
 
@@ -51,6 +64,9 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
diff --git a/src/proj_mdist.c b/src/proj_mdist.c
index 465ebeb..d7e4344 100644
--- a/src/proj_mdist.c
+++ b/src/proj_mdist.c
@@ -3,8 +3,6 @@
 **
 ** Copyright (c) 2003, 2006   Gerald I. Evenden
 */
-static const char
-LIBPROJ_ID[] = "$Id: proj_mdist.c 1856 2010-06-11 03:26:04Z warmerdam $";
 /*
 ** Permission is hereby granted, free of charge, to any person obtaining
 ** a copy of this software and associated documentation files (the
diff --git a/src/proj_rouss.c b/src/proj_rouss.c
index f2c49e2..f1c2f5a 100644
--- a/src/proj_rouss.c
+++ b/src/proj_rouss.c
@@ -3,8 +3,6 @@
 **
 ** Copyright (c) 2003, 2006   Gerald I. Evenden
 */
-static const char
-LIBPROJ_ID[] = "$Id: proj_rouss.c 1856 2010-06-11 03:26:04Z warmerdam $";
 /*
 ** Permission is hereby granted, free of charge, to any person obtaining
 ** a copy of this software and associated documentation files (the
diff --git a/src/projects.h b/src/projects.h
index b35e89e..ac95f69 100644
--- a/src/projects.h
+++ b/src/projects.h
@@ -1,6 +1,4 @@
 /******************************************************************************
- * $Id: projects.h 2356 2013-06-25 01:02:23Z warmerdam $
- *
  * Project:  PROJ.4
  * Purpose:  Primary (private) include file for PROJ.4 library.
  * Author:   Gerald Evenden
@@ -511,17 +509,9 @@ struct PJ_DATUMS *pj_get_datums_ref( void );
 struct PJ_UNITS *pj_get_units_ref( void );
 struct PJ_LIST  *pj_get_list_ref( void );
 struct PJ_PRIME_MERIDIANS  *pj_get_prime_meridians_ref( void );
- 
-#ifndef DISABLE_CVSID
-#  if defined(__GNUC__) && __GNUC__ >= 4
-#    define PJ_CVSID(string)     static char pj_cvsid[] __attribute__((used)) = string;
-#  else
-#    define PJ_CVSID(string)     static char pj_cvsid[] = string; \
-static char *cvsid_aw() { return( cvsid_aw() ? ((char *) NULL) : pj_cvsid ); }
-#  endif
-#else
-#  define PJ_CVSID(string)
-#endif
+
+double pj_atof( const char* nptr );
+double pj_strtod( const char *nptr, char **endptr );
 
 #ifdef __cplusplus
 }
diff --git a/src/test228.c b/src/test228.c
index 464c573..cdfc865 100644
--- a/src/test228.c
+++ b/src/test228.c
@@ -15,14 +15,18 @@ int main(int argc, char* argv[])
 #include <assert.h>
 #include <unistd.h>
 
-volatile int go_on = 1;
+volatile int run = 0;
+volatile int started = 0;
 
 void* thread_main(void* unused)
 {
     projCtx p_proj_ctxt;
     projPJ p_WGS84_proj;
     projPJ p_OSGB36_proj;
-    
+
+    __sync_add_and_fetch(&started, 1);
+    while(run == 0);
+
     p_proj_ctxt=pj_ctx_alloc();
     p_WGS84_proj=pj_init_plus_ctx(p_proj_ctxt,"+proj=longlat "
             "+ellps=WGS84 +datum=WGS84 +no_defs");
@@ -30,7 +34,7 @@ void* thread_main(void* unused)
             "+proj=longlat +ellps=airy +datum=OSGB36 +nadgrids=OSTN02_NTv2.gsb "
             "+no_defs");
     
-    while(go_on)
+    while(run)
     {
         double x, y;
         int proj_ret;
@@ -61,9 +65,11 @@ int main(int argc, char* argv[])
 
     pthread_create(&tid1, &attr1, thread_main, NULL);
     pthread_create(&tid2, &attr2, thread_main, NULL);
+    while(started != 2);
+    run = 1;
     for(i=0;i<2;i++)
         sleep(1);
-    go_on = 0;
+    run = 0;
     return 0;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/proj.git



More information about the Pkg-grass-devel mailing list