Author: wyoung
Date: Mon Mar  6 19:39:45 2006
New Revision: 1231

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1231&view=rev
Log:
libm autoconf test works properly with Bakefile now

Modified:
    branches/v2.1-bakefile/config/libm.m4
    branches/v2.1-bakefile/examples/examples.bkl
    branches/v2.1-bakefile/lib/lib.bkl

Modified: branches/v2.1-bakefile/config/libm.m4
URL: 
http://svn.gna.org/viewcvs/mysqlpp/branches/v2.1-bakefile/config/libm.m4?rev=1231&r1=1230&r2=1231&view=diff
==============================================================================
--- branches/v2.1-bakefile/config/libm.m4 (original)
+++ branches/v2.1-bakefile/config/libm.m4 Mon Mar  6 19:39:45 2006
@@ -1,17 +1,37 @@
 dnl @synopsis LIB_MATH
 dnl 
-dnl This macro figures out how to link a program using common math
-dnl functions.
-dnl
-dnl On some platforms (e.g. Solaris), you must specifically add -lm to
-dnl the link line to use standard math functions like floor(3).
+dnl This macro figures out how whether programs using C's math routines
+dnl need to link to libm or not.  This is common on SysV Unices.
 dnl
 dnl @category C
 dnl @author Warren Young <[EMAIL PROTECTED]>
-dnl @version 1.1, 2005-09-06
+dnl @version 1.2, 2006-03-06
 
 AC_DEFUN([LIB_MATH],
 [
-       AC_SEARCH_LIBS([floor], [m])
+       AC_MSG_CHECKING([whether -lm is needed to use C math functions])
+       
+       MYSQLPP_EXTRA_LIBS=
+       TRY_LIBM=no
+       AC_TRY_LINK(
+               [ #include <math.h> ],
+               [ floor(0); ], AC_MSG_RESULT(no), TRY_LIBM=yes)
+
+       if test "x$TRY_LIBM" = "xyes"
+       then
+               save_LIBS=$LIBS
+               LIBS="$LIBS -lm"
+               AC_TRY_LINK(
+                       [ #include <math.h> ],
+                       [ floor(0); ],
+                       [ 
+                               MYSQLPP_EXTRA_LIBS=-lm 
+                               AC_MSG_RESULT(yes)
+                       ],
+                       AC_MSG_ERROR([Failed to build program containing math 
functions!]))
+               LIBS="$save_LIBS"
+       fi
+
+       AC_SUBST(MYSQLPP_EXTRA_LIBS)
 ])
 

Modified: branches/v2.1-bakefile/examples/examples.bkl
URL: 
http://svn.gna.org/viewcvs/mysqlpp/branches/v2.1-bakefile/examples/examples.bkl?rev=1231&r1=1230&r2=1231&view=diff
==============================================================================
--- branches/v2.1-bakefile/examples/examples.bkl (original)
+++ branches/v2.1-bakefile/examples/examples.bkl Mon Mar  6 19:39:45 2006
@@ -27,7 +27,7 @@
 
                <if cond="FORMAT=='autoconf'">
                        <cxxflags>@PTHREAD_CFLAGS@</cxxflags>
-                       <ldflags>@PTHREAD_LIBS@</ldflags>
+                       <ldflags>@PTHREAD_LIBS@ @MYSQLPP_EXTRA_LIBS@</ldflags>
                        <sys-lib>@MYSQL_C_LIB@</sys-lib>
 
                        <warnings>max</warnings>

Modified: branches/v2.1-bakefile/lib/lib.bkl
URL: 
http://svn.gna.org/viewcvs/mysqlpp/branches/v2.1-bakefile/lib/lib.bkl?rev=1231&r1=1230&r2=1231&view=diff
==============================================================================
--- branches/v2.1-bakefile/lib/lib.bkl (original)
+++ branches/v2.1-bakefile/lib/lib.bkl Mon Mar  6 19:39:45 2006
@@ -39,7 +39,7 @@
                
                <if cond="FORMAT=='autoconf'">
                        <cxxflags>@PTHREAD_CFLAGS@</cxxflags>
-                       <ldflags>@PTHREAD_LIBS@</ldflags>
+                       <ldflags>@PTHREAD_LIBS@ @MYSQLPP_EXTRA_LIBS@</ldflags>
                        <sys-lib>@MYSQL_C_LIB@</sys-lib>
 
                        <modify-target target="uninstall">


_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits

Reply via email to