From: Bruno Haible Date: Mon, 17 Nov 2008 11:12:39 +0000 (+0100) Subject: Add support for Haiku and BeOS. X-Git-Tag: v0.1~6666 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=350b445ef71a216fd5c322d9f51c409b3a2226ac;p=gnulib.git Add support for Haiku and BeOS. --- diff --git a/ChangeLog b/ChangeLog index 0beb305c9..8d48be882 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-11-17 Bruno Haible + + * m4/sockets.m4 (gl_SOCKETS): After trying -lsocket, try also + -lnetwork and -lnet. Needed for Haiku and BeOS. + 2008-11-16 Bruno Haible * m4/getaddrinfo.m4 (gl_GETADDRINFO): Fix indentation. diff --git a/m4/sockets.m4 b/m4/sockets.m4 index c7bd6646a..124e777a5 100644 --- a/m4/sockets.m4 +++ b/m4/sockets.m4 @@ -1,4 +1,4 @@ -# sockets.m4 serial 2 +# sockets.m4 serial 3 dnl Copyright (C) 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -32,8 +32,10 @@ AC_DEFUN([gl_SOCKETS], else dnl Unix API. dnl Solaris has most socket functions in libsocket. - AC_CACHE_CHECK([whether setsockopt requires -lsocket], [gl_cv_lib_socket], [ - gl_cv_lib_socket=no + dnl Haiku has most socket functions in libnetwork. + dnl BeOS has most socket functions in libnet. + AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [ + gl_cv_lib_socket= AC_TRY_LINK([extern #ifdef __cplusplus "C" @@ -41,18 +43,39 @@ AC_DEFUN([gl_SOCKETS], char setsockopt();], [setsockopt();], [], [gl_save_LIBS="$LIBS" - LIBS="$LIBS -lsocket" + LIBS="$gl_save_LIBS -lsocket" AC_TRY_LINK([extern #ifdef __cplusplus "C" #endif char setsockopt();], [setsockopt();], - [gl_cv_lib_socket=yes]) + [gl_cv_lib_socket="-lsocket"]) + if test -z "$gl_cv_lib_socket"; then + LIBS="$gl_save_LIBS -lnetwork" + AC_TRY_LINK([extern +#ifdef __cplusplus +"C" +#endif +char setsockopt();], [setsockopt();], + [gl_cv_lib_socket="-lnetwork"]) + if test -z "$gl_cv_lib_socket"; then + LIBS="$gl_save_LIBS -lnet" + AC_TRY_LINK([extern +#ifdef __cplusplus +"C" +#endif +char setsockopt();], [setsockopt();], + [gl_cv_lib_socket="-lnet"]) + fi + fi LIBS="$gl_save_LIBS" ]) + if test -z "$gl_cv_lib_socket"; then + gl_cv_lib_socket="none needed" + fi ]) - if test $gl_cv_lib_socket = yes; then - LIBSOCKET='-lsocket' + if test "$gl_cv_lib_socket" != "none needed"; then + LIBSOCKET="$gl_cv_lib_socket" fi fi AC_SUBST([LIBSOCKET])