Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

new nawk autotools problem



Hi,

Attached is a awk script and input file that fail to work with new nawk.
This problem occurred when trying to bootstrap pkgsrc on recent
-current.

It fails for me with:
awk: can't read value of field; it's an array name.
 input record number 1, file 
 source line number 70

        Jonathan Kollasch
BEGIN {
S["LTLIBOBJS"]=""
S["diff_u"]="-u"
S["GCC"]="yes"
S["INSTALL"]="/usr/bin/install -c"
S["default_sys_path"]="/tmp/pbulk-bootstrap/share/mk"
S["mksrc"]="mk"
S["machine_arch"]="x86_64"
S["force_machine"]=""
S["machine"]="amd64"
S["LIBOBJS"]=""
S["ac_exe_suffix"]=""
S["INSTALL_DATA"]="${INSTALL} -m 644"
S["INSTALL_SCRIPT"]="${INSTALL}"
S["INSTALL_PROGRAM"]="${INSTALL}"
S["EGREP"]="/usr/bin/grep -E"
S["GREP"]="/usr/bin/grep"
S["CPP"]="gcc -E"
S["OBJEXT"]="o"
S["EXEEXT"]=""
S["ac_ct_CC"]="gcc"
S["CPPFLAGS"]=" -DUSE_EMALLOC"
S["LDFLAGS"]=""
S["CFLAGS"]="-g -O2"
S["CC"]="gcc"
S["target_alias"]=""
S["host_alias"]=""
S["build_alias"]=""
S["LIBS"]=" -lutil"
S["ECHO_T"]=""
S["ECHO_N"]="-n"
S["ECHO_C"]=""
S["DEFS"]="-DHAVE_CONFIG_H"
S["mandir"]="${datarootdir}/man"
S["localedir"]="${datarootdir}/locale"
S["libdir"]="${exec_prefix}/lib"
S["psdir"]="${docdir}"
S["pdfdir"]="${docdir}"
S["dvidir"]="${docdir}"
S["htmldir"]="${docdir}"
S["infodir"]="${datarootdir}/info"
S["docdir"]="${datarootdir}/doc/${PACKAGE_TARNAME}"
S["oldincludedir"]="/usr/include"
S["includedir"]="${prefix}/include"
S["localstatedir"]="${prefix}/var"
S["sharedstatedir"]="${prefix}/com"
S["sysconfdir"]="${prefix}/etc"
S["datadir"]="${datarootdir}"
S["datarootdir"]="${prefix}/share"
S["libexecdir"]="${exec_prefix}/libexec"
S["sbindir"]="${exec_prefix}/sbin"
S["bindir"]="${exec_prefix}/bin"
S["program_transform_name"]="s,x,x,"
S["prefix"]="/tmp/pbulk-bootstrap"
S["exec_prefix"]="${prefix}"
S["PACKAGE_URL"]=""
S["PACKAGE_BUGREPORT"]="sjg%NetBSD.org@localhost"
S["PACKAGE_STRING"]="bmake 20100414"
S["PACKAGE_VERSION"]="20100414"
S["PACKAGE_TARNAME"]="bmake"
S["PACKAGE_NAME"]="bmake"
S["PATH_SEPARATOR"]=":"
S["SHELL"]="/bin/ksh"
  for (key in S) S_is_set[key] = 1
  FS = ""

}
{
  line = $ 0
  nfields = split(line, field, "@")
  substed = 0
  len = length(field[1])
  for (i = 2; i < nfields; i++) {
    key = field[i]
    keylen = length(key)
    if (S_is_set[key]) {
      value = S[key]
      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
      len += length(value) + length(field[++i])
      substed = 1
    } else
      len += 1 + keylen
  }

  print line
}

#       $NetBSD: Makefile.in,v 1.17 2010/05/13 18:43:07 joerg Exp $
#       @(#)Makefile    5.2 (Berkeley) 12/28/90

#       $Id: Makefile.in,v 1.17 2010/05/13 18:43:07 joerg Exp $

PROG=   bmake
SRCS=   arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \
        make.c parse.c str.c suff.c targ.c trace.c var.c util.c 
SRCS+=  strlist.c
SRCS+=  make_malloc.c
SRCS+=  lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c \
        lstDatum.c lstDeQueue.c lstDestroy.c lstDupl.c lstEnQueue.c \
        lstFind.c lstFindFrom.c lstFirst.c lstForEach.c lstForEachFrom.c \
        lstInit.c lstInsert.c lstIsAtEnd.c lstIsEmpty.c lstLast.c \
        lstMember.c lstNext.c lstOpen.c lstRemove.c lstReplace.c lstSucc.c
SRCS += lstPrev.c

# you can use this Makefile if you have an earlier version of bmake.
prefix= @prefix@
srcdir= /tmp/pbulk-bootstrap/bmake
CC?= @CC@

# Base version on src date
MAKE_VERSION= 20100510
MACHINE=@machine@
MACHINE_ARCH=@machine_arch@
DEFAULT_SYS_PATH = @default_sys_path@

NOMAN=  yes

CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\"
CFLAGS+= -I. -I${srcdir} @DEFS@ @CPPFLAGS@ ${XDEFS} -DMAKE_NATIVE
CFLAGS+= ${CFLAGS_${.TARGET:T}} 
CFLAGS_main.o= "-DMAKE_VERSION=\"${MAKE_VERSION}\""
LDFLAGS= @LDFLAGS@
LIBOBJS= @LIBOBJS@
LDADD= @LIBS@

.if !empty(LIBOBJS)
SRCS+= ${LIBOBJS:T:.o=.c}
.endif

.PATH:  ${srcdir}
.PATH:  ${srcdir}/lst.lib

OS!= uname -s
ARCH!= uname -p 2>/dev/null || uname -m

# list of OS's which are derrived from BSD4.4
isBSD44= NetBSD FreeBSD OpenBSD DragonFly

.if ${OS} == "NetBSD"
# Don't set these for anyone else since we don't know what the effect may be.
# On FreeBSD WARNS=2 sets a bunch of -W flags that make does not handle.
WFORMAT= 1
WARNS=4
.endif

.if empty(isBSD44:M${OS})
# XXX not sure if we still want this given that configure
# lets us force or not the definition of MACHINE.
CFLAGS_main.o+= "-DFORCE_MACHINE=\"${MACHINE}\""
MANTARGET=cat
INSTALL?=${srcdir}/install-sh
.if (${MACHINE} == "sun386")
# even I don't have one of these anymore :-)
CFLAGS+= -DPORTAR
.elif (${MACHINE} != "sunos")
SRCS+= sigcompat.c
CFLAGS+= -DSIGNAL_FLAGS=SA_RESTART
.endif
.endif
.if make(obj) || make(clean)
SUBDIR+= unit-tests
.endif

# many systems use gcc these days
CC_IS_GCC=@GCC@
.if ${CC_IS_GCC} == "yes"
# problem with gcc3
CFLAGS_var.o+= -Wno-cast-qual
.endif

CFLAGS_main.o+= "-D@force_machine@MACHINE=\"${MACHINE}\"" 
"-DMACHINE_ARCH=\"${MACHINE_ARCH}\""

EXTRACT_MAN=no

.if exists(${srcdir}/../Makefile.inc)
.include "${srcdir}/../Makefile.inc"
.endif
.-include <bsd.prog.mk>
# sigh, FreeBSD at least includes bsd.subdir.mk via bsd.obj.mk
# so the inclusion below, results in complaints about re-defined
# targets.  For NetBSD though we need to explicitly include it.
.if defined(SUBDIR) && !target(${SUBDIR:[1]})
.-include <bsd.subdir.mk>
.endif

# Force these
BINDIR= ${prefix}/bin
MANDIR= ${prefix}/man

arch.o: config.h
# make sure that MAKE_VERSION gets updated.
main.o: ${SRCS} ${MAKEFILE}

MK?=${prefix}/share/mk
MKSRC?=@mksrc@
INSTALL?=${srcdir}/install-sh

beforeinstall:
        test -d ${DESTDIR}${BINDIR} || ${INSTALL} -m 775 -d ${DESTDIR}${BINDIR}
        test -d ${DESTDIR}${MANDEST} || ${INSTALL} -m 775 -d 
${DESTDIR}${MANDEST}

# latest version of *.mk includes an installer.
# you should not need to  set USE_OS
install-mk:
.if exists(${MKSRC}/install-mk)
        test -d ${DESTDIR}${MK} || ${INSTALL} -m 775 -d ${DESTDIR}${MK}
        ${MKSRC}/install-mk -v -m 644 ${DESTDIR}${MK} ${USE_OS}
.else
        @echo need to unpack mk.tar.gz under ${srcdir} or set MKSRC; false
.endif

.ifdef TOOLDIR
# this is a native netbsd build, 
# use libutil rather than the local emalloc etc.
CPPFLAGS+= -DUSE_EMALLOC
LDADD+=-lutil
DPADD+=${LIBUTIL}
.endif

# A simple unit-test driver to help catch regressions
accept test:
        cd ${.CURDIR}/unit-tests && ${.MAKE} -r -m / 
TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}


Home | Main Index | Thread Index | Old Index