# [PATCH] Fix naming scheme for configure cache variables.

4 messages from 2009-01-19 to 2009-01-21. Participants: Ralf Wildenhues, Junio C Hamano.
Thread: https://gitlist.dev/t/17257

## Ralf Wildenhues, 2009-01-19 20:34

Subject: [PATCH] Fix naming scheme for configure cache variables.
Message-ID: <20090119203436.GB3539@ins.uni-bonn.de>
URL: https://gitlist.dev/e/20090119203436.GB3539%40ins.uni-bonn.de

```
In order to be cached, configure variables need to contain the
string '_cv_', and they should begin with a package-specific
prefix in order to avoid interfering with third-party macros.
Rename ld_dashr, ld_wl_rpath, ld_rpath to git_cv_ld_dashr etc.
---

This avoids a warning with newer autoconf versions about the naming of
the cache variables, and makes the caching work for them.

As to the 'git_' prefix, it could be argued that the other cache
variables used in configure.ac should also be renamed s/ac_/git_/
If you like, I can provide a patch for those, too.

Thanks,
Ralf

 configure.ac |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0a5fc8c..363547c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,31 +114,31 @@ AC_MSG_NOTICE([CHECKS for programs])
 #
 AC_PROG_CC([cc gcc])
 # which switch to pass runtime path to dynamic libraries to the linker
-AC_CACHE_CHECK([if linker supports -R], ld_dashr, [
+AC_CACHE_CHECK([if linker supports -R], git_cv_ld_dashr, [
    SAVE_LDFLAGS="${LDFLAGS}"
    LDFLAGS="${SAVE_LDFLAGS} -R /"
-   AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_dashr=yes], [ld_dashr=no])
+   AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_dashr=yes], [git_cv_ld_dashr=no])
    LDFLAGS="${SAVE_LDFLAGS}"
 ])
-if test "$ld_dashr" = "yes"; then
+if test "$git_cv_ld_dashr" = "yes"; then
    AC_SUBST(CC_LD_DYNPATH, [-R])
 else
-   AC_CACHE_CHECK([if linker supports -Wl,-rpath,], ld_wl_rpath, [
+   AC_CACHE_CHECK([if linker supports -Wl,-rpath,], git_cv_ld_wl_rpath, [
       SAVE_LDFLAGS="${LDFLAGS}"
       LDFLAGS="${SAVE_LDFLAGS} -Wl,-rpath,/"
-      AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_wl_rpath=yes], [ld_wl_rpath=no])
+      AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_wl_rpath=yes], [git_cv_ld_wl_rpath=no])
       LDFLAGS="${SAVE_LDFLAGS}"
    ])
-   if test "$ld_wl_rpath" = "yes"; then
+   if test "$git_cv_ld_wl_rpath" = "yes"; then
       AC_SUBST(CC_LD_DYNPATH, [-Wl,-rpath,])
    else
-      AC_CACHE_CHECK([if linker supports -rpath], ld_rpath, [
+      AC_CACHE_CHECK([if linker supports -rpath], git_cv_ld_rpath, [
          SAVE_LDFLAGS="${LDFLAGS}"
          LDFLAGS="${SAVE_LDFLAGS} -rpath /"
-         AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_rpath=yes], [ld_rpath=no])
+         AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_rpath=yes], [git_cv_ld_rpath=no])
          LDFLAGS="${SAVE_LDFLAGS}"
       ])
-      if test "$ld_rpath" = "yes"; then
+      if test "$git_cv_ld_rpath" = "yes"; then
          AC_SUBST(CC_LD_DYNPATH, [-rpath])
       else
          AC_MSG_WARN([linker does not support runtime path to dynamic libraries])
-- 
1.6.1.137.g3d9e8

```

## Junio C Hamano, 2009-01-20 06:30

Subject: Re: [PATCH] Fix naming scheme for configure cache variables.
Message-ID: <7vljt6mqv0.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vljt6mqv0.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20090119203436.GB3539@ins.uni-bonn.de>

```
Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:

> In order to be cached, configure variables need to contain the
> string '_cv_', and they should begin with a package-specific
> prefix in order to avoid interfering with third-party macros.
> Rename ld_dashr, ld_wl_rpath, ld_rpath to git_cv_ld_dashr etc.
> ---
>
> This avoids a warning with newer autoconf versions about the naming of
> the cache variables, and makes the caching work for them.

Thanks.

We require every patch we accept to be accompanied with a sign-off.

Can you certify that ... [see Documentation/SubmittingPatches and look for
(4) Sign your work] ... please?

```

## Ralf Wildenhues, 2009-01-20 07:08

Subject: Re: [PATCH] Fix naming scheme for configure cache variables.
Message-ID: <20090120070852.GE5561@ins.uni-bonn.de>
URL: https://gitlist.dev/e/20090120070852.GE5561%40ins.uni-bonn.de
In-Reply-To: <7vljt6mqv0.fsf@gitster.siamese.dyndns.org>

```
* Junio C Hamano wrote on Tue, Jan 20, 2009 at 07:30:27AM CET:
> Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:
> 
> > In order to be cached, configure variables need to contain the
> > string '_cv_', and they should begin with a package-specific
> > prefix in order to avoid interfering with third-party macros.
> > Rename ld_dashr, ld_wl_rpath, ld_rpath to git_cv_ld_dashr etc.

> We require every patch we accept to be accompanied with a sign-off.
> 
> Can you certify that ... [see Documentation/SubmittingPatches and look for
> (4) Sign your work] ... please?

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>

Sorry about that.

Cheers,
Ralf

```

## Junio C Hamano, 2009-01-21 10:26

Subject: Re: [PATCH] Fix naming scheme for configure cache variables.
Message-ID: <7v7i4peyzc.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v7i4peyzc.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20090119203436.GB3539@ins.uni-bonn.de>

```
Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:

> In order to be cached, configure variables need to contain the
> string '_cv_', and they should begin with a package-specific
> prefix in order to avoid interfering with third-party macros.
> Rename ld_dashr, ld_wl_rpath, ld_rpath to git_cv_ld_dashr etc.
>
> Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>

Thanks.

```
