Thanks for your quick reply.
I haven't tried the Cygwin64's Emacs because my experience with the Cygwin32's Emacs was not as pleasant as the native windows compiled Emacs, and there were reports of the Emacs from Cygwin64 crashing quite often. But I shall try it when I have time.
I think your guess of the cause of error (PATH) can be spot on. According to your instruction, I received the following errors:
checking whether make sets $(MAKE)... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for makeinfo... makeinfo
checking for texi2dvi... false
checking for ptex... ptex
checking for pbibtex... pbibtex
checking for dvipdfmx... dvipdfmx
checking for texi2pdf... false
checking for egrep... egrep
checking for emacs... /cygdrive/c/Program Files (x86)/GNU Emacs 24.5/bin/emacs
checking what a flavor does /cygdrive/c/Program Files (x86)/GNU Emacs 24.5/bin/emacs have... Emacs 24.5
checking prefix for /cygdrive/c/Program Files (x86)/GNU Emacs 24.5/bin/emacs... c:/Program Files (x86)/GNU Emacs 24.5
checking where lisp files should go... $(prefix)/share/emacs/site-lisp/w3m/
checking where icon files should go... $(prefix)/share/emacs/24.5/etc/images/w3m
./configure: eval: line 2748: syntax error near unexpected token `('
./configure: eval: line 2748: `/cygdrive/c/Program Files (x86)/GNU Emacs 24.5/bin/emacs -q -no-site-file -batch -l w3mhack.el NONE -f w3mhack-print-status 2>/dev/null | $EGREP -v '^$''
configure: error: Process couldn't proceed. See the above messages.