From d1d44c146a5e37e642c49ad86b614fcacbcd9f67 Mon Sep 17 00:00:00 2001 From: Paulo Antonio Alvarez Date: Tue, 22 Dec 2020 15:15:52 -0300 Subject: [PATCH] ext2fs: compile the io implementation according to os In mingw and cygwin, compile the windows_io manager, compile the unix_io everywhere else. Signed-off-by: Theodore Ts'o --- configure | 10 ++++++++++ configure.ac | 13 ++++++++++++- lib/ext2fs/Makefile.in | 17 +++++++++++++++-- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 2b37962..405b730 100755 --- 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 diff --git a/configure.ac b/configure.ac index 4c4b552..824a93d 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/lib/ext2fs/Makefile.in b/lib/ext2fs/Makefile.in index 5d9af86..2dca12e 100644 --- a/lib/ext2fs/Makefile.in +++ b/lib/ext2fs/Makefile.in @@ -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 -- 1.8.3.1