Author: wyoung
Date: Mon Mar  6 20:10:05 2006
New Revision: 1232

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1232&view=rev
Log:
Changed -lsocket and -lnsl tests so they work with Bakefile the same way
that the -lm test now does.

Modified:
    branches/v2.1-bakefile/config/socket_nsl.m4

Modified: branches/v2.1-bakefile/config/socket_nsl.m4
URL: 
http://svn.gna.org/viewcvs/mysqlpp/branches/v2.1-bakefile/config/socket_nsl.m4?rev=1232&r1=1231&r2=1232&view=diff
==============================================================================
--- branches/v2.1-bakefile/config/socket_nsl.m4 (original)
+++ branches/v2.1-bakefile/config/socket_nsl.m4 Mon Mar  6 20:10:05 2006
@@ -10,16 +10,63 @@
 dnl in libsocket but needs libnsl for socket().
 dnl
 dnl @category Misc
-dnl @author Russ Allbery <[EMAIL PROTECTED]>
-dnl @author Stepan Kasal <[EMAIL PROTECTED]>
-dnl @author Warren Young <[EMAIL PROTECTED]>
-dnl @version 1.4, 2005-09-06
+dnl @author Warren Young <[EMAIL PROTECTED]>
+dnl @version 1.5, 2006-03-06
 
 AC_DEFUN([LIB_SOCKET_NSL],
 [
-       AC_SEARCH_LIBS([gethostbyname], [nsl])
-       AC_SEARCH_LIBS([socket], [socket], [], [
-               AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
-               [], [-lnsl])])
+       save_LIBS="$LIBS"
+
+       AC_MSG_CHECKING([whether -lsocket is needed])
+       TRY_LSOCKET=no
+       AC_TRY_LINK(
+               [ 
+                       #include <sys/types.h>
+                       #include <sys/socket.h> 
+                       #include <netinet/in.h>
+                       #include <arpa/inet.h>
+               ],
+               [ socket(AF_INET, SOCK_STREAM, 0); ],
+               AC_MSG_RESULT(no), TRY_LSOCKET=yes)
+
+       if test "x$TRY_LSOCKET" = "xyes"
+       then
+               LIBS="-lsocket $LIBS"
+               AC_TRY_LINK(
+                       [ 
+                               #include <sys/types.h>
+                               #include <sys/socket.h> 
+                               #include <netinet/in.h>
+                               #include <arpa/inet.h>
+                       ],
+                       [ socket(AF_INET, SOCK_STREAM, 0); ],
+                       [ 
+                               MYSQLPP_EXTRA_LIBS="-lsocket 
$MYSQLPP_EXTRA_LIBS"
+                               AC_MSG_RESULT(yes)
+                       ],
+                       AC_MSG_ERROR([failed to link using -lsocket!]))
+       fi
+
+       AC_MSG_CHECKING([whether -lnsl is needed])
+       TRY_LNSL=no
+       AC_TRY_LINK(
+               [ #include <sys/netdb.h> ],
+               [ gethostbyname("gna.org"); ],
+               AC_MSG_RESULT(no), TRY_LNSL=yes)
+
+       if test "x$TRY_LNSL" = "xyes"
+       then
+               LIBS="-lnsl $LIBS"
+               AC_TRY_LINK(
+                       [ #include <netdb.h> ],
+                       [ gethostbyname("gna.org"); ],
+                       [ 
+                               MYSQLPP_EXTRA_LIBS="-lnsl $MYSQLPP_EXTRA_LIBS"
+                               AC_MSG_RESULT(yes)
+                       ],
+                       AC_MSG_ERROR([failed to link using -lnsl!]))
+       fi
+
+       AC_SUBST(MYSQLPP_EXTRA_LIBS)
 ])
 


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

Reply via email to