AC_DEFUN([AC_DEBIAN_CHECK],[
        PTHREAD_LIB=""
       AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
                           [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
                                       [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
                                                   [AC_CHECK_FUNC(pthread_create)]
                                                   )]
                                      )]
                )      

        DL_LIB=""
        AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl")

        DEB_LIB="$PTHREAD_LIB $DL_LIB"
        AC_SUBST(DL_LIB)
        AC_SUBST(PTHREAD_LIB)
        AC_SUBST(DEB_LIB)
        AC_PROVIDE([AC_DEBIAN_CHECK])
])
