#compdef configure config.status

local ret=1
local -a expl suf

[[ -prefix - ]] ||
    ! zstyle -T ":completion:${curcontext}:options" prefix-needed &&
    _arguments -- -i '(--(disable|enable)-FEATURE* --(with|without)-PACKAGE*)' \
              -s '((#s)--disable- --enable-
	           (#s)--enable- --disable-
		   (#s)--with- --without-
		   (#s)--without- --with-)' \
	      '*=(E|)PREFIX*:prefix directory:_files -/' \
              '*=PROGRAM*:program:_command_names -e' \
	      '*=NAME*executable*:program:_command_names -e' \
	      '*=NAME*:file:_files' && ret=0

if [[ ! -prefix - ]]; then
  if [[ "$PREFIX" = *\=* ]]; then
    compstate[parameter]="${PREFIX%%\=*}"
    compset -P 1 '*='
    _value && ret=0
  else
    compset -S '=*' || suf=( -r = -S = )
    _wanted -x variables expl variable compadd $suf \
        CC CFLAGS CPP CPPFLAGS CXX CXXFLAGS DEFS ERLCFLAGS FCFLAGS \
        FFLAGS GOFLAGS LDFLAGS LIBS OBJCFLAGS OBJCXXFLAGS && ret=0
  fi
fi

return ret
