Miscellaneous CMake fixes

- detect proper intptr type;
- handle properly readline library
- use readline in tsql
- include gcrypt on unix if gnutls is detected

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>