[comp.unix.programmer] HELP!!! Metaconfig expert needed!

afc@shibaya.lonestar.org (Augustine Cano) (05/14/91)

I'm trying to write a package to be configured with metaconfig.  I did fix
metaconfig 2 to work with perl 3 (044) (I no longer get syntax errors, but
I might not have fixed everything that needed fixing.)

I created a test "package" consisting of just one *.U unit and one *.SH
file (included below).  Metaconfig runs to completion but then I'm left
with empty Configure and config.h.SH files.  This is the output of metaconfig:

$! nulled, predecessor circle
$! nulled, predecessor circle
$! nulled, predecessor circle
$! nulled, predecessor circle
$! nulled, predecessor circle
$! nulled, predecessor circle
$! nulled, predecessor circle
$! nulled, predecessor circle
$! nulled, predecessor circle

This is mytest.U:

?RCS:$Header: mytest.c.U,v 1.1 91/02/14 00:00:00 afc Exp $
?X: 
?X: Test unit.
?X:
?RCS: $Log:	mytest.c.U,v $
?RCS: 
?RCS: Revision 1.1  91/05/04  00:00:00  afc
?RCS: Baseline.
?RCS: 
?MAKE:mytest.c var1 var2 var3 c1 c2 : test cat echo n c Myread mansrc Mcc Guess Oldconfig Loc
?MAKE:	-pick add $@ %*
?S:var1:
?S:	Test variable # 1.
?S:.
?S:var2:
?S:	Test variable # 2.
?S:.
?S:var3:
?S:	Test variable # 3.
?S:.
?S:c1:
?S:	Test variable # 4.
?S:.
?S:c2:
?S:	Test variable # 5.
?S:.
:
q_no1="Input a number "
q_no2="Input yes/no "
q_no3="Enter a string "
q_no4="Enter another string "
q_no5="Enter another string "

$echo $n "$q_no1$c"
. myread var1

if test $var1 -gt 1; then
  var2=false
  dflt=n
  $echo $n "$q_no2 [$dflt] $c"
  . myread
  case "$ans" in
    y*) var2=true;;
  esac
fi

$echo $n "$q_no3$c"
. myread var3

$echo $n "$q_no4$c"
. myread c1

$echo $n "$q_no5$c"
. myread c2


And this is mytest.c.SH:

case $CONFIG in
'')
    if test ! -f config.sh; then
	ln ../config.sh . || \
	ln ../../config.sh . || \
	ln ../../../config.sh . || \
	(echo "Can't find config.sh."; exit 1)
    fi
    . config.sh
    ;;
esac
: This forces SH files to create target in same directory as SH file.
: This is so that make depend always knows where to find SH derivatives.
case "$0" in
*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
esac
echo "Extracting fdmtron.c (with variable substitutions)"
: This section of the file will have variable substitutions done on it.
: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
: Protect any dollar signs and backticks that you do not want interpreted
: by putting a backslash in front.  You may delete these comments.
$spitshell >mytest.c <<!GROK!THIS!
/*
 * MYTEST.C  Just a test of metaconfig
 */

/************************************************************************/

!GROK!THIS!
if test $var1 -eq 1 ; then
$spitshell >>mytest.c <<!GROK!THIS!
void mytest()

{
!GROK!THIS!
if test $var2 ; then
  $spitshell >>mytest.c <<!GROK!THIS!
  $c1 = $var3 |= $c2;
}
!GROK!THIS!
else
$spitshell >>mytest.c <<!GROK!THIS!
  $c1 |= $c2;
}
!GROK!THIS!
fi
: In the following dollars and backticks do not need the extra backslash.
$spitshell >>mytest.c <<'!NO!SUBS!'
!NO!SUBS!
chmod 755 mytest.c
$eunicefix mytest.c

Any solution, hint or even documentation for dist 3 would be most welcome.
What am I doing wrong?  This is driving me nuts!

Thanks in advance.  I'll post a summary of e-mail responses if there's
interest.

-- 
Augustine Cano		INTERNET: afc@shibaya.lonestar.org
			UUCP:     ...!{ernest,egsner}!shibaya!afc

hokey@plus5.com (Hokey) (05/15/91)

Well, since Larry didn't speak up...

In article <1991May13.182956.23088@shibaya.lonestar.org> afc@shibaya.lonestar.org (Augustine Cano) writes:
>
>... This is the output of metaconfig:
>
>$! nulled, predecessor circle
> ...

Ignore these.  They are a nuisance, and are fixed in metaconfig v3.

>This is mytest.U:
>
> ...
>?MAKE:mytest.c var1 var2 var3 c1 c2 : test cat echo n c Myread mansrc Mcc Guess Oldconfig Loc

A Unit file MUST have the first MAKE dependency be the name of the Unit file.
This should even be documented in the version of metaconfig you have.
Rename the file to "var1.U" and change the aforementioned lined to:

?MAKE:var1 var2 var3 c1 c2 : test cat echo n c Myread mansrc Mcc Guess Oldconfig Loc

Then, everything should work just fine.  At least, it works with my v3
metaconfig, and should work just as well with v2 (modulo the nuisance
warning messages).

The "metalint" utility I wrote for v3 will catch this problem.

Oh, I don't know when Larry plans to release v3.

Enjoy!
-- 
Harlan				We are Space Guys.  We know what we are doing.