diff -Naur htop-1.0.2/configure htop-1.0.2-haiku/configure
--- htop-1.0.2/configure	2012-10-03 20:13:10.000000000 +0000
+++ htop-1.0.2-haiku/configure	2012-11-29 12:07:07.717750272 +0000
@@ -11388,13 +11388,13 @@
 
 
 # Checks for libraries.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ceil in -lm" >&5
-$as_echo_n "checking for ceil in -lm... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ceil in $LIBM" >&5
+$as_echo_n "checking for ceil in $LIBM... " >&6; }
 if test "${ac_cv_lib_m_ceil+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm  $LIBS"
+LIBS="$LIBM  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -11429,7 +11429,7 @@
 #define HAVE_LIBM 1
 _ACEOF
 
-  LIBS="-lm $LIBS"
+  LIBS="$LIBM $LIBS"
 
 else
   missing_libraries="$missing_libraries libm"
diff -Naur htop-1.0.2/configure.ac htop-1.0.2-haiku/configure.ac
--- htop-1.0.2/configure.ac	2012-08-29 13:24:31.023330816 +0000
+++ htop-1.0.2-haiku/configure.ac	2012-11-29 10:13:11.320602112 +0000
@@ -1,3 +1,5 @@
+
+
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 
@@ -22,7 +24,7 @@
 AC_PROG_LIBTOOL
 
 # Checks for libraries.
-AC_CHECK_LIB([m], [ceil], [], [missing_libraries="$missing_libraries libm"])
+AC_CHECK_LIB(m, cos, LIBM="$LIBM")
 
 # Checks for header files.
 AC_HEADER_DIRENT
