=== modified file 'configure.in'
--- configure.in	2007-06-20 22:11:55 +0000
+++ configure.in	2007-06-20 22:54:18 +0000
@@ -1801,7 +1801,8 @@
 again]);
 fi
 fi
-AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
+AC_CHECK_TYPES([off_t], [], [], [#include <sys/types.h>])
+AC_CHECK_TYPES([sigset_t], [], [], [#include <signal.h>])
 AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
 AC_CHECK_TYPES([u_int32_t])
 
@@ -1898,7 +1899,7 @@
   chsize cuserid fchmod fcntl \
   fconvert fdatasync finite fpresetsticky fpsetmask fsync ftruncate \
   getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \
-  getpwuid getrlimit getrusage getwd gmtime_r index initgroups isnan \
+  getpwuid getrlimit getrusage getwd gmtime_r index initgroups \
   localtime_r locking longjmp lrand48 madvise mallinfo memcpy memmove \
   mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 getpagesize \
   pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
@@ -1927,11 +1928,19 @@
 esac
 
 # isinf() could be a function or a macro (HPUX)
+# although according to ISO C, it must be a macro
 AC_MSG_CHECKING(for isinf with <math.h>)
 AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_ISINF, [1], [isinf() macro or function]),
  AC_MSG_RESULT(no))
+
+# do the same check for isnan
+AC_MSG_CHECKING(for isnan with <math.h>)
+AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isnan(f); return r],
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_ISNAN, [1], [isnan() macro or function]),
+ AC_MSG_RESULT(no))
  
 CFLAGS="$ORG_CFLAGS"
 

=== modified file 'mysys/my_gethwaddr.c'
--- mysys/my_gethwaddr.c	2007-06-20 22:11:55 +0000
+++ mysys/my_gethwaddr.c	2007-06-20 22:56:09 +0000
@@ -30,6 +30,14 @@
   return res;
 }
 
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
 #ifdef __FreeBSD__
 
 #include <net/ethernet.h>
@@ -73,7 +81,6 @@
 #elif __linux__
 
 #include <net/if.h>
-#include <sys/ioctl.h>
 #include <net/ethernet.h>
 
 my_bool my_gethwaddr(uchar *to)

=== modified file 'mysys/my_lib.c'
--- mysys/my_lib.c	2007-06-20 22:11:55 +0000
+++ mysys/my_lib.c	2007-06-20 22:50:51 +0000
@@ -105,7 +105,7 @@
   struct dirent *dp;
   char		tmp_path[FN_REFLEN+1],*tmp_file;
 #ifdef THREAD
-  char	dirent_tmp[sizeof(struct dirent)+_POSIX_PATH_MAX+1];
+  char	dirent_tmp[sizeof(struct dirent)+PATH_MAX+1];
 #endif
   DBUG_ENTER("my_dir");
   DBUG_PRINT("my",("path: '%s' MyFlags: %d",path,MyFlags));

=== modified file 'sql/net_serv.cc'
--- sql/net_serv.cc	2007-06-20 22:11:55 +0000
+++ sql/net_serv.cc	2007-06-20 22:50:51 +0000
@@ -47,6 +47,11 @@
 #include <violite.h>
 #include <signal.h>
 #include <errno.h>
+
+#ifdef HAVE_POLL
+#include <poll.h>
+#endif
+
 #ifdef __NETWARE__
 #include <sys/select.h>
 #endif

=== modified file 'storage/innobase/os/os0file.c'
--- storage/innobase/os/os0file.c	2007-06-20 22:11:55 +0000
+++ storage/innobase/os/os0file.c	2007-06-20 22:50:51 +0000
@@ -722,8 +722,8 @@
 	struct stat	statinfo;
 #ifdef HAVE_READDIR_R
 	char		dirent_buf[sizeof(struct dirent)
-				   + _POSIX_PATH_MAX + 100];
-	/* In /mysys/my_lib.c, _POSIX_PATH_MAX + 1 is used as
+				   + PATH_MAX + 100];
+	/* In /mysys/my_lib.c, PATH_MAX + 1 is used as
 	the max file name len; but in most standards, the
 	length is NAME_MAX; we add 100 to be even safer */
 #endif
@@ -747,7 +747,7 @@
 		return(1);
 	}
 
-	ut_a(strlen(ent->d_name) < _POSIX_PATH_MAX + 100 - 1);
+	ut_a(strlen(ent->d_name) < PATH_MAX + 100 - 1);
 #else
 	ent = readdir(dir);
 

=== modified file 'storage/ndb/src/common/portlib/NdbTCP.cpp'
--- storage/ndb/src/common/portlib/NdbTCP.cpp	2007-06-20 22:11:55 +0000
+++ storage/ndb/src/common/portlib/NdbTCP.cpp	2007-06-20 22:50:51 +0000
@@ -18,6 +18,10 @@
 #include <my_net.h>
 #include <NdbTCP.h>
 
+#ifdef HAVE_POLL
+#include <poll.h>
+#endif
+
 extern "C"
 int 
 Ndb_getInAddr(struct in_addr * dst, const char *address) {

=== modified file 'storage/ndb/src/cw/cpcd/Process.cpp'
--- storage/ndb/src/cw/cpcd/Process.cpp	2007-06-20 22:11:55 +0000
+++ storage/ndb/src/cw/cpcd/Process.cpp	2007-06-20 22:50:51 +0000
@@ -22,10 +22,29 @@
 #include "CPCD.hpp"
 
 #include <pwd.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 #ifdef HAVE_GETRLIMIT
 #include <sys/resource.h>
 #endif
 
+/* getdtablesize() isn't always guaranteed to be there */
+
+int
+local_getdtablesize() {
+#ifdef HAVE_GETRLIMIT
+  struct rlimit rlim;
+
+  if (getrlimit(RLIMIT_NOFILE, &rlim) == 0)
+    return (int)rlim.rlim_cur;
+  else
+#endif
+    return (int)sysconf(_SC_OPEN_MAX);
+}
+
 void
 CPCD::Process::print(FILE * f){
   fprintf(f, "define process\n");
@@ -316,7 +335,7 @@
   }
 
   /* Close all filedescriptors */
-  for(i = STDERR_FILENO+1; (int)i < getdtablesize(); i++)
+  for(i = STDERR_FILENO+1; (int)i < local_getdtablesize(); i++)
     close(i);
 
   execv(m_path.c_str(), argv);

