diff --git a/configure.ac b/configure.ac
index dad2e72..73a762a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,7 +8,7 @@ AC_CANONICAL_TARGET
 dnl Setup for automake
 AM_INIT_AUTOMAKE([tar-ustar dist-bzip2])
 
-AM_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS(config.h)
 
 # Checks for programs.
 AC_PROG_CC
@@ -17,9 +17,8 @@ AC_PROG_MAKE_SET
 
 AC_HEADER_STDC
 # Checks for libraries.
-AC_CHECK_LIB([m], [sin],, 
-	AC_MSG_ERROR([libm not found!! 
-No maths library?? What kinda crazy system is that??]))
+AC_CHECK_LIB(m, sin)
+AC_SUBST(LIBM)
 
 AC_PATH_X
 AC_PATH_XTRA
