Whamcloud - gitweb
ext2fs: compile the io implementation according to os
authorPaulo Antonio Alvarez <pauloaalvarez@gmail.com>
Tue, 22 Dec 2020 18:15:52 +0000 (15:15 -0300)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 31 Mar 2021 20:09:23 +0000 (16:09 -0400)
In mingw and cygwin, compile the windows_io manager, compile the unix_io
everywhere else.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
configure
configure.ac
lib/ext2fs/Makefile.in

index 2b37962..405b730 100755 (executable)
--- a/configure
+++ b/configure
@@ -622,6 +622,7 @@ ac_includes_default="\
 gt_needs=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+OS_IO_FILE
 systemd_system_unit_dir
 have_systemd
 systemd_LIBS
@@ -12671,6 +12672,15 @@ else
 fi
 
 
+OS_IO_FILE=""
+case "$host_os" in
+  cigwin*|mingw*|msys*)
+    OS_IO_FILE=windows_io
+  ;;
+  *)
+    OS_IO_FILE=unix_io
+  ;;
+esac
 
 test -d lib || mkdir lib
 test -d include || mkdir include
index 4c4b552..824a93d 100644 (file)
@@ -1785,7 +1785,18 @@ AS_IF([test "x${with_systemd_unit_dir}" != "xno"],
   ])
 AC_SUBST(have_systemd)
 AC_SUBST(systemd_system_unit_dir)
-
+dnl Adjust the compiled files if we are on windows vs everywhere else
+dnl
+OS_IO_FILE=""
+[case "$host_os" in
+  cigwin*|mingw*|msys*)
+    OS_IO_FILE=windows_io
+  ;;
+  *)
+    OS_IO_FILE=unix_io
+  ;;
+esac]
+AC_SUBST(OS_IO_FILE)
 dnl
 dnl Make our output files, being sure that we create the some miscellaneous 
 dnl directories
index 5d9af86..2dca12e 100644 (file)
@@ -127,7 +127,7 @@ OBJS= $(DEBUGFS_LIB_OBJS) $(RESIZE_LIB_OBJS) $(E2IMAGE_LIB_OBJS) \
        symlink.o \
        $(TDB_OBJ) \
        undo_io.o \
-       unix_io.o \
+       @OS_IO_FILE@.o \
        sparse_io.o \
        unlink.o \
        valid_blk.o \
@@ -217,7 +217,7 @@ SRCS= ext2_err.c \
        $(srcdir)/tst_getsize.c \
        $(srcdir)/tst_iscan.c \
        $(srcdir)/undo_io.c \
-       $(srcdir)/unix_io.c \
+       $(srcdir)/@OS_IO_FILE@.c \
        $(srcdir)/sparse_io.c \
        $(srcdir)/unlink.c \
        $(srcdir)/valid_blk.c \
@@ -630,6 +630,19 @@ $(srcdir)/utf8data.h:
                -t $(top_srcdir)/util/ucd/NormalizationTest-11.0.0.txt \
                -o $@
 
+#
+# This needs to be manually maintained since "make depend" on a
+# Linux system is going to blow up due to the lack of windows.h
+# header file.  If someone on Windows tries to run "make depend",
+# they will need to comment this chunk below.
+#
+windows_io.o: $(srcdir)/windows_io.c $(top_builddir)/lib/config.h \
+ $(top_builddir)/lib/dirpaths.h $(srcdir)/ext2_fs.h \
+ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \
+ $(srcdir)/ext2_fs.h $(srcdir)/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \
+ $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+ $(srcdir)/ext2_ext_attr.h $(srcdir)/bitops.h $(srcdir)/ext2fsP.h
+
 # +++ Dependency line eater +++
 # 
 # Makefile dependencies follow.  This must be the last section in