+# Detect if we have the epoll() syscall
+TestBool("CONFIG_UCW_EPOLL", "Checking for epoll", sub {
+ return UCW::Configure::C::TestCompile("epoll", <<'FINIS' ) ? 1 : 0;
+#include <sys/epoll.h>
+int main(void)
+{
+ epoll_create(256);
+ return 0;
+}
+FINIS
+});
+
+# Check if we want to use monotonic clock
+TestBool("CONFIG_UCW_MONOTONIC_CLOCK", "Checking for monotonic clock", sub {
+ return Get("CONFIG_LINUX");
+});
+
+if (IsSet("CONFIG_DARWIN")) {
+ # Darwin does not support BSD regexes, fix up
+ if (!IsSet("CONFIG_UCW_POSIX_REGEX") && !IsSet("CONFIG_UCW_PCRE")) {
+ Set("CONFIG_UCW_POSIX_REGEX" => 1);
+ Warn "BSD regex library on Darwin isn't compatible, using POSIX regex.\n";
+ }
+
+ # Fill in some constants not found in the system header files
+ Set("SOL_TCP" => 6); # missing in /usr/include/netinet/tcp.h
+ if (IsGiven("CONFIG_UCW_DIRECT_IO") && IsSet("CONFIG_UCW_DIRECT_IO")) {
+ Fail("Direct I/O is not available on darwin");
+ } else {
+ UnSet("CONFIG_UCW_DIRECT_IO");
+ }
+}
+
+PostConfig {
+ AtWrite {
+ UCW::Configure::C::ConfigHeader("ucw/autoconf.h", [
+ # Included symbols
+ '^CONFIG_UCW_' => 1,
+ '^CPU_' => 1,
+ '^UCW_VERSION(_|$)' => 1,
+ ]);
+ } if Get("CONFIG_INSTALL_API");
+
+ # Include direct FB?
+ if (!IsSet("CONFIG_UCW_THREADS") || !IsSet("CONFIG_UCW_DIRECT_IO")) {
+ if (IsGiven("CONFIG_UCW_FB_DIRECT") && IsSet("CONFIG_UCW_FB_DIRECT")) {
+ if (!IsSet("CONFIG_UCW_THREADS")) {
+ Fail("CONFIG_UCW_FB_DIRECT needs CONFIG_UCW_THREADS");
+ } else {
+ Fail("CONFIG_UCW_FB_DIRECT needs CONFIG_UCW_DIRECT_IO");
+ }
+ }
+ UnSet("CONFIG_UCW_FB_DIRECT");
+ }
+};
+