Browse Source

Search for socket() and define _POSIX_PTHREAD_SEMANTICS for Solaris

git-svn-id: https://klish.googlecode.com/svn/trunk@581 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 12 years ago
parent
commit
297101ca20
4 changed files with 68 additions and 31 deletions
  1. 0 3
      config.h.in
  2. 60 19
      configure
  3. 5 7
      configure.ac
  4. 3 2
      lub/db/db.c

+ 0 - 3
config.h.in

@@ -51,9 +51,6 @@
 /* Define to 1 if you have the <regex.h> header file. */
 #undef HAVE_REGEX_H
 
-/* Define to 1 if you have the `socket' function. */
-#undef HAVE_SOCKET
-
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 

+ 60 - 19
configure

@@ -16779,6 +16779,66 @@ else
 $as_echo "$as_me: WARNING: Skipping BFD library checks because of GPL Licence" >&2;}
 fi
 
+################################
+# Search for network functions (like connect())
+################################
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5
+$as_echo_n "checking for library containing socket... " >&6; }
+if ${ac_cv_search_socket+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char socket ();
+int
+main ()
+{
+return socket ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' socket; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_socket=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_socket+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_socket+:} false; then :
+
+else
+  ac_cv_search_socket=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5
+$as_echo "$ac_cv_search_socket" >&6; }
+ac_res=$ac_cv_search_socket
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+
 ################################
 # Check for regex.h
 ################################
@@ -16925,25 +16985,6 @@ fi
 done
 
 
-################################
-# Check for socket
-################################
-for ac_func in socket
-do :
-  ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket"
-if test "x$ac_cv_func_socket" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_SOCKET 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: socket() not found: the socket is not supported" >&5
-$as_echo "$as_me: WARNING: socket() not found: the socket is not supported" >&2;}
-fi
-done
-
-
-
 ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF

+ 5 - 7
configure.ac

@@ -238,6 +238,11 @@ else
     AC_MSG_WARN([Skipping BFD library checks because of GPL Licence])
 fi
 
+################################
+# Search for network functions (like connect())
+################################
+AC_SEARCH_LIBS([socket], [socket])
+
 ################################
 # Check for regex.h
 ################################
@@ -275,12 +280,5 @@ AC_CHECK_HEADERS(grp.h, [],
 AC_CHECK_FUNCS(chroot, [],
     AC_MSG_WARN([chroot() not found: the choot is not supported]))
 
-################################
-# Check for socket
-################################
-AC_CHECK_FUNCS(socket, [],
-    AC_MSG_WARN([socket() not found: the socket is not supported]))
-
-
 AC_CONFIG_FILES(Makefile)
 AC_OUTPUT

+ 3 - 2
lub/db/db.c

@@ -1,3 +1,6 @@
+/* It must be here to include config.h before another headers */
+#include "lub/db.h"
+
 #include <stdlib.h>
 #include <errno.h>
 #include <sys/types.h>
@@ -5,8 +8,6 @@
 #include <grp.h>
 #include <unistd.h>
 
-#include "lub/db.h"
-
 struct passwd *lub_db_getpwnam(const char *name)
 {
 	size_t size;