[GRASS5] Re: auto-locate EPSG

Glynn Clements glynn at gclements.plus.com
Fri Apr 28 13:26:29 EDT 2006


Markus Neteler wrote:

> > > configure is autogenerated from configure.in by autoconf-2.13
> > > So, the file configure.in has to be worked on, not configure.
> > > Unfortunately a macro seems to be
> > > missing for the .../share/ stuff, that's why this damn hack is needed.
> > 
> > So do we need a LOC_ARG_WITH_SHARE macro to go with the
> > LOC_ARG_WITH_{INC,LIB} macros? I.e.:
> > 
> > aclocal.m4:
> > 
> > 	AC_DEFUN(LOC_ARG_WITH_SHARE,[
> > 	AC_ARG_WITH($1-share,
> > 	LOC_PAD([  --with-$1-share=DIRS])[$2 data files are in DIRS])
> > 	])

Actually, this needs to be a single directory, unless the code which
locates the file can handle a list of directories. So:

	AC_DEFUN(LOC_ARG_WITH_SHARE,[
	AC_ARG_WITH($1-share,
	LOC_PAD([  --with-$1-share=DIR])[$2 data files are in DIR])
	])

Note that, unlike headers/libraries, where the compiler/linker has a
default search path, the default value (the empty string) isn't much
use; the option has to be specified explicitly for the file to be
found.

> > configure.in:
> > 
> > 	LOC_ARG_WITH_SHARE(proj, External PROJ.4)
> 
> Thanks for your help! Do we probably also need to define
> 
> LOC_CHECK_SHARE_PATH(proj,External PROJ.4,PROJSHARE)

Definitely; it's needed to actually read the option value.

> LOC_CHECK_SHARE(epsg,External PROJ.4,$PROJSHARE)

Probably a good idea, although the file isn't needed until run-time
(AFAIK), so the test isn't critical.

Also, if it's possible to use GRASS at all without that file, it
should use the 4th argument to generate a warning (the default is a
fatal error), e.g.:

	LOC_CHECK_SHARE(epsg,External PROJ.4,$PROJSHARE,[
	AC_MSG_WARN([*** Unable to locate PROJ data files.])
	])

> If not, I don't know how to figure out PROJSHARE (which I then need in
> include/Make/Platform.make[.in]. If yes, would you mind to write those?

	AC_DEFUN(LOC_CHECK_SHARE_PATH,[
	AC_MSG_CHECKING(for location of $2 data files)
	case "$with_$1_share" in
	y | ye | yes | n | no)
		AC_MSG_ERROR([*** You must supply a directory to --with-$1-share.])
		;;
	esac
	AC_MSG_RESULT($with_$1_share)
	
	if test -n "$with_$1_share" ; then
	    if test -d "$with_$1_share"; then
	        $3="$$3 -I$dir"
	    else
	        AC_MSG_ERROR([*** $2 data directory $dir does not exist.])
	    fi
	fi
	])

	AC_DEFUN(LOC_CHECK_SHARE,[
	AC_CHECK_FILE($3/$1, [], ifelse($4,[],[
	    AC_MSG_ERROR([*** Unable to locate $2 data files.])
	], $4))
	])

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list