When compiling varnishtop (and other tools) on RHEL/CentOS 5, I came across the following issue:
varnishtop.o: In function `do_curses':
/tmp/varnish-2.1.4/bin/varnishtop/varnishtop.c:223: undefined reference to `initscr'
/tmp/varnish-2.1.4/bin/varnishtop/varnishtop.c:224: undefined reference to `raw'
/tmp/varnish-2.1.4/bin/varnishtop/varnishtop.c:225: undefined reference to `noecho'
/tmp/varnish-2.1.4/bin/varnishtop/varnishtop.c:226: undefined reference to `nonl'
/tmp/varnish-2.1.4/bin/varnishtop/varnishtop.c:227: undefined reference to `stdscr'
collect2: ld returned 1 exit status
make: *** [varnishtop] Error 1
The issue seems to be with the ncurses library that comes with the standard distribution. So, I installed the ncurses-5.7 libs from source, using:
./configure --with-shared --with-debug --enable-overwrite --with-termlib
and then recompiling/building varnish/varnishtop.