Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jul 2008 13:54:46 +0930
From:      Malcolm Kay <malcolm.kay@internode.on.net>
To:        freebsd-questions@freebsd.org
Cc:        Anton Shterenlikht <mexas@bristol.ac.uk>
Subject:   Re: snippet of configure script - explain please
Message-ID:  <200807101354.46321.malcolm.kay@internode.on.net>
In-Reply-To: <20080709172513.GA51206@mech-cluster238.men.bris.ac.uk>
References:  <20080709172513.GA51206@mech-cluster238.men.bris.ac.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 10 Jul 2008 02:55 am, Anton Shterenlikht wrote:
> I get errors building ports/graphviz on FBSD 6.3 on alpha.
> It seems the error is due to configure script erroneously
> deciding that there is no strncasecmp function on OS.
> 
> Based on config.log:
> 
> configure:9333: result: no
This probably the result for the previous check; probably strcasecmp

> configure:9253: checking for strncasecmp
> 
> I think the following configure snippet is to blame.
> Could somebody explain, at least in general terms,
> what this piece of code does.
> 
> many thanks
> anton
> 
>    9249
>    9250 for ac_func in strcasecmp strncasecmp
>    9251 do
>    9252 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
This is eqivalent to:
  as_ac_var=ac_cv_func_strcasecmp
or:
  as_ac_var=ac_cv_func_strncasecmp
depending on which time through the loop.

>    9253 { echo "$as_me:$LINENO: checking for $ac_func" >&5
>    9254 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
These lines simplly write reports of one type or another (including to config.log ?)
The $ECHO_N and $ECHO_C are to cater for different versions of 'echo' wrt line feeds.

>    9255 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
I find this line somewhat strange as I've not been able
to find documentation for the expansion of ${parameter+set} under the Bourne shell.
(nor bash, nor ksh)
*****************************************************
Presumably someone out there knows where to find it?
*****************************************************
But it seems that it returns "set" if "parameter" has been assigned a value and 
null otherwise.

Unless strcasecmp, strncasecmp have already been checked one expects these will fail
so the 'else' section is executed.


>    9256   echo $ECHO_N "(cached) $ECHO_C" >&6
>    9257 else
>    9258   cat >conftest.$ac_ext <<_ACEOF
>    9259 /* confdefs.h.  */
>    9260 _ACEOF
>    9261 cat confdefs.h >>conftest.$ac_ext
>    9262 cat >>conftest.$ac_ext <<_ACEOF
>    9263 /* end confdefs.h.  */
This is the start of the build of a C program to test if the library function exists.
But we've barely started -- the guts of the check is still to come.

One would expect that if it does not exist the configuration would implement
some alternative action so even then I would not expect the built to fail.

> where
> 
> as_tr_sh :
> 
>     549 # Sed expression to map a string onto a valid variable name.
>     550 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
> 
> as_cr_alnum :
> 
>      40 as_cr_alnum=$as_cr_Letters$as_cr_digits
> 
> as_me :
> 
>     132 # Name of the executable.
>     133 as_me=`$as_basename -- "$0" ||
> 
> ECHO_N and ECHO_C :
> 
>     474 ECHO_C= ECHO_N= ECHO_T=
>     475 case `echo -n x` in
>     476 -n*)
>     477   case `echo 'x\c'` in
>     478   *c*) ECHO_T=' ';;     # ECHO_T is single tab character.
>     479   *)   ECHO_C='\c';;
>     480   esac;;
>     481 *)
>     482   ECHO_N='-n';;
>     483 esac
>  
> 

Best of luck,
Malcolm Kay



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807101354.46321.malcolm.kay>