build: check for glibtoolize or libtoolize command

Fixes #1200 and #1201.