gnulib-tool: Synthesize appropriate _LDFLAGS for a libtool library.
[pspp] / m4 / poll.m4
index 3a7c186dc6f8f27a410e3bd2efec8ea8e82878ed..38595971d01ece9e145790aea35bea6975355948 100644 (file)
@@ -1,4 +1,4 @@
-# poll.m4 serial 9
+# poll.m4 serial 11
 dnl Copyright (c) 2003, 2005, 2006, 2007, 2009, 2010 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -7,8 +7,9 @@ dnl with or without modifications, as long as this notice is preserved.
 
 AC_DEFUN([gl_FUNC_POLL],
 [
-  AC_CHECK_HEADERS([poll.h])
+  AC_REQUIRE([gl_POLL_H])
   if test "$ac_cv_header_poll_h" = no; then
+    ac_cv_func_poll=no
     gl_cv_func_poll=no
   else
     AC_CHECK_FUNC([poll],
@@ -51,18 +52,22 @@ This is MacOSX or AIX
 #endif
 ], [gl_cv_func_poll=no], [gl_cv_func_poll=yes])])])
   fi
-  if test $gl_cv_func_poll = yes; then
-    AC_DEFINE([HAVE_POLL], [1],
-      [Define to 1 if you have the 'poll' function and it works.])
-    POLL_H=
-  else
+  if test $gl_cv_func_poll != yes; then
+    AC_CHECK_FUNC([poll], [ac_cv_func_poll=yes], [ac_cv_func_poll=no])
+    if test $ac_cv_func_poll = no; then
+      HAVE_POLL=0
+    else
+      REPLACE_POLL=1
+    fi
+  fi
+  if test $HAVE_POLL = 0 || test $REPLACE_POLL = 1; then
+    gl_REPLACE_POLL_H
     AC_LIBOBJ([poll])
-    AC_DEFINE([poll], [rpl_poll],
-      [Define to poll if the replacement function should be used.])
     gl_PREREQ_POLL
-    POLL_H=poll.h
+  else
+    AC_DEFINE([HAVE_POLL], [1],
+      [Define to 1 if you have the 'poll' function and it works.])
   fi
-  AC_SUBST([POLL_H])
 ])
 
 # Prerequisites of lib/poll.c.