use acx_pthread instead of hardcoding libs and cflags into build system
Pull request ID:
Hardcoding -lphtread is not the most portable way of including threads support. Please use upstream macros instead.
First patch includes m4 macro, second makes use of it