From owner-freebsd-questions@FreeBSD.ORG Thu Jul 10 04:39:59 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B290106566B for ; Thu, 10 Jul 2008 04:39:59 +0000 (UTC) (envelope-from malcolm.kay@internode.on.net) Received: from ipmail01.adl6.internode.on.net (ipmail01.adl6.internode.on.net [203.16.214.146]) by mx1.freebsd.org (Postfix) with ESMTP id 172398FC14 for ; Thu, 10 Jul 2008 04:39:58 +0000 (UTC) (envelope-from malcolm.kay@internode.on.net) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AikFAJQqdUh5LQ2Y/2dsb2JhbACBW65v X-IronPort-AV: E=Sophos;i="4.30,335,1212330600"; d="scan'208";a="145702991" Received: from ppp121-45-13-152.lns10.adl2.internode.on.net (HELO alpha.home) ([121.45.13.152]) by ipmail01.adl6.internode.on.net with ESMTP; 10 Jul 2008 13:54:47 +0930 From: Malcolm Kay Organization: at home To: freebsd-questions@freebsd.org Date: Thu, 10 Jul 2008 13:54:46 +0930 User-Agent: KMail/1.8 References: <20080709172513.GA51206@mech-cluster238.men.bris.ac.uk> In-Reply-To: <20080709172513.GA51206@mech-cluster238.men.bris.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200807101354.46321.malcolm.kay@internode.on.net> Cc: Anton Shterenlikht Subject: Re: snippet of configure script - explain please X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jul 2008 04:39:59 -0000 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