Permalink
Browse files

Evaluate a possibly set environment variable PROJ_LIB (#4930).

  • Loading branch information...
mkofahl authored and tbonfort committed Jan 6, 2015
1 parent 6c72159 commit e17e69ba1567869e935cabeee51b5f2bc71cac14
Showing with 23 additions and 0 deletions.
  1. +12 −0 mapproject.c
  2. +1 −0 mapproject.h
  3. +4 −0 mapservutil.c
  4. +3 −0 maputil.c
  5. +3 −0 shp2img.c
View
@@ -1245,6 +1245,18 @@ static const char *msProjFinder( const char *filename)
}
#endif /* def USE_PROJ */
+/************************************************************************/
+/* msProjLibInitFromEnv() */
+/************************************************************************/
+void msProjLibInitFromEnv()
+{
+ const char *val;
+
+ if( (val=getenv( "PROJ_LIB" )) != NULL ) {
+ msSetPROJ_LIB(val, NULL);
+ }
+}
+
/************************************************************************/
/* msSetPROJ_LIB() */
/************************************************************************/
View
@@ -99,6 +99,7 @@ extern "C" {
double *x, double *y );
MS_DLL_EXPORT void msSetPROJ_LIB( const char *, const char * );
+ MS_DLL_EXPORT void msProjLibInitFromEnv();
/* Provides compatiblity with PROJ.4 4.4.2 */
#ifndef PJ_VERSION
View
@@ -1817,6 +1817,10 @@ int msCGIHandler(const char *query_string, void **out_buffer, size_t *buffer_len
msIOBuffer *buf;
msIO_installStdoutToBuffer();
+
+ /* Use PROJ_LIB env vars if set */
+ msProjLibInitFromEnv();
+
/* Use MS_ERRORFILE and MS_DEBUGLEVEL env vars if set */
if( msDebugInitFromEnv() != MS_SUCCESS ) {
msCGIWriteError(mapserv);
View
@@ -1893,6 +1893,9 @@ int msSetup()
msThreadInit();
#endif
+ /* Use PROJ_LIB env vars if set */
+ msProjLibInitFromEnv();
+
/* Use MS_ERRORFILE and MS_DEBUGLEVEL env vars if set */
if (msDebugInitFromEnv() != MS_SUCCESS)
return MS_FAILURE;
View
@@ -113,6 +113,9 @@ int main(int argc, char *argv[])
exit(1);
}
+ /* Use PROJ_LIB env vars if set */
+ msProjLibInitFromEnv();
+
/* Use MS_ERRORFILE and MS_DEBUGLEVEL env vars if set */
if ( msDebugInitFromEnv() != MS_SUCCESS ) {
msWriteError(stderr);

0 comments on commit e17e69b

Please sign in to comment.