fixed handling of HAVE_GUI
Added AC_PROG_RANLIB, since automake 1.11 is complaining:

lib/Makefile.am:30: library used but `RANLIB' is undefined
lib/Makefile.am:30:   The usual way to define `RANLIB' is to add `AC_PROG_RANLIB'
lib/Makefile.am:30:   to `configure.ac' and run `autoconf' again.