build: Configure pthread and dl FLAGS by AC_CHECK_LIB.