> This much is enough to get Parted to compile on Hurd. However should
> the DASD headers (fdasd.h and vtoc.h) in include/parted be also
> conditionalized? I did not do it, since libparted/arch/linux.c is them
> #included.

libparted/arch/linux.c do not need fdasd.h or vtoc.h, since none of
the components in the headers are being used in linux.c. Just removing
the #includes (on a system without having __s390__ defined) do not
give any build errors, while there is no #ifdef...#endif block to show
that any DASD specific struct or function is being used.

I would say yes for consistency.

Done. 'git diff' attached. Comments?

Happy hacking,
Debarshi
--
GPG key ID: 63D4A5A7
Key server: pgp.mit.edu
diff --git a/configure.ac b/configure.ac
index d00fb15..2db260b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -433,6 +433,12 @@ AC_CHECK_HEADER([execinfo.h], [
 	])
 ])
 
+dnl Checks for #defines.
+have_s390=no
+AC_CHECK_FUNC([__s390__], have_s390=yes, )
+AC_CHECK_FUNC([__s390x__], have_s390=yes, )
+AM_CONDITIONAL([HAVE_S390], [test "$have_s390" = yes])
+
 dnl check for "check", unit testing library/header
 PKG_CHECK_MODULES([CHECK], [check >= 0.9.3], have_check=yes, have_check=no)
 if test "$have_check" != "yes"; then
diff --git a/include/parted/Makefile.am b/include/parted/Makefile.am
index 13df6c0..79e08cb 100644
--- a/include/parted/Makefile.am
+++ b/include/parted/Makefile.am
@@ -1,4 +1,13 @@
+if HAVE_S390
+S390_HEADERS = fdasd.h vtoc.h
+else
+S390_HEADERS =
+endif
+
 partedincludedir      =	$(includedir)/parted
+# Dummy-- to prevent error: "S390dir not defined".
+S390dir               = $(partedincludedir)
+
 partedinclude_HEADERS = gnu.h		\
 			linux.h		\
 			constraint.h	\
@@ -11,9 +20,8 @@ partedinclude_HEADERS = gnu.h		\
 			natmath.h	\
 			timer.h		\
 			unit.h		\
-			parted.h    \
-			vtoc.h		\
-			fdasd.h
+			parted.h        \
+                        $(S390_HEADERS)
 
 noinst_HEADERS	      = crc32.h		\
 			endian.h
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 312cc8c..75d029e 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -65,9 +65,6 @@
 #define HDIO_GETGEO             0x0301  /* get device geometry */
 #define HDIO_GET_IDENTITY       0x030d  /* get IDE identification info */
 
-#include <parted/vtoc.h>
-#include <parted/fdasd.h>
-
 #if defined(O_DIRECT) && (!defined(__s390__) || !defined(__s390x__))
 #define RD_MODE (O_RDONLY | O_DIRECT)
 #define WR_MODE (O_WRONLY | O_DIRECT)
diff --git a/libparted/labels/Makefile.am b/libparted/labels/Makefile.am
index 5b0aec4..437f163 100644
--- a/libparted/labels/Makefile.am
+++ b/libparted/labels/Makefile.am
@@ -3,14 +3,18 @@
 #
 # This file may be modified and/or distributed without restriction.
 
+if HAVE_S390
+S390_SOURCES = dasd.c fdasd.c vtoc.c
+else
+S390_SOURCES =
+endif
+
 partedincludedir      =	-I$(top_srcdir)/include
 noinst_LTLIBRARIES    =	liblabels.la
 
 liblabels_la_SOURCES  = rdb.c		\
 			bsd.c  		\
-			dasd.c		\
-			fdasd.c		\
-			vtoc.c		\
+			$(S390_SOURCES)	\
 			efi_crc32.c	\
 			dos.c  		\
 			dvh.h		\
_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel

Reply via email to