Making HAL dependency optional

This simple patch just make the libhal dependency optional.