summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-11-09 18:36:00 -0800
committerKaz Kylheku <kaz@kylheku.com>2018-11-09 18:36:00 -0800
commit6734b978113d2b827e74e5e77fad6a7d9bc7f757 (patch)
tree485a927ab46da3da337a073e11fb0a779edbba5f
parent1783f215d2e0e00b3b1c6db2a6a9df2ed3d699e3 (diff)
downloadtxr-6734b978113d2b827e74e5e77fad6a7d9bc7f757.tar.gz
txr-6734b978113d2b827e74e5e77fad6a7d9bc7f757.tar.bz2
txr-6734b978113d2b827e74e5e77fad6a7d9bc7f757.zip
POSIX requires <sys/select.h> for select function.
A patch being applied to TXR in the Void Linux distribution informs me that the Musl library requires this. Traditional Unix put the select materials in <sys/types.h> and <unistd.h>. * configure: Add test for presence of <sys/select.h> and whether that header actually declares select-related declarations and macros. Define HAVE_SYS_SELECT_H in config.h if so. * socket.c: Conditionally include <sys/select.h>.
-rwxr-xr-xconfigure24
-rw-r--r--socket.c3
2 files changed, 27 insertions, 0 deletions
diff --git a/configure b/configure
index cb5aedb4..5b94d229 100755
--- a/configure
+++ b/configure
@@ -2801,6 +2801,30 @@ else
printf "no\n"
fi
+if [ $have_sockets ] ; then
+ printf "Checking whether we have <sys/select.h> ... "
+
+ cat > conftest.c <<!
+#include <sys/select.h>
+
+int main(int argc, char **argv)
+{
+ fd_set rfds;
+ int res;
+ FD_ZERO(&rfds);
+ FD_SET(0, &rfds);
+ res = res = select(1, &rfds, 0, 0, 0);
+ return 0;
+}
+!
+ if conftest; then
+ printf "yes\n"
+ printf "#define HAVE_SYS_SELECT_H 1\n" >> config.h
+ else
+ printf "no\n"
+ fi
+fi
+
printf "Checking for getaddrinfo ... "
cat > conftest.c <<!
diff --git a/socket.c b/socket.c
index 177c0e75..ace6944a 100644
--- a/socket.c
+++ b/socket.c
@@ -40,6 +40,9 @@
#include <netdb.h>
#include "config.h"
#include ALLOCA_H
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
#include "lib.h"
#include "stream.h"
#include "signal.h"