[GRASS-dev] hacking configure for gettext

I would like GRASS to use gettext that is installed in a location NOT in the standard /usr/local… I have no problem building gettext in such a location but I am having problems telling GRASS where to find it.

The configure switch to enable gettext is --with-nls. I’ve tried adding additional arguments

–with-nls-includes=“/Users/cmbarton/grass_source/gettext/gettext_dist/include” --with-nls-libs=“/Users/cmbarton/grass_source/gettext/gettext_dist/lib”

to tell GRASS where to find gettext but these do not seem to do the trick.

Can someone familiar with the build system suggest how to specify where to find gettext or now to modify configure so that GRASS can find gettext in this other location?

The reason for this is twofold. It makes for cleaner compiling and updating if I can keep GRASS dependencies out of my system files. It is also needed to avoid the SIP problem on the current Mac OS. The more dependencies that can be bundled with GRASS that do not link to system folders, the better.

Thanks
Michael


C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Head, Graduate Faculty in Complex Adaptive Systems Science
Arizona State University

voice: 480-965-6262 (SHESC), 480-965-8130/727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)

www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

Michael Barton wrote:

I would like GRASS to use gettext that is installed in a location
NOT in the standard /usr/local... I have no problem building gettext
in such a location but I am having problems telling GRASS where to
find it.

The configure switch to enable gettext is --with-nls. I've tried
adding additional arguments

--with-nls-includes="/Users/cmbarton/grass_source/gettext/gettext_dist/include"
--with-nls-libs="/Users/cmbarton/grass_source/gettext/gettext_dist/lib"

to tell GRASS where to find gettext but these do not seem to do the
trick.

Can someone familiar with the build system suggest how to specify
where to find gettext or now to modify configure so that GRASS can
find gettext in this other location?

Currently, gettext is treated as a system function, i.e. there's no
way to configure search paths beyond the generic --with-includes= and
--with-libs= switches. It's checked initially without additional
libraries (AC_CHECK_FUNC), and if that fails with -lintl
(AC_CHECK_LIB).

To treat it as an external library function, try the attached patch.

Note that you'll need to add $(INTLINC) to ... something. probably
Either INC (in Grass.make) or NLS_CFLAGS (in Compile.make). Adding it
to individual Makefiles isn't feasible because <libintl.h> is included
from <grass/glocale.h>, which is included by practically everything.

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

(attachments)

gettext.diff (1.02 KB)

Thanks Glynn.

I'll try this out and see what happens. I've also tried to point the generic --with-includes= and
--with-libs= switches to my gettext location but it has made no difference.

It looks like it is bundled dependencies that cause Mac OSX SIP to block GRASS launching. Trying to run the install_tool on every possible binary file that might link with one of these seems unrealistic. The simplest solution seems to be to build all dependencies outside of the Mac system folders. That is a pain but doable...if GRASS will recognize these dependencies in their non-system locations.

Michael

____________________
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Head, Graduate Faculty in Complex Adaptive Systems Science
Arizona State University

voice: 480-965-6262 (SHESC), 480-965-8130/727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

On Jun 8, 2016, at 12:41 PM, Glynn Clements <glynn@gclements.plus.com> wrote:

Michael Barton wrote:

I would like GRASS to use gettext that is installed in a location
NOT in the standard /usr/local... I have no problem building gettext
in such a location but I am having problems telling GRASS where to
find it.

The configure switch to enable gettext is --with-nls. I've tried
adding additional arguments

--with-nls-includes="/Users/cmbarton/grass_source/gettext/gettext_dist/include"
--with-nls-libs="/Users/cmbarton/grass_source/gettext/gettext_dist/lib"

to tell GRASS where to find gettext but these do not seem to do the
trick.

Can someone familiar with the build system suggest how to specify
where to find gettext or now to modify configure so that GRASS can
find gettext in this other location?

Currently, gettext is treated as a system function, i.e. there's no
way to configure search paths beyond the generic --with-includes= and
--with-libs= switches. It's checked initially without additional
libraries (AC_CHECK_FUNC), and if that fails with -lintl
(AC_CHECK_LIB).

To treat it as an external library function, try the attached patch.

Note that you'll need to add $(INTLINC) to ... something. probably
Either INC (in Grass.make) or NLS_CFLAGS (in Compile.make). Adding it
to individual Makefiles isn't feasible because <libintl.h> is included
from <grass/glocale.h>, which is included by practically everything.

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

Index: configure.in

--- configure.in (revision 68639)
+++ configure.in (working copy)
@@ -321,6 +321,9 @@
LOC_ARG_WITH_INC(readline, Readline)
LOC_ARG_WITH_LIB(readline, Readline)

+LOC_ARG_WITH_INC(nls, NLS)
+LOC_ARG_WITH_LIB(nls, NLS)
+
LOC_ARG_WITH_INC(tiff, TIFF)
LOC_ARG_WITH_LIB(tiff, TIFF)

@@ -1652,20 +1655,28 @@

LOC_CHECK_USE(nls,NLS,USE_NLS)

+if test -n "${USE_NLS}" ; then
+ AC_DEFINE(USE_NLS)
+
+INTLINC=
+
+LOC_CHECK_INC_PATH(nls,NLS,INTLINC)
+
+LOC_CHECK_INCLUDES(libintl.h,NSL,$INTLINC)
+
INTLLIB=
HAVE_NLS=

-if test -n "${USE_NLS}" ; then
- AC_DEFINE(USE_NLS)
+LOC_CHECK_LIB_PATH(nsl,NLS,INTLLIB)

-AC_CHECK_FUNC(gettext, INTLLIB=, [
-AC_CHECK_LIB(intl, gettext, INTLLIB=-lintl, [
- AC_MSG_ERROR([*** Unable to locate gettext() function.])
-])])
+LOC_CHECK_FUNC(gettext,NLS,INTLLIB,[
+LOC_CHECK_LIBS(intl,gettext,NLS,$INTLLIB,INTLLIB,)
+])

    HAVE_NLS=1
fi

+AC_SUBST(INTLINC)
AC_SUBST(INTLLIB)
AC_SUBST(HAVE_NLS)