fix up libm detection and use (#3724)
authorSimon Marlow <marlowsd@gmail.com>
Wed, 16 Dec 2009 11:36:52 +0000 (11:36 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Wed, 16 Dec 2009 11:36:52 +0000 (11:36 +0000)
configure.ac
mk/config.mk.in
rts/package.conf.in

index 15b3c85..a751e17 100644 (file)
@@ -728,11 +728,8 @@ dnl    Keep that check as early as possible.
 dnl    as we need to know whether we need libm
 dnl    for math functions or not
 dnl    (see http://hackage.haskell.org/trac/ghc/ticket/3730)
-AC_CHECK_FUNC(atan,[fp_libm_not_needed=yes;LIBM=],[fp_libm_not_needed=dunno])
-if test x"$fp_libm_not_needed" = xdunno; then
-   AC_CHECK_LIB([m], [atan], [LIBS="-lm $LIBS"; LIBM="-lm"],[LIBM=])
-fi
-AC_SUBST([LIBM])
+AC_SEARCH_LIBS(atan, m, 
+  [AC_DEFINE([HAVE_LIBM], [1], [Define to 1 if you need to link with libm])])
 
 dnl ** check whether this machine has BFD and liberty installed (used for debugging)
 dnl    the order of these tests matters: bfd needs liberty
index 4b8417a..f2d0776 100644 (file)
@@ -302,9 +302,6 @@ SupportsSplitObjs=$(strip $(if $(filter YES,$(ArchSupportsSplitObjs)),\
 # By default, enable SplitObjs for the libraries if this build supports it
 SplitObjs=$(SupportsSplitObjs)
 
-# Math library
-LIBM=@LIBM@
-
 # .NET interop support?
 #
 DotnetSupport=NO
index 087a7e9..2dff162 100644 (file)
@@ -27,7 +27,10 @@ library-dirs:                TOP"/rts/dist/build" PAPI_LIB_DIR
 
 hs-libraries:   "HSrts"
 
-extra-libraries:               "m"             /* for ldexp() */
+extra-libraries:
+#ifdef HAVE_LIBM
+                               "m"             /* for ldexp() */
+#endif
 #ifdef HAVE_LIBRT
                              , "rt"
 #endif