-AC_CHECK_LIB(libpcsclite, SCardEstablishContext)
-if test x$ac_cv_lib_SCardEstablishContext != xyes; then
- AC_MSG_ERROR([Cannot find usable libpcsclite])
-fi
+AC_CHECK_HEADERS([winscard.h reader.h], [],
+ [AC_MSG_ERROR([[pcsclite headers not found]])])
+AC_CHECK_LIB([pcsclite], [SCardEstablishContext], [],
+ [AC_MSG_ERROR([[pcsclite library not useable]])])