dnl Checks for header files.
dnl We do this in multiple stages, because unlike Linux all the other operating systems really suck and don't include their own dependencies.
-AC_CHECK_HEADERS([syslog.h sys/file.h sys/param.h sys/resource.h sys/socket.h sys/time.h sys/un.h sys/wait.h netdb.h arpa/inet.h dirent.h curses.h ifaddrs.h])
+AC_CHECK_HEADERS([syslog.h sys/file.h sys/param.h sys/resource.h sys/socket.h sys/time.h sys/un.h sys/wait.h netdb.h arpa/inet.h dirent.h curses.h ifaddrs.h stdatomic.h])
dnl Checks for typedefs, structures, and compiler characteristics.
MeshLink_ATTRIBUTE(__malloc__)
#include "system.h"
#include <pthread.h>
-#include <stdatomic.h>
#include "adns.h"
#include "devtools.h"
});
if(sig) {
+#ifdef HAVE_STDATOMIC_H
atomic_flag_clear(&sig->set);
+#endif
sig->cb(loop, sig->data);
}
}
}
void signal_trigger(event_loop_t *loop, signal_t *sig) {
+#ifdef HAVE_STDATOMIC_H
+
if(atomic_flag_test_and_set(&sig->set)) {
return;
}
+#endif
+
uint8_t signum = sig->signum;
write(loop->pipefd[1], &signum, 1);
return;
sig->signum = signum;
sig->node.data = sig;
+#ifdef HAVE_STDATOMIC_H
atomic_flag_clear(&sig->set);
+#endif
if(loop->pipefd[0] == -1) {
pipe_init(loop);
typedef struct signal_t {
struct splay_node_t node;
int signum;
+#ifdef HAVE_STDATOMIC_H
volatile atomic_flag set;
+#endif
signal_cb_t cb;
void *data;
} signal_t;
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
-#include <stdatomic.h>
#include <stdbool.h>
#include <stdint.h>
#include <inttypes.h>
#include <limits.h>
#include <assert.h>
+#ifdef HAVE_STDATOMIC_H
+#include <stdatomic.h>
+#endif
+
#ifdef HAVE_MINGW
#include <w32api.h>
#include <winsock2.h>