Skip to content

Commit 2ab07fd

Browse files
author
myeisha
committed
add compile flag to disable managed IO on !windows
1 parent 1cece88 commit 2ab07fd

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ libtool
3232
configure
3333
*.pc
3434
missing
35+
.*.swp

Makefile.am

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11

2+
export IO_COMPILE_FLAGS:=@IO_COMPILE_FLAGS@
3+
24
ACLOCAL_AMFLAGS = -I m4
35

46
SUBDIRS = man src scripts docs data

configure.ac

+8
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ AS_IF([test "x$with_gnutls" = xyes],
5050
fi],
5151
[])])
5252

53+
AC_ARG_ENABLE([native-io],
54+
[AS_HELP_STRING([--disable-native-io],
55+
[disable support for native IO backends in Manos.IO])],
56+
[IO_COMPILE_FLAGS=FORCE_MANAGED_IO],
57+
[IO_COMPILE_FLAGS=])
58+
59+
AC_SUBST(IO_COMPILE_FLAGS)
60+
5361

5462

5563
dnl ******************************************************************

src/Manos.IO/Manos.IO.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
<WarningLevel>4</WarningLevel>
3030
<ConsolePause>false</ConsolePause>
3131
</PropertyGroup>
32+
<PropertyGroup Condition=" '$(IO_COMPILE_FLAGS)' == 'FORCE_MANAGED_IO' ">
33+
<DefineConstants>ALWAYS_USE_MANAGED_IO</DefineConstants>
34+
</PropertyGroup>
3235
<ItemGroup>
3336
<Reference Include="System" />
3437
<Reference Include="System.Core" />

src/Manos.IO/Manos.IO/Context.cs

+7-3
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,23 @@ protected Context ()
1515
Dispose (false);
1616
}
1717

18-
private static readonly bool isWindows;
18+
private static readonly bool useManagedImpl;
1919

2020
static Context ()
2121
{
22-
isWindows = Environment.OSVersion.Platform == PlatformID.Win32NT
22+
#if ALWAYS_USE_MANAGED_IO
23+
useManagedImpl = true;
24+
#else
25+
useManagedImpl = Environment.OSVersion.Platform == PlatformID.Win32NT
2326
|| Environment.OSVersion.Platform == PlatformID.Win32S
2427
|| Environment.OSVersion.Platform == PlatformID.Win32Windows
2528
|| Environment.OSVersion.Platform == PlatformID.WinCE;
29+
#endif
2630
}
2731

2832
public static Context Create ()
2933
{
30-
if (isWindows) {
34+
if (useManagedImpl) {
3135
return new Manos.IO.Managed.Context ();
3236
} else {
3337
return new Manos.IO.Libev.Context ();

0 commit comments

Comments
 (0)