Switch to gd check from autotools library

cc @charterchap @zerebubuth